This is an automated email from the ASF dual-hosted git repository.

tobiasistvan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ambari-logsearch.git


The following commit(s) were added to refs/heads/master by this push:
     new b219916  [AMBARI-25012] Log Search UI: cannot save filters + select 
all selecting the ovirrides as well (#57)
b219916 is described below

commit b21991615d744a983799af24631d64c4d0640e5c
Author: Istvan Tobias <tobias.ist...@gmail.com>
AuthorDate: Fri Dec 7 14:13:53 2018 +0100

    [AMBARI-25012] Log Search UI: cannot save filters + select all selecting 
the ovirrides as well (#57)
---
 .../app/components/action-menu/action-menu.component.html    |  4 ++--
 .../src/app/components/action-menu/action-menu.component.ts  | 12 ++----------
 .../log-index-filter/log-index-filter.component.ts           |  2 +-
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git 
a/ambari-logsearch-web/src/app/components/action-menu/action-menu.component.html
 
b/ambari-logsearch-web/src/app/components/action-menu/action-menu.component.html
index f8c65de..acd6504 100644
--- 
a/ambari-logsearch-web/src/app/components/action-menu/action-menu.component.html
+++ 
b/ambari-logsearch-web/src/app/components/action-menu/action-menu.component.html
@@ -31,7 +31,7 @@
   title="{{'logIndexFilter.title' | translate}}">
   <header>
       <dropdown-button [options]="clustersListItems$ | async" 
(selectItem)="onSelectCluster($event)"
-      label="{{'logIndexFilter.selectCluster' | translate}}" 
buttonClass="btn-link"></dropdown-button>
+      label="{{'logIndexFilter.selectCluster' | translate}}" 
buttonClass="btn-link" (selectItem)="onSelectCluster($event)"></dropdown-button>
   </header>
   <section>
     <p>{{'logIndexFilter.caption' | translate}}</p>
@@ -41,7 +41,7 @@
   </section>
   <footer>
     <button class="btn btn-secondary" 
(click)="closeLogIndexFilter()">{{'modal.cancel' | translate}}</button>
-    <button class="btn btn-primary" (click)="saveLogIndexFilter()" 
[disabled]="isModalSubmitDisabled">
+    <button class="btn btn-primary" (click)="saveLogIndexFilter()" 
[disabled]="isModalSubmitDisabled$ | async">
       {{'modal.save' | translate}}
     </button>
   </footer>
diff --git 
a/ambari-logsearch-web/src/app/components/action-menu/action-menu.component.ts 
b/ambari-logsearch-web/src/app/components/action-menu/action-menu.component.ts
index cbc35f1..f00eb2d 100644
--- 
a/ambari-logsearch-web/src/app/components/action-menu/action-menu.component.ts
+++ 
b/ambari-logsearch-web/src/app/components/action-menu/action-menu.component.ts
@@ -46,8 +46,6 @@ export class ActionMenuComponent  implements OnInit, 
OnDestroy {
 
   settingsForm: FormGroup = this.settings.settingsFormGroup;
 
-  isModalSubmitDisabled = true;
-
   clustersListItems$: Observable<ListItem[]> = this.clustersService.getAll()
     .map((clusterNames: string[]): ListItem[] => 
clusterNames.map(this.utilsService.getListItemFromString))
     .map((clusters: ListItem[]) => {
@@ -58,6 +56,7 @@ export class ActionMenuComponent  implements OnInit, 
OnDestroy {
     });
 
   selectedClusterName$: BehaviorSubject<string> = new BehaviorSubject('');
+  isModalSubmitDisabled$: Observable<boolean> = 
this.selectedClusterName$.map(cluster => !cluster);
 
   destroyed$ = new Subject();
 
@@ -72,10 +71,7 @@ export class ActionMenuComponent  implements OnInit, 
OnDestroy {
   }
 
   ngOnInit() {
-    this.selectedClusterName$.takeUntil(this.destroyed$).subscribe(
-      (clusterName: string) => this.setModalSubmitDisabled(!clusterName)
-    );
-    this.clustersListItems$.filter((items: ListItem[]) => items.some((item: 
ListItem) => item.isChecked)).first()
+    this.clustersListItems$.filter((items: ListItem[]) => items.some((item: 
ListItem) => item.isChecked)).take(1)
       .map((items: ListItem[]) => items.find((item: ListItem) => 
item.isChecked))
       .subscribe((item) => this.selectedClusterName$.next(item.value));
   }
@@ -88,10 +84,6 @@ export class ActionMenuComponent  implements OnInit, 
OnDestroy {
     return this.logsContainerService.captureSeconds;
   }
 
-  setModalSubmitDisabled(isDisabled: boolean): void {
-    this.isModalSubmitDisabled = isDisabled;
-  }
-
   refresh(): void {
     this.logsContainerService.loadLogs();
   }
diff --git 
a/ambari-logsearch-web/src/app/components/log-index-filter/log-index-filter.component.ts
 
b/ambari-logsearch-web/src/app/components/log-index-filter/log-index-filter.component.ts
index 5ea0803..02e1679 100644
--- 
a/ambari-logsearch-web/src/app/components/log-index-filter/log-index-filter.component.ts
+++ 
b/ambari-logsearch-web/src/app/components/log-index-filter/log-index-filter.component.ts
@@ -143,7 +143,7 @@ export class LogIndexFilterComponent implements OnInit, 
OnDestroy, OnChanges, Co
   processAllComponentsForLevel(levelName: LogLevel, isChecked: boolean): void {
     this.activeClusterConfigs.forEach((component: 
LogIndexFilterComponentConfig): void => {
       component[levelName].defaults = isChecked;
-      component[levelName].overrides = isChecked;
+      component[levelName].overrides = component.hasOverrides && isChecked;
     });
     this.updateValue();
   }

Reply via email to