@@ -6,34 +6,34 @@ import {ResizeEvent} from 'angular-resizable-element';
66import * as moment from 'moment' ;
77import { Observable , Subject } from 'rxjs' ;
88import { filter , takeUntil } from 'rxjs/operators' ;
9- import { UtmToastService } from '../../../shared/alert/utm-toast.service' ;
10- import {
11- ElasticFilterDefaultTime
12- } from '../../../shared/components/utm/filters/elastic-filter-time/elastic-filter-time.component' ;
13- import {
14- UtmFilterBehavior
15- } from '../../../shared/components/utm/filters/utm-elastic-filter/shared/behavior/utm-filter.behavior' ;
16- import {
17- UtmTableDetailComponent
18- } from '../../../shared/components/utm/table/utm-table/utm-table-detail/utm-table-detail.component' ;
9+
1910import { ADMIN_ROLE } from '../../../shared/constants/global.constant' ;
20- import { LOG_ANALYZER_TOTAL_ITEMS } from '../../../shared/constants/log-analyzer .constant' ;
11+ import { ALERT_INDEX_PATTERN , LOG_INDEX_PATTERN } from '../../../shared/constants/main-index-pattern .constant' ;
2112import { ITEMS_PER_PAGE } from '../../../shared/constants/pagination.constants' ;
13+ import { LOG_ANALYZER_TOTAL_ITEMS } from '../../../shared/constants/log-analyzer.constant' ;
14+
2215import { ElasticDataTypesEnum } from '../../../shared/enums/elastic-data-types.enum' ;
2316import { ElasticOperatorsEnum } from '../../../shared/enums/elastic-operators.enum' ;
2417import { DataNatureTypeEnum , NatureDataPrefixEnum } from '../../../shared/enums/nature-data.enum' ;
2518import { ElasticDataExportService } from '../../../shared/services/elasticsearch/elastic-data-export.service' ;
2619import { ElasticDataService } from '../../../shared/services/elasticsearch/elastic-data.service' ;
20+ import { LocalFieldService } from '../../../shared/services/elasticsearch/local-field.service' ;
2721import { TimezoneFormatService } from '../../../shared/services/utm-timezone.service' ;
22+
23+ import { UtmToastService } from '../../../shared/alert/utm-toast.service' ;
24+
25+ import { ElasticFilterDefaultTime } from '../../../shared/components/utm/filters/elastic-filter-time/elastic-filter-time.component' ;
26+ import { UtmFilterBehavior } from '../../../shared/components/utm/filters/utm-elastic-filter/shared/behavior/utm-filter.behavior' ;
27+ import { UtmTableDetailComponent } from '../../../shared/components/utm/table/utm-table/utm-table-detail/utm-table-detail.component' ;
28+
2829import { DatePipeDefaultOptions } from '../../../shared/types/date-pipe-default-options' ;
2930import { ElasticSearchFieldInfoType } from '../../../shared/types/elasticsearch/elastic-search-field-info.type' ;
3031import { ElasticFilterType } from '../../../shared/types/filter/elastic-filter.type' ;
3132import { UtmIndexPattern } from '../../../shared/types/index-pattern/utm-index-pattern' ;
3233import { UtmFieldType } from '../../../shared/types/table/utm-field.type' ;
3334import { parseQueryParamsToFilter } from '../../../shared/util/query-params-to-filter.util' ;
34- import {
35- LogAnalyzerQueryCreateComponent
36- } from '../../queries/log-analyzer-query-create/log-analyzer-query-create.component' ;
35+
36+ import { LogAnalyzerQueryCreateComponent } from '../../queries/log-analyzer-query-create/log-analyzer-query-create.component' ;
3737import { IndexFieldController } from '../../shared/behaviors/index-field-controller.behavior' ;
3838import { IndexPatternBehavior } from '../../shared/behaviors/index-pattern.behavior' ;
3939import { LogFilterBehavior } from '../../shared/behaviors/log-filter.behavior' ;
@@ -62,6 +62,8 @@ export class LogAnalyzerViewComponent implements OnInit, OnDestroy {
6262 value : [ 'now-24h' , 'now' ]
6363 } ] ;
6464 selectedFields : ElasticSearchFieldInfoType [ ] = [ { name : '@timestamp' , type : ElasticDataTypesEnum . DATE } ] ;
65+ fieldsNames : string [ ] = [ ] ;
66+ indexPatternNames : string [ ] = [ ] ;
6567 dataNature : string = DataNatureTypeEnum . EVENT ;
6668 queryParams : any ;
6769 counter : any ;
@@ -99,7 +101,8 @@ export class LogAnalyzerViewComponent implements OnInit, OnDestroy {
99101 private elasticDataExportService : ElasticDataExportService ,
100102 private timezoneFormatService : TimezoneFormatService ,
101103 private logFilterBehavior : LogFilterBehavior ,
102- private router : Router ) {
104+ private router : Router ,
105+ private localFieldService : LocalFieldService ) {
103106
104107 this . detailWidth = ( this . pageWidth - 310 ) ;
105108 }
@@ -123,6 +126,7 @@ export class LogAnalyzerViewComponent implements OnInit, OnDestroy {
123126
124127 } ) ;
125128 this . dateFormat$ = this . timezoneFormatService . getDateFormatSubject ( ) ;
129+ this . loadFieldNames ( ) ;
126130 this . initExplorer ( ) ;
127131 }
128132
@@ -468,4 +472,15 @@ export class LogAnalyzerViewComponent implements OnInit, OnDestroy {
468472 this . destroy$ . next ( ) ;
469473 this . destroy$ . complete ( ) ;
470474 }
475+
476+ loadFieldNames ( ) {
477+ this . fieldsNames = [
478+ ...this . localFieldService . getPatternStoredFields ( ALERT_INDEX_PATTERN ) . map ( f => f . name ) ,
479+ ...this . localFieldService . getPatternStoredFields ( LOG_INDEX_PATTERN ) . map ( f => f . name )
480+ ] ;
481+ }
482+
483+ indexPatternLoaded ( indexPatternNames : string [ ] ) {
484+ this . indexPatternNames = indexPatternNames ;
485+ }
471486}
0 commit comments