mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
Disallow editing attribute key and type (#3305)
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
: ''
|
: ''
|
||||||
"
|
"
|
||||||
:placeholder="$t('ATTRIBUTES_MGMT.ADD.FORM.NAME.PLACEHOLDER')"
|
:placeholder="$t('ATTRIBUTES_MGMT.ADD.FORM.NAME.PLACEHOLDER')"
|
||||||
|
readonly
|
||||||
@blur="$v.displayName.$touch"
|
@blur="$v.displayName.$touch"
|
||||||
/>
|
/>
|
||||||
<label :class="{ error: $v.description.$error }">
|
<label :class="{ error: $v.description.$error }">
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<label :class="{ error: $v.attributeType.$error }">
|
<label :class="{ error: $v.attributeType.$error }">
|
||||||
{{ $t('ATTRIBUTES_MGMT.ADD.FORM.TYPE.LABEL') }}
|
{{ $t('ATTRIBUTES_MGMT.ADD.FORM.TYPE.LABEL') }}
|
||||||
<select v-model="attributeType">
|
<select v-model="attributeType" disabled>
|
||||||
<option v-for="type in types" :key="type.id" :value="type.id">
|
<option v-for="type in types" :key="type.id" :value="type.id">
|
||||||
{{ type.option }}
|
{{ type.option }}
|
||||||
</option>
|
</option>
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<woot-button
|
<woot-button
|
||||||
:is-loading="isUpdating"
|
:is-loading="isUpdating"
|
||||||
:disabled="$v.displayName.$invalid || $v.description.$invalid"
|
:disabled="$v.description.$invalid"
|
||||||
>
|
>
|
||||||
{{ $t('ATTRIBUTES_MGMT.EDIT.UPDATE_BUTTON_TEXT') }}
|
{{ $t('ATTRIBUTES_MGMT.EDIT.UPDATE_BUTTON_TEXT') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
@@ -117,6 +118,13 @@ export default {
|
|||||||
attributeKey() {
|
attributeKey() {
|
||||||
return convertToSlug(this.displayName);
|
return convertToSlug(this.displayName);
|
||||||
},
|
},
|
||||||
|
selectedAttributeType() {
|
||||||
|
return this.types.find(
|
||||||
|
item =>
|
||||||
|
item.option.toLowerCase() ===
|
||||||
|
this.selectedAttribute.attribute_display_type
|
||||||
|
).id;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setFormValues();
|
this.setFormValues();
|
||||||
@@ -128,6 +136,7 @@ export default {
|
|||||||
setFormValues() {
|
setFormValues() {
|
||||||
this.displayName = this.selectedAttribute.attribute_display_name;
|
this.displayName = this.selectedAttribute.attribute_display_name;
|
||||||
this.description = this.selectedAttribute.attribute_description;
|
this.description = this.selectedAttribute.attribute_description;
|
||||||
|
this.attributeType = this.selectedAttributeType;
|
||||||
},
|
},
|
||||||
async editAttributes() {
|
async editAttributes() {
|
||||||
this.$v.$touch();
|
this.$v.$touch();
|
||||||
@@ -137,10 +146,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
await this.$store.dispatch('attributes/update', {
|
await this.$store.dispatch('attributes/update', {
|
||||||
id: this.selectedAttribute.id,
|
id: this.selectedAttribute.id,
|
||||||
attribute_display_name: this.displayName,
|
|
||||||
attribute_description: this.description,
|
attribute_description: this.description,
|
||||||
attribute_display_type: this.attributeType,
|
|
||||||
attribute_key: this.attributeKey,
|
|
||||||
});
|
});
|
||||||
this.showAlert(this.$t('ATTRIBUTES_MGMT.EDIT.API.SUCCESS_MESSAGE'));
|
this.showAlert(this.$t('ATTRIBUTES_MGMT.EDIT.API.SUCCESS_MESSAGE'));
|
||||||
this.onClose();
|
this.onClose();
|
||||||
|
|||||||
Reference in New Issue
Block a user