2019-06-23 03:35:23 -07:00
|
|
|
<template>
|
|
|
|
<div class="node-settings" @keydown.stop>
|
|
|
|
<div class="header-side-menu">
|
|
|
|
<span v-if="node">
|
|
|
|
<display-with-change :key-name="'name'" @valueChanged="valueChanged"></display-with-change>
|
2020-01-04 20:51:54 -08:00
|
|
|
<a v-if="nodeType" :href="'http://n8n.io/nodes/' + nodeType.name" target="_blank" class="node-info">
|
2021-08-29 04:36:17 -07:00
|
|
|
<n8n-tooltip class="clickable" placement="top" >
|
2021-11-10 10:41:40 -08:00
|
|
|
<div slot="content" v-html="`<strong>${$baseText('nodeSettings.nodeDescription')}:</strong><br />` + nodeTypeDescription + `<br /><br /><strong>${$baseText('nodeSettings.clickOnTheQuestionMarkIcon')}</strong>`"></div>
|
2019-09-01 13:25:54 -07:00
|
|
|
<font-awesome-icon icon="question-circle" />
|
2021-08-29 04:36:17 -07:00
|
|
|
</n8n-tooltip>
|
2019-09-01 13:25:54 -07:00
|
|
|
</a>
|
2019-06-23 03:35:23 -07:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="node-is-not-valid" v-if="node && !nodeValid">
|
2021-11-10 10:41:40 -08:00
|
|
|
<n8n-text>
|
|
|
|
{{
|
|
|
|
$baseText(
|
|
|
|
'nodeSettings.theNodeIsNotValidAsItsTypeIsUnknown',
|
|
|
|
{ interpolate: { nodeType: node.type } },
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
</n8n-text>
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
|
|
|
<div class="node-parameters-wrapper" v-if="node && nodeValid">
|
2021-10-18 20:57:49 -07:00
|
|
|
<el-tabs stretch @tab-click="handleTabClick">
|
2021-11-10 10:41:40 -08:00
|
|
|
<el-tab-pane :label="$baseText('nodeSettings.parameters')">
|
2019-06-23 03:35:23 -07:00
|
|
|
<node-credentials :node="node" @credentialSelected="credentialSelected"></node-credentials>
|
|
|
|
<node-webhooks :node="node" :nodeType="nodeType" />
|
|
|
|
<parameter-input-list :parameters="parametersNoneSetting" :hideDelete="true" :nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged" />
|
2021-10-27 12:55:37 -07:00
|
|
|
<div v-if="parametersNoneSetting.length === 0" class="no-parameters">
|
2021-11-10 10:41:40 -08:00
|
|
|
<n8n-text>
|
|
|
|
{{ $baseText('nodeSettings.thisNodeDoesNotHaveAnyParameters') }}
|
|
|
|
</n8n-text>
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
|
|
|
</el-tab-pane>
|
2021-11-10 10:41:40 -08:00
|
|
|
<el-tab-pane :label="$baseText('nodeSettings.settings')">
|
2019-07-18 10:26:16 -07:00
|
|
|
<parameter-input-list :parameters="nodeSettings" :hideDelete="true" :nodeValues="nodeValues" path="" @valueChanged="valueChanged" />
|
2019-06-23 03:35:23 -07:00
|
|
|
<parameter-input-list :parameters="parametersSetting" :nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged" />
|
|
|
|
</el-tab-pane>
|
|
|
|
</el-tabs>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import {
|
|
|
|
INodeTypeDescription,
|
|
|
|
INodeParameters,
|
|
|
|
INodeProperties,
|
|
|
|
NodeHelpers,
|
|
|
|
NodeParameterValue,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
import {
|
|
|
|
INodeUi,
|
|
|
|
INodeUpdatePropertiesInformation,
|
|
|
|
IUpdateInformation,
|
|
|
|
} from '@/Interface';
|
|
|
|
|
2021-10-18 20:57:49 -07:00
|
|
|
import { ElTabPane } from "element-ui/types/tab-pane";
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
import DisplayWithChange from '@/components/DisplayWithChange.vue';
|
|
|
|
import ParameterInputFull from '@/components/ParameterInputFull.vue';
|
|
|
|
import ParameterInputList from '@/components/ParameterInputList.vue';
|
|
|
|
import NodeCredentials from '@/components/NodeCredentials.vue';
|
|
|
|
import NodeWebhooks from '@/components/NodeWebhooks.vue';
|
2020-01-23 15:57:34 -08:00
|
|
|
import { get, set, unset } from 'lodash';
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2021-05-11 20:12:53 -07:00
|
|
|
import { externalHooks } from '@/components/mixins/externalHooks';
|
2019-06-23 03:35:23 -07:00
|
|
|
import { genericHelpers } from '@/components/mixins/genericHelpers';
|
|
|
|
import { nodeHelpers } from '@/components/mixins/nodeHelpers';
|
|
|
|
|
|
|
|
import mixins from 'vue-typed-mixins';
|
|
|
|
|
|
|
|
export default mixins(
|
2021-05-11 20:12:53 -07:00
|
|
|
externalHooks,
|
2019-06-23 03:35:23 -07:00
|
|
|
genericHelpers,
|
|
|
|
nodeHelpers,
|
|
|
|
)
|
|
|
|
|
|
|
|
.extend({
|
|
|
|
name: 'NodeSettings',
|
|
|
|
components: {
|
|
|
|
DisplayWithChange,
|
|
|
|
NodeCredentials,
|
|
|
|
ParameterInputFull,
|
|
|
|
ParameterInputList,
|
|
|
|
NodeWebhooks,
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
nodeType (): INodeTypeDescription | null {
|
|
|
|
if (this.node) {
|
2021-09-21 10:38:24 -07:00
|
|
|
return this.$store.getters.nodeType(this.node.type, this.node.typeVersion);
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
},
|
2019-09-01 13:25:54 -07:00
|
|
|
nodeTypeDescription (): string {
|
2020-01-04 20:51:54 -08:00
|
|
|
if (this.nodeType && this.nodeType.description) {
|
|
|
|
return this.nodeType.description;
|
2019-09-01 13:25:54 -07:00
|
|
|
} else {
|
2021-11-10 10:41:40 -08:00
|
|
|
return this.$baseText('nodeSettings.noDescriptionFound');
|
2019-09-01 13:25:54 -07:00
|
|
|
}
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
headerStyle (): object {
|
|
|
|
if (!this.node) {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
'background-color': this.node.color,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
node (): INodeUi {
|
|
|
|
return this.$store.getters.activeNode;
|
|
|
|
},
|
|
|
|
parametersSetting (): INodeProperties[] {
|
|
|
|
return this.parameters.filter((item) => {
|
|
|
|
return item.isNodeSetting;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
parametersNoneSetting (): INodeProperties[] {
|
|
|
|
return this.parameters.filter((item) => {
|
|
|
|
return !item.isNodeSetting;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
parameters (): INodeProperties[] {
|
|
|
|
if (this.nodeType === null) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.nodeType.properties;
|
|
|
|
},
|
|
|
|
isColorDefaultValue (): boolean {
|
|
|
|
if (this.nodeType === null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.node.color === this.nodeType.defaults.color;
|
|
|
|
},
|
|
|
|
workflowRunning (): boolean {
|
|
|
|
return this.$store.getters.isActionActive('workflowRunning');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
nodeValid: true,
|
|
|
|
nodeColor: null,
|
|
|
|
nodeValues: {
|
|
|
|
color: '#ff0000',
|
2020-04-12 10:58:30 -07:00
|
|
|
alwaysOutputData: false,
|
2020-08-08 11:31:04 -07:00
|
|
|
executeOnce: false,
|
2020-05-05 08:34:12 -07:00
|
|
|
notesInFlow: false,
|
2019-06-23 03:35:23 -07:00
|
|
|
continueOnFail: false,
|
2019-07-18 10:26:16 -07:00
|
|
|
retryOnFail: false,
|
|
|
|
maxTries: 3,
|
|
|
|
waitBetweenTries: 1000,
|
2019-06-23 03:35:23 -07:00
|
|
|
notes: '',
|
|
|
|
parameters: {},
|
|
|
|
} as INodeParameters,
|
2019-07-18 10:26:16 -07:00
|
|
|
|
|
|
|
nodeSettings: [
|
|
|
|
{
|
2021-11-10 10:41:40 -08:00
|
|
|
displayName: this.$baseText('nodeSettings.notes.displayName'),
|
2019-07-18 10:26:16 -07:00
|
|
|
name: 'notes',
|
|
|
|
type: 'string',
|
|
|
|
typeOptions: {
|
|
|
|
rows: 5,
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
noDataExpression: true,
|
2021-11-10 10:41:40 -08:00
|
|
|
description: this.$baseText('nodeSettings.notes.description'),
|
2019-07-18 10:26:16 -07:00
|
|
|
},
|
2020-05-05 08:34:12 -07:00
|
|
|
{
|
2021-11-10 10:41:40 -08:00
|
|
|
displayName: this.$baseText('nodeSettings.notesInFlow.displayName'),
|
2020-05-05 08:34:12 -07:00
|
|
|
name: 'notesInFlow',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
noDataExpression: true,
|
2021-11-10 10:41:40 -08:00
|
|
|
description: this.$baseText('nodeSettings.notesInFlow.description'),
|
2020-05-05 08:34:12 -07:00
|
|
|
},
|
2019-07-18 10:26:16 -07:00
|
|
|
{
|
2021-11-10 10:41:40 -08:00
|
|
|
displayName: this.$baseText('nodeSettings.color.displayName'),
|
2019-07-18 10:26:16 -07:00
|
|
|
name: 'color',
|
|
|
|
type: 'color',
|
|
|
|
default: '#ff0000',
|
|
|
|
noDataExpression: true,
|
2021-11-10 10:41:40 -08:00
|
|
|
description: this.$baseText('nodeSettings.color.description'),
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
2020-04-12 10:58:30 -07:00
|
|
|
{
|
2021-11-10 10:41:40 -08:00
|
|
|
displayName: this.$baseText('nodeSettings.alwaysOutputData.displayName'),
|
2020-04-12 10:58:30 -07:00
|
|
|
name: 'alwaysOutputData',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
noDataExpression: true,
|
2021-11-10 10:41:40 -08:00
|
|
|
description: this.$baseText('nodeSettings.alwaysOutputData.description'),
|
2020-04-12 10:58:30 -07:00
|
|
|
},
|
2020-08-08 11:31:04 -07:00
|
|
|
{
|
2021-11-10 10:41:40 -08:00
|
|
|
displayName: this.$baseText('nodeSettings.executeOnce.displayName'),
|
2020-08-08 11:31:04 -07:00
|
|
|
name: 'executeOnce',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
noDataExpression: true,
|
2021-11-10 10:41:40 -08:00
|
|
|
description: this.$baseText('nodeSettings.executeOnce.description'),
|
2020-08-08 11:31:04 -07:00
|
|
|
},
|
2019-07-18 10:26:16 -07:00
|
|
|
{
|
2021-11-10 10:41:40 -08:00
|
|
|
displayName: this.$baseText('nodeSettings.retryOnFail.displayName'),
|
2019-07-18 10:26:16 -07:00
|
|
|
name: 'retryOnFail',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
noDataExpression: true,
|
2021-11-10 10:41:40 -08:00
|
|
|
description: this.$baseText('nodeSettings.retryOnFail.description'),
|
2019-07-18 10:26:16 -07:00
|
|
|
},
|
|
|
|
{
|
2021-11-10 10:41:40 -08:00
|
|
|
displayName: this.$baseText('nodeSettings.maxTries.displayName'),
|
2019-07-18 10:26:16 -07:00
|
|
|
name: 'maxTries',
|
|
|
|
type: 'number',
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 2,
|
|
|
|
maxValue: 5,
|
|
|
|
},
|
|
|
|
default: 3,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
retryOnFail: [
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
noDataExpression: true,
|
2021-11-10 10:41:40 -08:00
|
|
|
description: this.$baseText('nodeSettings.maxTries.description'),
|
2019-07-18 10:26:16 -07:00
|
|
|
},
|
|
|
|
{
|
2021-11-10 10:41:40 -08:00
|
|
|
displayName: this.$baseText('nodeSettings.waitBetweenTries.displayName'),
|
2019-07-18 10:26:16 -07:00
|
|
|
name: 'waitBetweenTries',
|
|
|
|
type: 'number',
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
maxValue: 5000,
|
|
|
|
},
|
|
|
|
default: 1000,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
retryOnFail: [
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
noDataExpression: true,
|
2021-11-10 10:41:40 -08:00
|
|
|
description: this.$baseText('nodeSettings.waitBetweenTries.description'),
|
2019-07-18 10:26:16 -07:00
|
|
|
},
|
|
|
|
{
|
2021-11-10 10:41:40 -08:00
|
|
|
displayName: this.$baseText('nodeSettings.continueOnFail.displayName'),
|
2019-07-18 10:26:16 -07:00
|
|
|
name: 'continueOnFail',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
noDataExpression: true,
|
2021-11-10 10:41:40 -08:00
|
|
|
description: this.$baseText('nodeSettings.continueOnFail.description'),
|
2019-07-18 10:26:16 -07:00
|
|
|
},
|
|
|
|
] as INodeProperties[],
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
};
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
node (newNode, oldNode) {
|
|
|
|
this.setNodeValues();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
noOp () {},
|
|
|
|
setValue (name: string, value: NodeParameterValue) {
|
|
|
|
const nameParts = name.split('.');
|
|
|
|
let lastNamePart: string | undefined = nameParts.pop();
|
|
|
|
|
|
|
|
let isArray = false;
|
|
|
|
if (lastNamePart !== undefined && lastNamePart.includes('[')) {
|
|
|
|
// It incldues an index so we have to extract it
|
|
|
|
const lastNameParts = lastNamePart.match(/(.*)\[(\d+)\]$/);
|
|
|
|
if (lastNameParts) {
|
|
|
|
nameParts.push(lastNameParts[1]);
|
|
|
|
lastNamePart = lastNameParts[2];
|
|
|
|
isArray = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the value via Vue.set that everything updates correctly in the UI
|
|
|
|
if (nameParts.length === 0) {
|
|
|
|
// Data is on top level
|
|
|
|
if (value === null) {
|
|
|
|
// Property should be deleted
|
|
|
|
// @ts-ignore
|
|
|
|
Vue.delete(this.nodeValues, lastNamePart);
|
|
|
|
} else {
|
|
|
|
// Value should be set
|
|
|
|
// @ts-ignore
|
|
|
|
Vue.set(this.nodeValues, lastNamePart, value);
|
|
|
|
}
|
|
|
|
} else {
|
2019-07-14 05:10:16 -07:00
|
|
|
// Data is on lower level
|
2019-06-23 03:35:23 -07:00
|
|
|
if (value === null) {
|
|
|
|
// Property should be deleted
|
|
|
|
// @ts-ignore
|
|
|
|
let tempValue = get(this.nodeValues, nameParts.join('.')) as INodeParameters | NodeParameters[];
|
|
|
|
Vue.delete(tempValue as object, lastNamePart as string);
|
|
|
|
|
|
|
|
if (isArray === true && (tempValue as INodeParameters[]).length === 0) {
|
|
|
|
// If a value from an array got delete and no values are left
|
|
|
|
// delete also the parent
|
|
|
|
lastNamePart = nameParts.pop();
|
|
|
|
tempValue = get(this.nodeValues, nameParts.join('.')) as INodeParameters;
|
|
|
|
Vue.delete(tempValue as object, lastNamePart as string);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Value should be set
|
|
|
|
if (typeof value === 'object') {
|
|
|
|
// @ts-ignore
|
|
|
|
Vue.set(get(this.nodeValues, nameParts.join('.')), lastNamePart, JSON.parse(JSON.stringify(value)));
|
|
|
|
} else {
|
|
|
|
// @ts-ignore
|
|
|
|
Vue.set(get(this.nodeValues, nameParts.join('.')), lastNamePart, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
credentialSelected (updateInformation: INodeUpdatePropertiesInformation) {
|
|
|
|
// Update the values on the node
|
|
|
|
this.$store.commit('updateNodeProperties', updateInformation);
|
|
|
|
|
|
|
|
const node = this.$store.getters.nodeByName(updateInformation.name);
|
|
|
|
|
|
|
|
// Update the issues
|
|
|
|
this.updateNodeCredentialIssues(node);
|
2021-05-11 20:12:53 -07:00
|
|
|
|
|
|
|
this.$externalHooks().run('nodeSettings.credentialSelected', { updateInformation });
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
|
|
|
valueChanged (parameterData: IUpdateInformation) {
|
|
|
|
let newValue: NodeParameterValue;
|
|
|
|
if (parameterData.hasOwnProperty('value')) {
|
|
|
|
// New value is given
|
|
|
|
newValue = parameterData.value;
|
|
|
|
} else {
|
|
|
|
// Get new value from nodeData where it is set already
|
|
|
|
newValue = get(this.nodeValues, parameterData.name) as NodeParameterValue;
|
|
|
|
}
|
|
|
|
|
2019-07-14 05:10:16 -07:00
|
|
|
// Save the node name before we commit the change because
|
|
|
|
// we need the old name to rename the node properly
|
|
|
|
const nodeNameBefore = parameterData.node || this.node.name;
|
|
|
|
const node = this.$store.getters.nodeByName(nodeNameBefore);
|
|
|
|
if (parameterData.name === 'name') {
|
|
|
|
// Name of node changed so we have to set also the new node name as active
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2019-07-14 05:10:16 -07:00
|
|
|
// Update happens in NodeView so emit event
|
|
|
|
const sendData = {
|
|
|
|
value: newValue,
|
|
|
|
oldValue: nodeNameBefore,
|
|
|
|
name: parameterData.name,
|
|
|
|
};
|
|
|
|
this.$emit('valueChanged', sendData);
|
|
|
|
|
|
|
|
this.$store.commit('setActiveNode', newValue);
|
2019-07-18 08:41:53 -07:00
|
|
|
} else if (parameterData.name.startsWith('parameters.')) {
|
|
|
|
// A node parameter changed
|
2019-07-14 05:10:16 -07:00
|
|
|
|
|
|
|
const nodeType = this.$store.getters.nodeType(node.type);
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2019-07-14 05:10:16 -07:00
|
|
|
// Get only the parameters which are different to the defaults
|
|
|
|
let nodeParameters = NodeHelpers.getNodeParameters(nodeType.properties, node.parameters, false, false);
|
2021-05-11 20:12:53 -07:00
|
|
|
const oldNodeParameters = Object.assign({}, nodeParameters);
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2019-07-14 05:10:16 -07:00
|
|
|
// Copy the data because it is the data of vuex so make sure that
|
|
|
|
// we do not edit it directly
|
|
|
|
nodeParameters = JSON.parse(JSON.stringify(nodeParameters));
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2019-07-14 05:10:16 -07:00
|
|
|
// Remove the 'parameters.' from the beginning to just have the
|
|
|
|
// actual parameter name
|
|
|
|
const parameterPath = parameterData.name.split('.').slice(1).join('.');
|
|
|
|
|
|
|
|
// Check if the path is supposed to change an array and if so get
|
|
|
|
// the needed data like path and index
|
2019-09-19 14:19:34 -07:00
|
|
|
const parameterPathArray = parameterPath.match(/(.*)\[(\d+)\]$/);
|
2019-07-14 05:10:16 -07:00
|
|
|
|
|
|
|
// Apply the new value
|
|
|
|
if (parameterData.value === undefined && parameterPathArray !== null) {
|
|
|
|
// Delete array item
|
|
|
|
const path = parameterPathArray[1];
|
|
|
|
const index = parameterPathArray[2];
|
|
|
|
const data = get(nodeParameters, path);
|
|
|
|
|
|
|
|
if (Array.isArray(data)) {
|
|
|
|
data.splice(parseInt(index, 10), 1);
|
|
|
|
Vue.set(nodeParameters as object, path, data);
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
} else {
|
2020-01-23 15:57:34 -08:00
|
|
|
if (newValue === undefined) {
|
|
|
|
unset(nodeParameters as object, parameterPath);
|
|
|
|
} else {
|
|
|
|
set(nodeParameters as object, parameterPath, newValue);
|
|
|
|
}
|
2019-07-14 05:10:16 -07:00
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2019-07-14 05:10:16 -07:00
|
|
|
// Get the parameters with the now new defaults according to the
|
|
|
|
// from the user actually defined parameters
|
|
|
|
nodeParameters = NodeHelpers.getNodeParameters(nodeType.properties, nodeParameters as INodeParameters, true, false);
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2019-07-14 05:10:16 -07:00
|
|
|
for (const key of Object.keys(nodeParameters as object)) {
|
|
|
|
if (nodeParameters && nodeParameters[key] !== null && nodeParameters[key] !== undefined) {
|
|
|
|
this.setValue(`parameters.${key}`, nodeParameters[key] as string);
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
2019-07-14 05:10:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update the data in vuex
|
|
|
|
const updateInformation = {
|
|
|
|
name: node.name,
|
|
|
|
value: nodeParameters,
|
|
|
|
};
|
2021-05-15 15:51:14 -07:00
|
|
|
|
2019-07-14 05:10:16 -07:00
|
|
|
this.$store.commit('setNodeParameters', updateInformation);
|
2021-05-15 15:51:14 -07:00
|
|
|
|
2021-05-11 20:12:53 -07:00
|
|
|
this.$externalHooks().run('nodeSettings.valueChanged', { parameterPath, newValue, parameters: this.parameters, oldNodeParameters });
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2020-02-09 23:37:08 -08:00
|
|
|
this.updateNodeParameterIssues(node, nodeType);
|
2019-07-14 05:10:16 -07:00
|
|
|
this.updateNodeCredentialIssues(node);
|
2019-07-18 08:41:53 -07:00
|
|
|
} else {
|
|
|
|
// A property on the node itself changed
|
|
|
|
|
|
|
|
// Update data in settings
|
|
|
|
Vue.set(this.nodeValues, parameterData.name, newValue);
|
|
|
|
|
|
|
|
// Update data in vuex
|
|
|
|
const updateInformation = {
|
|
|
|
name: node.name,
|
|
|
|
key: parameterData.name,
|
|
|
|
value: newValue,
|
|
|
|
};
|
|
|
|
this.$store.commit('setNodeValue', updateInformation);
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* Sets the values of the active node in the internal settings variables
|
|
|
|
*/
|
|
|
|
setNodeValues () {
|
|
|
|
if (!this.node) {
|
|
|
|
// No node selected
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.nodeType !== null) {
|
|
|
|
this.nodeValid = true;
|
|
|
|
|
2019-07-18 10:26:16 -07:00
|
|
|
const foundNodeSettings = [];
|
2019-06-23 03:35:23 -07:00
|
|
|
if (this.node.color) {
|
2019-07-18 10:26:16 -07:00
|
|
|
foundNodeSettings.push('color');
|
2019-06-23 03:35:23 -07:00
|
|
|
Vue.set(this.nodeValues, 'color', this.node.color);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.node.notes) {
|
2019-07-18 10:26:16 -07:00
|
|
|
foundNodeSettings.push('notes');
|
2019-06-23 03:35:23 -07:00
|
|
|
Vue.set(this.nodeValues, 'notes', this.node.notes);
|
|
|
|
}
|
|
|
|
|
2020-04-12 10:58:30 -07:00
|
|
|
if (this.node.alwaysOutputData) {
|
|
|
|
foundNodeSettings.push('alwaysOutputData');
|
|
|
|
Vue.set(this.nodeValues, 'alwaysOutputData', this.node.alwaysOutputData);
|
|
|
|
}
|
|
|
|
|
2020-08-08 11:31:04 -07:00
|
|
|
if (this.node.executeOnce) {
|
|
|
|
foundNodeSettings.push('executeOnce');
|
|
|
|
Vue.set(this.nodeValues, 'executeOnce', this.node.executeOnce);
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
if (this.node.continueOnFail) {
|
2019-07-18 10:26:16 -07:00
|
|
|
foundNodeSettings.push('continueOnFail');
|
2019-06-23 03:35:23 -07:00
|
|
|
Vue.set(this.nodeValues, 'continueOnFail', this.node.continueOnFail);
|
|
|
|
}
|
|
|
|
|
2020-05-05 08:34:12 -07:00
|
|
|
if (this.node.notesInFlow) {
|
|
|
|
foundNodeSettings.push('notesInFlow');
|
|
|
|
Vue.set(this.nodeValues, 'notesInFlow', this.node.notesInFlow);
|
|
|
|
}
|
|
|
|
|
2019-07-18 10:26:16 -07:00
|
|
|
if (this.node.retryOnFail) {
|
|
|
|
foundNodeSettings.push('retryOnFail');
|
|
|
|
Vue.set(this.nodeValues, 'retryOnFail', this.node.retryOnFail);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.node.maxTries) {
|
|
|
|
foundNodeSettings.push('maxTries');
|
|
|
|
Vue.set(this.nodeValues, 'maxTries', this.node.maxTries);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.node.waitBetweenTries) {
|
|
|
|
foundNodeSettings.push('waitBetweenTries');
|
|
|
|
Vue.set(this.nodeValues, 'waitBetweenTries', this.node.waitBetweenTries);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set default node settings
|
|
|
|
for (const nodeSetting of this.nodeSettings) {
|
|
|
|
if (!foundNodeSettings.includes(nodeSetting.name)) {
|
|
|
|
// Set default value
|
|
|
|
Vue.set(this.nodeValues, nodeSetting.name, nodeSetting.default);
|
|
|
|
}
|
|
|
|
if (nodeSetting.name === 'color') {
|
|
|
|
// For color also apply the default node color to the node settings
|
|
|
|
nodeSetting.default = this.nodeType.defaults.color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
Vue.set(this.nodeValues, 'parameters', JSON.parse(JSON.stringify(this.node.parameters)));
|
|
|
|
} else {
|
|
|
|
this.nodeValid = false;
|
|
|
|
}
|
|
|
|
},
|
2021-10-18 20:57:49 -07:00
|
|
|
handleTabClick(tab: ElTabPane) {
|
|
|
|
if(tab.label === 'Settings') {
|
|
|
|
this.$telemetry.track('User viewed node settings', { node_type: this.node ? this.node.type : '', workflow_id: this.$store.getters.workflowId });
|
|
|
|
}
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
|
|
|
mounted () {
|
|
|
|
this.setNodeValues();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
|
|
.node-settings {
|
2021-09-11 01:15:36 -07:00
|
|
|
overflow: hidden;
|
|
|
|
min-width: 350px;
|
|
|
|
max-width: 350px;
|
2021-10-27 12:55:37 -07:00
|
|
|
|
|
|
|
.no-parameters {
|
|
|
|
margin-top: var(--spacing-xs);
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
.header-side-menu {
|
|
|
|
padding: 1em 0 1em 1.8em;
|
2021-09-11 01:15:36 -07:00
|
|
|
font-size: var(--font-size-l);
|
2019-06-23 03:35:23 -07:00
|
|
|
background-color: $--custom-window-sidebar-top;
|
2019-07-11 06:05:12 -07:00
|
|
|
|
|
|
|
.node-info {
|
|
|
|
display: none;
|
|
|
|
padding-left: 0.5em;
|
|
|
|
font-size: 0.8em;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
.node-info {
|
|
|
|
display: inline;
|
|
|
|
}
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.node-is-not-valid {
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.node-parameters-wrapper {
|
2021-09-11 01:15:36 -07:00
|
|
|
height: 100%;
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
.el-tabs__header {
|
|
|
|
background-color: #fff5f2;
|
2021-10-27 12:55:37 -07:00
|
|
|
margin-bottom: 0;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.el-tabs {
|
|
|
|
height: 100%;
|
|
|
|
.el-tabs__content {
|
|
|
|
overflow-y: auto;
|
2021-09-11 01:15:36 -07:00
|
|
|
height: 100%;
|
|
|
|
padding-bottom: 180px;
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
.el-tab-pane {
|
2021-10-27 12:55:37 -07:00
|
|
|
margin: 0 var(--spacing-s);
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-tabs__nav {
|
2021-10-27 12:55:37 -07:00
|
|
|
padding-bottom: var(--spacing-xs);
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
2021-08-29 04:36:17 -07:00
|
|
|
.add-option {
|
|
|
|
i.el-select__caret {
|
|
|
|
color: var(--color-foreground-xlight);
|
|
|
|
}
|
|
|
|
.el-input .el-input__inner {
|
|
|
|
&,
|
|
|
|
&:hover,
|
|
|
|
&:focus {
|
|
|
|
border-radius: 20px;
|
|
|
|
color: var(--color-foreground-xlight);
|
|
|
|
font-weight: 600;
|
|
|
|
background-color: var(--color-primary);
|
|
|
|
border-color: var(--color-primary);
|
|
|
|
text-align: center;
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2021-08-29 04:36:17 -07:00
|
|
|
&::placeholder {
|
|
|
|
color: var(--color-foreground-xlight);
|
|
|
|
opacity: 1; /** Firefox */
|
|
|
|
}
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.parameter-content {
|
|
|
|
font-size: 0.9em;
|
|
|
|
margin-right: -15px;
|
|
|
|
margin-left: -15px;
|
|
|
|
input {
|
|
|
|
width: calc(100% - 35px);
|
|
|
|
padding: 5px;
|
|
|
|
}
|
|
|
|
select {
|
|
|
|
width: calc(100% - 20px);
|
|
|
|
padding: 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
display: table;
|
|
|
|
content: " ";
|
|
|
|
position: relative;
|
|
|
|
box-sizing: border-box;
|
|
|
|
clear: both;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.parameter-wrapper {
|
|
|
|
padding: 0 1em;
|
|
|
|
}
|
2021-08-29 04:36:17 -07:00
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
.color-reset-button-wrapper {
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
}
|
|
|
|
.color-reset-button {
|
|
|
|
position: absolute;
|
|
|
|
right: 7px;
|
|
|
|
top: -25px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.parameter-value {
|
|
|
|
input.expression {
|
|
|
|
border-style: dashed;
|
|
|
|
border-color: #ff9600;
|
|
|
|
display: inline-block;
|
|
|
|
position: relative;
|
|
|
|
width: 100%;
|
|
|
|
box-sizing:border-box;
|
|
|
|
background-color: #793300;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|