mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-16 01:24:05 -08:00
c85faff4f1
* ✨ Make it possible to dynamically load node packages * ⚡ Fix comment * ✨ Make possible to dynamically install nodes from npm * Created migration for sqlite regarding community nodes * Saving to db whenever a package with nodes is installed * Created endpoint to fetch installed packages * WIP - uninstall package with nodes * Fix lint issues * Updating nodes via API * Lint and improvement fixes * Created community node helpers and removed packages taht do not contain nodes * Check for package updates when fetching installed packages * Blocked access to non-owner and preventing incorrect install of packages * Added auto healing process * Unit tests for helpers * Finishing tests for helpers * Improved unit tests, refactored more helpers and created integration tests for GET * Implemented detection of missing packages on init and added warning to frontend settings * Add check for banned packages and fix broken tests * Create migrations for other db systems * Updated with latest changes from master * Fixed conflict errors * Improved unit tests, refactored more helpers and created integration tests for GET * Implemented detection of missing packages on init and added warning to frontend settings * 🔥 Removing access check for the Settings sidebar item * ✨ Added inital community nodes settings screen * ⚡Added executionMode flag to settings * ✨ Implemented N8N-callout component * 💄Updating Callout component template propery names * 💄 Updating Callout component styling. * 💄Updating Callout component sizing and colors. * ✔️ Updating Callout component test snapshots after styling changes * ✨ Updating the `ActionBox` component so it supports callouts and conditional button rendering * 💄 Removing duplicate callout theme validation in the `ActionBox` component. Adding a selection control for it in the storybook. * ✨ Added warning message if instance is in the queue mode. Updated colors based on the new design. * ⚡ Added a custom permission support to router * 🔨 Implemented UM detection as a custom permission. * 👌Updating route permission logic. * ✨ Implemented installed community packages list in the settings view * 👌 Updating settings routes rules and community nodes setting view. * Allow installation of packages that failed to load * 👌 Updating `ActionBox`, `CommuntyPackageCard` components and settings loading logic. * 👌 Fixing community nodes loading state and sidebar icon spacing. * ✨ Implemented loading skeletons for community package cards * 👌 Handling errrors while loading installed package list. Updating spacing. * 👌 Updating community nodes error messages. * Added disable flag * 🐛 Fixing a community nodes update detection bug when there are missing packages. (#3497) * ✨ Added front-end support for community nodes feature flag * ✨ Implemented community package installation modal dialog * 💄 Community nodes installation modal updates: Moved links to constants and used them in translations, disabling inputs in loading state. * ✨ Implemented community packages install flow * Standardize error codes (#3501) * Standardize error: 400 for request issues such as invalid package name and 500 for installation problems * Fix http status code for when package is not found * ✨ Implemented community package installation modal dialog * 💄 Community nodes installation modal updates: Moved links to constants and used them in translations, disabling inputs in loading state. * ✨ Implemented community packages install flow * ✨ Updated error handling based on the response codes * ✨ Implemented community package installation modal dialog * ✨ Implemented community package uninstall flow. * ✨ Finished update confirm modal UI * 💄 Replaced community nodes tooltip image with the one exported from figma. * ✨ Implemented community package update process * ✨ Updating community nodes list after successful package update * 🔒 Updating public API setting route to use new access rules. Updating express app definition in community nodes tests * ✨ Implemented community package installation modal dialog * 💄 Community nodes installation modal updates: Moved links to constants and used them in translations, disabling inputs in loading state. * ✨ Implemented community packages install flow * ✨ Updated error handling based on the response codes * Change output for installation request * Improve payload for update requests * 👌 Updating community nodes install modal UI * 👌 Updating community nodes confirm modal logic * 👌 Refactoring community nodes confirm modal dialog * 👌 Separating community nodes components loading states * 💄 Updating community nodes install modal spacing. * Fix behavior for installing already installed packages * 💡 Commenting community nodes install process * 🔥 Removing leftover commits of deleted Vue mutations * ✨ Updated node list to identify community nodes and handle node name clash * ✨ Implemented missing community node dialog. * 💄 Updating n8n-tabs component to support tooltips * ✨ Updating node details with community node details. * 🔨 Using back-end response when updating community packages * 👌 Updating tabs component and refactoring community nodes store mutations * 👌 Adding community node flag to node type descriptions and using it to identify community nodes * 👌 Hiding unnecessary elements from missing node details panel. * 👌 Updating missing node type descriptions for custom and community nodes * 👌 Updating community node package name detection logic * 👌 Removing communityNode flag from node description * ✨ Adding `force` flag to credentials fetching (#3527) * ✨ Adding `force` flag to credentials fetching which can be used to skip check when loading credentials * ✨ Forcing credentials loading when opening nodeView * 👌 Minor updates to community nodes details panel * tests for post endpoint * duplicate comments * Add Patch and Delete enpoints tests * 🔒 Using `pageCategory`prop to assemble the list of settings routes instead of hard-coded array (#3562) * 📈 Added front-end telemetry events for community nodes * 📈 Updating community nodes telemetry events * 💄 Updating community nodes settings UI elements based on product/design review * 💄 Updating node view & node details view for community nodes based on product/design feedback * 💄 Fixing community node text capitalisation * ✨ Adding community node install error message under the package name input field * Fixed and improved tests * Fix lint issue * feat: Migrated to npm release of riot-tmpl fork. * 📈 Updating community nodes telemetry events based on the product review * 💄 Updating community nodes UI based on the design feedback * 🔀 Merging recent node draggable panels changes * Implement self healing process * Improve error messages for package name requirement and disk space * 💄 Removing front-end error message override since appropriate response is available from the back-end * Fix lint issues * Fix installed node name * 💄 Removed additional node name parsing * 📈 Updating community nodes telemetry events * Fix postgres migration for cascading nodes when package is removed * Remove postman mock for banned packages * 📈 Adding missing telemetry event for community node documentation click * 🐛 Fixing community nodes UI bugs reported during the bug bash * Fix issue with uninstalling packages not reflecting UI * 🐛 Fixing a missing node type bug when trying to run a workflow. * Improve error detection for installing packages * 💄 Updating community nodes components styling and wording based on the product feedback * Implement telemetry be events * Add author name and email to packages * Fix telemetry be events for community packages * 📈 Updating front-end telemetry events with community nodes author data * 💄 Updating credentials documentation link logic to handle community nodes credentials * 🐛 Fixing draggable panels logic * Fix duplicate wrong import * 💄 Hiding community nodes credentials documentation links when they don't contain an absolute URL * Fix issue with detection of missing packages * 💄 Adding the `Docs` tab to community nodes * 💄 Adding a failed loading indicator to community nodes list * Prevent n8n from crashing on startup * Refactor and improve code quality * ⚡ Remove not needed depenedency Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: Milorad Filipović <milorad@n8n.io> Co-authored-by: Milorad FIlipović <miloradfilipovic19@gmail.com> Co-authored-by: agobrech <ael.gobrecht@gmail.com> Co-authored-by: Alex Grozav <alex@grozav.com>
725 lines
20 KiB
Vue
725 lines
20 KiB
Vue
<template>
|
|
<div :class="{'node-settings': true, 'dragging': dragging}" @keydown.stop>
|
|
<div :class="$style.header">
|
|
<div class="header-side-menu">
|
|
<NodeTitle class="node-name" :value="node && node.name" :nodeType="nodeType" @input="nameChanged" :readOnly="isReadOnly"></NodeTitle>
|
|
<div
|
|
v-if="!isReadOnly"
|
|
>
|
|
<NodeExecuteButton v-if="node && nodeValid" :nodeName="node.name" @execute="onNodeExecute" size="small" telemetrySource="parameters"/>
|
|
</div>
|
|
</div>
|
|
<NodeSettingsTabs v-if="node && nodeValid" v-model="openPanel" :nodeType="nodeType" :sessionId="sessionId" />
|
|
</div>
|
|
<div class="node-is-not-valid" v-if="node && !nodeValid">
|
|
<p :class="$style.warningIcon">
|
|
<font-awesome-icon icon="exclamation-triangle" />
|
|
</p>
|
|
<div class="missingNodeTitleContainer mt-s mb-xs">
|
|
<n8n-text size="large" color="text-dark" bold>
|
|
{{ $locale.baseText('nodeSettings.communityNodeUnknown.title') }}
|
|
</n8n-text>
|
|
</div>
|
|
<div v-if="isCommunityNode" :class="$style.descriptionContainer">
|
|
<div class="mb-l">
|
|
<span
|
|
v-html="$locale.baseText('nodeSettings.communityNodeUnknown.description', { interpolate: { packageName: node.type.split('.')[0] } })"
|
|
@click="onMissingNodeTextClick"
|
|
>
|
|
</span>
|
|
</div>
|
|
<n8n-link
|
|
:to="COMMUNITY_NODES_INSTALLATION_DOCS_URL"
|
|
@click="onMissingNodeLearnMoreLinkClick"
|
|
>
|
|
{{ $locale.baseText('nodeSettings.communityNodeUnknown.installLink.text') }}
|
|
</n8n-link>
|
|
</div>
|
|
<span v-else
|
|
v-html="
|
|
$locale.baseText('nodeSettings.nodeTypeUnknown.description',
|
|
{
|
|
interpolate: { docURL: CUSTOM_NODES_DOCS_URL }
|
|
})
|
|
">
|
|
</span>
|
|
</div>
|
|
<div class="node-parameters-wrapper" v-if="node && nodeValid">
|
|
<div v-show="openPanel === 'params'">
|
|
<node-webhooks
|
|
:node="node"
|
|
:nodeType="nodeType"
|
|
/>
|
|
<parameter-input-list
|
|
:parameters="parametersNoneSetting"
|
|
:hideDelete="true"
|
|
:nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged"
|
|
@activate="onWorkflowActivate"
|
|
>
|
|
<node-credentials
|
|
:node="node"
|
|
@credentialSelected="credentialSelected"
|
|
/>
|
|
</parameter-input-list>
|
|
<div v-if="parametersNoneSetting.length === 0" class="no-parameters">
|
|
<n8n-text>
|
|
{{ $locale.baseText('nodeSettings.thisNodeDoesNotHaveAnyParameters') }}
|
|
</n8n-text>
|
|
</div>
|
|
|
|
<div v-if="isCustomApiCallSelected(nodeValues)" class="parameter-item parameter-notice">
|
|
<n8n-notice
|
|
:content="$locale.baseText(
|
|
'nodeSettings.useTheHttpRequestNode',
|
|
{ interpolate: { nodeTypeDisplayName: nodeType.displayName } }
|
|
)"
|
|
/>
|
|
</div>
|
|
|
|
</div>
|
|
<div v-show="openPanel === 'settings'">
|
|
<parameter-input-list :parameters="parametersSetting" :nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged" />
|
|
<parameter-input-list :parameters="nodeSettings" :hideDelete="true" :nodeValues="nodeValues" path="" @valueChanged="valueChanged" />
|
|
</div>
|
|
</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';
|
|
|
|
import {
|
|
COMMUNITY_NODES_INSTALLATION_DOCS_URL,
|
|
CUSTOM_NODES_DOCS_URL,
|
|
} from '../constants';
|
|
|
|
import NodeTitle from '@/components/NodeTitle.vue';
|
|
import ParameterInputFull from '@/components/ParameterInputFull.vue';
|
|
import ParameterInputList from '@/components/ParameterInputList.vue';
|
|
import NodeCredentials from '@/components/NodeCredentials.vue';
|
|
import NodeSettingsTabs from '@/components/NodeSettingsTabs.vue';
|
|
import NodeWebhooks from '@/components/NodeWebhooks.vue';
|
|
import { get, set, unset } from 'lodash';
|
|
|
|
import { externalHooks } from '@/components/mixins/externalHooks';
|
|
import { genericHelpers } from '@/components/mixins/genericHelpers';
|
|
import { nodeHelpers } from '@/components/mixins/nodeHelpers';
|
|
|
|
import mixins from 'vue-typed-mixins';
|
|
import NodeExecuteButton from './NodeExecuteButton.vue';
|
|
import { isCommunityPackageName } from './helpers';
|
|
|
|
export default mixins(
|
|
externalHooks,
|
|
genericHelpers,
|
|
nodeHelpers,
|
|
)
|
|
.extend({
|
|
name: 'NodeSettings',
|
|
components: {
|
|
NodeTitle,
|
|
NodeCredentials,
|
|
ParameterInputFull,
|
|
ParameterInputList,
|
|
NodeSettingsTabs,
|
|
NodeWebhooks,
|
|
NodeExecuteButton,
|
|
},
|
|
computed: {
|
|
nodeType (): INodeTypeDescription | null {
|
|
if (this.node) {
|
|
return this.$store.getters.nodeType(this.node.type, this.node.typeVersion);
|
|
}
|
|
|
|
return null;
|
|
},
|
|
nodeTypeName(): string {
|
|
if (this.nodeType) {
|
|
const shortNodeType = this.$locale.shortNodeType(this.nodeType.name);
|
|
|
|
return this.$locale.headerText({
|
|
key: `headers.${shortNodeType}.displayName`,
|
|
fallback: this.nodeType.name,
|
|
});
|
|
}
|
|
|
|
return '';
|
|
},
|
|
nodeTypeDescription (): string {
|
|
if (this.nodeType && this.nodeType.description) {
|
|
const shortNodeType = this.$locale.shortNodeType(this.nodeType.name);
|
|
|
|
return this.$locale.headerText({
|
|
key: `headers.${shortNodeType}.description`,
|
|
fallback: this.nodeType.description,
|
|
});
|
|
} else {
|
|
return this.$locale.baseText('nodeSettings.noDescriptionFound');
|
|
}
|
|
},
|
|
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;
|
|
},
|
|
isCommunityNode(): boolean {
|
|
return isCommunityPackageName(this.node.type);
|
|
},
|
|
},
|
|
props: {
|
|
eventBus: {
|
|
},
|
|
dragging: {
|
|
type: Boolean,
|
|
},
|
|
sessionId: {
|
|
type: String,
|
|
},
|
|
},
|
|
data () {
|
|
return {
|
|
nodeValid: true,
|
|
nodeColor: null,
|
|
openPanel: 'params',
|
|
nodeValues: {
|
|
color: '#ff0000',
|
|
alwaysOutputData: false,
|
|
executeOnce: false,
|
|
notesInFlow: false,
|
|
continueOnFail: false,
|
|
retryOnFail: false,
|
|
maxTries: 3,
|
|
waitBetweenTries: 1000,
|
|
notes: '',
|
|
parameters: {},
|
|
} as INodeParameters,
|
|
|
|
nodeSettings: [
|
|
{
|
|
displayName: this.$locale.baseText('nodeSettings.alwaysOutputData.displayName'),
|
|
name: 'alwaysOutputData',
|
|
type: 'boolean',
|
|
default: false,
|
|
noDataExpression: true,
|
|
description: this.$locale.baseText('nodeSettings.alwaysOutputData.description'),
|
|
},
|
|
{
|
|
displayName: this.$locale.baseText('nodeSettings.executeOnce.displayName'),
|
|
name: 'executeOnce',
|
|
type: 'boolean',
|
|
default: false,
|
|
noDataExpression: true,
|
|
description: this.$locale.baseText('nodeSettings.executeOnce.description'),
|
|
},
|
|
{
|
|
displayName: this.$locale.baseText('nodeSettings.retryOnFail.displayName'),
|
|
name: 'retryOnFail',
|
|
type: 'boolean',
|
|
default: false,
|
|
noDataExpression: true,
|
|
description: this.$locale.baseText('nodeSettings.retryOnFail.description'),
|
|
},
|
|
{
|
|
displayName: this.$locale.baseText('nodeSettings.maxTries.displayName'),
|
|
name: 'maxTries',
|
|
type: 'number',
|
|
typeOptions: {
|
|
minValue: 2,
|
|
maxValue: 5,
|
|
},
|
|
default: 3,
|
|
displayOptions: {
|
|
show: {
|
|
retryOnFail: [
|
|
true,
|
|
],
|
|
},
|
|
},
|
|
noDataExpression: true,
|
|
description: this.$locale.baseText('nodeSettings.maxTries.description'),
|
|
},
|
|
{
|
|
displayName: this.$locale.baseText('nodeSettings.waitBetweenTries.displayName'),
|
|
name: 'waitBetweenTries',
|
|
type: 'number',
|
|
typeOptions: {
|
|
minValue: 0,
|
|
maxValue: 5000,
|
|
},
|
|
default: 1000,
|
|
displayOptions: {
|
|
show: {
|
|
retryOnFail: [
|
|
true,
|
|
],
|
|
},
|
|
},
|
|
noDataExpression: true,
|
|
description: this.$locale.baseText('nodeSettings.waitBetweenTries.description'),
|
|
},
|
|
{
|
|
displayName: this.$locale.baseText('nodeSettings.continueOnFail.displayName'),
|
|
name: 'continueOnFail',
|
|
type: 'boolean',
|
|
default: false,
|
|
noDataExpression: true,
|
|
description: this.$locale.baseText('nodeSettings.continueOnFail.description'),
|
|
},
|
|
{
|
|
displayName: this.$locale.baseText('nodeSettings.notes.displayName'),
|
|
name: 'notes',
|
|
type: 'string',
|
|
typeOptions: {
|
|
rows: 5,
|
|
},
|
|
default: '',
|
|
noDataExpression: true,
|
|
description: this.$locale.baseText('nodeSettings.notes.description'),
|
|
},
|
|
{
|
|
displayName: this.$locale.baseText('nodeSettings.notesInFlow.displayName'),
|
|
name: 'notesInFlow',
|
|
type: 'boolean',
|
|
default: false,
|
|
noDataExpression: true,
|
|
description: this.$locale.baseText('nodeSettings.notesInFlow.description'),
|
|
},
|
|
] as INodeProperties[],
|
|
COMMUNITY_NODES_INSTALLATION_DOCS_URL,
|
|
CUSTOM_NODES_DOCS_URL,
|
|
};
|
|
},
|
|
watch: {
|
|
node (newNode, oldNode) {
|
|
this.setNodeValues();
|
|
},
|
|
},
|
|
methods: {
|
|
onWorkflowActivate() {
|
|
this.$emit('activate');
|
|
},
|
|
onNodeExecute () {
|
|
this.$emit('execute');
|
|
},
|
|
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 {
|
|
// Data is on lower level
|
|
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.getNodeByName(updateInformation.name);
|
|
|
|
// Update the issues
|
|
this.updateNodeCredentialIssues(node);
|
|
|
|
this.$externalHooks().run('nodeSettings.credentialSelected', { updateInformation });
|
|
},
|
|
nameChanged(name: string) {
|
|
// @ts-ignore
|
|
this.valueChanged({
|
|
value: name,
|
|
name: 'name',
|
|
});
|
|
},
|
|
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;
|
|
}
|
|
|
|
// 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.getNodeByName(nodeNameBefore);
|
|
if (parameterData.name === 'name') {
|
|
// Name of node changed so we have to set also the new node name as active
|
|
|
|
// Update happens in NodeView so emit event
|
|
const sendData = {
|
|
value: newValue,
|
|
oldValue: nodeNameBefore,
|
|
name: parameterData.name,
|
|
};
|
|
this.$emit('valueChanged', sendData);
|
|
|
|
} else if (parameterData.name.startsWith('parameters.')) {
|
|
// A node parameter changed
|
|
|
|
const nodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null;
|
|
if (!nodeType) {
|
|
return;
|
|
}
|
|
|
|
// Get only the parameters which are different to the defaults
|
|
let nodeParameters = NodeHelpers.getNodeParameters(nodeType.properties, node.parameters, false, false, node);
|
|
const oldNodeParameters = Object.assign({}, nodeParameters);
|
|
|
|
// 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));
|
|
|
|
// 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
|
|
const parameterPathArray = parameterPath.match(/(.*)\[(\d+)\]$/);
|
|
|
|
// 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);
|
|
}
|
|
} else {
|
|
if (newValue === undefined) {
|
|
unset(nodeParameters as object, parameterPath);
|
|
} else {
|
|
set(nodeParameters as object, parameterPath, newValue);
|
|
}
|
|
}
|
|
|
|
// 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, node);
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
// Update the data in vuex
|
|
const updateInformation = {
|
|
name: node.name,
|
|
value: nodeParameters,
|
|
};
|
|
|
|
this.$store.commit('setNodeParameters', updateInformation);
|
|
|
|
this.$externalHooks().run('nodeSettings.valueChanged', { parameterPath, newValue, parameters: this.parameters, oldNodeParameters });
|
|
|
|
this.updateNodeParameterIssues(node, nodeType);
|
|
this.updateNodeCredentialIssues(node);
|
|
} 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);
|
|
}
|
|
},
|
|
/**
|
|
* 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;
|
|
|
|
const foundNodeSettings = [];
|
|
if (this.node.color) {
|
|
foundNodeSettings.push('color');
|
|
Vue.set(this.nodeValues, 'color', this.node.color);
|
|
}
|
|
|
|
if (this.node.notes) {
|
|
foundNodeSettings.push('notes');
|
|
Vue.set(this.nodeValues, 'notes', this.node.notes);
|
|
}
|
|
|
|
if (this.node.alwaysOutputData) {
|
|
foundNodeSettings.push('alwaysOutputData');
|
|
Vue.set(this.nodeValues, 'alwaysOutputData', this.node.alwaysOutputData);
|
|
}
|
|
|
|
if (this.node.executeOnce) {
|
|
foundNodeSettings.push('executeOnce');
|
|
Vue.set(this.nodeValues, 'executeOnce', this.node.executeOnce);
|
|
}
|
|
|
|
if (this.node.continueOnFail) {
|
|
foundNodeSettings.push('continueOnFail');
|
|
Vue.set(this.nodeValues, 'continueOnFail', this.node.continueOnFail);
|
|
}
|
|
|
|
if (this.node.notesInFlow) {
|
|
foundNodeSettings.push('notesInFlow');
|
|
Vue.set(this.nodeValues, 'notesInFlow', this.node.notesInFlow);
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
Vue.set(this.nodeValues, 'parameters', JSON.parse(JSON.stringify(this.node.parameters)));
|
|
} else {
|
|
this.nodeValid = false;
|
|
}
|
|
},
|
|
onMissingNodeTextClick(event: MouseEvent) {
|
|
if ((event.target as Element).localName === 'a') {
|
|
this.$telemetry.track('user clicked cnr browse button', { source: 'cnr missing node modal' });
|
|
}
|
|
},
|
|
onMissingNodeLearnMoreLinkClick() {
|
|
this.$telemetry.track('user clicked cnr docs link', {
|
|
source: 'missing node modal source',
|
|
package_name: this.node.type.split('.')[0],
|
|
node_type: this.node.type,
|
|
});
|
|
},
|
|
},
|
|
mounted () {
|
|
this.setNodeValues();
|
|
if (this.eventBus) {
|
|
(this.eventBus as Vue).$on('openSettings', () => {
|
|
this.openPanel = 'settings';
|
|
});
|
|
}
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.header {
|
|
background-color: var(--color-background-base);
|
|
}
|
|
|
|
.warningIcon {
|
|
color: var(--color-text-lighter);
|
|
font-size: var(--font-size-2xl);
|
|
}
|
|
|
|
.descriptionContainer {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
</style>
|
|
|
|
<style lang="scss">
|
|
.node-settings {
|
|
overflow: hidden;
|
|
min-width: 360px;
|
|
max-width: 360px;
|
|
background-color: var(--color-background-xlight);
|
|
height: 100%;
|
|
border: var(--border-base);
|
|
border-radius: var(--border-radius-large);
|
|
box-shadow: 0 4px 16px rgb(50 61 85 / 10%);
|
|
|
|
.no-parameters {
|
|
margin-top: var(--spacing-xs);
|
|
}
|
|
|
|
.header-side-menu {
|
|
padding: var(--spacing-s) var(--spacing-s) var(--spacing-s) var(--spacing-s);
|
|
font-size: var(--font-size-l);
|
|
display: flex;
|
|
|
|
.node-name {
|
|
padding-top: var(--spacing-5xs);
|
|
flex-grow: 1;
|
|
}
|
|
}
|
|
|
|
.node-is-not-valid {
|
|
height: 75%;
|
|
padding: 10px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
text-align: center;
|
|
line-height: var(--font-line-height-regular);
|
|
}
|
|
|
|
.node-parameters-wrapper {
|
|
height: 100%;
|
|
overflow-y: auto;
|
|
padding: 0 20px 200px 20px;
|
|
}
|
|
|
|
&.dragging {
|
|
border-color: var(--color-primary);
|
|
box-shadow: 0px 6px 16px rgba(255, 74, 51, 0.15);
|
|
}
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.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>
|