Skip to content
Snippets Groups Projects
Commit fa371794 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

show system notification's details as before, fixes #4388

Closes #4388

Merge request studip/studip!3200
parent ae61e7fb
No related branches found
No related tags found
No related merge requests found
...@@ -178,10 +178,11 @@ class MessageBox implements LayoutMessage, JsonSerializable ...@@ -178,10 +178,11 @@ class MessageBox implements LayoutMessage, JsonSerializable
public function jsonSerialize(): mixed public function jsonSerialize(): mixed
{ {
return [ return [
'type' => $this->class, 'type' => $this->class,
'message' => $this->message, 'message' => $this->message,
'details' => $this->details, 'details' => $this->details,
'closeable' => $this->isCloseable(), 'close_details' => $this->close_details,
'closeable' => $this->isCloseable(),
]; ];
} }
} }
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
{{ $gettext('Strg+Alt+T hält das automatische Ausblenden der Meldung an bzw. setzt es wieder fort.') }} {{ $gettext('Strg+Alt+T hält das automatische Ausblenden der Meldung an bzw. setzt es wieder fort.') }}
</p> </p>
<details v-if="notification.details?.length > 0" <details v-if="notification.details?.length > 0"
class="system-notification-details"> class="system-notification-details"
<summary> :open="showDetails"
>
<summary @click="toggleDetails()">
{{ $gettext('Details') }} {{ $gettext('Details') }}
</summary> </summary>
<template v-if="Array.isArray(notification.details)"> <template v-if="Array.isArray(notification.details)">
...@@ -76,6 +78,7 @@ export default { ...@@ -76,6 +78,7 @@ export default {
}, },
data() { data() {
return { return {
showDetails: !this.notification.close_details,
stopTimeout: false, stopTimeout: false,
timeout: null, timeout: null,
windowIsBlurred: false, windowIsBlurred: false,
...@@ -135,6 +138,9 @@ export default { ...@@ -135,6 +138,9 @@ export default {
this.visibleFor this.visibleFor
); );
} }
},
toggleDetails() {
this.showDetails = !this.showDetails;
} }
}, },
mounted() { mounted() {
......
...@@ -41,24 +41,25 @@ export default { ...@@ -41,24 +41,25 @@ export default {
} }
}, },
methods: { methods: {
addNotification(notification) {
this.allNotifications.push({
key: this.counter++,
...notification
});
},
destroyNotification(notification) { destroyNotification(notification) {
this.allNotifications = this.allNotifications.filter(n => n !== notification); this.allNotifications = this.allNotifications.filter(n => n !== notification);
} }
}, },
created() { created() {
if (Array.isArray(this.notifications)) { if (Array.isArray(this.notifications)) {
this.allNotifications = [...this.notifications]; this.notifications.map(this.addNotification);
} else { } else {
this.allNotifications = Object.values(this.notifications); Object.values(this.notifications).map(this.addNotification);
} }
}, },
mounted() { mounted() {
this.globalOn('push-system-notification', notification => { this.globalOn('push-system-notification', this.addNotification);
this.allNotifications.push({
key: this.counter++,
...notification
});
});
window.addEventListener('keydown', evt => { window.addEventListener('keydown', evt => {
if (evt.altKey && evt.ctrlKey && evt.code === 'KeyT') { if (evt.altKey && evt.ctrlKey && evt.code === 'KeyT') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment