Skip to content

Commit

Permalink
Use a connect button per container, route that button to the JMX runt…
Browse files Browse the repository at this point in the history
…ime mbean attribute of the remote container
  • Loading branch information
gashcrumb committed May 3, 2013
1 parent 2209717 commit e125f5b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion hawtio-web/src/main/webapp/app/fabric/html/containers.html
Expand Up @@ -5,7 +5,6 @@
<fieldset>
<div class="control-group inline-block">
<div class="btn-group">
<button ng-disabled="!anySelectionHasJolokia()" class="btn" ng-click="connect()"><i class="icon-signin"></i> Connect</button>
<button ng-disabled="selectedContainers.length == 0 || !anySelectionAlive(false)" class="btn" ng-click="start()"><i class="icon-play-circle"></i> Start</button>
<button ng-disabled="selectedContainers.length == 0 || !anySelectionAlive(true)" class="btn" ng-click="stop()"><i class="icon-off"></i> Stop</button>
<button ng-disabled="selectedContainers.length == 0" class="btn" ng-click="delete()"><i class="icon-remove"></i> Delete</button>
Expand Down
25 changes: 13 additions & 12 deletions hawtio-web/src/main/webapp/app/fabric/js/containers.ts
Expand Up @@ -74,14 +74,12 @@ module Fabric {
});
};

$scope.connect = () => {
var selected = $scope.selectedContainers || [];
var row = selected.find((s) => s.jolokiaUrl);
$scope.connect = (row) => {
if (row) {
// TODO lets find these from somewhere! :)
var userName = "admin";
var password = "admin";
Fabric.connect($scope.row, userName, password, true);
Fabric.connect(row, userName, password, true);
}
};

Expand All @@ -90,11 +88,6 @@ module Fabric {
return selected.length && selected.any((s) => s.alive === state);
};

$scope.anySelectionHasJolokia = () => {
var selected = $scope.selectedContainers || [];
return selected.length && selected.any((s) => s.jolokiaUrl);
};

$scope.everySelectionAlive = (state) => {
var selected = $scope.selectedContainers || [];
return selected.length && selected.every((s) => s.alive === state);
Expand Down Expand Up @@ -188,7 +181,7 @@ module Fabric {
filterText: ''
},
selectedItems: $scope.selectedContainers,
rowHeight: 32,
rowHeight: 42,
showSelectionCheckbox: true,
selectWithCheckboxOnly: true,
keepLastSelected: false,
Expand All @@ -201,6 +194,13 @@ module Fabric {
width: 56,
resizable: false
},
{
field: 'jolokiaUrl',
displayName: 'Connect',
headerCellTemplate: '<div ng-click="col.sort()" class="ngHeaderSortColumn {{col.headerClass}}" ng-style="{\'cursor\': col.cursor}" ng-class="{ \'ngSorted\': !noSortVisible }"><div class="ngHeaderText colt{{$index}} pagination-centered" title="Connect to container"><i class="icon-cloud"></i></div><div class="ngSortButtonDown" ng-show="col.showSortButtonDown()"></div><div class="ngSortButtonUp" ng-show="col.showSortButtonUp()"></div></div>',
cellTemplate: '<div class="ngCellText centered"><button class="btn" ng-disabled="!row.entity.jolokiaUrl" title="Open a new window and connect to this container" ng-click="connect(row.entity)"><i class="icon-signin"></i></button></div>',
width: 48
},
{
field: 'name',
displayName: 'Name',
Expand Down Expand Up @@ -260,7 +260,7 @@ module Fabric {
if (!Object.equal($scope.result, response.value)) {

$scope.result = response.value;

$scope.containers = [];
$scope.profiles = empty();
$scope.versions = empty();
Expand All @@ -278,7 +278,8 @@ module Fabric {
version: container.versionId,
status: $scope.statusIcon(container),
services: services,
profileIds: container.profileIds
profileIds: container.profileIds,
jolokiaUrl: container.jolokiaUrl
});
});

Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/fabric/js/helpers.ts
Expand Up @@ -245,7 +245,7 @@ module Fabric {
if (password) {
full += "&_pwd=" + password;
}
window.open(full);
window.open(full + "/#/jmx/attributes?nid=root-java.lang-Runtime" );
}
}
}

0 comments on commit e125f5b

Please sign in to comment.