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 #468 from lucasponce/Alerts-Fixes
Browse files Browse the repository at this point in the history
Alerts fixes
  • Loading branch information
mtho11 committed Sep 16, 2015
2 parents 9555363 + d58ac7e commit e3fecac
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 271 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module HawkularMetrics {
export class AppServerDeploymentsDetailsController {
/// this is for minification purposes
public static $inject = ['$location', '$scope', '$rootScope', '$interval', '$log', '$filter', '$routeParams',
'$modal', 'HawkularInventory', 'HawkularMetric', 'HawkularAlert', 'HawkularOps', 'HawkularAlertsManager',
'$modal', 'HawkularInventory', 'HawkularMetric', 'HawkularOps', 'HawkularAlertsManager',
'ErrorsManager', '$q', 'NotificationsService'];

private autoRefreshPromise:ng.IPromise<number>;
Expand All @@ -46,7 +46,6 @@ module HawkularMetrics {
private $modal:any,
private HawkularInventory:any,
private HawkularMetric:any,
private HawkularAlert:any,
private HawkularOps:any,
private HawkularAlertsManager:IHawkularAlertsManager,
private ErrorsManager:IErrorsManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
module HawkularMetrics {

export class JvmAlertController {
public static $inject = ['$scope', 'HawkularAlert', 'HawkularAlertsManager', 'ErrorsManager', '$log', '$q',
public static $inject = ['$scope', 'HawkularAlertsManager', 'ErrorsManager', '$log', '$q',
'$rootScope', '$routeParams', '$modal', '$interval', 'HkHeaderParser'];

private resourceId: string;
Expand All @@ -41,7 +41,6 @@ module HawkularMetrics {
public headerLinks: any;

constructor(private $scope:any,
private HawkularAlert:any,
private HawkularAlertsManager: IHawkularAlertsManager,
private ErrorsManager: IErrorsManager,
private $log: ng.ILogService,
Expand Down Expand Up @@ -253,7 +252,13 @@ module HawkularMetrics {
}
alertIdList = alertIdList.slice(0, - 1);

this.HawkularAlert.Alert.resolve({alertIds: alertIdList}, {}).$promise.then( () => {
let resolvedAlerts = {
alertIds: alertIdList,
resolvedBy: 'user', // FIXME update with current user
resolvedNotes: 'Manually resolved'
};

this.HawkularAlertsManager.resolveAlerts(resolvedAlerts).then( () => {
this.alertList.length = 0;
this.isResolvingAll = false;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module HawkularMetrics {
export class AppServerJvmDetailsController {
/// this is for minification purposes
public static $inject = ['$location', '$scope', '$rootScope', '$interval', '$log', '$filter', '$routeParams',
'$modal', '$window', 'HawkularInventory', 'HawkularMetric', 'HawkularAlert', 'HawkularAlertsManager',
'$modal', '$window', 'HawkularInventory', 'HawkularMetric', 'HawkularAlertsManager',
'ErrorsManager', '$q', 'md5'];

public static USED_COLOR = '#1884c7'; /// blue
Expand Down Expand Up @@ -58,7 +58,6 @@ module HawkularMetrics {
private $window: any,
private HawkularInventory: any,
private HawkularMetric: any,
private HawkularAlert: any,
private HawkularAlertsManager: HawkularMetrics.IHawkularAlertsManager,
private ErrorsManager: HawkularMetrics.IErrorsManager,
private $q: ng.IQService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module HawkularMetrics {

/// this is for minification purposes
public static $inject = ['$location', '$scope', '$rootScope', '$interval', '$log', '$filter', '$routeParams',
'$modal', 'HawkularInventory', 'HawkularMetric', 'HawkularAlert', 'HawkularAlertsManager', 'ErrorsManager',
'$modal', 'HawkularInventory', 'HawkularMetric', 'HawkularAlertsManager', 'ErrorsManager',
'$q', '$window', 'md5'];

public static MAX_ACTIVE_COLOR = '#1884c7'; /// blue
Expand All @@ -51,7 +51,6 @@ module HawkularMetrics {
private $modal: any,
private HawkularInventory: any,
private HawkularMetric: any,
private HawkularAlert: any,
private HawkularAlertsManager: IHawkularAlertsManager,
private ErrorsManager: IErrorsManager,
private $q: ng.IQService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,27 @@ module HawkularMetrics {
public templateUrl = 'plugins/metrics/html/directives/alert.html';


constructor(private HawkularAlert) {
constructor(private HawkularAlertsManager) {
this.link = (scope:any, element:ng.IAugmentedJQuery, attrs:ng.IAttributes) => {
scope.alertResolve = ():void => {
this.HawkularAlert.Alert.resolve({alertIds: scope.alert.id}, {}, () => {
let resolvedAlerts = {
alertIds: scope.alert.id,
resolvedBy: 'user', // FIXME update with current user
resolvedNotes: 'Manually resolved'
};
this.HawkularAlertsManager.resolveAlerts(resolvedAlerts).then( () => {
scope.refresh({hkAlert: scope.alert});
});
};
};
}

public static Factory() {
let directive = (HawkularAlert:any) => {
return new HkAlertPanel(HawkularAlert);
let directive = (HawkularAlertsManager:any) => {
return new HkAlertPanel(HawkularAlertsManager);
};

directive['$inject'] = ['HawkularAlert'];
directive['$inject'] = ['HawkularAlertsManager'];

return directive;
}
Expand Down
11 changes: 8 additions & 3 deletions console/src/main/scripts/plugins/metrics/ts/metricsAlerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module HawkularMetrics {


export class MetricsAlertController {
public static $inject = ['$scope', 'HawkularAlert', 'HawkularAlertsManager', 'ErrorsManager', '$log', '$q',
public static $inject = ['$scope', 'HawkularAlertsManager', 'ErrorsManager', '$log', '$q',
'$rootScope', '$routeParams', '$modal', '$interval', 'HkHeaderParser'];

private metricId: string; /// @todo: use MetricId
Expand All @@ -127,7 +127,6 @@ module HawkularMetrics {
public headerLinks: any;

constructor(private $scope:any,
private HawkularAlert:any,
private HawkularAlertsManager: HawkularMetrics.IHawkularAlertsManager,
private ErrorsManager: HawkularMetrics.IErrorsManager,
private $log: ng.ILogService,
Expand Down Expand Up @@ -214,7 +213,13 @@ module HawkularMetrics {
}
alertIdList = alertIdList.slice(0, - 1);

this.HawkularAlert.Alert.resolve({alertIds: alertIdList}, {}).$promise.then( () => {
let resolvedAlerts = {
alertIds: alertIdList,
resolvedBy: 'user', // FIXME update with current user
resolvedNotes: 'Manually resolved'
};

this.HawkularAlertsManager.resolveAlerts(resolvedAlerts).then( () => {
this.alertList.length = 0;
this.isResolvingAll = false;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module HawkularMetrics {
export class AppServerListController {
/// this is for minification purposes
public static $inject = ['$location', '$scope', '$rootScope', '$interval', '$log', '$filter', '$modal',
'HawkularInventory', 'HawkularMetric', 'HawkularAlert', 'HawkularAlertsManager', 'ErrorsManager', '$q',
'HawkularInventory', 'HawkularMetric', 'HawkularAlertsManager', 'ErrorsManager', '$q',
'md5', 'HkHeaderParser'];

private resourceList;
Expand All @@ -43,7 +43,6 @@ module HawkularMetrics {
private $modal: any,
private HawkularInventory: any,
private HawkularMetric: any,
private HawkularAlert: any,
private HawkularAlertsManager: HawkularMetrics.IHawkularAlertsManager,
private ErrorsManager: HawkularMetrics.IErrorsManager,
private $q: ng.IQService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module HawkularMetrics {
export class MetricsAvailabilityController {
/// for minification only
public static $inject = ['$scope', '$rootScope', '$interval', '$window', '$log', 'HawkularMetric',
'HawkularAlert', '$routeParams', '$filter', '$moment', 'HawkularAlertsManager',
'$routeParams', '$filter', '$moment', 'HawkularAlertsManager',
'ErrorsManager', 'NotificationsService', '$modal'];

private availabilityDataPoints:IChartDataPoint[] = [];
Expand All @@ -61,7 +61,6 @@ module HawkularMetrics {
private $window:any,
private $log:ng.ILogService,
private HawkularMetric:any,
private HawkularAlert:any,
private $routeParams:any,
private $filter:ng.IFilterService,
private $moment:any,
Expand Down
14 changes: 6 additions & 8 deletions console/src/main/scripts/plugins/metrics/ts/metricsResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module HawkularMetrics {

export class MetricsViewController {
/// for minification only
public static $inject = ['$scope', '$rootScope', '$interval', '$log', 'HawkularAlert',
public static $inject = ['$scope', '$rootScope', '$interval', '$log',
'$routeParams', 'HawkularAlertsManager', 'ErrorsManager', 'NotificationsService', 'MetricsService'];

private bucketedDataPoints:IChartDataPoint[] = [];
Expand All @@ -45,7 +45,6 @@ module HawkularMetrics {
private $rootScope:IHawkularRootScope,
private $interval:ng.IIntervalService,
private $log:ng.ILogService,
private HawkularAlert:any,
private $routeParams:any,
private HawkularAlertsManager:IHawkularAlertsManager,
private ErrorsManager:IErrorsManager,
Expand Down Expand Up @@ -164,13 +163,12 @@ module HawkularMetrics {
}

private retrieveThreshold() {
this.HawkularAlert.Condition.query({triggerId: this.$routeParams.resourceId + '_trigger_thres'}).$promise
.then((response) => {

if (response[0]) {
this.threshold = response[0].threshold;
let triggerId = this.$routeParams.resourceId + '_trigger_thres';
this.HawkularAlertsManager.getTriggerConditions(triggerId)
.then((conditions) => {
if (conditions[0]) {
this.threshold = conditions[0].threshold;
}

}, (error) => {
this.$log.error('Error Loading Threshold data');
toastr.error('Error Loading Threshold Data: ' + error);
Expand Down

0 comments on commit e3fecac

Please sign in to comment.