diff --git a/packages/editor-ui/src/components/mixins/showMessage.ts b/packages/editor-ui/src/components/mixins/showMessage.ts index 6ed718ca52..8b25664e7b 100644 --- a/packages/editor-ui/src/components/mixins/showMessage.ts +++ b/packages/editor-ui/src/components/mixins/showMessage.ts @@ -1,5 +1,5 @@ import { Notification } from 'element-ui'; -import { ElNotificationOptions } from 'element-ui/types/notification'; +import { ElNotificationComponent, ElNotificationOptions } from 'element-ui/types/notification'; import mixins from 'vue-typed-mixins'; import { externalHooks } from '@/components/mixins/externalHooks'; @@ -15,6 +15,26 @@ export const showMessage = mixins(externalHooks).extend({ return Notification(messageData); }, + $showWarning(title: string, message: string, config?: {onClick?: () => void, duration?: number, customClass?: string, closeOnClick?: boolean}) { + let notification: ElNotificationComponent; + if (config && config.closeOnClick) { + const cb = config.onClick; + config.onClick = () => { + notification && notification.close(); + cb && cb(); + }; + } + + notification = this.$showMessage({ + title, + message, + type: 'warning', + ...(config || {}), + }); + + return notification; + }, + $showError(error: Error, title: string, message?: string) { const messageLine = message ? `${message}
` : ''; this.$showMessage({ diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index ffe8c31712..f024913cba 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -166,6 +166,7 @@ import { XYPositon, IPushDataExecutionFinished, ITag, + IVersion, IWorkflowTemplate, } from '../Interface'; import { mapGetters } from 'vuex'; @@ -2235,8 +2236,26 @@ export default mixins( } this.stopLoading(); - setTimeout(() => { - this.$store.dispatch('versions/fetchVersions'); + setTimeout(async () => { + await this.$store.dispatch('versions/fetchVersions'); + const currentVersion: IVersion | undefined = this.$store.getters['versions/currentVersion']; + if (currentVersion && currentVersion.hasSecurityIssue) { + const fixVersion = currentVersion.securityIssueFixVersion; + let message = `Please update to latest version.`; + if (fixVersion) { + message = `Please update to version ${fixVersion} or higher.`; + } + message = `${message}
More info`; + this.$showWarning('Critical Update', message, { + onClick: () => { + this.$store.dispatch('ui/openVersionsModal'); + }, + closeOnClick: true, + customClass: 'clickable', + duration: 0, + }); + } + }, 0); });