From 240b2f075e0a800807741671e66ad21b30dec4ba Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Fri, 15 Sep 2023 13:17:04 +0200 Subject: [PATCH] feat(editor): Add Workflow history route and base page (no-changelog) (#7161) --- packages/cli/src/Server.ts | 1 + packages/editor-ui/src/constants.ts | 2 + .../src/plugins/i18n/locales/en.json | 1 + packages/editor-ui/src/router.ts | 31 ++++++++-- .../editor-ui/src/views/WorkflowHistory.vue | 56 +++++++++++++++++++ packages/workflow/src/Interfaces.ts | 1 + 6 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 packages/editor-ui/src/views/WorkflowHistory.vue diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index 3903373c71e35..61c14fa1b8b1a 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -324,6 +324,7 @@ export class Server extends AbstractServer { externalSecrets: false, showNonProdBanner: false, debugInEditor: false, + workflowHistory: false, }, mfa: { enabled: false, diff --git a/packages/editor-ui/src/constants.ts b/packages/editor-ui/src/constants.ts index c91d713926715..bf2541b7b0967 100644 --- a/packages/editor-ui/src/constants.ts +++ b/packages/editor-ui/src/constants.ts @@ -383,6 +383,7 @@ export const enum VIEWS { SOURCE_CONTROL = 'SourceControl', AUDIT_LOGS = 'AuditLogs', MFA_VIEW = 'MfaView', + WORKFLOW_HISTORY = 'WorkflowHistory', } export const enum FAKE_DOOR_FEATURES { @@ -454,6 +455,7 @@ export const enum EnterpriseEditionFeature { ExternalSecrets = 'externalSecrets', AuditLogs = 'auditLogs', DebugInEditor = 'debugInEditor', + WorkflowHistory = 'workflowHistory', } export const MAIN_NODE_PANEL_WIDTH = 360; diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index d03cea2ab463a..ff43e76679106 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -1753,6 +1753,7 @@ "workflowSettings.timeoutAfter": "Timeout After", "workflowSettings.timeoutWorkflow": "Timeout Workflow", "workflowSettings.timezone": "Timezone", + "workflowHistory.title": "Version History", "workflows.heading": "Workflows", "workflows.add": "Add Workflow", "workflows.menu.my": "My workflows", diff --git a/packages/editor-ui/src/router.ts b/packages/editor-ui/src/router.ts index 03b6994d13040..d29b8582493b5 100644 --- a/packages/editor-ui/src/router.ts +++ b/packages/editor-ui/src/router.ts @@ -40,6 +40,7 @@ import SamlOnboarding from '@/views/SamlOnboarding.vue'; import SettingsSourceControl from './views/SettingsSourceControl.vue'; import SettingsExternalSecrets from './views/SettingsExternalSecrets.vue'; import SettingsAuditLogs from './views/SettingsAuditLogs.vue'; +import WorkflowHistory from '@/views/WorkflowHistory.vue'; import { EnterpriseEditionFeature, VIEWS } from '@/constants'; interface IRouteConfig { @@ -293,6 +294,28 @@ export const routes = [ }, ], }, + { + path: '/workflow/:workflowId/history/:historyId?', + name: VIEWS.WORKFLOW_HISTORY, + components: { + default: WorkflowHistory, + sidebar: MainSidebar, + }, + meta: { + keepWorkflowAlive: true, + permissions: { + allow: { + loginStatus: [LOGIN_STATUS.LoggedIn], + }, + deny: { + shouldDeny: () => + !useSettingsStore().isEnterpriseFeatureEnabled( + EnterpriseEditionFeature.WorkflowHistory, + ), + }, + }, + }, + }, { path: '/workflows/templates/:id', name: VIEWS.TEMPLATE_IMPORT, @@ -493,7 +516,7 @@ export const routes = [ shouldDeny: () => { const settingsStore = useSettingsStore(); return ( - settingsStore.settings.hideUsagePage === true || + settingsStore.settings.hideUsagePage || settingsStore.settings.deployment?.type === 'cloud' ); }, @@ -570,7 +593,7 @@ export const routes = [ deny: { shouldDeny: () => { const settingsStore = useSettingsStore(); - return settingsStore.isPublicApiEnabled === false; + return !settingsStore.isPublicApiEnabled; }, }, }, @@ -685,7 +708,7 @@ export const routes = [ deny: { shouldDeny: () => { const settingsStore = useSettingsStore(); - return settingsStore.isCommunityNodesFeatureEnabled === false; + return !settingsStore.isCommunityNodesFeatureEnabled; }, }, }, @@ -702,7 +725,7 @@ export const routes = [ pageCategory: 'settings', getProperties(route: RouteLocation) { return { - feature: route.params['featureId'], + feature: route.params.featureId, }; }, }, diff --git a/packages/editor-ui/src/views/WorkflowHistory.vue b/packages/editor-ui/src/views/WorkflowHistory.vue new file mode 100644 index 0000000000000..c3644612091be --- /dev/null +++ b/packages/editor-ui/src/views/WorkflowHistory.vue @@ -0,0 +1,56 @@ + + + diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index 280d195d1b782..b59448aae95e0 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -2186,6 +2186,7 @@ export interface IN8nUISettings { externalSecrets: boolean; showNonProdBanner: boolean; debugInEditor: boolean; + workflowHistory: boolean; }; hideUsagePage: boolean; license: {