[Kimchi-devel] [PATCH][Wok] UI: Remove notification array and make notifications persistent
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Mon May 30 15:11:06 UTC 2016
Hi Lucio,
thank you for the comment, I agree with you.
Will send a v2 soon.
Regards,
Rodrigo
On 05/30/2016 11:14 AM, Lucio Correia wrote:
> Reviewed-By: Lucio Correia <luciojhc at linux.vnet.ibm.com>
>
> On 28-05-2016 18:14, 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 code, 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..3759cbe 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.code
>> + "')").length) == 0) {
> Would it be better if we test by notif.message instead of notif.code?
> I ask it because there are some messages that use string templates to
> indicate on which vm the problem is, and it would be nice to show two
> messages in case we have the problem occurring in two vms.
>
>
>> wok.message.notify(notif, '#message-container-area');
>> - wok.postedNotifications.push(notif.message);
>> }
>> - })
>> - };
>> + });
>> + }
>> setTimeout(notificationsLoop, wok.NOTIFICATION_INTERVAL);
>> },
>> function(data){
>>
>
>
More information about the Kimchi-devel
mailing list