Initial working new notify - needs sprucing up but working!
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable */
|
||||
/* xeslint-disable */
|
||||
|
||||
var devModeShowErrors = false;
|
||||
|
||||
@@ -7,10 +7,10 @@ var devModeShowErrors = false;
|
||||
// Localize, Log and optionally display errors
|
||||
// return localized message in case caller needs it
|
||||
function dealWithError(msg, vm) {
|
||||
debugger;
|
||||
//debugger;
|
||||
msg = window.$gz.locale.translateString(msg);
|
||||
//In some cases the error may not be localizable, if this is not a debug run then it should show without the ?? that localizing puts in keys not found
|
||||
//so it's not as wierd looking to the user
|
||||
//so it's not as weird looking to the user
|
||||
if (!devModeShowErrors && msg.includes("??")) {
|
||||
msg = msg.replace("??", "");
|
||||
}
|
||||
@@ -20,8 +20,7 @@ function dealWithError(msg, vm) {
|
||||
var errMsg =
|
||||
"DEV ERROR errorHandler::devShowUnknownError - unexpected error: \r\n" +
|
||||
msg;
|
||||
//eslint-disable-next-line
|
||||
console.log(errMsg);
|
||||
|
||||
window.$gz.eventBus.$emit("notify-error", errMsg);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,31 @@ export default {
|
||||
wireUpEventHandlers(vm) {
|
||||
//Notifications: pops up and slowly disappears
|
||||
|
||||
/*
|
||||
This (and in form error boxes) all needs to be replaced with the stock v-alert, v-dialog and v-snackbar
|
||||
The v-alert component is used to convey important information to the user through the use contextual types icons and color. These default types come in in 4 variations: success, info, warning, and error. Default icons are assigned which help represent different actions each type portrays
|
||||
The v-snackbar component is used to display a quick message to a user. Snackbars support positioning, removal delay, and callbacks.
|
||||
The v-dialog component inform users about a specific task and may contain critical information, require decisions, or involve multiple tasks. Use dialogs sparingly because they are interruptive.
|
||||
|
||||
TODO:
|
||||
- NOTIFICATION SNACKBAR - used for temp notifications, create as a component
|
||||
- put it in the App.vue just above the router view
|
||||
- Make it respond to event bus messages and popup
|
||||
- Should be able to show more than one sequentially
|
||||
- Always auto-times out? (or...)
|
||||
|
||||
- DIALOG - used for are you sure prompts etc
|
||||
- Modal
|
||||
- callable from anywhere (sits in App.vue?)Like this: https://gist.github.com/eolant/ba0f8a5c9135d1a146e1db575276177d
|
||||
- can return data via callback (I think)
|
||||
- Has suitable types of icons
|
||||
|
||||
- ERRORBOX: Create a custom component for the top of form error box, it uses a v-alert and is consistently the same so make one re-usable component for that and us in edit forms as now but replacing the v-alert block
|
||||
- This actually is not a current requirement but as soon as there is more than one edit form it will be so...
|
||||
|
||||
|
||||
*/
|
||||
|
||||
///////////
|
||||
//ERROR
|
||||
window.$gz.eventBus.$on("notify-error", function handleNotifyWarn(msg) {
|
||||
@@ -38,11 +63,32 @@ export default {
|
||||
///////////
|
||||
//INFO
|
||||
window.$gz.eventBus.$on("notify-info", function handleNotifyWarn(msg) {
|
||||
vm.$dialog.notify.info(msg, {
|
||||
position: "bottom-right",
|
||||
icon: "fa-info-circle",
|
||||
timeout: 3000
|
||||
});
|
||||
// // eslint-disable-next-line no-debugger
|
||||
// debugger;
|
||||
// eslint-disable-next-line no-console
|
||||
//console.log(msg);
|
||||
vm.$root.$gznotify(msg, { color: "info" });
|
||||
// if (vm.$root.$gznoitfy(msg, "Are you sure?", { color: "red" })) {
|
||||
// alert("YES");
|
||||
// } else {
|
||||
// alert("CANCEL");
|
||||
// }
|
||||
// vm.$dialog.notify.info(msg, {
|
||||
// position: "bottom-right",
|
||||
// icon: "fa-info-circle",
|
||||
// timeout: 3000,
|
||||
// actions: [
|
||||
// {
|
||||
// text: window.$gz.locale.get("Cancel"),
|
||||
// key: false
|
||||
// },
|
||||
// {
|
||||
// text: window.$gz.locale.get("Delete"),
|
||||
// color: "red",
|
||||
// key: true
|
||||
// }
|
||||
// ]
|
||||
// });
|
||||
});
|
||||
|
||||
///////////
|
||||
|
||||
Reference in New Issue
Block a user