Skip to content

Commit

Permalink
resources: smoother collection tags (fixes #5776) (#7778)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
RheuX and dogi authored Nov 19, 2024
1 parent 937d33e commit 3d2f3aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.15.52",
"version": "0.15.53",
"myplanet": {
"latest": "v0.20.99",
"min": "v0.19.99"
Expand Down
16 changes: 16 additions & 0 deletions src/app/shared/forms/planet-tag-input-dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export class PlanetTagInputDialogComponent {
this.data.initTags();
this.deleteDialog.close();
this.planetMessageService.showMessage($localize`Tag deleted: ${tag.name}`);
this.resetValidationAndCheck(this.addTagForm);
},
onError: (error) => this.planetMessageService.showAlert($localize`There was a problem deleting this tag.`)
};
Expand Down Expand Up @@ -230,6 +231,21 @@ export class PlanetTagInputDialogComponent {
);
}

resetValidationAndCheck(form: FormGroup) {
Object.keys(form.controls).forEach(key => {
const control = form.get(key);
control?.clearValidators();

if (key === 'name') {
control?.setValidators(this.tagNameSyncValidator());
control?.setAsyncValidators(ac => this.tagNameAsyncValidator(ac));
}

control?.markAsUntouched();
control?.updateValueAndValidity();
});
}

toggleSubcollection(event, tagId) {
event.stopPropagation();
const newState = !this.subcollectionIsOpen.get(tagId);
Expand Down

0 comments on commit 3d2f3aa

Please sign in to comment.