[Kimchi-devel] [PATCH v2][Wok] UI: Remove notification array and make notifications persistent
Lucio Correia
luciojhc at linux.vnet.ibm.com
Mon May 30 17:00:49 UTC 2016
Hi,
In my tests, I see the same message being replicated several times (each
5 seconsds) in Wok/Settings tab. But perhaps it is not an issue with
this patch, since it does not happen on Host and Virtualization tabs.
On 30-05-2016 13:04, Rodrigo Trujillo wrote:
> There is an issue in frontend that does not allow notification messages
> to be showed more than once if the problem happens again.
> When user clicks on message close ("X") button, the notification message
> is only removed from backend, but not from the UI array.
> This patch changes functions to not use the array anymore, instead, it
> checks if the message is being displayed by its message string, then
> shows if necessary.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
> ui/js/src/wok.main.js | 1 -
> ui/js/src/wok.utils.js | 8 ++++----
> 2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js
> index 2146b3d..cf5b6a2 100644
> --- a/ui/js/src/wok.main.js
> +++ b/ui/js/src/wok.main.js
> @@ -19,7 +19,6 @@
> */
>
> wok.NOTIFICATION_INTERVAL = 5000
> -wok.postedNotifications = []
> wok.tabMode = {};
>
> wok.config = undefined;
> diff --git a/ui/js/src/wok.utils.js b/ui/js/src/wok.utils.js
> index 1fb3c9b..1b585f1 100644
> --- a/ui/js/src/wok.utils.js
> +++ b/ui/js/src/wok.utils.js
> @@ -209,12 +209,12 @@ wok.notificationsLoop = function notificationsLoop() {
> function(notifications){
> if(notifications && notifications.length > 0) {
> $.each(notifications, function(i, notif) {
> - if (wok.postedNotifications.indexOf(notif.message) == -1) {
> + // Check if notification is being displayed
> + if (($("#alert-container").contents().find("div:contains('" + notif.message + "')").length) == 0) {
> wok.message.notify(notif, '#message-container-area');
> - wok.postedNotifications.push(notif.message);
> }
> - })
> - };
> + });
> + }
> setTimeout(notificationsLoop, wok.NOTIFICATION_INTERVAL);
> },
> function(data){
>
--
Lucio Correia
Software Engineer
IBM LTC Brazil
More information about the Kimchi-devel
mailing list