This is an automated email from the ASF dual-hosted git repository.
gongchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/master by this push:
new ed390a50c [fixed] required field check for tag settings (#2071)
ed390a50c is described below
commit ed390a50c9baf38a6e16b6b5922756ca594486a1
Author: Calvin <[email protected]>
AuthorDate: Sun Jun 9 22:54:40 2024 +0800
[fixed] required field check for tag settings (#2071)
---
web-app/src/app/routes/setting/tags/tags.component.ts | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/web-app/src/app/routes/setting/tags/tags.component.ts
b/web-app/src/app/routes/setting/tags/tags.component.ts
index f9dfb8ede..215eaf1d9 100644
--- a/web-app/src/app/routes/setting/tags/tags.component.ts
+++ b/web-app/src/app/routes/setting/tags/tags.component.ts
@@ -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';
@@ -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,
@@ -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) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]