tobias-istvan closed pull request #57: [AMBARI-25012] Log Search UI: cannot save filters + select all selecting the ovirrides as well URL: https://github.com/apache/ambari-logsearch/pull/57
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): 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 f8c65de82c..acd6504140 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 cbc35f1dc4..f00eb2d930 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 5ea0803bbd..02e16798c3 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(); } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services