mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Hide not supported node options (#7597)
Currently Trigger-Nodes and Sub-Nodes display options that do not make sense or work like: - Always Output Data - Execute Once - On Error This PR hides those options for nodes that can not make use of them anyway to not confuse users. Github issue / Community forum post (link here to close automatically):
This commit is contained in:
parent
85e1a10021
commit
b532a7bdb7
|
@ -380,7 +380,55 @@ export default defineComponent({
|
||||||
} as INodeParameters,
|
} as INodeParameters,
|
||||||
nodeValuesInitialized: false, // Used to prevent nodeValues from being overwritten by defaults on reopening ndv
|
nodeValuesInitialized: false, // Used to prevent nodeValues from being overwritten by defaults on reopening ndv
|
||||||
|
|
||||||
nodeSettings: [
|
nodeSettings: [] as INodeProperties[],
|
||||||
|
COMMUNITY_NODES_INSTALLATION_DOCS_URL,
|
||||||
|
CUSTOM_NODES_DOCS_URL,
|
||||||
|
MAIN_NODE_PANEL_WIDTH,
|
||||||
|
hiddenIssuesInputs: [] as string[],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
node(newNode, oldNode) {
|
||||||
|
this.setNodeValues();
|
||||||
|
},
|
||||||
|
isCurlImportModalOpen(newValue, oldValue) {
|
||||||
|
if (newValue === false) {
|
||||||
|
let parameters = this.uiStore.getHttpNodeParameters || '';
|
||||||
|
|
||||||
|
if (!parameters) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
parameters = JSON.parse(parameters) as {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
this.valueChanged({
|
||||||
|
node: this.node.name,
|
||||||
|
name: 'parameters',
|
||||||
|
value: parameters,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.uiStore.setHttpNodeParameters({ name: IMPORT_CURL_MODAL_KEY, parameters: '' });
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
populateHiddenIssuesSet() {
|
||||||
|
if (!this.node || !this.workflowsStore.isNodePristine(this.node.name)) return;
|
||||||
|
|
||||||
|
this.hiddenIssuesInputs.push('credentials');
|
||||||
|
this.parametersNoneSetting.forEach((parameter) => {
|
||||||
|
this.hiddenIssuesInputs.push(parameter.name);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.workflowsStore.setNodePristine(this.node.name, false);
|
||||||
|
},
|
||||||
|
populateSettings() {
|
||||||
|
if (this.isExecutable && !this.isTriggerNode) {
|
||||||
|
this.nodeSettings.push(
|
||||||
|
...([
|
||||||
{
|
{
|
||||||
displayName: this.$locale.baseText('nodeSettings.alwaysOutputData.displayName'),
|
displayName: this.$locale.baseText('nodeSettings.alwaysOutputData.displayName'),
|
||||||
name: 'alwaysOutputData',
|
name: 'alwaysOutputData',
|
||||||
|
@ -445,7 +493,9 @@ export default defineComponent({
|
||||||
type: 'options',
|
type: 'options',
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: this.$locale.baseText('nodeSettings.onError.options.stopWorkflow.displayName'),
|
name: this.$locale.baseText(
|
||||||
|
'nodeSettings.onError.options.stopWorkflow.displayName',
|
||||||
|
),
|
||||||
value: 'stopWorkflow',
|
value: 'stopWorkflow',
|
||||||
description: this.$locale.baseText(
|
description: this.$locale.baseText(
|
||||||
'nodeSettings.onError.options.stopWorkflow.description',
|
'nodeSettings.onError.options.stopWorkflow.description',
|
||||||
|
@ -474,6 +524,11 @@ export default defineComponent({
|
||||||
noDataExpression: true,
|
noDataExpression: true,
|
||||||
description: this.$locale.baseText('nodeSettings.onError.description'),
|
description: this.$locale.baseText('nodeSettings.onError.description'),
|
||||||
},
|
},
|
||||||
|
] as INodeProperties[]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.nodeSettings.push(
|
||||||
|
...([
|
||||||
{
|
{
|
||||||
displayName: this.$locale.baseText('nodeSettings.notes.displayName'),
|
displayName: this.$locale.baseText('nodeSettings.notes.displayName'),
|
||||||
name: 'notes',
|
name: 'notes',
|
||||||
|
@ -493,50 +548,8 @@ export default defineComponent({
|
||||||
noDataExpression: true,
|
noDataExpression: true,
|
||||||
description: this.$locale.baseText('nodeSettings.notesInFlow.description'),
|
description: this.$locale.baseText('nodeSettings.notesInFlow.description'),
|
||||||
},
|
},
|
||||||
] as INodeProperties[],
|
] as INodeProperties[]),
|
||||||
COMMUNITY_NODES_INSTALLATION_DOCS_URL,
|
);
|
||||||
CUSTOM_NODES_DOCS_URL,
|
|
||||||
MAIN_NODE_PANEL_WIDTH,
|
|
||||||
hiddenIssuesInputs: [] as string[],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
node(newNode, oldNode) {
|
|
||||||
this.setNodeValues();
|
|
||||||
},
|
|
||||||
isCurlImportModalOpen(newValue, oldValue) {
|
|
||||||
if (newValue === false) {
|
|
||||||
let parameters = this.uiStore.getHttpNodeParameters || '';
|
|
||||||
|
|
||||||
if (!parameters) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
parameters = JSON.parse(parameters) as {
|
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
|
|
||||||
//@ts-ignore
|
|
||||||
this.valueChanged({
|
|
||||||
node: this.node.name,
|
|
||||||
name: 'parameters',
|
|
||||||
value: parameters,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.uiStore.setHttpNodeParameters({ name: IMPORT_CURL_MODAL_KEY, parameters: '' });
|
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
populateHiddenIssuesSet() {
|
|
||||||
if (!this.node || !this.workflowsStore.isNodePristine(this.node.name)) return;
|
|
||||||
|
|
||||||
this.hiddenIssuesInputs.push('credentials');
|
|
||||||
this.parametersNoneSetting.forEach((parameter) => {
|
|
||||||
this.hiddenIssuesInputs.push(parameter.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.workflowsStore.setNodePristine(this.node.name, false);
|
|
||||||
},
|
},
|
||||||
onParameterBlur(parameterName: string) {
|
onParameterBlur(parameterName: string) {
|
||||||
this.hiddenIssuesInputs = this.hiddenIssuesInputs.filter((name) => name !== parameterName);
|
this.hiddenIssuesInputs = this.hiddenIssuesInputs.filter((name) => name !== parameterName);
|
||||||
|
@ -1003,6 +1016,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.populateHiddenIssuesSet();
|
this.populateHiddenIssuesSet();
|
||||||
|
this.populateSettings();
|
||||||
this.setNodeValues();
|
this.setNodeValues();
|
||||||
this.eventBus?.on('openSettings', this.openSettings);
|
this.eventBus?.on('openSettings', this.openSettings);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue