Skip to content

Commit

Permalink
Fix #433 and switch over to hawtio-profile-selector directive for dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Aug 5, 2013
1 parent 98d44d6 commit b5cf79b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
6 changes: 3 additions & 3 deletions hawtio-web/src/main/webapp/app/fabric/html/fabricView.html
Expand Up @@ -239,8 +239,8 @@
</div>

<div modal="createProfileDialog">
<form name="createProfile" class="form-horizontal no-bottom-margin" ng-submit="doCreateProfile()">
<div class="modal-header"><h4>Create new Profile in Version {{version.id}}...</h4></div>
<form name="createProfile" class="form-horizontal no-bottom-margin" ng-submit="doCreateProfile(newProfileName, selectedParents)">
<div class="modal-header"><h4>Create new Profile in Version {{activeVersionId}}...</h4></div>
<div class="modal-body">
<label>Profile Name: </label>
<input name="id" class="input-xlarge" type="text" ng-model="newProfileName" required ng-pattern="/^[a-zA-Z0-9_-]*$/">
Expand All @@ -249,7 +249,7 @@

<p></p>
<label>Select one or more parent profiles as needed: </label>
<div class='dialogGrid' style="height: 250px;" ng-grid="createProfileGridOptions"></div>
<div fabric-profile-selector="selectedParents" version-id="activeVersionId"></div>
</div>
<div class="modal-footer">
<input class="btn btn-success" ng-disabled="!createProfile.$valid" type="submit" value="Create">
Expand Down
23 changes: 5 additions & 18 deletions hawtio-web/src/main/webapp/app/fabric/js/fabricView.ts
Expand Up @@ -31,7 +31,7 @@ module Fabric {
$scope.containers = [];
$scope.activeProfiles = [];

$scope.selectedVersion = {};
$scope.activeVersionId = '';
$scope.selectedContainers = [];
$scope.selectedProfiles = [];
$scope.selectedActiveProfiles = [];
Expand All @@ -58,21 +58,7 @@ module Fabric {

$scope.targetContainer = {};

// Data for profile/version creation dialogs
$scope.createProfileGridOptions = {
data: 'profiles',
selectedItems: $scope.selectedParents,
showSelectionCheckbox: true,
multiSelect: true,
selectWithCheckboxOnly: false,
keepLastSelected: false,
columnDefs: [
{
field: 'id',
displayName: 'Name'
}]
};

// Data for version creation dialog
$scope.createVersionGridOptions = {
data: 'versions',
selectedItems: $scope.selectedParentVersion,
Expand Down Expand Up @@ -179,9 +165,10 @@ module Fabric {


// create profile dialog action
$scope.doCreateProfile = () => {
$scope.doCreateProfile = (newProfileName, selectedParents) => {
$scope.newProfileName = newProfileName;
$scope.createProfileDialog = false;
var parents = $scope.selectedParents.map(function(profile) {return profile.id});
var parents = selectedParents.map(function(profile) {return profile.id});
createProfile(jolokia, $scope.activeVersionId, $scope.newProfileName, parents, function() {
notification('success', "Created profile " + $scope.newProfileName);
$scope.profileIdFilter = $scope.newProfileName;
Expand Down

0 comments on commit b5cf79b

Please sign in to comment.