Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the UX of non-migratable VMs in node maintenance mode (backport #1092) #1095

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions pkg/harvester/dialog/HarvesterMaintenanceDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Banner } from '@components/Banner';
import { Checkbox } from '@components/Form/Checkbox';
import { exceptionToErrorsArray } from '@shell/utils/error';
import { BadgeState } from '@components/BadgeState';
import { ucFirst } from '@shell/utils/string';

export default {
components: {
Expand All @@ -25,9 +26,9 @@ export default {

data() {
return {
errors: [],
unhealthyVM: '',
force: false
errors: [],
unhealthyVMs: [],
force: false
};
},

Expand All @@ -40,13 +41,15 @@ export default {
},

methods: {
ucFirst,

close() {
this.$emit('close');
},

async apply(buttonCb) {
this.errors = [];
this.unhealthyVM = '';
this.unhealthyVMs = [];

try {
const res = await this.actionResource.doAction('maintenancePossible');
Expand All @@ -62,8 +65,8 @@ export default {
} else if (res._status === 200 || res._status === 204) {
const res = await this.actionResource.doAction('listUnhealthyVM');

if (res.message) {
this.unhealthyVM = res;
if (res?.length) {
this.unhealthyVMs = res;
buttonCb(false);
} else {
await this.actionResource.doAction('enableMaintenanceMode', { force: 'false' });
Expand Down Expand Up @@ -97,13 +100,17 @@ export default {
label-key="harvester.host.enableMaintenance.force"
/>
</div>
<Banner color="warning" :label="t('harvester.host.enableMaintenance.protip')" class="mb-0" />
<Banner v-for="(err, i) in errors" :key="i" color="error" :label="err" />

<div v-if="unhealthyVM">
<Banner color="error mb-5">
<Banner color="warning" :label="t('harvester.host.enableMaintenance.protip')" />

<Banner v-for="(err, i) in errors" :key="i" color="error" :label="ucFirst(err)" />

<Banner v-if="!force" class="mt-0" color="warning" :labelKey="'harvester.host.enableMaintenance.shutDownVMs'" />

<div v-for="(unhealthyVM, i) in unhealthyVMs" :key="i">
<Banner color="error mt-0 mb-5">
<p>
{{ unhealthyVM.message }}
{{ ucFirst(unhealthyVM.message) }}
</p>
</Banner>

Expand Down
1 change: 1 addition & 0 deletions pkg/harvester/l10n/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ harvester:
enableMaintenance:
title: Enable Maintenance Mode
protip: The operation will migrate all virtual machines on this node to other nodes.
shutDownVMs: Check <b>Force</b> option to shutdown VMs which cannot be migrated in live mode.
force: Force
cordon:
title: Cordon
Expand Down
Loading