mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
[porting 1262] Fix vm rows reactivity
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com> (cherry picked from commit c3f266591261d856b5cfc746c30bcde73cba06e9)
This commit is contained in:
parent
e33302050b
commit
3ea8edb824
@ -24,35 +24,24 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async fetch() {
|
async fetch() {
|
||||||
const hash = await allHash({
|
await allHash({
|
||||||
vms: this.$store.dispatch('harvester/findAll', { type: HCI.VM }),
|
vms: this.$store.dispatch('harvester/findAll', { type: HCI.VM }),
|
||||||
vmis: this.$store.dispatch('harvester/findAll', { type: HCI.VMI }),
|
vmis: this.$store.dispatch('harvester/findAll', { type: HCI.VMI }),
|
||||||
allClusterNetwork: this.$store.dispatch('harvester/findAll', { type: HCI.CLUSTER_NETWORK }),
|
allClusterNetwork: this.$store.dispatch('harvester/findAll', { type: HCI.CLUSTER_NETWORK }),
|
||||||
});
|
});
|
||||||
const instanceMap = {};
|
|
||||||
|
|
||||||
(hash.vmis || []).forEach((vmi) => {
|
|
||||||
const vmiUID = vmi?.metadata?.ownerReferences?.[0]?.uid;
|
|
||||||
|
|
||||||
if (vmiUID) {
|
|
||||||
instanceMap[vmiUID] = vmi;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.allClusterNetwork = hash.allClusterNetwork;
|
|
||||||
this.rows = hash.vms.filter((row) => {
|
|
||||||
return instanceMap[row.metadata?.uid]?.status?.nodeName === this.node?.metadata?.labels?.[HOSTNAME];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
rows: [],
|
|
||||||
allClusterNetwork: []
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
allClusterNetwork() {
|
||||||
|
return this.$store.getters['harvester/all'](HCI.CLUSTER_NETWORK);
|
||||||
|
},
|
||||||
|
|
||||||
|
rows() {
|
||||||
|
const vms = this.$store.getters['harvester/all'](HCI.VM);
|
||||||
|
|
||||||
|
return vms.filter((vm) => vm.vmi?.status?.nodeName === this.node?.metadata?.labels?.[HOSTNAME]);
|
||||||
|
},
|
||||||
|
|
||||||
headers() {
|
headers() {
|
||||||
return [
|
return [
|
||||||
STATE,
|
STATE,
|
||||||
@ -87,8 +76,6 @@ export default {
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user