ui: fix notification list reordering intermittently (#7609)

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2023-08-24 14:59:25 +05:30 committed by GitHub
parent a0702279aa
commit 8ad1009ad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -109,7 +109,7 @@ export default {
(state, getters) => getters.headerNotices,
(newValue, oldValue) => {
if (oldValue !== newValue && newValue !== undefined) {
this.notices = newValue.reverse()
this.notices = newValue
}
}
)

View File

@ -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) {

View File

@ -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