Skip to content

Commit

Permalink
Console: Fix URL list blinking at each update
Browse files Browse the repository at this point in the history
  • Loading branch information
ammendonca committed Apr 6, 2015
1 parent 8544bb0 commit 9ed5bad
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions plugins/metrics/plugins/metrics/ts/addUrlPage.ts
Expand Up @@ -134,38 +134,41 @@ module HawkularMetrics {
}

getResourceList():any {
return this.HawkularInventory.Resource.query({tenantId: globalTenantId}, (aResourceList) => {
this.HawkularInventory.Resource.query({tenantId: globalTenantId}, (aResourceList) => {
// FIXME: hack.. make expanded out of list
var expanded = this.resourceList ? this.resourceList.expanded : [];
this.resourceList = aResourceList;
this.resourceList.expanded = expanded;
aResourceList.expanded = expanded;
this.HawkularAlert.Alert.query({}, (anAlertList) => {
this.alertList = anAlertList;
}, this);
angular.forEach(this.resourceList, function(res, idx) {
this.HawkularMetric.NumericMetricData.queryMetrics({
var promises = [];
angular.forEach(aResourceList, function(res, idx) {
promises.push(this.HawkularMetric.NumericMetricData.queryMetrics({
tenantId: globalTenantId, resourceId: res.id, numericId: (res.id + '.status.duration'),
start: moment().subtract(24, 'hours').valueOf(), end: moment().valueOf()}, (resource) => {
// FIXME: Work data so it works for chart ?
res['responseTime'] = resource;
});
this.HawkularMetric.NumericMetricData.queryMetrics({
}).$promise);
promises.push(this.HawkularMetric.NumericMetricData.queryMetrics({
tenantId: globalTenantId, resourceId: res.id, numericId: (res.id + '.status.code'),
start: moment().subtract(24, 'hours').valueOf(), end: moment().valueOf()}, (resource) => {
// FIXME: Use availability instead..
res['isUp'] = (resource[0] && resource[0].value >= 200 && resource[0].value < 300);
});
this.HawkularMetric.AvailabilityMetricData.query({
}).$promise);
promises.push(this.HawkularMetric.AvailabilityMetricData.query({
tenantId: globalTenantId,
availabilityId: res.id,
start: moment().subtract(24, 'hours').valueOf(),
end: moment().valueOf(),
buckets: 1}, (resource) => {
res['availability'] = resource[0].uptimeRatio * 100;
res['downTime'] = Math.round(resource[0].downtimeDuration / 1000 / 60);
});
}).$promise);
res['updateTime'] = new Date();
}, this);
this.$q.all(promises).then((result) => {
this.resourceList = aResourceList;
});

});
}
Expand Down

0 comments on commit 9ed5bad

Please sign in to comment.