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 { 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 mixins from 'vue-typed-mixins';
|
||||||
|
|
||||||
import { externalHooks } from '@/components/mixins/externalHooks';
|
import { externalHooks } from '@/components/mixins/externalHooks';
|
||||||
|
@ -15,6 +15,26 @@ export const showMessage = mixins(externalHooks).extend({
|
||||||
return Notification(messageData);
|
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) {
|
$showError(error: Error, title: string, message?: string) {
|
||||||
const messageLine = message ? `${message}<br/>` : '';
|
const messageLine = message ? `${message}<br/>` : '';
|
||||||
this.$showMessage({
|
this.$showMessage({
|
||||||
|
|
|
@ -166,6 +166,7 @@ import {
|
||||||
XYPositon,
|
XYPositon,
|
||||||
IPushDataExecutionFinished,
|
IPushDataExecutionFinished,
|
||||||
ITag,
|
ITag,
|
||||||
|
IVersion,
|
||||||
IWorkflowTemplate,
|
IWorkflowTemplate,
|
||||||
} from '../Interface';
|
} from '../Interface';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
@ -2235,8 +2236,26 @@ export default mixins(
|
||||||
}
|
}
|
||||||
this.stopLoading();
|
this.stopLoading();
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(async () => {
|
||||||
this.$store.dispatch('versions/fetchVersions');
|
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);
|
}, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue