Skip to content

Commit

Permalink
fix(editor): Making parameter input components label configurable (#5195
Browse files Browse the repository at this point in the history
)

fix(editor): Making parameter input component label configurable
  • Loading branch information
cstuncsik authored Jan 20, 2023
1 parent 736e700 commit 9ce526e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
:value="credentialData[parameter.name]"
:documentationUrl="documentationUrl"
:showValidationWarnings="showValidationWarnings"
:label="label"
eventSource="credentials"
@change="valueChanged"
/>
Expand All @@ -24,9 +25,8 @@

<script lang="ts">
import Vue from 'vue';
import { IUpdateInformation } from '../../Interface';
import { IParameterLabel } from 'n8n-workflow';
import { IUpdateInformation } from '@/Interface';
import ParameterInputExpanded from '../ParameterInputExpanded.vue';
export default Vue.extend({
Expand All @@ -40,6 +40,13 @@ export default Vue.extend({
components: {
ParameterInputExpanded,
},
data(): { label: IParameterLabel } {
return {
label: {
size: 'medium',
},
};
},
methods: {
valueChanged(parameterData: IUpdateInformation) {
const name = parameterData.name.split('.').pop();
Expand Down
9 changes: 8 additions & 1 deletion packages/editor-ui/src/components/ParameterInputExpanded.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:showTooltip="focused"
:showOptions="menuExpanded"
:data-test-id="parameter.name"
:size="label.size"
>
<template #options>
<parameter-options
Expand Down Expand Up @@ -60,7 +61,7 @@ import ParameterOptions from './ParameterOptions.vue';
import Vue, { PropType } from 'vue';
import ParameterInputWrapper from './ParameterInputWrapper.vue';
import { isValueExpression } from '@/utils';
import { INodeParameterResourceLocator, INodeProperties } from 'n8n-workflow';
import { INodeParameterResourceLocator, INodeProperties, IParameterLabel } from 'n8n-workflow';
import { mapStores } from 'pinia';
import { useWorkflowsStore } from '@/stores/workflows';
Expand All @@ -84,6 +85,12 @@ export default Vue.extend({
eventSource: {
type: String,
},
label: {
type: Object as PropType<IParameterLabel>,
default: () => ({
size: 'small',
}),
},
},
data() {
return {
Expand Down
10 changes: 8 additions & 2 deletions packages/editor-ui/src/components/ParameterInputFull.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:showTooltip="focused"
:showOptions="menuExpanded || focused || forceShowExpression"
:bold="false"
size="small"
:size="label.size"
color="text-dark"
>
<template #options>
Expand Down Expand Up @@ -85,7 +85,7 @@ import {
isValueExpression,
} from '@/utils';
import ParameterInputWrapper from '@/components/ParameterInputWrapper.vue';
import { INodeParameters, INodeProperties, INodePropertyMode } from 'n8n-workflow';
import { INodeParameters, INodeProperties, INodePropertyMode, IParameterLabel } from 'n8n-workflow';
import { BaseTextKey } from '@/plugins/i18n';
import { mapStores } from 'pinia';
import { useNDVStore } from '@/stores/ndv';
Expand Down Expand Up @@ -133,6 +133,12 @@ export default mixins(showMessage).extend({
value: {
type: [Number, String, Boolean, Array, Object] as PropType<INodeParameters>,
},
label: {
type: Object as PropType<IParameterLabel>,
default: () => ({
size: 'small',
}),
},
},
created() {
const mappingTooltipDismissHandler = this.onMappingTooltipDismissed.bind(this);
Expand Down
4 changes: 4 additions & 0 deletions packages/workflow/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,10 @@ export interface IParameterDependencies {
[key: string]: string[];
}

export type IParameterLabel = {
size?: 'small' | 'medium';
};

export interface IPollResponse {
closeFunction?: () => Promise<void>;
}
Expand Down

0 comments on commit 9ce526e

Please sign in to comment.