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_r327008834
########## 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 this.queryBuilder.clearSearch(); this.search(); } } queryForTreeView() { - if (!this.hideQueryBuilder) { - return this.queryBuilder.generateSelect(); - } else { - return this.manualQuery.nativeElement.value; - } Review comment: This is a good example when we having two separated source of the same value. Merged into one. The logic encapsulated in query builder and the difference between manual and built query in no longer exposed. (Query builder is never hidden or turned off only the filter bar changes depending on this flag.) ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services