mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-02-04 06:51:44 +00:00
Compare commits
1 Commits
v1.8.0-dev
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2db7ee7397 |
@ -190,12 +190,16 @@ harvester:
|
||||
title: Restart Virtual Machine
|
||||
tip: Restart the virtual machine for configuration changes to take effect.
|
||||
cancel: Save
|
||||
|
||||
notification:
|
||||
title:
|
||||
succeed: Succeed
|
||||
info: Info
|
||||
warning: Warning
|
||||
error: Error
|
||||
restartRequired:
|
||||
title: '{count} {count, plural, =1 {Virtual Machine is} other {Virtual Machines are}} Pending Restart'
|
||||
message: 'Please restart { vmNames } to apply updated configurations'
|
||||
action:
|
||||
createVM: Create Virtual Machine
|
||||
start: Start
|
||||
|
||||
@ -115,6 +115,7 @@ export default {
|
||||
allVMIs: [],
|
||||
allNodeNetworks: [],
|
||||
allClusterNetworks: [],
|
||||
restartNotificationDisplayed: false,
|
||||
HCI
|
||||
};
|
||||
},
|
||||
@ -174,6 +175,48 @@ export default {
|
||||
this['allVMIs'] = vmis;
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
// clear restart message before component unmount
|
||||
this.$store.dispatch('growl/clear');
|
||||
},
|
||||
|
||||
watch: {
|
||||
allVMs: {
|
||||
handler(neu) {
|
||||
const vmNames = [];
|
||||
|
||||
neu.forEach((vm) => {
|
||||
if (vm.isRestartRequired) {
|
||||
vmNames.push(vm.metadata.name);
|
||||
}
|
||||
});
|
||||
const count = vmNames.length;
|
||||
|
||||
if ( count === 0 && this.restartNotificationDisplayed) {
|
||||
this.restartNotificationDisplayed = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
// clear old notification before showing new one
|
||||
if (this.restartNotificationDisplayed) {
|
||||
this.$store.dispatch('growl/clear');
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 0 && vmNames.length > 0) {
|
||||
this.$store.dispatch('growl/warning', {
|
||||
title: this.t('harvester.notification.restartRequired.title', { count }),
|
||||
message: this.t('harvester.notification.restartRequired.message', { vmNames: vmNames.join(', ') }),
|
||||
timeout: 10000,
|
||||
}, { root: true });
|
||||
this.restartNotificationDisplayed = true;
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
lockIconTooltipMessage(row) {
|
||||
const message = '';
|
||||
@ -243,6 +286,12 @@ export default {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.growl-container {
|
||||
z-index: 56 !important; // set to be lower than the vm action menu (z-index: 57)
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.state {
|
||||
display: flex;
|
||||
|
||||
@ -1180,11 +1180,15 @@ export default class VirtVm extends HarvesterResource {
|
||||
);
|
||||
}
|
||||
|
||||
get stateDescription() {
|
||||
get isRestartRequired() {
|
||||
const conditions = get(this, 'status.conditions');
|
||||
const restartRequired = findBy(conditions, 'type', 'RestartRequired');
|
||||
|
||||
if (restartRequired && restartRequired.status === 'True') {
|
||||
return restartRequired && restartRequired.status === 'True';
|
||||
}
|
||||
|
||||
get stateDescription() {
|
||||
if (this.isRestartRequired) {
|
||||
return this.t('harvester.virtualMachine.hotplug.restartVMMessage');
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user