Feat: Don't allow commas in tag names

This commit is contained in:
NihadBadalov 2024-02-17 18:28:33 +01:00
parent f38da99c11
commit d3a5b224cc

View file

@ -17,11 +17,15 @@
v-model="tag.name"
type="text"
class="form-control"
:class="{'is-invalid': nameInvalid}"
:class="{'is-invalid': nameInvalid || nameContainsComma}"
required
>
<div class="invalid-feedback">
{{ $t("Tag with this name already exist.") }}
{{
nameInvalid
? $t("Tag with this name already exist.")
: $t("Tag name contains a comma.")
}}
</div>
</div>
@ -160,6 +164,7 @@ export default {
addingMonitor: [],
selectedAddMonitor: null,
nameInvalid: false,
nameContainsComma: false,
};
},
@ -260,6 +265,13 @@ export default {
this.nameInvalid = true;
return false;
}
this.nameContainsComma = false;
if (this.tag?.name?.includes(",")) {
this.nameContainsComma = true;
return false;
}
return true;
},