Skip to content

Commit 9b7cf31

Browse files
committed
feat: replace hardcoded search limit with MAX_SEARCH_RESULTS constant
Signed-off-by: Manuel Abascal <mjabascal10@gmail.com>
1 parent f9491e7 commit 9b7cf31

File tree

9 files changed

+15
-19
lines changed

9 files changed

+15
-19
lines changed

frontend/src/app/data-management/alert-management/alert-report-view/alert-report-view.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {HttpResponse} from '@angular/common/http';
22
import {Component, OnInit} from '@angular/core';
33
import {ActivatedRoute} from '@angular/router';
44
import * as moment from 'moment';
5-
import {LOG_ANALYZER_TOTAL_ITEMS} from '../../../shared/constants/log-analyzer.constant';
5+
import {MAX_SEARCH_RESULTS} from "../../../shared/constants/global.constant";
66
import {SortEvent} from '../../../shared/directives/sortable/type/sort-event';
77
import {DataNatureTypeEnum} from '../../../shared/enums/nature-data.enum';
88
import {ElasticDataExportService} from '../../../shared/services/elasticsearch/elastic-data-export.service';
@@ -78,7 +78,7 @@ export class AlertReportViewComponent implements OnInit {
7878
columns: this.report.columns,
7979
dataOrigin: DataNatureTypeEnum.ALERT,
8080
filters: this.report.filters,
81-
top: LOG_ANALYZER_TOTAL_ITEMS
81+
top: MAX_SEARCH_RESULTS
8282
};
8383
this.elasticDataExportService.exportCsv(params, 'UTM ALERTS').then(() => {
8484
this.generateReport = false;

frontend/src/app/data-management/alert-management/alert-reports/alert-reports.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {AccountService} from '../../../core/auth/account.service';
66
import {User} from '../../../core/user/user.model';
77
import {UtmToastService} from '../../../shared/alert/utm-toast.service';
88
import {ModalConfirmationComponent} from '../../../shared/components/utm/util/modal-confirmation/modal-confirmation.component';
9-
import {LOG_ANALYZER_TOTAL_ITEMS} from '../../../shared/constants/log-analyzer.constant';
109
import {ITEMS_PER_PAGE} from '../../../shared/constants/pagination.constants';
1110
import {SortEvent} from '../../../shared/directives/sortable/type/sort-event';
1211
import {DataNatureTypeEnum} from '../../../shared/enums/nature-data.enum';
@@ -17,6 +16,7 @@ import {SortByType} from '../../../shared/types/sort-by.type';
1716
import {AlertTagService} from '../shared/services/alert-tag.service';
1817
import {AlertReportFilterComponent} from './shared/components/alert-report-filter/alert-report-filter.component';
1918
import {AlertReportService} from './shared/services/report.service';
19+
import {MAX_SEARCH_RESULTS} from "../../../shared/constants/global.constant";
2020

2121
@Component({
2222
selector: 'app-alert-saved-reports',
@@ -128,7 +128,7 @@ export class AlertReportsComponent implements OnInit {
128128
columns: report.columns,
129129
dataOrigin: DataNatureTypeEnum.ALERT,
130130
filters: report.filters,
131-
top: LOG_ANALYZER_TOTAL_ITEMS
131+
top: MAX_SEARCH_RESULTS
132132
};
133133
this.elasticDataExportService.exportCsv(params, 'UTM ALERTS').then(() => {
134134
this.generateReport = false;

frontend/src/app/data-management/alert-management/alert-reports/shared/components/save-report/save-report.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {Component, Input, OnInit} from '@angular/core';
22
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
33
import {UtmToastService} from '../../../../../../shared/alert/utm-toast.service';
4-
import {LOG_ANALYZER_TOTAL_ITEMS} from '../../../../../../shared/constants/log-analyzer.constant';
54
import {ALERT_INDEX_PATTERN} from '../../../../../../shared/constants/main-index-pattern.constant';
65
import {ElasticDataExportService} from '../../../../../../shared/services/elasticsearch/elastic-data-export.service';
76
import {AlertReportType} from '../../../../../../shared/types/alert/alert-report.type';

frontend/src/app/data-management/alert-management/shared/components/alert-events-related/alert-events-related.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import {Component, Input, OnInit} from '@angular/core';
22
import {
33
UtmTableDetailComponent
44
} from '../../../../../shared/components/utm/table/utm-table/utm-table-detail/utm-table-detail.component';
5-
import {LOG_ANALYZER_TOTAL_ITEMS} from '../../../../../shared/constants/log-analyzer.constant';
65
import {ITEMS_PER_PAGE} from '../../../../../shared/constants/pagination.constants';
76
import {ElasticDataTypesEnum} from '../../../../../shared/enums/elastic-data-types.enum';
87
import {UtmFieldType} from '../../../../../shared/types/table/utm-field.type';
8+
import {MAX_SEARCH_RESULTS} from "../../../../../shared/constants/global.constant";
99

1010
@Component({
1111
selector: 'app-alert-events-related',
@@ -20,7 +20,7 @@ export class AlertEventsRelatedComponent implements OnInit {
2020
@Input() events: any[] = [];
2121
displayedLogs: any[] = [];
2222
page = 1;
23-
readonly totalItems = LOG_ANALYZER_TOTAL_ITEMS;
23+
readonly totalItems = MAX_SEARCH_RESULTS;
2424
itemsPerPage = ITEMS_PER_PAGE;
2525
readonly componentDetail = UtmTableDetailComponent;
2626
sortField = '';

frontend/src/app/data-management/file-management/shared/components/file-save-data/file-save-data.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {Component, Input, OnInit} from '@angular/core';
22
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
3-
import {LOG_ANALYZER_TOTAL_ITEMS} from '../../../../../shared/constants/log-analyzer.constant';
43
import {DataNatureTypeEnum} from '../../../../../shared/enums/nature-data.enum';
54
import {ElasticDataExportService} from '../../../../../shared/services/elasticsearch/elastic-data-export.service';
65
import {ElasticFilterType} from '../../../../../shared/types/filter/elastic-filter.type';
76
import {UtmFieldType} from '../../../../../shared/types/table/utm-field.type';
7+
import {MAX_SEARCH_RESULTS} from "../../../../../shared/constants/global.constant";
88

99
@Component({
1010
selector: 'app-file-save-data',
@@ -30,7 +30,7 @@ export class FileSaveDataComponent implements OnInit {
3030
columns: this.fields,
3131
dataOrigin: DataNatureTypeEnum.EVENT,
3232
filters: this.filters,
33-
top: LOG_ANALYZER_TOTAL_ITEMS
33+
top: MAX_SEARCH_RESULTS
3434
};
3535
this.elasticDataExportService.exportCsv(params, 'UTM FILE CLASSIFICATION').then(() => {
3636
this.generateReport = false;

frontend/src/app/log-analyzer/explorer/log-analyzer-field/log-analyzer-field-card/log-analyzer-field-detail/log-analyzer-field-detail.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
22
import {Observable} from 'rxjs';
33
import {UtmFilterBehavior} from '../../../../../shared/components/utm/filters/utm-elastic-filter/shared/behavior/utm-filter.behavior';
4-
import {LOG_ANALYZER_TOTAL_ITEMS} from '../../../../../shared/constants/log-analyzer.constant';
4+
import {MAX_SEARCH_RESULTS} from "../../../../../shared/constants/global.constant";
55
import {ElasticDataTypesEnum} from '../../../../../shared/enums/elastic-data-types.enum';
66
import {ElasticOperatorsEnum} from '../../../../../shared/enums/elastic-operators.enum';
77
import {ElasticSearchFieldInfoType} from '../../../../../shared/types/elasticsearch/elastic-search-field-info.type';
@@ -22,7 +22,7 @@ export class LogAnalyzerFieldDetailComponent implements OnInit, OnDestroy {
2222
filters: ElasticFilterType[] = [];
2323
fieldTopValues: LogAnalyzerFieldDetailType;
2424
loading = true;
25-
total = LOG_ANALYZER_TOTAL_ITEMS;
25+
total = MAX_SEARCH_RESULTS;
2626
public logObservable: Observable<{ filter: ElasticFilterType[], sort: string }>;
2727
subscription: any;
2828
private sort = '@timestamp,desc';

frontend/src/app/log-analyzer/explorer/log-analyzer-view/log-analyzer-view.component.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import * as moment from 'moment';
77
import {Observable, Subject} from 'rxjs';
88
import {filter, takeUntil} from 'rxjs/operators';
99

10-
import {ADMIN_ROLE} from '../../../shared/constants/global.constant';
10+
import {ADMIN_ROLE, MAX_SEARCH_RESULTS} from '../../../shared/constants/global.constant';
1111
import {ALERT_INDEX_PATTERN, LOG_INDEX_PATTERN} from '../../../shared/constants/main-index-pattern.constant';
1212
import {ITEMS_PER_PAGE} from '../../../shared/constants/pagination.constants';
13-
import {LOG_ANALYZER_TOTAL_ITEMS} from '../../../shared/constants/log-analyzer.constant';
1413

1514
import {ElasticDataTypesEnum} from '../../../shared/enums/elastic-data-types.enum';
1615
import {ElasticOperatorsEnum} from '../../../shared/enums/elastic-operators.enum';
@@ -38,7 +37,6 @@ import {IndexFieldController} from '../../shared/behaviors/index-field-controlle
3837
import {IndexPatternBehavior} from '../../shared/behaviors/index-pattern.behavior';
3938
import {LogFilterBehavior} from '../../shared/behaviors/log-filter.behavior';
4039
import {QueryRunBehavior} from '../../shared/behaviors/query-run.behavior';
41-
import {TabService} from '../../shared/services/tab.service';
4240
import {LogAnalyzerQueryType} from '../../shared/type/log-analyzer-query.type';
4341

4442
@Component({
@@ -54,7 +52,7 @@ export class LogAnalyzerViewComponent implements OnInit, OnDestroy {
5452
rows: any[] = [];
5553
page = 1;
5654
itemsPerPage = ITEMS_PER_PAGE;
57-
totalItems = LOG_ANALYZER_TOTAL_ITEMS;
55+
totalItems = MAX_SEARCH_RESULTS;
5856
view: 'table' | 'chart' = 'table';
5957
filters: ElasticFilterType[] = [{
6058
field: '@timestamp',
@@ -254,7 +252,7 @@ export class LogAnalyzerViewComponent implements OnInit, OnDestroy {
254252
this.logAnalyzerService.search(
255253
this.page,
256254
this.itemsPerPage,
257-
LOG_ANALYZER_TOTAL_ITEMS,
255+
MAX_SEARCH_RESULTS,
258256
this.pattern.pattern,
259257
this.filters,
260258
this.sortBy).subscribe(
@@ -380,7 +378,7 @@ export class LogAnalyzerViewComponent implements OnInit, OnDestroy {
380378
columns: this.fields,
381379
indexPattern: this.pattern.pattern,
382380
filters: this.filters,
383-
top: LOG_ANALYZER_TOTAL_ITEMS
381+
top: MAX_SEARCH_RESULTS
384382
};
385383
this.elasticDataExportService.exportCsv(params, 'UTM LOG EXPLORER').then(() => {
386384
this.csvExport = false;

frontend/src/app/shared/constants/global.constant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ export const DEMO_URL = 'https://demo.utmstack.com/';
55
export const LOG_SOURCE_DASHBOARD_NAME = 'Log source system';
66
export const SAAS_DEFAULT_PASSWORD = 'DefaultPa$$word!';
77
export const ONLINE_DOCUMENTATION_BASE = 'https://docs.utmstack.com/UTMStackDocumentationSite/';
8-
export const MAX_SEARCH_RESULTS = 100000;
8+
export const MAX_SEARCH_RESULTS = 10000;
99

frontend/src/app/shared/constants/log-analyzer.constant.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)