This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.18 by this push:
new 8ad1009ad2d ui: fix notification list reordering intermittently (#7609)
8ad1009ad2d is described below
commit 8ad1009ad2d59571f48a89b94d9c1424a46030f9
Author: Abhishek Kumar <[email protected]>
AuthorDate: Thu Aug 24 14:59:25 2023 +0530
ui: fix notification list reordering intermittently (#7609)
Signed-off-by: Abhishek Kumar <[email protected]>
---
ui/src/components/header/HeaderNotice.vue | 2 +-
ui/src/store/modules/user.js | 6 +++++-
ui/src/utils/plugins.js | 9 ++++++---
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/ui/src/components/header/HeaderNotice.vue
b/ui/src/components/header/HeaderNotice.vue
index fe9c579581e..82dc4d45edc 100644
--- a/ui/src/components/header/HeaderNotice.vue
+++ b/ui/src/components/header/HeaderNotice.vue
@@ -109,7 +109,7 @@ export default {
(state, getters) => getters.headerNotices,
(newValue, oldValue) => {
if (oldValue !== newValue && newValue !== undefined) {
- this.notices = newValue.reverse()
+ this.notices = newValue
}
}
)
diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js
index 3e9aef7af08..3994a3fc29d 100644
--- a/ui/src/store/modules/user.js
+++ b/ui/src/store/modules/user.js
@@ -348,9 +348,13 @@ const user = {
if (noticeIdx === -1) {
noticeArray.push(noticeJson)
} else {
+ const existingNotice = noticeArray[noticeIdx]
+ noticeJson.timestamp = existingNotice.timestamp
noticeArray[noticeIdx] = noticeJson
}
-
+ noticeArray.sort(function (a, b) {
+ return new Date(b.timestamp) - new Date(a.timestamp)
+ })
commit('SET_HEADER_NOTICES', noticeArray)
},
ProjectView ({ commit }, projectid) {
diff --git a/ui/src/utils/plugins.js b/ui/src/utils/plugins.js
index 5cc4bc6269a..7223f050368 100644
--- a/ui/src/utils/plugins.js
+++ b/ui/src/utils/plugins.js
@@ -65,7 +65,8 @@ export const pollJobPlugin = {
key: jobId,
title,
description,
- status: 'progress'
+ status: 'progress',
+ timestamp: new Date()
})
eventBus.on('update-job-details', (args) => {
@@ -107,7 +108,8 @@ export const pollJobPlugin = {
title,
description,
status: 'done',
- duration: 2
+ duration: 2,
+ timestamp: new Date()
})
eventBus.emit('update-job-details', { jobId, resourceId })
// Ensure we refresh on the same / parent page
@@ -157,7 +159,8 @@ export const pollJobPlugin = {
title,
description: desc,
status: 'failed',
- duration: 2
+ duration: 2,
+ timestamp: new Date()
})
eventBus.emit('update-job-details', { jobId, resourceId })
// Ensure we refresh on the same / parent page