From d6b8b9544f22c8c7fc0b0d45568b39dc1c05bd1d Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Wed, 11 Sep 2019 18:40:22 +0200 Subject: [PATCH] :zap: Display currently installed version in editor-ui --- packages/cli/src/Interfaces.ts | 1 + packages/cli/src/Server.ts | 3 +++ packages/editor-ui/src/Interface.ts | 1 + packages/editor-ui/src/components/MainSidebar.vue | 5 ++++- packages/editor-ui/src/store.ts | 7 +++++++ packages/editor-ui/src/views/NodeView.vue | 1 + 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/Interfaces.ts b/packages/cli/src/Interfaces.ts index 6f35bd51b4..1dfe02c2c8 100644 --- a/packages/cli/src/Interfaces.ts +++ b/packages/cli/src/Interfaces.ts @@ -255,6 +255,7 @@ export interface IN8nUISettings { saveManualExecutions: boolean; timezone: string; urlBaseWebhook: string; + versionCli: string; } diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index b61259ff43..6bd05bd8cb 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -6,6 +6,7 @@ import { import * as bodyParser from 'body-parser'; import * as history from 'connect-history-api-fallback'; import * as requestPromise from 'request-promise-native'; +import { version as versionCli } from '../package.json'; import { ActiveExecutions, @@ -73,6 +74,7 @@ import * as config from '../config'; // @ts-ignore import * as timezones from 'google-timezones-json'; import * as parseUrl from 'parseurl'; +import { version } from '@oclif/command/lib/flags'; class App { @@ -989,6 +991,7 @@ class App { saveManualExecutions: this.saveManualExecutions, timezone: this.timezone, urlBaseWebhook: WebhookHelpers.getWebhookBaseUrl(), + versionCli, }; })); diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 3e7cc8ebc9..53e24d23da 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -389,6 +389,7 @@ export interface IN8nUISettings { saveManualExecutions: boolean; timezone: string; urlBaseWebhook: string; + versionCli: string; } export interface IWorkflowSettings extends IWorkflowSettingsWorkflow { diff --git a/packages/editor-ui/src/components/MainSidebar.vue b/packages/editor-ui/src/components/MainSidebar.vue index 97317d9d6d..a53d85090f 100644 --- a/packages/editor-ui/src/components/MainSidebar.vue +++ b/packages/editor-ui/src/components/MainSidebar.vue @@ -16,7 +16,7 @@ n8n.io - n8n.io + n8n.io - Currently installed version {{versionCli}} @@ -205,6 +205,9 @@ export default mixins( currentWorkflow (): string { return this.$route.params.name; }, + versionCli (): string { + return this.$store.getters.versionCli; + }, workflowExecution (): IExecutionResponse | null { return this.$store.getters.getWorkflowExecution; }, diff --git a/packages/editor-ui/src/store.ts b/packages/editor-ui/src/store.ts index f74e1ab458..8bafe2bf9c 100644 --- a/packages/editor-ui/src/store.ts +++ b/packages/editor-ui/src/store.ts @@ -53,6 +53,7 @@ export const store = new Vuex.Store({ saveDataSuccessExecution: 'all', saveManualExecutions: false, timezone: 'America/New_York', + versionCli: '0.0.0', workflowExecutionData: null as IExecutionResponse | null, lastSelectedNode: null as string | null, nodeIndex: [] as Array, @@ -478,6 +479,9 @@ export const store = new Vuex.Store({ setTimezone (state, timezone: string) { Vue.set(state, 'timezone', timezone); }, + setVersionCli(state, version: string) { + Vue.set(state, 'versionCli', version); + }, addNodeType (state, typeData: INodeTypeDescription) { if (!typeData.hasOwnProperty('name')) { @@ -581,6 +585,9 @@ export const store = new Vuex.Store({ timezone: (state): string => { return state.timezone; }, + versionCli: (state): string => { + return state.versionCli; + }, // Push Connection pushConnectionActive: (state): boolean => { diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index dcaac6278c..c420d173ef 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -1846,6 +1846,7 @@ export default mixins( this.$store.commit('setSaveDataSuccessExecution', settings.saveDataSuccessExecution); this.$store.commit('setSaveManualExecutions', settings.saveManualExecutions); this.$store.commit('setTimezone', settings.timezone); + this.$store.commit('setVersionCli', settings.versionCli); }, async loadNodeTypes (): Promise { const nodeTypes = await this.restApi().getNodeTypes();