Skip to content

Commit

Permalink
refactor(editor): Correct some prop types (no-changelog) (n8n-io#10907)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Sep 23, 2024
1 parent 769ddfd commit 60ee0d4
Show file tree
Hide file tree
Showing 22 changed files with 43 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import AssistantIcon from '../AskAssistantIcon/AssistantIcon.vue';
withDefaults(defineProps<{ size: 'small' | 'mini' }>(), {
withDefaults(defineProps<{ size?: 'small' | 'mini' }>(), {
size: 'small',
});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { computed } from 'vue';
const props = withDefaults(
defineProps<{
size: 'mini' | 'small' | 'medium' | 'large';
theme: 'default' | 'blank' | 'disabled';
size?: 'mini' | 'small' | 'medium' | 'large';
theme?: 'default' | 'blank' | 'disabled';
}>(),
{
size: 'medium',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
withDefaults(defineProps<{ text: string; size: 'small' | 'medium' | 'large' | 'xlarge' }>(), {
withDefaults(defineProps<{ text: string; size?: 'small' | 'medium' | 'large' | 'xlarge' }>(), {
text: '',
size: 'medium',
});
Expand Down
12 changes: 6 additions & 6 deletions packages/design-system/src/components/CodeDiff/CodeDiff.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { useI18n } from 'n8n-design-system/composables/useI18n';
const MIN_LINES = 4;
interface Props {
title: string;
content: string;
replacing: boolean;
replaced: boolean;
error: boolean;
streaming: boolean;
title?: string;
content?: string;
replacing?: boolean;
replaced?: boolean;
error?: boolean;
streaming?: boolean;
}
type Line =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import AssistantText from '../AskAssistantText/AssistantText.vue';
const { t } = useI18n();
interface Props {
size: 'small' | 'medium';
static: boolean;
asked: boolean;
size?: 'small' | 'medium';
static?: boolean;
asked?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
Expand Down
4 changes: 2 additions & 2 deletions packages/design-system/src/components/N8nAvatar/Avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import Avatar from 'vue-boring-avatars';
import { getInitials } from '../../utils/labelUtil';
interface AvatarProps {
firstName: string;
lastName: string;
firstName?: string;
lastName?: string;
size?: 'xsmall' | 'small' | 'medium' | 'large';
colors?: string[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const sortedUsers = computed(() =>
}),
);
const setFilter = (value: string) => {
const setFilter = (value: string = '') => {
filter.value = value;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/__tests__/data/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function createCanvasNodeProvide({
} = {}) {
const props = createCanvasNodeProps({ id, label, selected, readOnly, data });
return {
[`${CanvasNodeKey}`]: {
[String(CanvasNodeKey)]: {
id: ref(props.id),
label: ref(props.label),
selected: ref(props.selected),
Expand Down Expand Up @@ -136,7 +136,7 @@ export function createCanvasHandleProvide({
isReadOnly?: boolean;
} = {}) {
return {
[`${CanvasNodeHandleKey}`]: {
[String(CanvasNodeHandleKey)]: {
label: ref(label),
mode: ref(mode),
type: ref(type),
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/components/CopyInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ type Props = {
label?: string;
hint?: string;
value?: string;
copyButtonText: string;
copyButtonText?: string;
toastTitle?: string;
toastMessage?: string;
size?: 'medium' | 'large';
collapse?: boolean;
redactValue?: boolean;
disableCopy: boolean;
disableCopy?: boolean;
};
const props = withDefaults(defineProps<Props>(), {
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/components/CredentialsSelect.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { ICredentialType, INodeProperties, NodeParameterValue } from 'n8n-workflow';
import type { ICredentialType, INodeProperties } from 'n8n-workflow';
import { computed, ref } from 'vue';
import ScopesNotice from '@/components/ScopesNotice.vue';
import NodeCredentials from '@/components/NodeCredentials.vue';
Expand All @@ -12,7 +12,7 @@ type Props = {
parameter: INodeProperties;
node?: INodeUi;
inputSize?: 'small' | 'large' | 'mini' | 'medium' | 'xlarge';
displayValue: NodeParameterValue;
displayValue: string;
isReadOnly: boolean;
displayTitle: string;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { onMounted, reactive, toRefs, onBeforeUnmount } from 'vue';
import { useExternalHooks } from '@/composables/useExternalHooks';
export interface Props {
placeholder: string;
modelValue: string;
placeholder?: string;
modelValue?: string;
}
withDefaults(defineProps<Props>(), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import LinkItem from '../ItemTypes/LinkItem.vue';
import CategorizedItemsRenderer from './CategorizedItemsRenderer.vue';
export interface Props {
elements: INodeCreateElement[];
elements?: INodeCreateElement[];
activeIndex?: number;
disabled?: boolean;
lazyRender?: boolean;
Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/components/NodeDetailsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const props = withDefaults(
}>(),
{
isProductionExecutionPreview: false,
readOnly: false,
},
);
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/ParameterInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const dateTimePickerOptions = ref({
});
const isFocused = ref(false);
const displayValue = computed<string | number | boolean | null>(() => {
const displayValue = computed(() => {
if (remoteParameterOptionsLoadingIssues.value) {
if (!nodeType.value || nodeType.value?.codex?.categories?.includes(CORE_NODES_CATEGORY)) {
return i18n.baseText('parameterInput.loadOptionsError');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Props = {
path: string;
inputSize: 'small' | 'medium';
labelSize: 'small' | 'medium';
teleported: boolean;
teleported?: boolean;
dependentParametersValues?: string | null;
isReadOnly?: boolean;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/RunDataAi/RunDataAi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface TreeNode {
}
export interface Props {
node: INodeUi;
runIndex: number;
runIndex?: number;
hideTitle?: boolean;
slim?: boolean;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/editor-ui/src/components/SaveButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { computed } from 'vue';
const props = withDefaults(
defineProps<{
saved: boolean;
isSaving: boolean;
disabled: boolean;
type: string;
withShortcut: boolean;
isSaving?: boolean;
disabled?: boolean;
type?: string;
withShortcut?: boolean;
shortcutTooltip?: string;
savingLabel?: string;
}>(),
Expand Down
10 changes: 5 additions & 5 deletions packages/editor-ui/src/components/TagsManager/TagsManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import type { BaseTextKey } from '@/plugins/i18n';
interface TagsManagerProps {
modalKey: string;
usageLocaleKey: BaseTextKey;
usageColumnTitleLocaleKey: BaseTextKey;
titleLocaleKey: BaseTextKey;
noTagsTitleLocaleKey: BaseTextKey;
noTagsDescriptionLocaleKey: BaseTextKey;
usageLocaleKey?: BaseTextKey;
usageColumnTitleLocaleKey?: BaseTextKey;
titleLocaleKey?: BaseTextKey;
noTagsTitleLocaleKey?: BaseTextKey;
noTagsDescriptionLocaleKey?: BaseTextKey;
tags: ITag[];
isLoading: boolean;
onFetchTags: () => Promise<void>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { useWorkflowResourcesLocator } from './useWorkflowResourcesLocator';
interface Props {
modelValue: INodeParameterResourceLocator;
eventBus?: EventBus;
inputSize: 'small' | 'mini' | 'medium' | 'large' | 'xlarge';
inputSize?: 'small' | 'mini' | 'medium' | 'large' | 'xlarge';
isValueExpression?: boolean;
isReadOnly?: boolean;
path: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('CanvasHandleRenderer', () => {
},
global: {
provide: {
[`${CanvasNodeHandleKey}`]: { label: ref(label) },
[String(CanvasNodeHandleKey)]: { label: ref(label) },
},
stubs: {
Handle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const props = withDefaults(
defineProps<{
executions: ExecutionSummaryWithScopes[];
filters: ExecutionFilterType;
total: number;
estimated: boolean;
total?: number;
estimated?: boolean;
}>(),
{
total: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface IWorkflowSaveSettings {
const props = withDefaults(
defineProps<{
initiallyExpanded: boolean;
initiallyExpanded?: boolean;
}>(),
{
initiallyExpanded: false,
Expand Down

0 comments on commit 60ee0d4

Please sign in to comment.