Merge branch 'master' into bugfix-app-hide
diff --git a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts
index 81c7b89..ad823d8 100644
--- a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts
+++ b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts
@@ -19,7 +19,7 @@
 
 import { Component, Inject, OnInit } from '@angular/core';
 import { ActivatedRoute, ParamMap, Router } from '@angular/router';
-import { I18NService } from '@core';
+import { I18NService, StartupService } from '@core';
 import { ALAIN_I18N_TOKEN, TitleService } from '@delon/theme';
 import { NzNotificationService } from 'ng-zorro-antd/notification';
 import { switchMap } from 'rxjs/operators';
@@ -32,6 +32,7 @@
 import { ParamDefine } from '../../../pojo/ParamDefine';
 import { AppDefineService } from '../../../service/app-define.service';
 import { CollectorService } from '../../../service/collector.service';
+import { GeneralConfigService } from '../../../service/general-config.service';
 import { MonitorService } from '../../../service/monitor.service';
 import { generateReadableRandomString } from '../../../shared/utils/common-util';
 
@@ -59,6 +60,8 @@
     private route: ActivatedRoute,
     private router: Router,
     private notifySvc: NzNotificationService,
+    private configService: GeneralConfigService,
+    private startUpSvc: StartupService,
     @Inject(ALAIN_I18N_TOKEN) private i18nSvc: I18NService,
     private titleSvc: TitleService,
     private collectorSvc: CollectorService
@@ -168,13 +171,19 @@
     };
     this.spinningTip = 'Loading...';
     this.isSpinning = true;
+
     this.monitorSvc.newMonitor(addMonitor).subscribe(
       message => {
-        this.isSpinning = false;
         if (message.code === 0) {
-          this.notifySvc.success(this.i18nSvc.fanyi('monitor.new.success'), '');
-          this.router.navigateByUrl(`/monitors?app=${info.monitor.app}`);
+          this.configService.updateAppTemplateConfig({ hide: false }, info.monitor.app).subscribe(() => {
+            this.startUpSvc.loadConfigResourceViaHttp().subscribe(() => {
+              this.isSpinning = false;
+              this.notifySvc.success(this.i18nSvc.fanyi('monitor.new.success'), '');
+              this.router.navigateByUrl(`/monitors?app=${info.monitor.app}`);
+            });
+          });
         } else {
+          this.isSpinning = false;
           this.notifySvc.error(this.i18nSvc.fanyi('monitor.new.failed'), message.msg);
         }
       },
diff --git a/web-app/src/app/routes/setting/define/define.component.ts b/web-app/src/app/routes/setting/define/define.component.ts
index 7246826..57aa7cb 100644
--- a/web-app/src/app/routes/setting/define/define.component.ts
+++ b/web-app/src/app/routes/setting/define/define.component.ts
@@ -266,7 +266,7 @@
       .subscribe(
         message => {
           if (message.code === 0) {
-            this.loadMenus();
+            this.updateLocalAppState(app, hide);
             this.startUpSvc.loadConfigResourceViaHttp().subscribe(() => {});
             this.notifySvc.success(this.i18nSvc.fanyi('common.notify.apply-success'), '');
           } else {
@@ -279,6 +279,18 @@
       );
   }
 
+  private updateLocalAppState(app: string, hide: boolean): void {
+    this.appMenusArr.forEach(([category, menuData]) => {
+      if (menuData.child) {
+        menuData.child.forEach((item: any) => {
+          if (item.value === app) {
+            item.hide = hide;
+          }
+        });
+      }
+    });
+  }
+
   renderCategoryName(category: string): string {
     let label = this.i18nSvc.fanyi(`menu.monitor.${category}`);
     if (label == `menu.monitor.${category}`) {