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 #542 from hawkular/HAWKULAR-538-2
Browse files Browse the repository at this point in the history
HAWKULAR-538 Additional changes to firstUpper filter and truncate in …
  • Loading branch information
mtho11 committed Oct 9, 2015
2 parents b1126de + 13259e8 commit 9b028c4
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 40 deletions.
2 changes: 2 additions & 0 deletions console/src/main/scripts/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"moment": "2.10.3",
"patternfly": "2.3.0",
"keycloak": "1.3.1",
"angular-truncate": "sparkalow/angular-truncate",
"angular-smart-truncate": "1.0.2",
"angular-wizard": "0.5.3"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,34 @@ <h1>Alert Center</h1>
<h3 class="pull-left">Alert Details</h3>
</div>
<div class="panel panel-default clearfix hk-alert-details">
<h2>{{acd.description}}</h2>
<h2>Alert: {{acd.description | characters: 55}}</h2>
<dl class="dl-horizontal">
<dt>State</dt>
<dd><span class="hk-open">{{acd.detailAlert.status | firstUpper}}</span></dd>
<dt>Severity</dt>
<dd>{{acd.detailAlert.severity | firstUpper}}</dd>
<dt>Description
<a class="hk-btn-icon" tabindex="0" role="button" data-toggle="popover" data-html="true" data-placement="top"
data-content="Trigger description"><i class="fa fa-info-circle"></i></a>
<a class="hk-btn-icon" tabindex="0" role="button"
popover-trigger="click" popover-placement="top" popover-append-to-body="true"
popover="Alert Trigger description"><i class="fa fa-info-circle"></i></a>
</dt>
<dd>{{acd.description}}</dd>
<dd>{{acd.description|characters: 40}}</dd>
<dt>Created</dt>
<dd>{{acd.detailAlert.ctime | date:'d MMM yyyy, HH:mm'}}</dd>
<dt>Resource Path
<a class="hk-btn-icon" tabindex="0" role="button" data-toggle="popover" data-html="true" data-placement="top"
data-content="e = environment, f = feed, r = the resource id"><i class="fa fa-info-circle"></i></a>
<a class="hk-btn-icon" tabindex="0" role="button"
popover-trigger="click" popover-placement="top" popover-append-to-body="true"
popover="e = environment, f = feed, r = resource id"
><i class="fa fa-info-circle"></i></a>
</dt>
<dd>{{acd.detailAlert.context.resourcePath}}</dd>
<dt>Feed Id</dt>
<dd>{{acd.feedId}}</dd>
<dt><span class="hide">Actions</span>
<dd>
<button class="btn btn-default" type="button" ng-click="acd.acknowledge()">Acknowledge</button>
<button class="btn btn-primary" type="button" ng-click="acd.resolve()">Resolve</button>
<button class="btn btn-default" type="button"
ng-disabled="acd.detailAlert.status != 'OPEN'" ng-click="acd.acknowledge()">Acknowledge</button>
<button class="btn btn-primary" type="button"
ng-disabled="acd.detailAlert.status == 'RESOLVED'"
ng-click="acd.resolve()">Resolve</button>
</dd>
</dl>
</div>
Expand Down Expand Up @@ -71,20 +75,6 @@ <h3 class="pull-left">Notification History</h3>
</table>
</div>

<!--
<div class="hk-info-top clearfix">
<h3 class="pull-left">Metrics</h3>
</div>
<div class="panel panel-default hk-graph">
<div class="hk-legend text-left">
<span><i class="fa fa-circle hk-primary"></i>Used</span>
<span><i class="fa fa-circle hk-orange"></i>Maximum</span>
<span><i class="fa fa-circle hk-gray"></i>Commited</span>
</div>
</div>
-->

</div>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h3 class="pull-left">Alerts ({{ac.alertsList.length}})</h3>
ng-disabled="!ac.hasOpenSelectedItems || ac.isWorking">Acknowledge
</button>
<button class="btn btn-primary" type="button" ng-click="ac.resolveSelected()"
ng-disabled="ac.selectCount < 1 || ac.isWorking">Resolve
ng-disabled="ac.selectCount < 1 || ac.isWorking || ac.hasResolvedItems()">Resolve
</button>
</div>
<table class="datatable table table-bordered hk-table-alerts hk-table-detailed hk-table-select">
Expand All @@ -49,9 +49,9 @@ <h3 class="pull-left">Alerts ({{ac.alertsList.length}})</h3>
<td><input type="checkbox" ng-checked="alert.selected"/></td>
<td ng-class="{'hk-bold': alert.status === 'OPEN'}">{{alert.status|firstUpper}}</td>
<td>{{alert.severity|firstUpper}}</td>
<td>{{alert.trigger.description}}</td>
<td>{{alert.trigger.description| characters: 35}}</td>
<td>{{alert.ctime | date:'d MMM yyyy, HH:mm'}}</td>
<td>{{alert.context.resourcePath}}</td>
<td>{{alert.context.resourcePath | truncate: 30}}</td>
<td><a class="btn btn-link"><i class="fa fa-chevron-circle-right fa-lg"
tooltip="View Details" tooltip-trigger tooltip-placement="top"
ng-click="ac.showDetailPage(alert.alertId)">
Expand Down
15 changes: 10 additions & 5 deletions console/src/main/scripts/plugins/metrics/ts/alertsCenterList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ module HawkularMetrics {
public lastUpdateDate:Date = new Date();

public alertsList:IAlert[];
public alertsPerPage = 5;
public selectedItems:IAlert[];
public alertsPerPage = 10;
public alertsCurPage = 0;
public headerLinks:any = {};
public selectCount = 0;
Expand Down Expand Up @@ -148,7 +149,7 @@ module HawkularMetrics {
this.isWorking = true;
let ackIdList = '';
this.alertsList.forEach((alertItem:IAlert) => {
if (alertItem.selected) {
if (alertItem.selected && alertItem.status !== 'ACKNOWLEDGED' || alertItem.status !== 'RESOLVED') {
ackIdList = ackIdList + alertItem.alertId + ',';
}
});
Expand All @@ -175,9 +176,13 @@ module HawkularMetrics {

public selectItem(item:IAlert):void {
item.selected = !item.selected;
let selectedItems = _.filter(this.alertsList, 'selected');
this.selectCount = selectedItems.length;
this.hasOpenSelectedItems = _.some(selectedItems,{'status': 'OPEN'});
this.selectedItems = _.filter(this.alertsList, 'selected');
this.selectCount = this.selectedItems.length;
this.hasOpenSelectedItems = _.some(this.selectedItems,{'status': 'OPEN'});
}

public hasResolvedItems(): boolean {
return _.some(this.selectedItems,{'status': 'RESOLVED'});
}

private resetAllUnselected() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@

module HawkularMetrics {

_module.filter('firstUpper', function () {
return function (input, all) {
return (!!input) ? input.replace(/([^\W_]+[^\s-]*) */g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
}) : '';
_module.filter('firstUpper', () => {
return (input) => {
if (input != null) {
input = input.toLowerCase();
return input.substring(0, 1).toUpperCase() + input.substring(1);
}
};
});

Expand Down
6 changes: 3 additions & 3 deletions console/src/main/scripts/plugins/metrics/ts/metricsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module HawkularMetrics {

export let _module = angular.module(HawkularMetrics.pluginName, ['ngResource', 'ui.select', 'hawkular.charts',
'hawkular.services', 'ui.bootstrap', 'topbar', 'patternfly.select', 'angular-momentjs', 'angular-md5', 'toastr',
'infinite-scroll','mgo-angular-wizard']);
'infinite-scroll', 'mgo-angular-wizard', 'truncate', '500tech.smart-truncate']);

_module.config(['$httpProvider', '$locationProvider', '$routeProvider',
($httpProvider, $locationProvider) => {
Expand Down Expand Up @@ -57,7 +57,7 @@ module HawkularMetrics {
templateUrl: 'plugins/metrics/html/url-response-time.html',
reloadOnSearch: false,
resolve: {
resource: ($route, $location, HawkularInventory, NotificationsService:INotificationsService) => {
resource: ($route, $location, HawkularInventory, NotificationsService:INotificationsService) => {
let p = HawkularInventory.Resource.get({
environmentId: globalEnvironmentId, resourcePath: $route.current.params.resourceId
}).$promise;
Expand All @@ -76,7 +76,7 @@ module HawkularMetrics {
templateUrl: 'plugins/metrics/html/url-availability.html',
reloadOnSearch: false,
resolve: {
resource: ($route, $location, HawkularInventory, NotificationsService:INotificationsService) => {
resource: ($route, $location, HawkularInventory, NotificationsService:INotificationsService) => {
let p = HawkularInventory.Resource.get({
environmentId: globalEnvironmentId, resourcePath: $route.current.params.resourceId
}).$promise;
Expand Down

0 comments on commit 9b028c4

Please sign in to comment.