Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #607
  • Loading branch information
gashcrumb committed Oct 3, 2013
1 parent 64672b4 commit ad353ec
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 12 deletions.
23 changes: 19 additions & 4 deletions hawtio-web/src/main/webapp/app/fabric/html/activeProfileList.html
Expand Up @@ -104,8 +104,9 @@
</div>
</div>
</div>
<div modal="editRequirements.dialog.show">
<div ng-show="editRequirements.addProfileRequirementShow">

<script type="text/ng-template" id="addProfileRequirement">
<div>
<div class="modal-header">
<h4>Add New Profile Requirements
</h4>
Expand All @@ -126,7 +127,11 @@ <h4>Add New Profile Requirements
</button>
</div>
</div>
<div ng-show="editRequirements.addDependentProfileDialogShow">
</script>


<script type="text/ng-template" id="addDependentProfile">
<div>
<div class="modal-header">
<h4>Add Dependencies to Profile: <b>{{editRequirements.addDependentProfileDialogProfile}}</b>
</h4>
Expand All @@ -147,7 +152,11 @@ <h4>Add Dependencies to Profile: <b>{{editRequirements.addDependentProfileDialog
</button>
</div>
</div>
<div ng-hide="editRequirements.addProfileRequirementShow || editRequirements.addDependentProfileDialogShow">
</script>


<script type="text/ng-template" id="addProfileRequirements">
<div>
<form name="requirementsForm" class="form-inline no-bottom-margin">
<div class="modal-header">
<h4>Edit Requirements
Expand Down Expand Up @@ -202,5 +211,11 @@ <h4>Edit Requirements
</div>
</form>
</div>

</script>

<div modal="editRequirements.dialog.show">
<div compile="currentPage"></div>
</div>

</div>
Expand Up @@ -8,7 +8,7 @@ module Fabric {

public scope = false;

public controller($scope, $element, $attrs, jolokia, $location, workspace) {
public controller($scope, $element, $attrs, jolokia, $location, workspace, $templateCache) {

$scope.containerArgs = ["id", "alive", "parentId", "profileIds", "versionId", "provisionResult", "jolokiaUrl", "root", 'jmxDomains'];
$scope.profileFields = ["id", "hidden"];
Expand All @@ -24,6 +24,8 @@ module Fabric {
$scope.showSelect = true;
$scope.requirements = null;

$scope.currentPage = $templateCache.get("addProfileRequirements");

// for editing container requirements
$scope.editRequirements = {
dialog: new Core.Dialog(),
Expand Down Expand Up @@ -100,7 +102,7 @@ module Fabric {
// how / hide / add a requirement on new profile
addProfileRequirementOpen: () => {
$scope.editRequirements.selectedProfiles.splice(0, $scope.editRequirements.selectedProfiles.length);
$scope.editRequirements.excludeProfiles = $scope.activeProfiles.map(p => p.id) || [];
$scope.editRequirements.excludeProfiles = $scope.activeProfiles.map((p) => { return p.id; });
$scope.editRequirements.addProfileRequirementShow = true;
},

Expand All @@ -125,6 +127,26 @@ module Fabric {
}
};

$scope.$watch('editRequirements.addDependentProfileDialogShow', (newValue, oldValue) => {
if (newValue !== oldValue) {
if (newValue) {
$scope.currentPage = $templateCache.get("addDependentProfile");
} else {
$scope.currentPage = $templateCache.get("addProfileRequirements");
}
}
});

$scope.$watch('editRequirements.addProfileRequirementShow', (newValue, oldValue) => {
if (newValue !== oldValue) {
if (newValue) {
$scope.currentPage = $templateCache.get("addProfileRequirement")
} else {
$scope.currentPage = $templateCache.get("addProfileRequirements");
}
}
})


$scope.updateActiveContainers = () => {
var activeProfiles = $scope.activeProfiles;
Expand Down Expand Up @@ -470,9 +492,9 @@ module Fabric {

public templateUrl = Fabric.templatePath + "activeProfileList.html";

public controller($scope, $element, $attrs, jolokia, $location, workspace) {
public controller($scope, $element, $attrs, jolokia, $location, workspace, $templateCache) {

super.controller($scope, $element, $attrs, jolokia, $location, workspace);
super.controller($scope, $element, $attrs, jolokia, $location, workspace, $templateCache);

$scope.searchFilter = '';

Expand Down
Expand Up @@ -62,11 +62,11 @@ module Fabric {
$scope.profiles = $scope.profiles.exclude((p) => { return p.hidden; });

if ($scope.excludedProfiles) {
$scope.profiles = $scope.profiles.exclude((p) => { return $scope.excludedProfiles.some((e) => { return e === p.id; })});
$scope.profiles = $scope.excluded();
}

if ($scope.includedProfiles) {
$scope.profiles = $scope.profiles.exclude((p) => { return $scope.includedProfiles.none((e) => { return e === p.id; })});
$scope.profiles = $scope.included();
}

var paths = [];
Expand Down Expand Up @@ -94,6 +94,14 @@ module Fabric {
}
};

$scope.excluded = () => {
return $scope.profiles.exclude((p) => { return $scope.excludedProfiles.some((e) => { return e === p.id; })});
};

$scope.included = () => {
return $scope.profiles.exclude((p) => { return $scope.includedProfiles.none((e) => { return e === p.id; })});
}


$scope.isOpen = (branch) => {
if ($scope.filterText !== '') {
Expand All @@ -116,13 +124,13 @@ module Fabric {

$scope.$watch('includedProfiles', (newValue, oldValue) => {
if (newValue !== oldValue) {
$scope.init();
$scope.profiles = $scope.included();
}
}, true);

$scope.$watch('excludedProfiles', (newValue, oldValue) => {
if (newValue !== oldValue) {
$scope.init();
$scope.profiles = $scope.excluded();
}
}, true);

Expand Down

0 comments on commit ad353ec

Please sign in to comment.