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_r327007289
 
 

 ##########
 File path: 
metron-interface/metron-alerts/src/app/alerts/alerts-list/alerts-list.component.ts
 ##########
 @@ -549,24 +522,52 @@ export class AlertsListComponent implements OnInit, 
OnDestroy {
     this.cdRef.detectChanges();
   }
 
-  toggleQueryBuilder() {
+  getStaleDataWarning() {
+    if (this.autoPollingSvc.getIsPollingActive()) {
+      return `<i class="fa fa-warning" aria-hidden="true"></i> Data is in a 
stale state!
+        Click <i class="fa fa-search" aria-hidden="true"></i> to update your 
view based
+        on your current filter and time-range configuration!`;
+    } else {
+      return `<i class="fa fa-warning" aria-hidden="true"></i> Data is in a 
stale state!
+        Automatic refresh is turned on. Your filter and/or time-range changes 
will apply automatically on next refresh.`;
+    }
+  }
+
+  getPollingCongestionWarning() {
+    return `<i class="fa fa-warning" aria-hidden="true"></i> Refresh interval 
is shorter than the response time.
+      Please increase the refresh interval in the <i class="fa fa-sliders" 
aria-hidden="true"></i> menu above,
+      or try to simplify your query filter.`;
+  }
+
+  private updatePollingInterval(refreshInterval: number): void {
+    this.autoPollingSvc.setInterval(refreshInterval);
+  }
+
+  private restoreAutoPollingState() {
+    if (this.autoPollingSvc.getIsPollingActive()) {
+      this.autoPollingSvc.setSuppression(false);
+    }
+  }
+
+  isQueryBuilderModeManual() {
+    return this.queryBuilder.getFilteringMode() === FilteringMode.MANUAL;
+  }
+
+  toggleQueryBuilderMode() {
+    // FIXME setting timerange on toggle feels like a hack
     this.setSelectedTimeRange([this.selectedTimeRange]);
-    if (!this.hideQueryBuilder) {
-      this.hideQueryBuilder = true;
-      this.manualQuery.nativeElement.value = this.queryBuilder.query;
+    if (this.queryBuilder.getFilteringMode() === FilteringMode.BUILDER) {
+      this.queryBuilder.setFilteringMode(FilteringMode.MANUAL);
     } else {
-      this.hideQueryBuilder = false;
+      this.queryBuilder.setFilteringMode(FilteringMode.BUILDER);
+      // FIXME: this could lead to a large blocking load depending on the 
response time
 
 Review comment:
   A separated jira was made out of this.
   There are lot's of opinions about using FIXME. In here I intentionally kept 
them bc alerts-list can't be cleared out/refactored in one iteration and 
reminders about already identified issues can be handy later when we touching 
this part of the code again.

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

Reply via email to