mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
add error message
This commit is contained in:
parent
750188def9
commit
20fe805c61
|
@ -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}<br/>` : '';
|
||||
this.$showMessage({
|
||||
|
|
|
@ -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}<br/><a class="primary-color">More info</a>`;
|
||||
this.$showWarning('Critical Update', message, {
|
||||
onClick: () => {
|
||||
this.$store.dispatch('ui/openVersionsModal');
|
||||
},
|
||||
closeOnClick: true,
|
||||
customClass: 'clickable',
|
||||
duration: 0,
|
||||
});
|
||||
}
|
||||
|
||||
}, 0);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue