Improve workflow activation (#2692)

* feat: activator disabled based on thiggers

* feat: tooltip over inactive switch

* feat: message for trigger types

* feat: deactivate on save if trigger is removed

* chore: refactor executions modal

* feat: calculate service name if possible

* feat: alert on activation

* chore: fix linting

* feat: always enable activator when active

* fix: adjust the alert

* feat: take disabled state into account

* feat: automatically save on activation

* feat: rely on nodes name and edit messages

* feat: isolate state for each activator instance

* feat: create activation modal component

* feat: activationModal checkbox and trigger message

* feat: add activation messages to node config

* chore: style activation modal

* chore: style fixes

* feat: refactor disabled state

* chore: refactor modal

* chore: refactor modal

* chore: tidy the node config

* chore: refactor and styling tweaks

* chore: minor fixes

* fix: check webhooks from ui nodes

* chore: remove saving prompt

* chore: explicit current workflow evaluation

* feat: add settings link to activation modal

* fix: immediately load executions on render

* feat: exclude error trigger from trigger nodes

* chore: add i18n keys

* fix: check localstorage more strictly

* fix: handle refresh in execution list

* remove unnessary event

* remove comment

* fix closing executions modal bugs

* update closing

* update translation key

* fix translation keys

* fix modal closing

* fix closing

* fix drawer closing

* close all modals when opening executions

* update key

* close all modals when opening workflow or new page

* delete unnessary comment

* clean up import

* clean up unnessary initial data

* clean up activator impl

* rewrite

* fix open modal bug

* simply remove error

* refactor activation logic

* fix i18n and such

* remove changes

* revert saving changes

* Revert "revert saving changes"

25c29d10553ebcc11939ff29938e8a5ac6b3ffae

* add translation

* fix new workflows saving

* clean up modal impl

* clean up impl

* refactor common code out

* remove active changes from saving

* refactor differently

* revert unnessary change

* set dirty false

* fix i18n bug

* avoid opening two modals

* fix tooltips

* add comment

* address other comments

* address comments

Co-authored-by: saintsebastian <tilitidam@gmail.com>
This commit is contained in:
Mutasem Aldmour
2022-01-21 18:00:00 +01:00
committed by GitHub
parent a9cef48048
commit 49bf786e5b
25 changed files with 372 additions and 174 deletions

View File

@@ -1,6 +1,12 @@
<template>
<span>
<el-dialog :visible="dialogVisible" append-to-body width="80%" :title="`${$locale.baseText('executionsList.workflowExecutions')} ${combinedExecutions.length}/${finishedExecutionsCountEstimated === true ? '~' : ''}${combinedExecutionsCount}`" :before-close="closeDialog">
<Modal
:name="EXECUTIONS_MODAL_KEY"
width="80%"
:title="`${$locale.baseText('executionsList.workflowExecutions')} ${combinedExecutions.length}/${finishedExecutionsCountEstimated === true ? '~' : ''}${combinedExecutionsCount}`"
:eventBus="modalBus"
>
<template v-slot:content>
<div class="filters">
<el-row>
<el-col :span="2" class="filter-headline">
@@ -153,9 +159,8 @@
<div class="load-more" v-if="finishedExecutionsCount > finishedExecutions.length || finishedExecutionsCountEstimated === true">
<n8n-button icon="sync" :title="$locale.baseText('executionsList.loadMore')" :label="$locale.baseText('executionsList.loadMore')" @click="loadMore()" :loading="isDataLoading" />
</div>
</el-dialog>
</span>
</template>
</Modal>
</template>
<script lang="ts">
@@ -163,9 +168,10 @@ import Vue from 'vue';
import ExecutionTime from '@/components/ExecutionTime.vue';
import WorkflowActivator from '@/components/WorkflowActivator.vue';
import Modal from '@/components/Modal.vue';
import { externalHooks } from '@/components/mixins/externalHooks';
import { WAIT_TIME_UNLIMITED } from '@/constants';
import { WAIT_TIME_UNLIMITED, EXECUTIONS_MODAL_KEY } from '@/constants';
import { restApi } from '@/components/mixins/restApi';
import { genericHelpers } from '@/components/mixins/genericHelpers';
@@ -200,12 +206,10 @@ export default mixins(
showMessage,
).extend({
name: 'ExecutionsList',
props: [
'dialogVisible',
],
components: {
ExecutionTime,
WorkflowActivator,
Modal,
},
data () {
return {
@@ -230,8 +234,24 @@ export default mixins(
stoppingExecutions: [] as string[],
workflows: [] as IWorkflowShortResponse[],
modalBus: new Vue(),
EXECUTIONS_MODAL_KEY,
};
},
async created() {
await this.loadWorkflows();
await this.refreshData();
this.handleAutoRefreshToggle();
this.$externalHooks().run('executionsList.openDialog');
this.$telemetry.track('User opened Executions log', { workflow_id: this.$store.getters.workflowId });
},
beforeDestroy() {
if (this.autoRefreshInterval) {
clearInterval(this.autoRefreshInterval);
this.autoRefreshInterval = undefined;
}
},
computed: {
statuses () {
return [
@@ -312,23 +332,9 @@ export default mixins(
return filter;
},
},
watch: {
dialogVisible (newValue, oldValue) {
if (newValue) {
this.openDialog();
}
},
},
methods: {
closeDialog () {
// Handle the close externally as the visible parameter is an external prop
// and is so not allowed to be changed here.
this.$emit('closeDialog');
if (this.autoRefreshInterval) {
clearInterval(this.autoRefreshInterval);
this.autoRefreshInterval = undefined;
}
return false;
closeDialog() {
this.modalBus.$emit('close');
},
convertToDisplayDate,
displayExecution (execution: IExecutionShortResponse, e: PointerEvent) {
@@ -343,7 +349,7 @@ export default mixins(
name: 'ExecutionById',
params: { id: execution.id },
});
this.closeDialog();
this.modalBus.$emit('closeAll');
},
handleAutoRefreshToggle () {
if (this.autoRefreshInterval) {
@@ -610,18 +616,6 @@ export default mixins(
);
}
},
async openDialog () {
Vue.set(this, 'selectedItems', {});
this.filter.workflowId = 'ALL';
this.checkAll = false;
await this.loadWorkflows();
await this.refreshData();
this.handleAutoRefreshToggle();
this.$externalHooks().run('executionsList.openDialog');
this.$telemetry.track('User opened Executions log', { workflow_id: this.$store.getters.workflowId });
},
async retryExecution (execution: IExecutionShortResponse, loadWorkflow?: boolean) {
this.isDataLoading = true;