This commit is contained in:
@@ -156,7 +156,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//this.$root.$gzconfirm = this.$refs.gzconfirm.open;
|
//this.$root.$gzconfirm = this.$refs.gzconfirm.open;
|
||||||
this.$root.$gznotify = this.$refs.gznotify.open;
|
this.$root.$gznotify = this.$refs.gznotify.addNotification;
|
||||||
|
|
||||||
//redirect to login if not authenticated
|
//redirect to login if not authenticated
|
||||||
if (!this.$store.state.authenticated) {
|
if (!this.$store.state.authenticated) {
|
||||||
|
|||||||
@@ -154,18 +154,18 @@ export default function initialize() {
|
|||||||
localOffset
|
localOffset
|
||||||
);
|
);
|
||||||
|
|
||||||
// window.$gz.eventBus.$emit(
|
window.$gz.eventBus.$emit(
|
||||||
// "notify-warning",
|
"notify-warning",
|
||||||
// "this is a warning test"
|
"this is a warning test"
|
||||||
// );
|
);
|
||||||
// window.$gz.eventBus.$emit(
|
window.$gz.eventBus.$emit(
|
||||||
// "notify-error",
|
"notify-error",
|
||||||
// "this is an error test"
|
"this is an error test"
|
||||||
// );
|
);
|
||||||
// window.$gz.eventBus.$emit(
|
window.$gz.eventBus.$emit(
|
||||||
// "notify-success",
|
"notify-success",
|
||||||
// "this is a success test"
|
"this is a success test"
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Store offset in locale data
|
//Store offset in locale data
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
:value="isVisible"
|
:value="isVisible"
|
||||||
:color="options.type"
|
:color="options.type"
|
||||||
:timeout="options.timeout"
|
:timeout="options.timeout"
|
||||||
|
|
||||||
>
|
>
|
||||||
<v-alert :type="options.type">
|
<v-alert :type="options.type">
|
||||||
{{ message }}
|
{{ message }}
|
||||||
@@ -15,11 +14,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
//todo: queify this so it can display multiple but sequentially
|
//todo: modify this to MD standards so it can display multiple notifications sequentially but one at a time only
|
||||||
|
//and no new one will overwrite an old one until the old one has had at least 2 seconds to show or some good default maybe based on how much text is on it?
|
||||||
export default {
|
export default {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
isVisible: false,
|
isVisible: false,
|
||||||
|
|
||||||
message: null,
|
message: null,
|
||||||
options: {
|
options: {
|
||||||
type: "info", //one of success, info, warning, and error, see v-alert docs for more info
|
type: "info", //one of success, info, warning, and error, see v-alert docs for more info
|
||||||
@@ -28,9 +27,24 @@ export default {
|
|||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
open(message, options) {
|
open(message, options) {
|
||||||
this.isVisible = true;
|
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.options = Object.assign(this.options, options);
|
this.options = Object.assign(this.options, options);
|
||||||
|
this.isVisible = true;
|
||||||
|
},
|
||||||
|
addNotification(message, options) {
|
||||||
|
//if it's not currently displaying anything then just show it immediately
|
||||||
|
if (!this.isVisible) {
|
||||||
|
this.message = message;
|
||||||
|
this.options = Object.assign(this.options, options);
|
||||||
|
this.isVisible = true;
|
||||||
|
} else {
|
||||||
|
//it *is* showing something so give it maximum 2 seconds then show the new one
|
||||||
|
setTimeout(() => {
|
||||||
|
this.message = message;
|
||||||
|
this.options = Object.assign(this.options, options);
|
||||||
|
this.isVisible = true;
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user