mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
set env variables
This commit is contained in:
parent
16b7d55357
commit
3cbe31dd5e
|
@ -445,6 +445,12 @@ export interface IPushDataConsoleMessage {
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IVersionNotificationSettings {
|
||||||
|
enabled: boolean;
|
||||||
|
endpoint: string;
|
||||||
|
infoUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IN8nUISettings {
|
export interface IN8nUISettings {
|
||||||
endpointWebhook: string;
|
endpointWebhook: string;
|
||||||
endpointWebhookTest: string;
|
endpointWebhookTest: string;
|
||||||
|
@ -463,6 +469,7 @@ export interface IN8nUISettings {
|
||||||
n8nMetadata?: {
|
n8nMetadata?: {
|
||||||
[key: string]: string | number | undefined;
|
[key: string]: string | number | undefined;
|
||||||
};
|
};
|
||||||
|
versionNotifications: IVersionNotificationSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWorkflowSettings extends IWorkflowSettingsWorkflow {
|
export interface IWorkflowSettings extends IWorkflowSettingsWorkflow {
|
||||||
|
@ -635,6 +642,7 @@ export interface IUiState {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IVersionsState {
|
export interface IVersionsState {
|
||||||
|
versionNotificationSettings: IVersionNotificationSettings;
|
||||||
nextVersions: IVersion[];
|
nextVersions: IVersion[];
|
||||||
currentVersion: IVersion | undefined;
|
currentVersion: IVersion | undefined;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { IVersion } from '@/Interface';
|
import { IVersion } from '@/Interface';
|
||||||
import { get } from './helpers';
|
import { get } from './helpers';
|
||||||
import { VERSIONS_BASE_URL } from '@/constants';
|
|
||||||
|
|
||||||
export async function getNextVersions(version: string): Promise<IVersion[]> {
|
export async function getNextVersions(endpoint: string, version: string): Promise<IVersion[]> {
|
||||||
return await get(VERSIONS_BASE_URL, version);
|
return await get(endpoint, version);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<section :class="$style['description']">
|
<section :class="$style['description']">
|
||||||
<p>You’re on {{ currentVersion.name }}, which was released <strong>{{currentReleaseDate}}</strong> and is {{ nextVersions.length }} version{{nextVersions.length > 1 ? 's' : ''}} behind the latest and greatest n8n</p>
|
<p>You’re on {{ currentVersion.name }}, which was released <strong>{{currentReleaseDate}}</strong> and is {{ nextVersions.length }} version{{nextVersions.length > 1 ? 's' : ''}} behind the latest and greatest n8n</p>
|
||||||
|
|
||||||
<a :class="$style.update" :href="UPDATE_INFO_URL" v-if="UPDATE_INFO_URL" target="_blank">
|
<a :class="$style.update" :href="infoUrl" v-if="infoUrl" target="_blank">
|
||||||
<font-awesome-icon icon="info-circle"></font-awesome-icon>
|
<font-awesome-icon icon="info-circle"></font-awesome-icon>
|
||||||
<span>How to update your n8n version</span>
|
<span>How to update your n8n version</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -38,7 +38,6 @@ import { format } from 'timeago.js';
|
||||||
|
|
||||||
import Modal from './Modal.vue';
|
import Modal from './Modal.vue';
|
||||||
import VersionCard from './VersionCard.vue';
|
import VersionCard from './VersionCard.vue';
|
||||||
import { UPDATE_INFO_URL } from '@/constants';
|
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'UpdatesPanel',
|
name: 'UpdatesPanel',
|
||||||
|
@ -47,15 +46,11 @@ export default Vue.extend({
|
||||||
VersionCard,
|
VersionCard,
|
||||||
},
|
},
|
||||||
props: ['modalName', 'visible'],
|
props: ['modalName', 'visible'],
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
UPDATE_INFO_URL,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('versions', [
|
...mapGetters('versions', [
|
||||||
'nextVersions',
|
'nextVersions',
|
||||||
'currentVersion',
|
'currentVersion',
|
||||||
|
'infoUrl',
|
||||||
]),
|
]),
|
||||||
currentReleaseDate() {
|
currentReleaseDate() {
|
||||||
return format(this.currentVersion.createdAt);
|
return format(this.currentVersion.createdAt);
|
||||||
|
|
|
@ -49,7 +49,3 @@ export const HIDDEN_NODES = ['n8n-nodes-base.start'];
|
||||||
export const WEBHOOK_NODE_NAME = 'n8n-nodes-base.webhook';
|
export const WEBHOOK_NODE_NAME = 'n8n-nodes-base.webhook';
|
||||||
export const HTTP_REQUEST_NODE_NAME = 'n8n-nodes-base.httpRequest';
|
export const HTTP_REQUEST_NODE_NAME = 'n8n-nodes-base.httpRequest';
|
||||||
export const REQUEST_NODE_FORM_URL = 'https://n8n-community.typeform.com/to/K1fBVTZ3';
|
export const REQUEST_NODE_FORM_URL = 'https://n8n-community.typeform.com/to/K1fBVTZ3';
|
||||||
|
|
||||||
// versions
|
|
||||||
export const VERSIONS_BASE_URL = `https://api-staging.n8n.io/versions/`;
|
|
||||||
export const UPDATE_INFO_URL = 'https://docs.n8n.io/';
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { getNextVersions } from '@/api/versions';
|
import { getNextVersions } from '@/api/versions';
|
||||||
import { versions } from 'process';
|
|
||||||
import { ActionContext, Module } from 'vuex';
|
import { ActionContext, Module } from 'vuex';
|
||||||
import {
|
import {
|
||||||
IRootState,
|
IRootState,
|
||||||
|
@ -10,6 +9,11 @@ import {
|
||||||
const module: Module<IVersionsState, IRootState> = {
|
const module: Module<IVersionsState, IRootState> = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
|
versionNotificationSettings: {
|
||||||
|
enabled: false,
|
||||||
|
endpoint: '',
|
||||||
|
infoUrl: '',
|
||||||
|
},
|
||||||
nextVersions: [],
|
nextVersions: [],
|
||||||
currentVersion: undefined,
|
currentVersion: undefined,
|
||||||
},
|
},
|
||||||
|
@ -23,18 +27,30 @@ const module: Module<IVersionsState, IRootState> = {
|
||||||
currentVersion(state: IVersionsState) {
|
currentVersion(state: IVersionsState) {
|
||||||
return state.currentVersion;
|
return state.currentVersion;
|
||||||
},
|
},
|
||||||
|
areNotificationsEnabled(state: IVersionsState) {
|
||||||
|
return state.versionNotificationSettings.enabled;
|
||||||
|
},
|
||||||
|
infoUrl(state: IVersionsState) {
|
||||||
|
return state.versionNotificationSettings.infoUrl;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setVersions(state: IVersionsState, {versions, currentVersion}: {versions: IVersion[], currentVersion: string}) {
|
setVersions(state: IVersionsState, {versions, currentVersion}: {versions: IVersion[], currentVersion: string}) {
|
||||||
state.nextVersions = versions.filter((version) => version.name !== currentVersion);
|
state.nextVersions = versions.filter((version) => version.name !== currentVersion);
|
||||||
state.currentVersion = versions.find((version) => version.name === currentVersion);
|
state.currentVersion = versions.find((version) => version.name === currentVersion);
|
||||||
},
|
},
|
||||||
|
setVersionNotificationSettings(state: IVersionsState, settings: {enabled: true, endpoint: string, infoUrl: string}) {
|
||||||
|
state.versionNotificationSettings = settings;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async fetchVersions(context: ActionContext<IVersionsState, IRootState>) {
|
async fetchVersions(context: ActionContext<IVersionsState, IRootState>) {
|
||||||
|
const enabled = context.state.versionNotificationSettings.enabled;
|
||||||
|
if (enabled) {
|
||||||
const currentVersion = context.rootState.versionCli;
|
const currentVersion = context.rootState.versionCli;
|
||||||
const versions = await getNextVersions(currentVersion);
|
const versions = await getNextVersions(context.state.versionNotificationSettings.endpoint, currentVersion);
|
||||||
context.commit('setVersions', {versions, currentVersion});
|
context.commit('setVersions', {versions, currentVersion});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -2170,6 +2170,7 @@ export default mixins(
|
||||||
this.$store.commit('setVersionCli', settings.versionCli);
|
this.$store.commit('setVersionCli', settings.versionCli);
|
||||||
this.$store.commit('setOauthCallbackUrls', settings.oauthCallbackUrls);
|
this.$store.commit('setOauthCallbackUrls', settings.oauthCallbackUrls);
|
||||||
this.$store.commit('setN8nMetadata', settings.n8nMetadata || {});
|
this.$store.commit('setN8nMetadata', settings.n8nMetadata || {});
|
||||||
|
this.$store.commit('versions/setVersionNotificationSettings', settings.versionNotifications);
|
||||||
},
|
},
|
||||||
async loadNodeTypes (): Promise<void> {
|
async loadNodeTypes (): Promise<void> {
|
||||||
const nodeTypes = await this.restApi().getNodeTypes();
|
const nodeTypes = await this.restApi().getNodeTypes();
|
||||||
|
@ -2194,7 +2195,35 @@ export default mixins(
|
||||||
this.stopLoading();
|
this.stopLoading();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async checkForNewVersions() {
|
||||||
|
const enabled = this.$store.getters['versions/areNotificationsEnabled'];
|
||||||
|
if (!enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.$store.dispatch('versions/fetchVersions');
|
||||||
|
const currentVersion: IVersion | undefined = this.$store.getters['versions/currentVersion'];
|
||||||
|
const nextVersions: IVersion[] = this.$store.getters['versions/nextVersions'];
|
||||||
|
if (currentVersion && currentVersion.hasSecurityIssue && nextVersions.length) {
|
||||||
|
const fixVersion = currentVersion.securityIssueFixVersion;
|
||||||
|
let message = `Please update to latest version.`;
|
||||||
|
if (fixVersion) {
|
||||||
|
message = `Please update to version ${fixVersion} or higher.`;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = `${message} <a class="primary-color">More info</a>`;
|
||||||
|
this.$showWarning('Critical Update', message, {
|
||||||
|
onClick: () => {
|
||||||
|
this.$store.dispatch('ui/openUpdatesPanel');
|
||||||
},
|
},
|
||||||
|
closeOnClick: true,
|
||||||
|
customClass: 'clickable',
|
||||||
|
duration: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
async mounted () {
|
async mounted () {
|
||||||
this.$root.$on('importWorkflowData', async (data: IDataObject) => {
|
this.$root.$on('importWorkflowData', async (data: IDataObject) => {
|
||||||
|
@ -2237,27 +2266,7 @@ export default mixins(
|
||||||
this.stopLoading();
|
this.stopLoading();
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await this.$store.dispatch('versions/fetchVersions');
|
this.checkForNewVersions();
|
||||||
const currentVersion: IVersion | undefined = this.$store.getters['versions/currentVersion'];
|
|
||||||
const nextVersions: IVersion[] = this.$store.getters['versions/nextVersions'];
|
|
||||||
if (currentVersion && currentVersion.hasSecurityIssue && nextVersions.length) {
|
|
||||||
const fixVersion = currentVersion.securityIssueFixVersion;
|
|
||||||
let message = `Please update to latest version.`;
|
|
||||||
if (fixVersion) {
|
|
||||||
message = `Please update to version ${fixVersion} or higher.`;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = `${message} <a class="primary-color">More info</a>`;
|
|
||||||
this.$showWarning('Critical Update', message, {
|
|
||||||
onClick: () => {
|
|
||||||
this.$store.dispatch('ui/openUpdatesPanel');
|
|
||||||
},
|
|
||||||
closeOnClick: true,
|
|
||||||
customClass: 'clickable',
|
|
||||||
duration: 0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}, 0);
|
}, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue