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 #180 from vrockai/AlertResolution
Browse files Browse the repository at this point in the history
Alert resolution update
  • Loading branch information
mtho11 committed Jun 2, 2015
2 parents 5a7059c + 6c507ce commit 96e6dc1
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<version.org.apache.activemq>5.10.0</version.org.apache.activemq>
<version.org.hawkular.accounts>1.0.4</version.org.hawkular.accounts>
<version.org.hawkular.agent>0.0.9</version.org.hawkular.agent>
<version.org.hawkular.alerts>0.0.4</version.org.hawkular.alerts>
<version.org.hawkular.alerts>0.0.5</version.org.hawkular.alerts>
<version.org.hawkular.availCreator>${project.version}</version.org.hawkular.availCreator>
<version.org.hawkular.bus>0.0.6</version.org.hawkular.bus>
<version.org.hawkular.console>${project.version}</version.org.hawkular.console>
Expand Down
2 changes: 1 addition & 1 deletion ui/console/src/main/scripts/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"d3": "3.4.8",
"event-drops": "0.1.1",
"hawkular-charts": "0.3.2",
"hawkular-ui-services": "0.3.0",
"hawkular-ui-services": "0.3.1",
"hawtio-core-navigation": "2.0.39",
"hawtio-core": "2.0.16",
"hawtio-template-cache": "2.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ <h1>No alerts.</h1>
<span ng-if="!alert.isThisYear">{{alert.end | date:'medium' }}).</span>
The average response time was {{alert.avg | number: 0}} ms.
</div>

<div class="alert-resolver">
<a ng-click="mac.alertResolve(alert, $index)" tooltip="Mark as resolved"
tooltip-placement="top"
tooltip-trigger="mouseenter"
tooltip-popup-delay="500">
<i class="fa" ng-class="{'fa-check-square-o': hover, 'fa-square-o': !hover}"
ng-mouseenter="hover = true"
ng-mouseleave="hover = false">
</i>
</a>
</div>
</div>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,4 +968,33 @@ section {
.form-horizontal .inline-row .duration {
margin-right: 35px;
}
}
.alert {

.hk-event {
padding-right: 1em;
}

.alert-resolver {
position: absolute;
padding-left: 1em;
width: 2em;
right: 1em;
cursor: pointer;

a > i.fa.fa-square-o {
color: @gray;
}

a i.fa-check-square-o {

&:hover {
color: @link-hover-color;
}
}

a i.fa-check-square-o {
color: @link-hover-color;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ module HawkularMetrics {
}
var expanded = this.resourceList ? this.resourceList.expanded : [];
aResourceList.expanded = expanded;
this.HawkularAlert.Alert.query({}, (anAlertList) => {
this.HawkularAlert.Alert.query({statuses:'OPEN'}, (anAlertList) => {
this.alertList = anAlertList;
}, this);
var promises = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,18 @@ module HawkularMetrics {
*/

return this.HawkularAlert.Alert.query({triggerIds:metricId+'_trigger_avail,' + metricId+'_trigger_thres'}).$promise.then((serverAlerts: any) => {
return this.HawkularAlert.Alert.query({
triggerIds:metricId+'_trigger_avail,' + metricId+'_trigger_thres',
statuses:'OPEN'
}).$promise.then((serverAlerts: any) => {

var momentNow = this.$moment();

this.$log.debug('querying data finished', serverAlerts);

for (var i = 0; i < serverAlerts.length; i++) {
var consoleAlert: any = {};
var serverAlert = serverAlerts[i];

this.$log.debug('server Alert to inspect: ', serverAlert);

consoleAlert.id = serverAlert.alertId;
consoleAlert.end = serverAlert.ctime;

var sum: number = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ module HawkularMetrics {

this.$log.debug('querying data');
this.$log.debug('$routeParams', $routeParams);

this.openSetup = () => {
var modalInstance = $modal.open({
templateUrl: 'plugins/metrics/html/alerts-setup.html',
Expand Down Expand Up @@ -78,6 +77,19 @@ module HawkularMetrics {
this.alertList.$resolved = true; // FIXME
}, (error) => { return this.HawkularErrorManager.errorHandler(error, 'Error fetching alerts.'); });
}

public alertResolve(alert: any, index: number): void {
for (var i = 0; i< this.alertList.length; i++) {
if (this.alertList[i].$$hashKey === alert.$$hashKey) {
console.log(this.alertList[i]);
this.HawkularAlert.Alert.resolve({alertIds: alert.id}, {}).$promise.then( () => {
this.alertList.splice(i, 1);
});
break;
}
}
}

}

_module.controller('MetricsAlertController', MetricsAlertController);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ module HawkularMetrics {
scope.goTos = [0];
scope.$watchGroup(['headers', 'perPage'], () => {
var pagesNumber = Math.ceil((scope.headers.total || 1) / scope.perPage);
console.log('pagesNumber', pagesNumber);
scope.goTos = new Array(pagesNumber);
});

Expand Down

0 comments on commit 96e6dc1

Please sign in to comment.