feat: Add message for readonly nodes. Improve foreign credentials handling (#4759)

* feat: Add message for readonly nodes. Improve foreign credentials handling

* Copy fix

Co-authored-by: João Ramos <hello@joao.pt>
This commit is contained in:
Alex Grozav 2022-12-06 12:15:07 +02:00 committed by GitHub
parent 37e580eb06
commit eb112ffd23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 5 deletions

View file

@ -72,7 +72,7 @@ export default mixins(Locale).extend({
}, },
size: { size: {
type: String, type: String,
validator: (value: string): boolean => ['mini', 'small', 'large'].includes(value), validator: (value: string): boolean => ['mini', 'small', 'medium', 'large'].includes(value),
}, },
}, },
data() { data() {

View file

@ -93,9 +93,10 @@
:dragging="isDragging" :dragging="isDragging"
:sessionId="sessionId" :sessionId="sessionId"
:nodeType="activeNodeType" :nodeType="activeNodeType"
:isReadOnly="readOnly || hasForeignCredential" :hasForeignCredential="hasForeignCredential"
:readOnly="readOnly"
:blockUI="blockUi && showTriggerPanel" :blockUI="blockUi && showTriggerPanel"
:executable="!readOnly || hasForeignCredential" :executable="!readOnly"
@valueChanged="valueChanged" @valueChanged="valueChanged"
@execute="onNodeExecute" @execute="onNodeExecute"
@stopExecution="onStopExecution" @stopExecution="onStopExecution"

View file

@ -10,7 +10,7 @@
:isReadOnly="isReadOnly" :isReadOnly="isReadOnly"
@input="nameChanged" @input="nameChanged"
></NodeTitle> ></NodeTitle>
<div v-if="executable"> <div v-if="isExecutable">
<NodeExecuteButton <NodeExecuteButton
v-if="!blockUI" v-if="!blockUI"
:nodeName="node.name" :nodeName="node.name"
@ -71,6 +71,10 @@
data-test-id="node-parameters" data-test-id="node-parameters"
v-if="node && nodeValid" v-if="node && nodeValid"
> >
<n8n-notice
v-if="hasForeignCredential"
:content="$locale.baseText('nodeSettings.hasForeignCredential')"
/>
<div v-show="openPanel === 'params'"> <div v-show="openPanel === 'params'">
<node-webhooks :node="node" :nodeType="nodeType" /> <node-webhooks :node="node" :nodeType="nodeType" />
@ -183,6 +187,12 @@ export default mixins(externalHooks, nodeHelpers).extend({
isCurlImportModalOpen(): boolean { isCurlImportModalOpen(): boolean {
return this.uiStore.isModalOpen(IMPORT_CURL_MODAL_KEY); return this.uiStore.isModalOpen(IMPORT_CURL_MODAL_KEY);
}, },
isReadOnly(): boolean {
return this.readOnly || this.hasForeignCredential;
},
isExecutable(): boolean {
return this.executable || this.hasForeignCredential;
},
nodeTypeName(): string { nodeTypeName(): string {
if (this.nodeType) { if (this.nodeType) {
const shortNodeType = this.$locale.shortNodeType(this.nodeType.name); const shortNodeType = this.$locale.shortNodeType(this.nodeType.name);
@ -257,8 +267,13 @@ export default mixins(externalHooks, nodeHelpers).extend({
nodeType: { nodeType: {
type: Object as PropType<INodeTypeDescription>, type: Object as PropType<INodeTypeDescription>,
}, },
isReadOnly: { readOnly: {
type: Boolean, type: Boolean,
default: false,
},
hasForeignCredential: {
type: Boolean,
default: false,
}, },
blockUI: { blockUI: {
type: Boolean, type: Boolean,

View file

@ -763,6 +763,7 @@
"nodeSettings.useTheHttpRequestNode": "Use the <b>HTTP Request</b> node to make a custom API call. We'll take care of the {nodeTypeDisplayName} auth for you. <a target=\"_blank\" href=\"https://docs.n8n.io/integrations/custom-operations/\">Learn more</a>", "nodeSettings.useTheHttpRequestNode": "Use the <b>HTTP Request</b> node to make a custom API call. We'll take care of the {nodeTypeDisplayName} auth for you. <a target=\"_blank\" href=\"https://docs.n8n.io/integrations/custom-operations/\">Learn more</a>",
"nodeSettings.waitBetweenTries.description": "How long to wait between each attempt (in milliseconds)", "nodeSettings.waitBetweenTries.description": "How long to wait between each attempt (in milliseconds)",
"nodeSettings.waitBetweenTries.displayName": "Wait Between Tries (ms)", "nodeSettings.waitBetweenTries.displayName": "Wait Between Tries (ms)",
"nodeSettings.hasForeignCredential": "This node is working as expected, but you can't edit it since its credentials aren't shared with you. To edit this node, please ask the owner of the workflow to share the credentials with you. Alternatively, you can also duplicate this node in the workflow and add your own credentials.",
"nodeView.addNode": "Add node", "nodeView.addNode": "Add node",
"nodeView.addATriggerNodeFirst": "Add a <a data-action='showNodeCreator'>Trigger Node</a> first", "nodeView.addATriggerNodeFirst": "Add a <a data-action='showNodeCreator'>Trigger Node</a> first",
"nodeView.addOrEnableTriggerNode": "<a data-action='showNodeCreator'>Add</a> or enable a Trigger node to execute the workflow", "nodeView.addOrEnableTriggerNode": "<a data-action='showNodeCreator'>Add</a> or enable a Trigger node to execute the workflow",