Skip to content

Commit

Permalink
Select profiles from URL, link back to view page from profile detail …
Browse files Browse the repository at this point in the history
…page
  • Loading branch information
gashcrumb committed May 30, 2013
1 parent 17eca19 commit ecb3177
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/fabric/html/fabricView.html
Expand Up @@ -143,7 +143,7 @@
</div>
<div class="section-controls">

<i class="icon-circle-blank clickable" tytpe="Clear Selection" ng-click="setActiveProfile(null)"></i>
<i class="icon-circle-blank clickable" title="Clear Selection" ng-click="setActiveProfile(null)"></i>

</div>
<div class="section-filter">
Expand Down
3 changes: 2 additions & 1 deletion hawtio-web/src/main/webapp/app/fabric/html/profile.html
@@ -1,7 +1,8 @@
<div ng-controller="Fabric.ProfileController">

<div class="row-fluid">
<div class="pull-left">
<h2 style="display: inline;">Version: <a ng-href="#/fabric/profiles?pv={{versionId}}">{{versionId}}</a> / Profile:
<h2 style="display: inline;">/ <a ng-href="#/fabric/view?cv={{versionId}}&sp={{row.id}}">{{versionId}}</a> /
{{row.id}}</h2>
&nbsp;
<a href="#/fabric/containers?cv={{versionId}}&cp={{row.id}}">
Expand Down
37 changes: 26 additions & 11 deletions hawtio-web/src/main/webapp/app/fabric/js/fabricView.ts
Expand Up @@ -6,7 +6,19 @@ module Fabric {
$scope.versionsOp = 'versions()';
$scope.containersOp = 'containers(java.util.List)';

$scope.activeVersionId = $location.search()['cv'];
$scope.init = () => {

$scope.activeVersionId = $location.search()['cv'];

var profiles = $location.search()['sp'];
$scope.selectedProfileIds = [];
if (profiles) {
$scope.selectedProfileIds = profiles.split(',');
}

}

$scope.init();

$scope.versions = [];
$scope.profiles = [];
Expand Down Expand Up @@ -89,20 +101,15 @@ module Fabric {
$scope.selectedParents = [];
$scope.selectedParentVersion = [];

$scope.$on('$routeUpdate', () => {
$scope.activeVersionId = $location.search()['cv'];
});
$scope.$on('$routeUpdate', $scope.init);

// watchers for selection handling
$scope.$watch('activeVersionId', (oldValue, newValue) => {
if (oldValue !== newValue) {
$scope.profiles = $scope.currentVersionProfiles($scope.activeVersionId);
if ($scope.activeVersionId === '') {
$scope.activeProfileId = '';
$scope.profiles = [];
}
$location.search('cv', $scope.activeVersionId);
}
});


Expand All @@ -112,9 +119,6 @@ module Fabric {
$scope.selectedProfiles = [];
} else {
$scope.selectedProfiles = $scope.profiles.filter((p) => { return p.selected; });
if ($scope.selectedProfiles.length > 0) {
$scope.activeProfileId = '';
}
}

}
Expand All @@ -140,6 +144,14 @@ module Fabric {
}, true);


$scope.$watch('selectedProfiles', (oldValue, newValue) => {
if (oldValue !== newValue) {
var ids = $scope.selectedProfiles.map((p) => { return p.id; }).join(',');
$location.search('sp', ids);
}
});


// create profile dialog action
$scope.doCreateProfile = () => {
$scope.createProfileDialog = false;
Expand Down Expand Up @@ -241,7 +253,6 @@ module Fabric {
} else {
$scope.removeProfile($scope.activeContainerId, profile.id);
}
$scope.activeProfileId = '';
};


Expand Down Expand Up @@ -364,6 +375,10 @@ module Fabric {
selected = profile.selected;
}

if ($scope.selectedProfileIds.any(p)) {
selected = true;
}

answer.push({
id: p,
versionId: version.id,
Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/fabric/js/profile.ts
Expand Up @@ -14,7 +14,7 @@ module Fabric {
if (angular.isDefined($scope.versionId) && angular.isDefined($scope.profileId)) {
Core.register(jolokia, $scope, {
type: 'exec', mbean: managerMBean,
operation: 'getProfile(java.lang.String,java.lang.String)',
operation: 'getProfile(java.lang.String, java.lang.String)',
arguments: [$scope.versionId, $scope.profileId]
}, onSuccess(render));
}
Expand Down

0 comments on commit ecb3177

Please sign in to comment.