Skip to content

Commit

Permalink
view the requirements (with info/warnings) on the active profiles pag…
Browse files Browse the repository at this point in the history
…e for #576
  • Loading branch information
jstrachan committed Sep 30, 2013
1 parent 3be582b commit 007986f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 13 deletions.
Expand Up @@ -8,8 +8,8 @@
</div>
</div>

<div class="active-profile-count">Count</div>
<div class="active-profile-actions">Actions</div>
<div class="active-profile-count" title="The actual number of instances of each profile that are currently running">Count</div>
<div class="active-profile-requirements" title="The required number of instances of each profile">Requirements</div>
</div>
<div class="active-profile-list" ng-repeat="profile in activeProfiles" ng-show="profileMatchesFilter(profile)">
<div class="expandable" ng-class="isOpen(profile)">
Expand All @@ -21,12 +21,15 @@
<a ng-click="showProfile(profile)">{{profile.id}}</a> / {{profile.versionId}}
</div>
<div class="active-profile-count">
{{profile.count}}
<span class="badge {{requirementStyle(profile)}}">
{{profile.count}}
</span>
</div>

<div class="active-profile-actions">
<i class="icon-minus clickable" title="Scale Down (not implemented yet)"></i>
<i class="icon-plus clickable" title="Scale Up (not implemented yet)"></i>
<div class="active-profile-requirements">
<span ng-show="minimumInstances(profile.id)" class="badge">
{{minimumInstances(profile.id)}}
</span>
</div>

</div>
Expand Down
39 changes: 35 additions & 4 deletions hawtio-web/src/main/webapp/app/fabric/js/containerDirective.ts
Expand Up @@ -329,16 +329,47 @@ module Fabric {

$scope.profileMatchesFilter = (profile) => {
return profile.id.has($scope.searchFilter) || !profile.containers.filter((id) => { return id.has($scope.searchFilter); }).isEmpty();
}
};

$scope.containerMatchesFilter = (container) => {
return container.id.has($scope.searchFilter) || !container.profileIds.filter((id) => {return id.has($scope.searchFilter);}).isEmpty();
}
};

}
$scope.minimumInstances = (profileId) => {
var profileRequirements = $scope.profileRequirements(profileId);
return profileRequirements ? profileRequirements.minimumInstances : null;
};

$scope.requirementStyle = (profile) => {
var min = $scope.minimumInstances(profile.id);
if (min) {
var count = profile.count;
if (!count) {
return "badge-important";
} else if (min > count) {
return "badge-warning";
}
}
return "";
};

$scope.profileRequirements = (profileId) => {
if ($scope.requirements) {
var profileRequirements = $scope.requirements.profileRequirements;
if (profileRequirements) {
return profileRequirements.find({profile: profileId});
}
}
return null;
};

}
function onRequirements(response) {
if (response) {
$scope.requirements = response.value;
}
}

Core.register(jolokia, $scope, {type: 'exec', mbean: Fabric.managerMBean, operation: "requirements()"}, onSuccess(onRequirements));
}
}
}
6 changes: 3 additions & 3 deletions hawtio-web/src/main/webapp/css/site-base.css
Expand Up @@ -1859,14 +1859,14 @@ dd.file-list {
left: 0;
}

.active-profile-actions {
.active-profile-requirements {
position: absolute;
right: 10px;
right: 150px;
}

.active-profile-count {
position: absolute;
right: 250px;
right: 10px;
}

.active-profile-name {
Expand Down

0 comments on commit 007986f

Please sign in to comment.