tiborm commented on a change in pull request #1514: METRON-2190: [UI] Alerts
UI: Indicating loading and preventing parallel requests
URL: https://github.com/apache/metron/pull/1514#discussion_r326994513
##########
File path:
metron-interface/metron-alerts/src/app/alerts/alerts-list/alerts-list.component.spec.ts
##########
@@ -28,53 +28,136 @@ import { SaveSearchService } from
'app/service/save-search.service';
import { MetaAlertService } from 'app/service/meta-alert.service';
import { GlobalConfigService } from 'app/service/global-config.service';
import { DialogService } from 'app/service/dialog.service';
-import { SearchRequest } from 'app/model/search-request';
-import { Observable, of, Subject } from 'rxjs';
-import { Filter } from 'app/model/filter';
-import { QueryBuilder } from './query-builder';
import { TIMESTAMP_FIELD_NAME } from 'app/utils/constants';
-import { SearchResponse } from 'app/model/search-response';
import { By } from '@angular/platform-browser';
+import { Observable, Subject, of, throwError } from 'rxjs';
+import { Filter } from 'app/model/filter';
+import { QueryBuilder, FilteringMode } from './query-builder';
+import { SearchResponse } from 'app/model/search-response';
+import { AutoPollingService } from './auto-polling/auto-polling.service';
+import { Router } from '@angular/router';
+import { Alert } from 'app/model/alert';
+import { AlertSource } from 'app/model/alert-source';
+import { SearchRequest } from 'app/model/search-request';
+import { query } from '@angular/core/src/render3';
+import { RestError } from 'app/model/rest-error';
+import { DialogType } from 'app/shared/metron-dialog/metron-dialog.component';
+
+@Component({
+ selector: 'app-auto-polling',
+ template: '<div></div>',
+})
+class MockAutoPollingComponent {}
+
+@Component({
+ selector: 'app-configure-rows',
+ template: '<div></div>',
+})
+class MockConfigureRowsComponent {
+ @Input() refreshInterval = 0;
+ @Input() srcElement = {};
+ @Input() pageSize = 0;
+}
+
+@Component({
+ selector: 'app-modal-loading-indicator',
+ template: '<div></div>',
+})
+class MockModalLoadingIndicatorComponent {
+ @Input() show = false;
+}
+
+@Component({
+ selector: 'app-time-range',
+ template: '<div></div>',
+})
+class MockTimeRangeComponent {
+ @Input() disabled = false;
+ @Input() selectedTimeRange = {};
+}
+
+@Directive({
+ selector: '[appAceEditor]',
+})
+class MockAceEditorDirective {
+ @Input() text = '';
+}
+
+@Component({
+ selector: 'app-alert-filters',
+ template: '<div></div>',
+})
+class MockAlertFilterComponent {
+ @Input() facets = [];
+}
+
+@Component({
+ selector: 'app-group-by',
+ template: '<div></div>',
+})
+class MockGroupByComponent {
+ @Input() facets = [];
+}
+
+@Component({
+ selector: 'app-table-view',
+ template: '<div></div>',
+})
+class MockTableViewComponent {
+ @Input() alerts = [];
+ @Input() pagination = {};
+ @Input() alertsColumnsToDisplay = [];
+ @Input() selectedAlerts = [];
+}
+
+@Component({
+ selector: 'app-tree-view',
+ template: '<div></div>',
+})
+class MockTreeViewComponent {
+ @Input() alerts = [];
+ @Input() pagination = {};
+ @Input() alertsColumnsToDisplay = [];
+ @Input() selectedAlerts = [];
+ @Input() globalConfig = {};
+ @Input() query = '';
+ @Input() groups = [];
+}
+
Review comment:
With mocking out all the visual sub components instead of importing the
actual ones the test become faster.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services