Skip to content

Commit

Permalink
Reapply "17466 FIX Refresh user messages not only on page reload"
Browse files Browse the repository at this point in the history
This reverts commit 2e8394e.

SUP-21044

Change-Id: Ieaa3a7cf3f92bd41bcb959b31676610e5f77019f
  • Loading branch information
makanakoeln committed Jan 8, 2025
1 parent 14f40ef commit c6517d5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
18 changes: 18 additions & 0 deletions .werks/17466.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[//]: # (werk v2)
# Refresh user messages not only on page reload

key | value
---------- | ---
date | 2025-01-07T12:09:20+00:00
version | 2.4.0b1
class | fix
edition | cre
component | multisite
level | 1
compatible | yes

Messages send via "Setup" - "Users" - "Send user messages" were only shown on
page reload.

New messages of methods "Show popup message" and "Show hint in the 'User' menu"
are now shown on every sidebar status update (default: 30 seconds).
27 changes: 15 additions & 12 deletions packages/cmk-frontend/src/js/modules/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,7 @@ export function execute_sidebar_scheduler() {
}

if (g_sidebar_notify_interval !== null) {
const timestamp = new Date().getTime() / 1000;
if (timestamp % g_sidebar_notify_interval == 0) {
if (g_seconds_to_update == 0) {
update_messages();
if (g_may_ack) {
update_unack_incomp_werks();
Expand Down Expand Up @@ -1248,18 +1247,22 @@ function update_messages() {
}

export function update_message_trigger(msg_text: string, msg_count: number) {
const l = document.getElementById("messages_label")!;
if (msg_count === 0) {
l.style.display = "none";
return;
}
const l = document.getElementById("messages_label");
if (l) {
if (msg_count === 0) {
l.style.display = "none";
return;
}

l.innerText = msg_count.toString();
l.style.display = "inline";
l.innerText = msg_count.toString();
l.style.display = "inline";
}

const user_messages = document.getElementById("messages_link_to")!;
const text_content = msg_count + " " + msg_text;
user_messages.textContent = text_content;
const user_messages = document.getElementById("messages_link_to");
if (user_messages) {
const text_content = msg_count + " " + msg_text;
user_messages.textContent = text_content;
}
}

function mark_message_read(
Expand Down

0 comments on commit c6517d5

Please sign in to comment.