mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-01 02:34:03 +00:00
Fix: Allow removing and re-adding the same tag
like, why would you even do this?
This commit is contained in:
parent
9b5abf9bb1
commit
fcbeed55bf
1 changed files with 19 additions and 9 deletions
|
@ -198,7 +198,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
validateDraftTag() {
|
validateDraftTag() {
|
||||||
if (this.newTags.concat(this.preSelectedTags).filter(tag => (
|
if (this.deleteTags.find(tag => tag.name == this.newDraftTag.select?.name && tag.value == this.newDraftTag.value)) {
|
||||||
|
// Undo removing a Tag
|
||||||
|
this.newDraftTag.nameInvalid = false;
|
||||||
|
this.newDraftTag.valueInvalid = false;
|
||||||
|
this.newDraftTag.invalid = false;
|
||||||
|
} else if (this.newTags.concat(this.preSelectedTags).filter(tag => (
|
||||||
tag.name == this.newDraftTag.select?.name && tag.value == this.newDraftTag.value
|
tag.name == this.newDraftTag.select?.name && tag.value == this.newDraftTag.value
|
||||||
) || (
|
) || (
|
||||||
tag.name == this.newDraftTag.name && tag.value == this.newDraftTag.value
|
tag.name == this.newDraftTag.name && tag.value == this.newDraftTag.value
|
||||||
|
@ -235,14 +240,19 @@ export default {
|
||||||
addDraftTag() {
|
addDraftTag() {
|
||||||
console.log("Adding Draft Tag: ", this.newDraftTag);
|
console.log("Adding Draft Tag: ", this.newDraftTag);
|
||||||
if (this.newDraftTag.select != null) {
|
if (this.newDraftTag.select != null) {
|
||||||
// Add an existing Tag
|
if (this.deleteTags.find(tag => tag.name == this.newDraftTag.select.name && tag.value == this.newDraftTag.value)) {
|
||||||
this.newTags.push({
|
// Undo removing a tag
|
||||||
id: this.newDraftTag.select.id,
|
this.deleteTags = this.deleteTags.filter(tag => !(tag.name == this.newDraftTag.select.name && tag.value == this.newDraftTag.value));
|
||||||
color: this.newDraftTag.select.color,
|
} else {
|
||||||
name: this.newDraftTag.select.name,
|
// Add an existing Tag
|
||||||
value: this.newDraftTag.value,
|
this.newTags.push({
|
||||||
new: true,
|
id: this.newDraftTag.select.id,
|
||||||
})
|
color: this.newDraftTag.select.color,
|
||||||
|
name: this.newDraftTag.select.name,
|
||||||
|
value: this.newDraftTag.value,
|
||||||
|
new: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Add new Tag
|
// Add new Tag
|
||||||
this.newTags.push({
|
this.newTags.push({
|
||||||
|
|
Loading…
Reference in a new issue