[ 
https://issues.apache.org/jira/browse/AMBARI-25015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16712841#comment-16712841
 ] 

ASF GitHub Bot commented on AMBARI-25015:
-----------------------------------------

tobias-istvan closed pull request #59: [AMBARI-25015] [Log Search UI] Cluster 
search param added by default when the app loaded on service logs screen
URL: https://github.com/apache/ambari-logsearch/pull/59
 
 
   

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/filters-panel/filters-panel.component.ts
 
b/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.ts
index 7fa2b0f596..cc5be260d6 100644
--- 
a/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.ts
+++ 
b/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.ts
@@ -119,23 +119,29 @@ export class FiltersPanelComponent implements OnDestroy, 
OnInit {
     const logsType = this.logsContainerService.logsTypeMap[currentLogsType];
     const fieldsModel: any = logsType && logsType.fieldsModel;
     let subType: string;
-    let fields: Observable<any>;
+    let fields$: Observable<any>;
     switch (currentLogsType) {
       case 'auditLogs':
-        fields = fieldsModel.getParameter(subType ? 'overrides' : 'defaults');
+        fields$ = fieldsModel.getParameter(subType ? 'overrides' : 'defaults');
         if (subType) {
-          fields = fields.map(items => items && items[subType]);
+          fields$ = fields$.map(items => items && items[subType]);
         }
         break;
       case 'serviceLogs':
-        fields = fieldsModel.getAll();
+        fields$ = fieldsModel.getAll();
         break;
       default:
-        fields = Observable.from([]);
+        fields$ = Observable.from([]);
         break;
     }
-    this.searchBoxItems$ = fields.defaultIfEmpty([]).map(items => items ? 
items.filter(field => field.filterable) : [])
-      .map(this.utils.logFieldToListItemMapper);
+    this.searchBoxItems$ = fields$.defaultIfEmpty([]).map(items => items ? 
items.filter(field => field.filterable) : [])
+      .map(this.utils.logFieldToListItemMapper)
+      .map((fields: ListItem[]): ListItem[] => fields.map(
+        (field: ListItem): ListItem => ({
+          ...field,
+          isChecked: false
+        })
+      ));
   }
 
   isFilterConditionDisplayed(key: string): boolean {
diff --git 
a/ambari-logsearch-web/src/app/components/search-box/search-box.component.html 
b/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
index 5fd87abea1..25b0b10f4c 100644
--- 
a/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
+++ 
b/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
@@ -21,7 +21,11 @@
 <ng-container *ngFor="let parameter of parameters">
 <label class="parameter-label" [class.exclude]="parameter.isExclude" 
[class.include]="!parameter.isExclude">
   {{parameter.label | translate}}:
-  <span class="parameter-value">{{(parameter.name === 'type' ? 
(parameter.value | componentLabel | async) : parameter.value)}}</span>
+  <ng-container [ngSwitch]="parameter.name">
+      <span *ngSwitchCase="type" class="parameter-value">{{parameter.value | 
componentLabel | async}}</span>
+      <span *ngSwitchCase="host" class="parameter-value">{{parameter.value | 
hostName | async}}</span>
+      <span *ngSwitchDefault class="parameter-value">{{parameter.value}}</span>
+  </ng-container>
   <span class="fa toggle-parameter action-icon" [ngClass]="{'fa-search-minus': 
parameter.isExclude, 'fa-search-plus': !parameter.isExclude}"
         (click)="toggleParameter($event, parameter.id)" 
tooltip="{{('filter.toggleTo.' + (parameter.isExclude ? 'include' : 'exclude')) 
| translate}}"></span>
   <span class="fa fa-times remove-parameter action-icon" 
(click)="removeParameter($event, parameter.id)"></span>
diff --git 
a/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
 
b/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
index 32348a3c7f..971fe275c0 100644
--- 
a/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
+++ 
b/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
@@ -26,6 +26,7 @@ import {UtilsService} from '@app/services/utils.service';
 import {SearchBoxComponent} from './search-box.component';
 import {ComponentsService, components} from 
'@app/services/storage/components.service';
 import {ComponentLabelPipe} from '@app/pipes/component-label';
+import {HostNamePipe} from "@app/pipes/host-name.pipe";
 
 describe('SearchBoxComponent', () => {
   let component: SearchBoxComponent;
@@ -35,6 +36,7 @@ describe('SearchBoxComponent', () => {
     TestBed.configureTestingModule({
       declarations: [
         ComponentLabelPipe,
+        HostNamePipe,
         SearchBoxComponent
       ],
       imports: [


 

----------------------------------------------------------------
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


> [Log Search UI] Cluster search param added by default when the app loaded on 
> service logs screen
> ------------------------------------------------------------------------------------------------
>
>                 Key: AMBARI-25015
>                 URL: https://issues.apache.org/jira/browse/AMBARI-25015
>             Project: Ambari
>          Issue Type: Improvement
>    Affects Versions: 2.7.3
>            Reporter: Istvan Tobias
>            Assignee: Istvan Tobias
>            Priority: Major
>              Labels: pull-request-available
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to