mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
fix: find the correct vmim based on creationTimeStamp (#389)
Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
parent
f4e363396d
commit
3ea73978ee
@ -139,10 +139,18 @@ export default {
|
|||||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||||
const vmimList = this.$store.getters[`${ inStore }/all`](HCI.VMIM) || [];
|
const vmimList = this.$store.getters[`${ inStore }/all`](HCI.VMIM) || [];
|
||||||
|
|
||||||
const migrationUid = this.vmi?.status?.migrationState?.migrationUid;
|
const vmiName = this.vmi?.name || '';
|
||||||
const vmim = vmimList.find((VMIM) => VMIM?.metadata?.uid === migrationUid);
|
|
||||||
|
|
||||||
return vmim;
|
// filter the corresponding vmims by vmim.spec.vmiName and find the latest one by creationTimestamp
|
||||||
|
const vmim = vmimList.filter((VMIM) => VMIM?.spec?.vmiName === vmiName).sort((a, b) => {
|
||||||
|
if (a?.metadata?.creationTimestamp > b?.metadata?.creationTimestamp) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
return vmim.length > 0 && vmim[0] ? vmim[0] : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
migrationEvents() {
|
migrationEvents() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user