2022-01-21 09:00:00 -08:00
|
|
|
<template>
|
|
|
|
<Modal
|
|
|
|
:name="WORKFLOW_ACTIVE_MODAL_KEY"
|
|
|
|
:title="$locale.baseText('activationModal.workflowActivated')"
|
|
|
|
width="460px"
|
|
|
|
>
|
2022-11-18 05:59:31 -08:00
|
|
|
<template #content>
|
2022-01-21 09:00:00 -08:00
|
|
|
<div>
|
|
|
|
<n8n-text>{{ triggerContent }}</n8n-text>
|
|
|
|
</div>
|
|
|
|
<div :class="$style.spaced">
|
|
|
|
<n8n-text>
|
|
|
|
<n8n-text :bold="true">
|
|
|
|
{{ $locale.baseText('activationModal.theseExecutionsWillNotShowUp') }}
|
|
|
|
</n8n-text>
|
|
|
|
{{ $locale.baseText('activationModal.butYouCanSeeThem') }}
|
|
|
|
<a @click="showExecutionsList">
|
|
|
|
{{ $locale.baseText('activationModal.executionList') }}
|
|
|
|
</a>
|
|
|
|
{{ $locale.baseText('activationModal.ifYouChooseTo') }}
|
|
|
|
<a @click="showSettings">{{ $locale.baseText('activationModal.saveExecutions') }}</a>
|
|
|
|
</n8n-text>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2022-11-18 05:59:31 -08:00
|
|
|
<template #footer="{ close }">
|
2022-01-21 09:00:00 -08:00
|
|
|
<div :class="$style.footer">
|
|
|
|
<el-checkbox :value="checked" @change="handleCheckboxChange">{{ $locale.baseText('activationModal.dontShowAgain') }}</el-checkbox>
|
|
|
|
<n8n-button @click="close" :label="$locale.baseText('activationModal.gotIt')" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
import Modal from '@/components/Modal.vue';
|
2022-11-04 06:04:31 -07:00
|
|
|
import { WORKFLOW_ACTIVE_MODAL_KEY, WORKFLOW_SETTINGS_MODAL_KEY, LOCAL_STORAGE_ACTIVATION_FLAG, VIEWS } from '../constants';
|
2022-11-23 04:41:53 -08:00
|
|
|
import { getActivatableTriggerNodes, getTriggerNodeServiceName } from '@/utils';
|
2022-11-04 06:04:31 -07:00
|
|
|
import { mapStores } from 'pinia';
|
|
|
|
import { useUIStore } from '@/stores/ui';
|
|
|
|
import { useWorkflowsStore } from '@/stores/workflows';
|
|
|
|
import { useNodeTypesStore } from '@/stores/nodeTypes';
|
2022-01-21 09:00:00 -08:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
name: 'ActivationModal',
|
|
|
|
components: {
|
|
|
|
Modal,
|
|
|
|
},
|
|
|
|
props: [
|
|
|
|
'modalName',
|
|
|
|
],
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
WORKFLOW_ACTIVE_MODAL_KEY,
|
|
|
|
checked: false,
|
2022-10-26 01:02:56 -07:00
|
|
|
modalBus: new Vue(),
|
2022-01-21 09:00:00 -08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async showExecutionsList () {
|
2022-11-04 06:04:31 -07:00
|
|
|
const activeExecution = this.workflowsStore.activeWorkflowExecution;
|
|
|
|
const currentWorkflow = this.workflowsStore.workflowId;
|
2022-10-26 01:02:56 -07:00
|
|
|
|
|
|
|
if (activeExecution) {
|
|
|
|
this.$router.push({
|
|
|
|
name: VIEWS.EXECUTION_PREVIEW,
|
|
|
|
params: { name: currentWorkflow, executionId: activeExecution.id },
|
|
|
|
}).catch(()=>{});;
|
|
|
|
} else {
|
|
|
|
this.$router.push({ name: VIEWS.EXECUTION_HOME, params: { name: currentWorkflow } }).catch(() => {});
|
|
|
|
}
|
2022-11-04 06:04:31 -07:00
|
|
|
this.uiStore.closeModal(WORKFLOW_ACTIVE_MODAL_KEY);
|
2022-01-21 09:00:00 -08:00
|
|
|
},
|
|
|
|
async showSettings() {
|
2022-11-04 06:04:31 -07:00
|
|
|
this.uiStore.openModal(WORKFLOW_SETTINGS_MODAL_KEY);
|
2022-01-21 09:00:00 -08:00
|
|
|
},
|
|
|
|
handleCheckboxChange (checkboxValue: boolean) {
|
|
|
|
this.checked = checkboxValue;
|
|
|
|
window.localStorage.setItem(LOCAL_STORAGE_ACTIVATION_FLAG, checkboxValue.toString());
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
2022-11-04 06:04:31 -07:00
|
|
|
...mapStores(
|
|
|
|
useNodeTypesStore,
|
|
|
|
useUIStore,
|
|
|
|
useWorkflowsStore,
|
|
|
|
),
|
2022-01-21 09:00:00 -08:00
|
|
|
triggerContent (): string {
|
2022-11-04 06:04:31 -07:00
|
|
|
const foundTriggers = getActivatableTriggerNodes(this.workflowsStore.workflowTriggerNodes);
|
2022-01-21 09:00:00 -08:00
|
|
|
if (!foundTriggers.length) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (foundTriggers.length > 1) {
|
|
|
|
return this.$locale.baseText('activationModal.yourTriggersWillNowFire');
|
|
|
|
}
|
|
|
|
|
|
|
|
const trigger = foundTriggers[0];
|
|
|
|
|
2022-11-04 06:04:31 -07:00
|
|
|
const triggerNodeType = this.nodeTypesStore.getNodeType(trigger.type, trigger.typeVersion);
|
|
|
|
if (triggerNodeType) {
|
|
|
|
if (triggerNodeType.activationMessage) {
|
|
|
|
return triggerNodeType.activationMessage;
|
|
|
|
}
|
2022-01-21 09:00:00 -08:00
|
|
|
|
2022-11-04 06:04:31 -07:00
|
|
|
const serviceName = getTriggerNodeServiceName(triggerNodeType);
|
|
|
|
if (trigger.webhookId) {
|
|
|
|
return this.$locale.baseText('activationModal.yourWorkflowWillNowListenForEvents', {
|
|
|
|
interpolate: {
|
|
|
|
serviceName,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
} else if (triggerNodeType.polling) {
|
|
|
|
return this.$locale.baseText('activationModal.yourWorkflowWillNowRegularlyCheck', {
|
|
|
|
interpolate: {
|
|
|
|
serviceName,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2022-01-21 09:00:00 -08:00
|
|
|
}
|
2022-11-04 06:04:31 -07:00
|
|
|
return this.$locale.baseText('activationModal.yourTriggerWillNowFire');
|
2022-01-21 09:00:00 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.spaced {
|
|
|
|
margin-top: var(--spacing-2xs);
|
|
|
|
}
|
|
|
|
|
|
|
|
.footer {
|
|
|
|
text-align: right;
|
|
|
|
|
|
|
|
> * {
|
|
|
|
margin-left: var(--spacing-s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|