Skip to content

Commit

Permalink
feat(editor): Add Workflow history route and base page (no-changelog) (
Browse files Browse the repository at this point in the history
  • Loading branch information
cstuncsik authored Sep 15, 2023
1 parent 556a613 commit 240b2f0
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ export class Server extends AbstractServer {
externalSecrets: false,
showNonProdBanner: false,
debugInEditor: false,
workflowHistory: false,
},
mfa: {
enabled: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/editor-ui/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -454,6 +455,7 @@ export const enum EnterpriseEditionFeature {
ExternalSecrets = 'externalSecrets',
AuditLogs = 'auditLogs',
DebugInEditor = 'debugInEditor',
WorkflowHistory = 'workflowHistory',
}
export const MAIN_NODE_PANEL_WIDTH = 360;

Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
31 changes: 27 additions & 4 deletions packages/editor-ui/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -493,7 +516,7 @@ export const routes = [
shouldDeny: () => {
const settingsStore = useSettingsStore();
return (
settingsStore.settings.hideUsagePage === true ||
settingsStore.settings.hideUsagePage ||
settingsStore.settings.deployment?.type === 'cloud'
);
},
Expand Down Expand Up @@ -570,7 +593,7 @@ export const routes = [
deny: {
shouldDeny: () => {
const settingsStore = useSettingsStore();
return settingsStore.isPublicApiEnabled === false;
return !settingsStore.isPublicApiEnabled;
},
},
},
Expand Down Expand Up @@ -685,7 +708,7 @@ export const routes = [
deny: {
shouldDeny: () => {
const settingsStore = useSettingsStore();
return settingsStore.isCommunityNodesFeatureEnabled === false;
return !settingsStore.isCommunityNodesFeatureEnabled;
},
},
},
Expand All @@ -702,7 +725,7 @@ export const routes = [
pageCategory: 'settings',
getProperties(route: RouteLocation) {
return {
feature: route.params['featureId'],
feature: route.params.featureId,
};
},
},
Expand Down
56 changes: 56 additions & 0 deletions packages/editor-ui/src/views/WorkflowHistory.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<script setup lang="ts">
import { useI18n } from '@/composables';
const i18n = useI18n();
</script>
<template>
<div :class="$style.view">
<n8n-heading :class="$style.header" tag="h2" size="medium" bold>Workflow name</n8n-heading>
<div :class="$style.corner">
<n8n-heading tag="h2" size="medium" bold>{{
i18n.baseText('workflowHistory.title')
}}</n8n-heading>
<n8n-button type="tertiary" icon="times" size="small" text square />
</div>
<div :class="$style.content"></div>
<div :class="$style.list"></div>
</div>
</template>
<style module lang="scss">
.view {
display: grid;
width: 100%;
grid-template-areas: 'header corner' 'content list';
grid-template-columns: auto 330px;
grid-template-rows: 65px auto;
background-color: var(--color-background-xlight);
}
.header {
grid-area: header;
display: flex;
align-items: center;
padding: 0 var(--spacing-l);
border-bottom: var(--border-width-base) var(--border-style-base) var(--color-foreground-base);
}
.corner {
grid-area: corner;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 var(--spacing-3xs) 0 var(--spacing-s);
background-color: var(--color-background-lighter);
border-bottom: var(--border-width-base) var(--border-style-base) var(--color-foreground-base);
border-left: var(--border-width-base) var(--border-style-base) var(--color-foreground-base);
}
.content {
grid-area: content;
}
.list {
grid-area: list;
border-left: var(--border-width-base) var(--border-style-base) var(--color-foreground-base);
}
</style>
1 change: 1 addition & 0 deletions packages/workflow/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2186,6 +2186,7 @@ export interface IN8nUISettings {
externalSecrets: boolean;
showNonProdBanner: boolean;
debugInEditor: boolean;
workflowHistory: boolean;
};
hideUsagePage: boolean;
license: {
Expand Down

0 comments on commit 240b2f0

Please sign in to comment.