From 49bf786e5b9a95479fb85602e21c22ec0e9d2d4b Mon Sep 17 00:00:00 2001 From: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com> Date: Fri, 21 Jan 2022 18:00:00 +0100 Subject: [PATCH] :sparkles: 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 --- .../src/components/ActivationModal.vue | 121 ++++++++++++++ .../src/components/ContactPromptModal.vue | 3 +- .../CredentialEdit/CredentialEdit.vue | 7 +- .../src/components/ExecutionsList.vue | 70 ++++----- .../components/MainHeader/WorkflowDetails.vue | 2 +- .../editor-ui/src/components/MainSidebar.vue | 11 +- packages/editor-ui/src/components/Modal.vue | 26 +-- .../editor-ui/src/components/ModalDrawer.vue | 11 +- packages/editor-ui/src/components/Modals.vue | 30 +++- packages/editor-ui/src/components/Node.vue | 4 +- .../editor-ui/src/components/ValueSurvey.vue | 7 +- .../src/components/WorkflowActivator.vue | 148 ++++++++---------- .../editor-ui/src/components/WorkflowOpen.vue | 2 +- packages/editor-ui/src/components/helpers.ts | 13 ++ .../src/components/mixins/workflowHelpers.ts | 26 +++ packages/editor-ui/src/constants.ts | 3 + packages/editor-ui/src/modules/ui.ts | 30 ++-- .../src/plugins/i18n/locales/en.json | 25 ++- packages/editor-ui/src/store.ts | 1 + packages/nodes-base/nodes/Cron/Cron.node.ts | 1 + .../nodes/Interval/Interval.node.ts | 1 + .../nodes/SseTrigger/SseTrigger.node.ts | 1 + .../nodes-base/nodes/Webhook/Webhook.node.ts | 1 + .../WorkflowTrigger/WorkflowTrigger.node.ts | 1 + packages/workflow/src/Interfaces.ts | 1 + 25 files changed, 372 insertions(+), 174 deletions(-) create mode 100644 packages/editor-ui/src/components/ActivationModal.vue diff --git a/packages/editor-ui/src/components/ActivationModal.vue b/packages/editor-ui/src/components/ActivationModal.vue new file mode 100644 index 0000000000..d928976a79 --- /dev/null +++ b/packages/editor-ui/src/components/ActivationModal.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/packages/editor-ui/src/components/ContactPromptModal.vue b/packages/editor-ui/src/components/ContactPromptModal.vue index 903d931088..4d84820c84 100644 --- a/packages/editor-ui/src/components/ContactPromptModal.vue +++ b/packages/editor-ui/src/components/ContactPromptModal.vue @@ -80,7 +80,6 @@ export default mixins(workflowHelpers).extend({ instance_id: this.$store.getters.instanceId, email: null, }); - this.$store.commit('ui/closeTopModal'); }, async send() { if (this.isEmailValid) { @@ -100,7 +99,7 @@ export default mixins(workflowHelpers).extend({ type: 'success', }); } - this.$store.commit('ui/closeTopModal'); + this.modalBus.$emit('close'); } }, }, diff --git a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue index 0b620890e6..28aef70869 100644 --- a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue +++ b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue @@ -344,7 +344,7 @@ export default mixins(showMessage, nodeHelpers).extend({ }, }, methods: { - async beforeClose(done: () => void) { + async beforeClose() { let keepEditing = false; if (this.hasUnsavedChanges) { @@ -368,8 +368,7 @@ export default mixins(showMessage, nodeHelpers).extend({ } if (!keepEditing) { - done(); - return; + return true; } else if (!this.requiredPropertiesFilled) { this.showValidationWarning = true; @@ -378,6 +377,8 @@ export default mixins(showMessage, nodeHelpers).extend({ else if (this.isOAuthType) { this.scrollToBottom(); } + + return false; }, displayCredentialParameter(parameter: INodeProperties): boolean { diff --git a/packages/editor-ui/src/components/ExecutionsList.vue b/packages/editor-ui/src/components/ExecutionsList.vue index 807e86bceb..073d536402 100644 --- a/packages/editor-ui/src/components/ExecutionsList.vue +++ b/packages/editor-ui/src/components/ExecutionsList.vue @@ -1,6 +1,12 @@ diff --git a/packages/editor-ui/src/components/Node.vue b/packages/editor-ui/src/components/Node.vue index f7be2408f1..af6ea8b2a9 100644 --- a/packages/editor-ui/src/components/Node.vue +++ b/packages/editor-ui/src/components/Node.vue @@ -92,7 +92,7 @@ import NodeIcon from '@/components/NodeIcon.vue'; import mixins from 'vue-typed-mixins'; import { get } from 'lodash'; -import { getStyleTokenValue } from './helpers'; +import { getStyleTokenValue, getTriggerNodeServiceName } from './helpers'; import { INodeUi, XYPosition } from '@/Interface'; export default mixins(externalHooks, nodeBase, nodeHelpers, workflowHelpers).extend({ @@ -131,7 +131,7 @@ export default mixins(externalHooks, nodeBase, nodeHelpers, workflowHelpers).ext 'node.waitingForYouToCreateAnEventIn', { interpolate: { - nodeType: this.nodeType && this.nodeType.displayName.replace(/Trigger/, ""), + nodeType: this.nodeType && getTriggerNodeServiceName(this.nodeType.displayName), }, }, ); diff --git a/packages/editor-ui/src/components/ValueSurvey.vue b/packages/editor-ui/src/components/ValueSurvey.vue index c331795ce0..2ec1c8d241 100644 --- a/packages/editor-ui/src/components/ValueSurvey.vue +++ b/packages/editor-ui/src/components/ValueSurvey.vue @@ -1,6 +1,7 @@