refactor: remove the confirm input

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
Yi-Ya Chen 2025-01-17 18:06:04 +08:00
parent 526d1bb875
commit fdc635955b
No known key found for this signature in database
GPG Key ID: 9A2E6FBD33F68EDE

View File

@ -6,7 +6,6 @@ import AsyncButton from '@shell/components/AsyncButton';
import { Banner } from '@components/Banner'; import { Banner } from '@components/Banner';
import { Card } from '@components/Card'; import { Card } from '@components/Card';
import { escapeHtml } from '@shell/utils/string'; import { escapeHtml } from '@shell/utils/string';
import CopyToClipboardText from '@shell/components/CopyToClipboardText';
/** /**
* @name ConfirmExecutionDialog * @name ConfirmExecutionDialog
@ -21,7 +20,6 @@ export default {
AsyncButton, AsyncButton,
Banner, Banner,
Card, Card,
CopyToClipboardText
}, },
props: { props: {
@ -36,7 +34,7 @@ export default {
}, },
data() { data() {
return { errors: [], confirmName: '' }; return { errors: [] };
}, },
computed: { computed: {
@ -66,10 +64,6 @@ export default {
}, ''); }, '');
}, },
nameToMatch() {
return this.resources[0].nameDisplay;
},
plusMore() { plusMore() {
const remaining = this.resources.length - this.names.length; const remaining = this.resources.length - this.names.length;
@ -96,10 +90,6 @@ export default {
return this.$store.getters['type-map/labelFor'](schema, this.resources.length); return this.$store.getters['type-map/labelFor'](schema, this.resources.length);
}, },
applyDisabled() {
return this.confirmName !== this.nameToMatch;
},
protip() { protip() {
return this.t('dialog.confirmExecution.protip', { alternateLabel }); return this.t('dialog.confirmExecution.protip', { alternateLabel });
}, },
@ -109,7 +99,6 @@ export default {
escapeHtml, escapeHtml,
close() { close() {
this.confirmName = '';
this.errors = []; this.errors = [];
this.$emit('close'); this.$emit('close');
}, },
@ -132,7 +121,6 @@ export default {
<template> <template>
<Card <Card
class="prompt-related"
:show-highlight-border="false" :show-highlight-border="false"
> >
<template #title> <template #title>
@ -146,20 +134,6 @@ export default {
<span <span
v-clean-html="t(warningMessageKey, { type, names: resourceNames }, true)" v-clean-html="t(warningMessageKey, { type, names: resourceNames }, true)"
></span> ></span>
<div class="mt-10 mb-10">
<span
v-clean-html="t('dialog.confirmExecution.confirmName', { nameToMatch: escapeHtml(nameToMatch) }, true)"
></span>
</div>
<div class="mb-10">
<CopyToClipboardText :text="nameToMatch" />
</div>
<input
id="confirm"
v-model="confirmName"
type="text"
/>
<div class="text-info mt-20"> <div class="text-info mt-20">
{{ protip }} {{ protip }}
</div> </div>
@ -171,24 +145,27 @@ export default {
</template> </template>
<template #actions> <template #actions>
<button <div class="actions">
class="btn role-secondary mr-10" <button
@click="close" class="btn role-secondary"
> @click="close"
{{ t('generic.cancel') }} >
</button> {{ t('generic.cancel') }}
<AsyncButton </button>
mode="apply" <AsyncButton
class="btn bg-error ml-10" mode="apply"
:disabled="applyDisabled" class="btn bg-error ml-10"
@click="apply" :disabled="applyDisabled"
/> @click="apply"
/>
</div>
</template> </template>
</Card> </Card>
</template> </template>
<style lang='scss' scoped> <style lang='scss' scoped>
.actions { .actions {
width: 100%;
text-align: right; text-align: right;
} }
</style> </style>