Update RestarVMDialog in edit VM page; fix slots-template issue

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia 2024-09-24 19:20:27 +02:00
parent 6a232be450
commit dad5b5d890
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393
2 changed files with 37 additions and 34 deletions

View File

@ -4,10 +4,13 @@ import AsyncButton from '@shell/components/AsyncButton';
import { Card } from '@components/Card'; import { Card } from '@components/Card';
import { Banner } from '@components/Banner'; import { Banner } from '@components/Banner';
import { exceptionToErrorsArray } from '@shell/utils/error'; import { exceptionToErrorsArray } from '@shell/utils/error';
import AppModal from '@shell/components/AppModal';
export default { export default {
emits: ['close'], emits: ['close'],
components: { components: {
AppModal,
Card, Card,
AsyncButton, AsyncButton,
Banner, Banner,
@ -31,7 +34,6 @@ export default {
try { try {
this.vm.doActionGrowl('restart', {}); this.vm.doActionGrowl('restart', {});
buttonDone(true); buttonDone(true);
this.resolve();
this.close(); this.close();
} catch (err) { } catch (err) {
console.error(err); // eslint-disable-line console.error(err); // eslint-disable-line
@ -56,44 +58,41 @@ export default {
class="prompt-restart" class="prompt-restart"
:show-highlight-border="false" :show-highlight-border="false"
> >
<h4 <template #title>
slot="title" <h4
v-clean-html="t('harvester.modal.restart.title')" v-clean-html="t('harvester.modal.restart.title')"
class="text-default-text" class="text-default-text"
/> />
<template slot="body">
<slot name="body">
<div
v-clean-html="t('harvester.modal.restart.tip')"
class="pl-10 pr-10"
>
</div>
</slot>
</template> </template>
<div <template #body>
slot="actions" <div
class="bottom" v-clean-html="t('harvester.modal.restart.tip')"
> class="pl-10 pr-10"
<Banner
v-for="(err, i) in errors" :key="i" color="error"
:label="err"
/> />
<div class="buttons"> </template>
<button
class="btn role-secondary mr-10"
@click="close"
>
{{ t('harvester.modal.restart.cancel') }}
</button>
<AsyncButton <template #actions>
mode="restart" <div class="bottom">
@click="apply" <Banner
v-for="(err, i) in errors" :key="i" color="error"
:label="err"
/> />
<div class="buttons">
<button
class="btn role-secondary mr-10"
@click="close"
>
{{ t('harvester.modal.restart.cancel') }}
</button>
<AsyncButton
mode="restart"
@click="apply"
/>
</div>
</div> </div>
</div> </template>
</Card> </Card>
</app-modal> </app-modal>
</template> </template>

View File

@ -413,7 +413,10 @@ export default {
return new Promise((resolve) => { return new Promise((resolve) => {
this.isOpen = true; this.isOpen = true;
this.$refs.restartDialog.resolve = resolve;
this.$nextTick(() => {
this.$refs.restartDialog.resolve = resolve;
});
}); });
}, },
@ -854,6 +857,7 @@ export default {
<RestartVMDialog <RestartVMDialog
v-if="isOpen" v-if="isOpen"
ref="restartDialog"
:vm="value" :vm="value"
/> />
</CruResource> </CruResource>