Skip to content

Commit

Permalink
[fixed] required field check for tag settings (#2071)
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin979 authored Jun 9, 2024
1 parent cfe93bf commit ed390a5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion web-app/src/app/routes/setting/tags/tags.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* under the License.
*/

import { Component, Inject, OnInit } from '@angular/core';
import { Component, Inject, OnInit, ViewChild } from '@angular/core';
import { NgForm } from '@angular/forms';
import { I18NService } from '@core';
import { ALAIN_I18N_TOKEN } from '@delon/theme';
import { NzModalService } from 'ng-zorro-antd/modal';
Expand All @@ -34,6 +35,8 @@ import { formatTagName } from '../../../shared/utils/common-util';
templateUrl: './tags.component.html'
})
export class SettingTagsComponent implements OnInit {
@ViewChild('tagForm', { static: false }) tagForm: NgForm | undefined;

constructor(
private notifySvc: NzNotificationService,
private modal: NzModalService,
Expand Down Expand Up @@ -183,6 +186,15 @@ export class SettingTagsComponent implements OnInit {
this.isManageModalVisible = false;
}
onManageModalOk() {
if (this.tagForm?.invalid) {
Object.values(this.tagForm.controls).forEach(control => {
if (control.invalid) {
control.markAsDirty();
control.updateValueAndValidity({ onlySelf: true });
}
});
return;
}
this.isManageModalOkLoading = true;
this.tag.name = this.tag.name.trim();
if (this.tag.tagValue != undefined) {
Expand Down

0 comments on commit ed390a5

Please sign in to comment.