2022-06-20 12:39:24 -07:00
|
|
|
<template>
|
|
|
|
<div :class="$style.container">
|
|
|
|
<transition name="fade" mode="out-in">
|
2024-01-09 03:11:39 -08:00
|
|
|
<div v-if="hasIssues || hideContent" key="empty"></div>
|
2023-12-28 00:49:58 -08:00
|
|
|
<div v-else-if="isListeningForEvents" key="listening">
|
2022-06-20 12:39:24 -07:00
|
|
|
<n8n-pulse>
|
2023-12-28 00:49:58 -08:00
|
|
|
<NodeIcon :node-type="nodeType" :size="40"></NodeIcon>
|
2022-06-20 12:39:24 -07:00
|
|
|
</n8n-pulse>
|
|
|
|
<div v-if="isWebhookNode">
|
|
|
|
<n8n-text tag="div" size="large" color="text-dark" class="mb-2xs" bold>{{
|
|
|
|
$locale.baseText('ndv.trigger.webhookNode.listening')
|
|
|
|
}}</n8n-text>
|
2022-07-20 08:50:39 -07:00
|
|
|
<div :class="[$style.shake, 'mb-xs']">
|
|
|
|
<n8n-text>
|
2022-06-20 12:39:24 -07:00
|
|
|
{{
|
|
|
|
$locale.baseText('ndv.trigger.webhookNode.requestHint', {
|
2024-05-31 08:22:27 -07:00
|
|
|
interpolate: { type: webhookHttpMethod ?? '' },
|
2022-06-20 12:39:24 -07:00
|
|
|
})
|
|
|
|
}}
|
|
|
|
</n8n-text>
|
|
|
|
</div>
|
|
|
|
<CopyInput
|
|
|
|
:value="webhookTestUrl"
|
2023-12-28 00:49:58 -08:00
|
|
|
:toast-title="$locale.baseText('ndv.trigger.copiedTestUrl')"
|
2022-06-20 12:39:24 -07:00
|
|
|
class="mb-2xl"
|
|
|
|
size="medium"
|
|
|
|
:collapse="true"
|
|
|
|
:copy-button-text="$locale.baseText('generic.clickToCopy')"
|
|
|
|
@copy="onTestLinkCopied"
|
|
|
|
></CopyInput>
|
2022-10-31 10:59:53 -07:00
|
|
|
<NodeExecuteButton
|
2023-08-29 05:00:17 -07:00
|
|
|
data-test-id="trigger-execute-button"
|
2023-12-28 00:49:58 -08:00
|
|
|
:node-name="nodeName"
|
2022-10-31 10:59:53 -07:00
|
|
|
size="medium"
|
2023-12-28 00:49:58 -08:00
|
|
|
telemetry-source="inputs"
|
|
|
|
@execute="onNodeExecute"
|
2022-10-31 10:59:53 -07:00
|
|
|
/>
|
2022-06-20 12:39:24 -07:00
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<n8n-text tag="div" size="large" color="text-dark" class="mb-2xs" bold>{{
|
2023-10-16 21:09:30 -07:00
|
|
|
listeningTitle
|
2022-06-20 12:39:24 -07:00
|
|
|
}}</n8n-text>
|
2022-07-20 08:50:39 -07:00
|
|
|
<div :class="[$style.shake, 'mb-xs']">
|
|
|
|
<n8n-text tag="div">
|
2023-10-16 21:09:30 -07:00
|
|
|
{{ listeningHint }}
|
2022-06-20 12:39:24 -07:00
|
|
|
</n8n-text>
|
|
|
|
</div>
|
2024-01-09 03:11:39 -08:00
|
|
|
<div v-if="displayChatButton">
|
2024-02-12 01:45:05 -08:00
|
|
|
<n8n-button class="mb-xl" @click="openWebhookUrl()">
|
2024-01-09 03:11:39 -08:00
|
|
|
{{ $locale.baseText('ndv.trigger.chatTrigger.openChat') }}
|
|
|
|
</n8n-button>
|
|
|
|
</div>
|
|
|
|
|
2023-04-28 06:50:39 -07:00
|
|
|
<NodeExecuteButton
|
2023-08-29 05:00:17 -07:00
|
|
|
data-test-id="trigger-execute-button"
|
2023-12-28 00:49:58 -08:00
|
|
|
:node-name="nodeName"
|
2023-04-28 06:50:39 -07:00
|
|
|
size="medium"
|
2023-12-28 00:49:58 -08:00
|
|
|
telemetry-source="inputs"
|
|
|
|
@execute="onNodeExecute"
|
2023-04-28 06:50:39 -07:00
|
|
|
/>
|
2022-06-20 12:39:24 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-12-28 00:49:58 -08:00
|
|
|
<div v-else key="default">
|
|
|
|
<div v-if="isActivelyPolling" class="mb-xl">
|
2022-06-20 12:39:24 -07:00
|
|
|
<n8n-spinner type="ring" />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div :class="$style.action">
|
|
|
|
<div :class="$style.header">
|
|
|
|
<n8n-heading v-if="header" tag="h1" bold>
|
|
|
|
{{ header }}
|
|
|
|
</n8n-heading>
|
|
|
|
<n8n-text v-if="subheader">
|
2022-09-05 07:36:22 -07:00
|
|
|
<span v-text="subheader" />
|
2022-06-20 12:39:24 -07:00
|
|
|
</n8n-text>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<NodeExecuteButton
|
2023-08-29 05:00:17 -07:00
|
|
|
data-test-id="trigger-execute-button"
|
2023-12-28 00:49:58 -08:00
|
|
|
:node-name="nodeName"
|
2022-06-20 12:39:24 -07:00
|
|
|
size="medium"
|
2023-12-28 00:49:58 -08:00
|
|
|
telemetry-source="inputs"
|
|
|
|
@execute="onNodeExecute"
|
2022-06-20 12:39:24 -07:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
2023-12-28 00:49:58 -08:00
|
|
|
<n8n-text v-if="activationHint" size="small" @click="onLinkClick">
|
2022-06-20 12:39:24 -07:00
|
|
|
<span v-html="activationHint"></span>
|
|
|
|
</n8n-text>
|
|
|
|
<n8n-link
|
|
|
|
v-if="activationHint && executionsHelp"
|
2023-12-28 00:49:58 -08:00
|
|
|
size="small"
|
2022-06-20 12:39:24 -07:00
|
|
|
@click="expandExecutionHelp"
|
|
|
|
>{{ $locale.baseText('ndv.trigger.moreInfo') }}</n8n-link
|
|
|
|
>
|
|
|
|
<n8n-info-accordion
|
|
|
|
v-if="executionsHelp"
|
2023-12-28 00:49:58 -08:00
|
|
|
ref="help"
|
2022-06-20 12:39:24 -07:00
|
|
|
:class="$style.accordion"
|
|
|
|
:title="$locale.baseText('ndv.trigger.executionsHint.question')"
|
|
|
|
:description="executionsHelp"
|
2023-12-28 00:49:58 -08:00
|
|
|
:event-bus="executionsHelpEventBus"
|
2023-07-28 00:51:07 -07:00
|
|
|
@click:body="onLinkClick"
|
2022-06-20 12:39:24 -07:00
|
|
|
></n8n-info-accordion>
|
|
|
|
</div>
|
|
|
|
</transition>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-05-16 02:43:46 -07:00
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
import { mapStores } from 'pinia';
|
2023-10-16 21:09:30 -07:00
|
|
|
import {
|
2024-01-09 03:11:39 -08:00
|
|
|
CHAT_TRIGGER_NODE_TYPE,
|
2023-10-16 21:09:30 -07:00
|
|
|
VIEWS,
|
|
|
|
WEBHOOK_NODE_TYPE,
|
|
|
|
WORKFLOW_SETTINGS_MODAL_KEY,
|
|
|
|
FORM_TRIGGER_NODE_TYPE,
|
|
|
|
} from '@/constants';
|
2023-04-24 03:18:24 -07:00
|
|
|
import type { INodeUi } from '@/Interface';
|
|
|
|
import type { INodeTypeDescription } from 'n8n-workflow';
|
2023-11-28 03:15:08 -08:00
|
|
|
import { getTriggerNodeServiceName } from '@/utils/nodeTypesUtils';
|
2023-05-15 09:41:13 -07:00
|
|
|
import NodeExecuteButton from '@/components/NodeExecuteButton.vue';
|
|
|
|
import CopyInput from '@/components/CopyInput.vue';
|
|
|
|
import NodeIcon from '@/components/NodeIcon.vue';
|
2023-05-05 01:41:54 -07:00
|
|
|
import { useUIStore } from '@/stores/ui.store';
|
|
|
|
import { useWorkflowsStore } from '@/stores/workflows.store';
|
|
|
|
import { useNDVStore } from '@/stores/ndv.store';
|
|
|
|
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
2023-07-28 00:51:07 -07:00
|
|
|
import { createEventBus } from 'n8n-design-system/utils';
|
2024-02-12 01:45:05 -08:00
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers';
|
2024-05-31 08:22:27 -07:00
|
|
|
import { isTriggerPanelObject } from '@/utils/typeGuards';
|
2023-04-21 06:59:04 -07:00
|
|
|
|
2023-05-16 02:43:46 -07:00
|
|
|
export default defineComponent({
|
2022-06-20 12:39:24 -07:00
|
|
|
name: 'TriggerPanel',
|
|
|
|
components: {
|
|
|
|
NodeExecuteButton,
|
|
|
|
CopyInput,
|
|
|
|
NodeIcon,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
nodeName: {
|
|
|
|
type: String,
|
2024-05-31 08:22:27 -07:00
|
|
|
required: true,
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
2024-04-03 04:43:14 -07:00
|
|
|
pushRef: {
|
2022-06-20 12:39:24 -07:00
|
|
|
type: String,
|
2024-05-31 08:22:27 -07:00
|
|
|
default: '',
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
|
|
|
},
|
2024-05-31 08:22:27 -07:00
|
|
|
emits: { activate: null, execute: null },
|
2024-02-12 01:45:05 -08:00
|
|
|
setup() {
|
|
|
|
const router = useRouter();
|
2024-02-27 01:39:45 -08:00
|
|
|
const workflowHelpers = useWorkflowHelpers({ router });
|
2024-02-12 01:45:05 -08:00
|
|
|
|
|
|
|
return {
|
|
|
|
workflowHelpers,
|
|
|
|
};
|
|
|
|
},
|
2023-12-28 00:49:58 -08:00
|
|
|
data: () => {
|
|
|
|
return {
|
|
|
|
executionsHelpEventBus: createEventBus(),
|
|
|
|
};
|
|
|
|
},
|
2022-06-20 12:39:24 -07:00
|
|
|
computed: {
|
2022-11-04 06:04:31 -07:00
|
|
|
...mapStores(useNodeTypesStore, useNDVStore, useUIStore, useWorkflowsStore),
|
2022-06-20 12:39:24 -07:00
|
|
|
node(): INodeUi | null {
|
2024-05-31 08:22:27 -07:00
|
|
|
return this.workflowsStore.getNodeByName(this.nodeName);
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
|
|
|
nodeType(): INodeTypeDescription | null {
|
|
|
|
if (this.node) {
|
2022-11-04 06:04:31 -07:00
|
|
|
return this.nodeTypesStore.getNodeType(this.node.type, this.node.typeVersion);
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
},
|
2024-05-31 08:22:27 -07:00
|
|
|
triggerPanel() {
|
|
|
|
const panel = this.nodeType?.triggerPanel;
|
|
|
|
if (isTriggerPanelObject(panel)) {
|
|
|
|
return panel;
|
|
|
|
}
|
|
|
|
return undefined;
|
|
|
|
},
|
2024-01-09 03:11:39 -08:00
|
|
|
hideContent(): boolean {
|
2024-05-31 08:22:27 -07:00
|
|
|
const hideContent = this.triggerPanel?.hideContent;
|
|
|
|
if (typeof hideContent === 'boolean') {
|
|
|
|
return hideContent;
|
2024-01-09 03:11:39 -08:00
|
|
|
}
|
|
|
|
|
2024-05-31 08:22:27 -07:00
|
|
|
if (this.node) {
|
|
|
|
const hideContentValue = this.workflowHelpers
|
|
|
|
.getCurrentWorkflow()
|
|
|
|
.expression.getSimpleParameterValue(this.node, hideContent, 'internal', {});
|
2024-01-09 03:11:39 -08:00
|
|
|
|
2024-05-31 08:22:27 -07:00
|
|
|
if (typeof hideContentValue === 'boolean') {
|
|
|
|
return hideContentValue;
|
2024-01-09 03:11:39 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
},
|
2022-06-20 12:39:24 -07:00
|
|
|
hasIssues(): boolean {
|
|
|
|
return Boolean(
|
2024-05-31 08:22:27 -07:00
|
|
|
this.node?.issues && (this.node.issues.parameters ?? this.node.issues.credentials),
|
2022-06-20 12:39:24 -07:00
|
|
|
);
|
|
|
|
},
|
|
|
|
serviceName(): string {
|
|
|
|
if (this.nodeType) {
|
|
|
|
return getTriggerNodeServiceName(this.nodeType);
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
},
|
2024-01-09 03:11:39 -08:00
|
|
|
displayChatButton(): boolean {
|
|
|
|
return Boolean(
|
|
|
|
this.node &&
|
|
|
|
this.node.type === CHAT_TRIGGER_NODE_TYPE &&
|
|
|
|
this.node.parameters.mode !== 'webhook',
|
|
|
|
);
|
|
|
|
},
|
2022-06-20 12:39:24 -07:00
|
|
|
isWebhookNode(): boolean {
|
|
|
|
return Boolean(this.node && this.node.type === WEBHOOK_NODE_TYPE);
|
|
|
|
},
|
|
|
|
webhookHttpMethod(): string | undefined {
|
2023-08-01 04:51:49 -07:00
|
|
|
if (!this.node || !this.nodeType?.webhooks?.length) {
|
2022-06-20 12:39:24 -07:00
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
2024-04-23 22:46:16 -07:00
|
|
|
const httpMethod = this.workflowHelpers.getWebhookExpressionValue(
|
2024-02-12 01:45:05 -08:00
|
|
|
this.nodeType.webhooks[0],
|
|
|
|
'httpMethod',
|
2024-04-23 22:46:16 -07:00
|
|
|
false,
|
2024-02-12 01:45:05 -08:00
|
|
|
);
|
2024-04-23 22:46:16 -07:00
|
|
|
|
|
|
|
if (Array.isArray(httpMethod)) {
|
|
|
|
return httpMethod.join(', ');
|
|
|
|
}
|
|
|
|
|
|
|
|
return httpMethod;
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
|
|
|
webhookTestUrl(): string | undefined {
|
2023-08-01 04:51:49 -07:00
|
|
|
if (!this.node || !this.nodeType?.webhooks?.length) {
|
2022-06-20 12:39:24 -07:00
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
2024-02-12 01:45:05 -08:00
|
|
|
return this.workflowHelpers.getWebhookUrl(this.nodeType.webhooks[0], this.node, 'test');
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
|
|
|
isWebhookBasedNode(): boolean {
|
2023-08-01 04:51:49 -07:00
|
|
|
return Boolean(this.nodeType?.webhooks?.length);
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
|
|
|
isPollingNode(): boolean {
|
2023-11-23 02:55:02 -08:00
|
|
|
return Boolean(this.nodeType?.polling);
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
|
|
|
isListeningForEvents(): boolean {
|
2023-08-01 04:51:49 -07:00
|
|
|
const waitingOnWebhook = this.workflowsStore.executionWaitingForWebhook;
|
|
|
|
const executedNode = this.workflowsStore.executedNode;
|
2022-06-20 12:39:24 -07:00
|
|
|
return (
|
|
|
|
!!this.node &&
|
|
|
|
!this.node.disabled &&
|
|
|
|
this.isWebhookBasedNode &&
|
|
|
|
waitingOnWebhook &&
|
|
|
|
(!executedNode || executedNode === this.nodeName)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
workflowRunning(): boolean {
|
2022-11-04 06:04:31 -07:00
|
|
|
return this.uiStore.isActionActive('workflowRunning');
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
|
|
|
isActivelyPolling(): boolean {
|
2022-11-04 06:04:31 -07:00
|
|
|
const triggeredNode = this.workflowsStore.executedNode;
|
2022-06-20 12:39:24 -07:00
|
|
|
|
|
|
|
return this.workflowRunning && this.isPollingNode && this.nodeName === triggeredNode;
|
|
|
|
},
|
|
|
|
isWorkflowActive(): boolean {
|
2022-11-04 06:04:31 -07:00
|
|
|
return this.workflowsStore.isWorkflowActive;
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
2023-10-16 21:09:30 -07:00
|
|
|
listeningTitle(): string {
|
|
|
|
return this.nodeType?.name === FORM_TRIGGER_NODE_TYPE
|
|
|
|
? this.$locale.baseText('ndv.trigger.webhookNode.formTrigger.listening')
|
|
|
|
: this.$locale.baseText('ndv.trigger.webhookNode.listening');
|
|
|
|
},
|
|
|
|
listeningHint(): string {
|
2024-01-09 03:11:39 -08:00
|
|
|
switch (this.nodeType?.name) {
|
|
|
|
case CHAT_TRIGGER_NODE_TYPE:
|
|
|
|
return this.$locale.baseText('ndv.trigger.webhookBasedNode.chatTrigger.serviceHint');
|
|
|
|
case FORM_TRIGGER_NODE_TYPE:
|
|
|
|
return this.$locale.baseText('ndv.trigger.webhookBasedNode.formTrigger.serviceHint');
|
|
|
|
default:
|
|
|
|
return this.$locale.baseText('ndv.trigger.webhookBasedNode.serviceHint', {
|
2023-10-16 21:09:30 -07:00
|
|
|
interpolate: { service: this.serviceName },
|
2024-01-09 03:11:39 -08:00
|
|
|
});
|
|
|
|
}
|
2023-10-16 21:09:30 -07:00
|
|
|
},
|
2022-06-20 12:39:24 -07:00
|
|
|
header(): string {
|
|
|
|
const serviceName = this.nodeType ? getTriggerNodeServiceName(this.nodeType) : '';
|
|
|
|
|
|
|
|
if (this.isActivelyPolling) {
|
|
|
|
return this.$locale.baseText('ndv.trigger.pollingNode.fetchingEvent');
|
|
|
|
}
|
|
|
|
|
2024-05-31 08:22:27 -07:00
|
|
|
if (this.triggerPanel?.header) {
|
|
|
|
return this.triggerPanel.header;
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.isWebhookBasedNode) {
|
|
|
|
return this.$locale.baseText('ndv.trigger.webhookBasedNode.action', {
|
|
|
|
interpolate: { name: serviceName },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
subheader(): string {
|
|
|
|
const serviceName = this.nodeType ? getTriggerNodeServiceName(this.nodeType) : '';
|
|
|
|
if (this.isActivelyPolling) {
|
|
|
|
return this.$locale.baseText('ndv.trigger.pollingNode.fetchingHint', {
|
|
|
|
interpolate: { name: serviceName },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
executionsHelp(): string {
|
2024-05-31 08:22:27 -07:00
|
|
|
if (this.triggerPanel?.executionsHelp) {
|
|
|
|
if (typeof this.triggerPanel.executionsHelp === 'string') {
|
|
|
|
return this.triggerPanel.executionsHelp;
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
2024-05-31 08:22:27 -07:00
|
|
|
if (!this.isWorkflowActive && this.triggerPanel.executionsHelp.inactive) {
|
|
|
|
return this.triggerPanel.executionsHelp.inactive;
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
2024-05-31 08:22:27 -07:00
|
|
|
if (this.isWorkflowActive && this.triggerPanel.executionsHelp.active) {
|
|
|
|
return this.triggerPanel.executionsHelp.active;
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.isWebhookBasedNode) {
|
|
|
|
if (this.isWorkflowActive) {
|
|
|
|
return this.$locale.baseText('ndv.trigger.webhookBasedNode.executionsHelp.active', {
|
|
|
|
interpolate: { service: this.serviceName },
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
return this.$locale.baseText('ndv.trigger.webhookBasedNode.executionsHelp.inactive', {
|
|
|
|
interpolate: { service: this.serviceName },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.isPollingNode) {
|
|
|
|
if (this.isWorkflowActive) {
|
|
|
|
return this.$locale.baseText('ndv.trigger.pollingNode.executionsHelp.active', {
|
|
|
|
interpolate: { service: this.serviceName },
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
return this.$locale.baseText('ndv.trigger.pollingNode.executionsHelp.inactive', {
|
|
|
|
interpolate: { service: this.serviceName },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
activationHint(): string {
|
2024-05-31 08:22:27 -07:00
|
|
|
if (this.isActivelyPolling || !this.triggerPanel) {
|
2022-06-20 12:39:24 -07:00
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2024-05-31 08:22:27 -07:00
|
|
|
if (this.triggerPanel.activationHint) {
|
|
|
|
if (typeof this.triggerPanel.activationHint === 'string') {
|
|
|
|
return this.triggerPanel.activationHint;
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
|
|
|
if (
|
|
|
|
!this.isWorkflowActive &&
|
2024-05-31 08:22:27 -07:00
|
|
|
typeof this.triggerPanel.activationHint.inactive === 'string'
|
2022-06-20 12:39:24 -07:00
|
|
|
) {
|
2024-05-31 08:22:27 -07:00
|
|
|
return this.triggerPanel.activationHint.inactive;
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
2024-05-31 08:22:27 -07:00
|
|
|
if (this.isWorkflowActive && typeof this.triggerPanel.activationHint.active === 'string') {
|
|
|
|
return this.triggerPanel.activationHint.active;
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.isWebhookBasedNode) {
|
|
|
|
if (this.isWorkflowActive) {
|
|
|
|
return this.$locale.baseText('ndv.trigger.webhookBasedNode.activationHint.active', {
|
|
|
|
interpolate: { service: this.serviceName },
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
return this.$locale.baseText('ndv.trigger.webhookBasedNode.activationHint.inactive', {
|
|
|
|
interpolate: { service: this.serviceName },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.isPollingNode) {
|
|
|
|
if (this.isWorkflowActive) {
|
|
|
|
return this.$locale.baseText('ndv.trigger.pollingNode.activationHint.active', {
|
|
|
|
interpolate: { service: this.serviceName },
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
return this.$locale.baseText('ndv.trigger.pollingNode.activationHint.inactive', {
|
|
|
|
interpolate: { service: this.serviceName },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
expandExecutionHelp() {
|
|
|
|
if (this.$refs.help) {
|
2023-07-28 00:51:07 -07:00
|
|
|
this.executionsHelpEventBus.emit('expand');
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
|
|
|
},
|
2024-01-09 03:11:39 -08:00
|
|
|
openWebhookUrl() {
|
|
|
|
this.$telemetry.track('User clicked ndv link', {
|
|
|
|
workflow_id: this.workflowsStore.workflowId,
|
2024-04-03 04:43:14 -07:00
|
|
|
push_ref: this.pushRef,
|
2024-01-09 03:11:39 -08:00
|
|
|
pane: 'input',
|
|
|
|
type: 'open-chat',
|
|
|
|
});
|
|
|
|
window.open(this.webhookTestUrl, '_blank', 'noreferrer');
|
|
|
|
},
|
2022-06-20 12:39:24 -07:00
|
|
|
onLinkClick(e: MouseEvent) {
|
|
|
|
if (!e.target) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const target = e.target as HTMLElement;
|
|
|
|
if (target.localName !== 'a') return;
|
|
|
|
|
2023-08-01 04:51:49 -07:00
|
|
|
if (target.dataset?.key) {
|
2022-06-20 12:39:24 -07:00
|
|
|
e.stopPropagation();
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
if (target.dataset.key === 'activate') {
|
|
|
|
this.$emit('activate');
|
|
|
|
} else if (target.dataset.key === 'executions') {
|
|
|
|
this.$telemetry.track('User clicked ndv link', {
|
2022-11-04 06:04:31 -07:00
|
|
|
workflow_id: this.workflowsStore.workflowId,
|
2024-04-03 04:43:14 -07:00
|
|
|
push_ref: this.pushRef,
|
2022-06-20 12:39:24 -07:00
|
|
|
pane: 'input',
|
|
|
|
type: 'open-executions-log',
|
|
|
|
});
|
2022-11-04 06:04:31 -07:00
|
|
|
this.ndvStore.activeNodeName = null;
|
2023-08-01 04:51:49 -07:00
|
|
|
void this.$router.push({
|
|
|
|
name: VIEWS.EXECUTIONS,
|
|
|
|
});
|
2022-06-20 12:39:24 -07:00
|
|
|
} else if (target.dataset.key === 'settings') {
|
2022-11-04 06:04:31 -07:00
|
|
|
this.uiStore.openModal(WORKFLOW_SETTINGS_MODAL_KEY);
|
2022-06-20 12:39:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onTestLinkCopied() {
|
|
|
|
this.$telemetry.track('User copied webhook URL', {
|
|
|
|
pane: 'inputs',
|
|
|
|
type: 'test url',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onNodeExecute() {
|
|
|
|
this.$emit('execute');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.container {
|
|
|
|
position: relative;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background-color: var(--color-background-base);
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
padding: var(--spacing-s) var(--spacing-s) var(--spacing-xl) var(--spacing-s);
|
|
|
|
text-align: center;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
> * {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.header {
|
|
|
|
margin-bottom: var(--spacing-s);
|
|
|
|
|
|
|
|
> * {
|
|
|
|
margin-bottom: var(--spacing-2xs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.action {
|
|
|
|
margin-bottom: var(--spacing-2xl);
|
|
|
|
}
|
|
|
|
|
|
|
|
.shake {
|
|
|
|
animation: shake 8s infinite;
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes shake {
|
|
|
|
90% {
|
|
|
|
transform: translateX(0);
|
|
|
|
}
|
|
|
|
92.5% {
|
|
|
|
transform: translateX(6px);
|
|
|
|
}
|
|
|
|
95% {
|
|
|
|
transform: translateX(-6px);
|
|
|
|
}
|
|
|
|
97.5% {
|
|
|
|
transform: translateX(6px);
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
transform: translateX(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.accordion {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.fade-enter-active,
|
|
|
|
.fade-leave-active {
|
|
|
|
transition: opacity 200ms;
|
|
|
|
}
|
|
|
|
.fade-enter,
|
|
|
|
.fade-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
</style>
|