Skip to content

Commit

Permalink
Merge pull request #62 from ammendonca/HWK-RANGES
Browse files Browse the repository at this point in the history
Console: Fix chart ranges to update end time to current time, and start ...
  • Loading branch information
mtho11 committed Mar 28, 2015
2 parents 1085cd6 + 3352735 commit 25bf834
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
14 changes: 9 additions & 5 deletions dist/hawkular-ui-components-metrics.js

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions plugins/metrics/plugins/metrics/ts/metricsResponsePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ module HawkularMetrics {
this.startTimeStamp = moment().subtract(1, 'hours').valueOf();
this.endTimeStamp = +moment();

this.metricId = $scope.hkParams.resourceId;

$scope.$on('RefreshChart', (event) => {
this.refreshChartDataNow(this.getMetricId());
});
Expand Down Expand Up @@ -100,11 +102,13 @@ module HawkularMetrics {
}

autoRefresh(intervalInSeconds:number):void {
this.refreshHistoricalChartDataForTimestamp(this.getMetricId());
this.autoRefreshPromise = this.$interval(() => {
this.$scope.hkEndTimestamp = +moment();
this.endTimeStamp = this.$scope.hkEndTimestamp;
this.refreshHistoricalChartDataForTimestamp(this.getMetricId(), this.$scope.hkStartTimestamp);
this.$scope.hkStartTimestamp = moment().subtract(this.$scope.hkParams.timeOffset, 'milliseconds').valueOf();
this.startTimeStamp = this.$scope.hkStartTimestamp;
this.refreshSummaryData(this.getMetricId());
this.refreshHistoricalChartDataForTimestamp(this.getMetricId());
this.retrieveThreshold();
}, intervalInSeconds * 1000);

Expand All @@ -120,10 +124,11 @@ module HawkularMetrics {


refreshChartDataNow(metricId:string, startTime?:number):void {
var adjStartTimeStamp:number = this.$scope.hkStartTimestamp;
this.$scope.hkEndTimestamp = +moment();
var adjStartTimeStamp:number = moment().subtract(this.$scope.hkParams.timeOffset, 'milliseconds').valueOf();
this.endTimeStamp = this.$scope.hkEndTimestamp;
this.refreshHistoricalChartDataForTimestamp(metricId, !startTime ? adjStartTimeStamp : startTime, this.endTimeStamp);
this.refreshSummaryData(metricId, startTime ? startTime : adjStartTimeStamp, this.endTimeStamp);
this.refreshHistoricalChartDataForTimestamp(metricId, !startTime ? adjStartTimeStamp : startTime, this.endTimeStamp);
this.retrieveThreshold();
}

Expand Down

0 comments on commit 25bf834

Please sign in to comment.