Skip to content

Commit

Permalink
Organize containers by ID and parent/child relationship, fix #345
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Jul 10, 2013
1 parent bfb812b commit b61a195
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
24 changes: 21 additions & 3 deletions hawtio-web/src/main/webapp/app/fabric/js/fabricView.ts
Expand Up @@ -2,7 +2,7 @@ module Fabric {

export function FabricViewController($scope, $location, jolokia, localStorage) {

$scope.containerArgs = ["id", "alive", "profileIds", "versionId", "provisionResult", "jolokiaUrl", "root"];
$scope.containerArgs = ["id", "alive", "parentId", "profileIds", "versionId", "provisionResult", "jolokiaUrl", "root"];
$scope.versionsOp = 'versions()';
$scope.containersOp = 'containers(java.util.List)';

Expand Down Expand Up @@ -577,10 +577,14 @@ module Fabric {
};

$scope.getSelectedClass = (obj) => {
var answer = [];
if (obj.selected) {
return 'selected';
answer.push('selected');
}
return '';
if (angular.isDefined(obj['root']) && obj['root'] === false) {
answer.push('child-container');
}
return answer.join(' ');
};


Expand Down Expand Up @@ -728,6 +732,20 @@ module Fabric {
if ($scope.containersResponse !== response) {
$scope.containersResponse = response;

var rootContainers = newContainers.exclude((c) => { return !c.root; });
var childContainers = newContainers.exclude((c) => { return c.root; });

if (childContainers.length > 0) {
var tmp = [];
rootContainers = rootContainers.sortBy('id');
rootContainers.each((c) => {
tmp.add(c);
var children = childContainers.exclude((child) => { return child.parentId !== c.id });
tmp.add(children.sortBy('id'));
});
newContainers = tmp;
}

newContainers.each((container) => {
var c = $scope.containers.find((c) => { return c.id === container.id; });
if (c) {
Expand Down
4 changes: 4 additions & 0 deletions hawtio-web/src/main/webapp/css/site-base.less
Expand Up @@ -1576,3 +1576,7 @@ td.adding {
min-height: 30px;
width: 160px;
}

.child-container {
margin-left: 2em;
}

0 comments on commit b61a195

Please sign in to comment.