Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #719 from ammendonca/HAWKULAR-741
Browse files Browse the repository at this point in the history
HAWKULAR-741 : Handle switch persona at Alert Center + Misc Fixes
  • Loading branch information
mtho11 committed Dec 15, 2015
2 parents 4cb7895 + e6baf20 commit 0e62cca
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h2 class="card-pf-title">
<span class="hk-input-text">{{acd.detailAlert.context.resourcePath}}</span>
</div>
</div>
<div class="form-group">
<div class="form-group" ng-show="acd.feedId">
<label class="col-sm-2 control-label">Feed Id
<a class="hk-btn-icon"><i tooltip="The ID of the agent collecting the metrics"
tooltip-trigger class="fa fa-info-circle"></i>
Expand Down
5 changes: 4 additions & 1 deletion console/src/main/scripts/plugins/metrics/ts/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ module HawkularMetrics {
export class TriggerSetupController {

public static $inject = ['$scope', 'HawkularAlertsManager', 'ErrorsManager', 'NotificationsService',
'$log', '$q', '$rootScope', '$routeParams', 'MetricsService'];
'$log', '$q', '$rootScope', '$routeParams', '$location', 'MetricsService'];

public fullTrigger:any = {};

Expand All @@ -132,6 +132,7 @@ module HawkularMetrics {
protected $q:ng.IQService,
protected $rootScope:any,
protected $routeParams:any,
protected $location:any,
protected MetricsService:IMetricsService) {
// TODO - update the pfly notification service to support more and category based notifications containers.
this.$rootScope.hkNotifications = {alerts: []};
Expand All @@ -151,6 +152,8 @@ module HawkularMetrics {
}), () => {
this.isSettingChange = !angular.equals(this.adm, this.admBak);
}, true);

$scope.$on('SwitchedPersona', () => $location.path('/hawkular-ui/alerts-center-triggers/'));
}

public cancel():string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ module HawkularMetrics {
$scope.acd = this;
this._alertId = $routeParams.alertId;

$scope.$on('SwitchedPersona', () => $location.path('/hawkular-ui/alerts-center/'));

this.alertsTimeOffset = $routeParams.timeOffset || $rootScope.hkParams.timeOffset || DEF_TIME_OFFSET;
// If the end time is not specified in URL use current time as end time
this.alertsTimeEnd = $routeParams.endTime ? $routeParams.endTime : Date.now();
Expand All @@ -73,7 +75,9 @@ module HawkularMetrics {
let alert = alerts.alertList[0];
this.detailAlert = alert;
this.description = alert.trigger.description;
this.feedId = alert.context.resourceName.split('/')[0];
let resourcePath = alert.context.resourcePath;
this.feedId = resourcePath.indexOf('/f;') === -1 ? '' :
resourcePath.substring(resourcePath.lastIndexOf('/f;')+3, resourcePath.indexOf('/r;'));
this.status = alert.status;
if (this.status === 'OPEN') {
this.statuses = ['OPEN', 'ACKNOWLEDGED', 'RESOLVED'];
Expand Down Expand Up @@ -179,16 +183,15 @@ module HawkularMetrics {
}

public getSparklineData(alert: IAlert) {
let offset = Math.ceil((60 * 60 * 1000 - alert.durationTime) / 2);
// show 30 mins before and after the alert (this helps always having 1h of data too)
let offset = 30 * 60 * 1000;
// Works for Accum GC.. possibly others ?
let metricsMethod = !!alert.dataId.match(new RegExp('accumulated', 'i')) ?
'retrieveCounterRateMetrics' : 'retrieveGaugeMetrics';
this.MetricsService[metricsMethod](this.$rootScope.userDetails.id,
alert.dataId,
alert.start - offset, alert.end + offset, 60).then((resource) => {
if (resource.length) {
this['alertChartData'] = resource;
}
this['alertChartData'] = resource;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ module HawkularMetrics {
currentPersona && this.getAlerts());
}

$scope.$on('SwitchedPersona', () => this.getAlerts());

}

private autoRefresh(intervalInSeconds:number):void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ module HawkularMetrics {
$rootScope.$watch('currentPersona', (currentPersona) =>
currentPersona && this.getTriggers());
}

$scope.$on('SwitchedPersona', () => this.getTriggers());
}

private autoRefresh(intervalInSeconds:number):void {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
<version.com.google.guava>16.0.1</version.com.google.guava>
<version.commons.io>2.4</version.commons.io>
<version.gnu.getopt>1.0.13</version.gnu.getopt>
<version.org.hawkular.accounts>1.1.3.Final</version.org.hawkular.accounts>
<version.org.hawkular.accounts>1.1.4.Final</version.org.hawkular.accounts>
<version.org.hawkular.agent>0.13.7.Final-SRC-revision-9b176c17b571a2176b9a3d79456186d4ffc042ae</version.org.hawkular.agent>
<version.org.hawkular.alerts>0.7.0.Final</version.org.hawkular.alerts>
<version.org.hawkular.alerts>0.7.1.Final</version.org.hawkular.alerts>
<version.org.hawkular.bus>0.7.3.Final</version.org.hawkular.bus>
<version.org.hawkular.commons>0.2.3.Final</version.org.hawkular.commons>
<version.org.hawkular.cmdgw>0.10.4.Final</version.org.hawkular.cmdgw>
Expand Down

0 comments on commit 0e62cca

Please sign in to comment.