* add panel * add workflow activation hints * support service trigger nodes * update polling state * support more views * update when trigger panel shows * update start/error nodes * add cron/interval info box * clean up start node * fix up webhook views * remove console log * add listening state * clean up loading state * update loading state * fix up animation * update views * add executions hint * update views * update accordian styling * address more issues * disable execute button if issues * disable if it has issues * add stop waiting button * can activate workflow when dsiabled * update el * fix has issues * add margin bttm * update views * close ndv * add shake * update copies * add error when polling node is missing one * update package lock * hide switch * hide binary data that's missing keys * hide main bar if ndv is open * remove waiting to execute * change accordion bg color * capitalize text * disable trigger panel in read only views * remove webhook title * update webhook desc * update component * update webhook executions note * update header * update webhook url * update exec help * bring back waiting to execute for non triggers * add transition fade * set shake * add helpful tooltip * add nonactive text * add inactive text * hide trigger panel by default * remove unused import * update pulse animation * handle empty values for options * update text * add flag for mock manual executions * add overrides * Add overrides * update check * update package lock; show button for others * hide more info * update other core nodes * update service name * remove panel from nodes * update panel * last tweaks * add telemetry event * add telemetry; address issues * address feedback * address feedback * address feedback * fix previous * fix previous * fix bug * fix bug with webhookbased * add extra break * update telemetry * update telemetry * add telemetry req * add info icon story; use icon component * clean css; en.json * clean en.json * rename key * add key * sort keys alpha * handle activation if active + add previous state to telemetry * stop activation if active * remove unnessary tracking * remove unused import * remove unused * remove unnessary flag * rewrite in ts * move pulse to design system * clean up * clean up * clean up * disable tslint check * disable tslint check
133 lines
3.8 KiB
Vue
133 lines
3.8 KiB
Vue
<template>
|
|
<div class="workflow-activator">
|
|
<n8n-tooltip :disabled="!disabled" placement="bottom">
|
|
<div slot="content">{{ $locale.baseText('workflowActivator.thisWorkflowHasNoTriggerNodes') }}</div>
|
|
<el-switch
|
|
v-loading="updatingWorkflowActivation"
|
|
:value="workflowActive"
|
|
@change="activeChanged"
|
|
:title="workflowActive ? $locale.baseText('workflowActivator.deactivateWorkflow') : $locale.baseText('workflowActivator.activateWorkflow')"
|
|
:disabled="disabled || updatingWorkflowActivation"
|
|
:active-color="getActiveColor"
|
|
inactive-color="#8899AA"
|
|
element-loading-spinner="el-icon-loading">
|
|
</el-switch>
|
|
</n8n-tooltip>
|
|
|
|
<div class="could-not-be-started" v-if="couldNotBeStarted">
|
|
<n8n-tooltip placement="top">
|
|
<div @click="displayActivationError" slot="content" v-html="$locale.baseText('workflowActivator.theWorkflowIsSetToBeActiveBut')"></div>
|
|
<font-awesome-icon @click="displayActivationError" icon="exclamation-triangle" />
|
|
</n8n-tooltip>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { showMessage } from '@/components/mixins/showMessage';
|
|
import { workflowActivate } from '@/components/mixins/workflowActivate';
|
|
|
|
import mixins from 'vue-typed-mixins';
|
|
import { mapGetters } from "vuex";
|
|
|
|
import { getActivatableTriggerNodes } from './helpers';
|
|
|
|
export default mixins(
|
|
showMessage,
|
|
workflowActivate,
|
|
)
|
|
.extend(
|
|
{
|
|
name: 'WorkflowActivator',
|
|
props: [
|
|
'workflowActive',
|
|
'workflowId',
|
|
],
|
|
computed: {
|
|
...mapGetters({
|
|
dirtyState: "getStateIsDirty",
|
|
}),
|
|
nodesIssuesExist (): boolean {
|
|
return this.$store.getters.nodesIssuesExist;
|
|
},
|
|
isWorkflowActive (): boolean {
|
|
const activeWorkflows = this.$store.getters.getActiveWorkflows;
|
|
return activeWorkflows.includes(this.workflowId);
|
|
},
|
|
couldNotBeStarted (): boolean {
|
|
return this.workflowActive === true && this.isWorkflowActive !== this.workflowActive;
|
|
},
|
|
getActiveColor (): string {
|
|
if (this.couldNotBeStarted === true) {
|
|
return '#ff4949';
|
|
}
|
|
return '#13ce66';
|
|
},
|
|
isCurrentWorkflow(): boolean {
|
|
return this.$store.getters['workflowId'] === this.workflowId;
|
|
},
|
|
disabled(): boolean {
|
|
const isNewWorkflow = !this.workflowId;
|
|
if (isNewWorkflow || this.isCurrentWorkflow) {
|
|
return !this.workflowActive && !this.containsTrigger;
|
|
}
|
|
|
|
return false;
|
|
},
|
|
containsTrigger(): boolean {
|
|
const foundTriggers = getActivatableTriggerNodes(this.$store.getters.workflowTriggerNodes);
|
|
return foundTriggers.length > 0;
|
|
},
|
|
},
|
|
methods: {
|
|
async activeChanged (newActiveState: boolean) {
|
|
return this.updateWorkflowActivation(this.workflowId, newActiveState);
|
|
},
|
|
async displayActivationError () {
|
|
let errorMessage: string;
|
|
try {
|
|
const errorData = await this.restApi().getActivationError(this.workflowId);
|
|
|
|
if (errorData === undefined) {
|
|
errorMessage = this.$locale.baseText('workflowActivator.showMessage.displayActivationError.message.errorDataUndefined');
|
|
} else {
|
|
errorMessage = this.$locale.baseText(
|
|
'workflowActivator.showMessage.displayActivationError.message.errorDataNotUndefined',
|
|
{ interpolate: { message: errorData.error.message } },
|
|
);
|
|
}
|
|
} catch (error) {
|
|
errorMessage = this.$locale.baseText('workflowActivator.showMessage.displayActivationError.message.catchBlock');
|
|
}
|
|
|
|
this.$showMessage({
|
|
title: this.$locale.baseText('workflowActivator.showMessage.displayActivationError.title'),
|
|
message: errorMessage,
|
|
type: 'warning',
|
|
duration: 0,
|
|
});
|
|
},
|
|
},
|
|
},
|
|
);
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.workflow-activator {
|
|
display: inline-block;
|
|
}
|
|
|
|
.could-not-be-started {
|
|
display: inline-block;
|
|
color: #ff4949;
|
|
margin-left: 0.5em;
|
|
}
|
|
|
|
::v-deep .el-loading-spinner {
|
|
margin-top: -10px;
|
|
}
|
|
|
|
</style>
|