diff options
| author | Nishant Tiwari <tiwari.nishant@ibm.com> | 2026-07-16 11:27:11 +0300 |
|---|---|---|
| committer | Nishant Tiwari <tiwari.nishant@ibm.com> | 2026-09-28 13:42:29 +0300 |
| commit | 85248e05cf5c44fc2a77135f829ae33b0d485e2f (patch) | |
| tree | 16378e768cfd50a88578c36ad28e6d9275dd8907 /src/views/Overview/ModalAssetTag.vue | |
| parent | 4628f24b336ea30b288a4b50d42c0e50d8d62869 (diff) | |
| download | webui-vue-master.tar.xz | |
Implemented the ability to view and edit the system asset tag directly
from the Overview page, including a modal dialog for editing, Vuex store
action for saving, and truncation in the app header.
Changes:
- Added ModalAssetTag.vue component with:
- Form input for editing the asset tag value
- Vuelidate validation requiring a non-empty tag
- Updated OverviewServer.vue to:
- Display asset tag in the system information section
- Add inline edit button using Carbon edit icon
- Dispatch saveAssetTag store action with toast feedback
- Refresh global system info after a successful save
- Added saveAssetTag action to SystemStore.js using PATCH
against the system path endpoint
- Updated AppHeader.vue to truncate asset tags longer than
30 characters with an ellipsis, preserving full value in
the title attribute for accessibility
- Added translation keys for asset tag label, modal title,
and success/error toast messages in en-US, ka-GE, and
ru-RU locale files
Testing:
- Verified asset tag displays correctly in system info section
- Verified modal opens, validates, and submits correctly
- Verified PATCH request updates asset tag on the server
- Validated success and error toast notifications display
- Confirmed long asset tags are truncated in the header
Change-Id: I6ac51dfc24b9d40986b74e9220cff955b029d659
Signed-off-by: Nishant Tiwari <tiwari.nishant@ibm.com>
Diffstat (limited to 'src/views/Overview/ModalAssetTag.vue')
| -rw-r--r-- | src/views/Overview/ModalAssetTag.vue | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/src/views/Overview/ModalAssetTag.vue b/src/views/Overview/ModalAssetTag.vue new file mode 100644 index 000000000..c73b5ba5e --- /dev/null +++ b/src/views/Overview/ModalAssetTag.vue @@ -0,0 +1,126 @@ +<template> + <b-modal + id="modal-asset-tag" + ref="modal" + :title="$t('pageOverview.modal.editAssetTag')" + @hidden="resetForm" + > + <b-form id="asset-settings" @submit.prevent="handleSubmit"> + <b-row> + <b-col sm="8"> + <b-form-group + :label="$t('pageOverview.assetTag')" + label-for="asset-tag" + > + <b-form-input + id="asset-tag" + v-model="form.assetTag" + type="text" + :state="getValidationState(v$.form.assetTag)" + @input="v$.form.assetTag.$touch()" + /> + <b-form-invalid-feedback role="alert"> + <template v-if="v$.form.assetTag.required.$invalid"> + {{ $t('global.form.fieldRequired') }} + </template> + </b-form-invalid-feedback> + </b-form-group> + </b-col> + </b-row> + </b-form> + <template #footer="{ cancel }"> + <b-button variant="secondary" @click="cancel()"> + {{ $t('global.action.cancel') }} + </b-button> + <b-button + form="asset-settings" + type="submit" + variant="primary" + @click="onOk" + > + {{ $t('global.action.save') }} + </b-button> + </template> + </b-modal> +</template> + +<script> +import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js'; +import { useVuelidate } from '@vuelidate/core'; +import { required } from '@vuelidate/validators'; + +export default { + mixins: [VuelidateMixin], + props: { + modelValue: { + type: Boolean, + default: false, + }, + tag: { + type: String, + default: '', + }, + }, + emits: ['ok', 'hidden', 'update:modelValue'], + setup() { + return { + v$: useVuelidate(), + }; + }, + data() { + return { + form: { + assetTag: this.tag ? this.tag : '', + }, + }; + }, + watch: { + tag() { + this.form.assetTag = this.tag; + }, + modelValue: { + handler(newValue) { + if (newValue) { + this.$nextTick(() => { + this.$refs.modal?.show(); + }); + } + }, + immediate: true, + }, + }, + validations() { + return { + form: { + assetTag: { + required, + }, + }, + }; + }, + methods: { + handleSubmit() { + this.v$.$touch(); + if (this.v$.$invalid) return; + this.$emit('ok', { AssetTag: this.form.assetTag }); + this.closeModal(); + }, + closeModal() { + this.$nextTick(() => { + this.$refs.modal.hide(); + }); + }, + resetForm() { + this.form.assetTag = this.tag; + this.v$.$reset(); + this.$emit('update:modelValue', false); + this.$emit('hidden'); + }, + onOk(bvModalEvt) { + // prevent modal close + bvModalEvt.preventDefault(); + this.handleSubmit(); + }, + }, +}; +</script> |
