Skip to content

Commit

Permalink
Fix various issues on container details page
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Aug 20, 2013
1 parent 940d5f3 commit 34c1b2c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
14 changes: 7 additions & 7 deletions hawtio-web/src/main/webapp/app/fabric/html/container.html
Expand Up @@ -140,8 +140,8 @@ <h1>{{row.id}}</h1>
<div class="span4">
<dl class="dl-horizontal">
<div class="btn-group pull-right">
<button class="btn" ng-click="addProfileDialog = true" title="Add new profiles to this container"><i class="icon-plus"></i> Add</button>
<button class="btn" ng-click="deleteProfileDialog = true" ng-disabled="selectedProfiles.length == 0"
<button class="btn" ng-click="addProfileDialog.open()" title="Add new profiles to this container"><i class="icon-plus"></i> Add</button>
<button class="btn" ng-click="deleteProfileDialog.open()" ng-disabled="selectedProfiles.length == 0"
title="Removes the selected profiles from this container"><i class="icon-remove"></i> Remove</button>
</div>
</dl>
Expand Down Expand Up @@ -192,7 +192,7 @@ <h1>{{row.id}}</h1>
</div>
</div>

<div hawtio-confirm-dialog="connectToContainerDialog" title="Connect to {{targetContainer.id}}?" ok-button-text="Connect" on-ok="connect()">
<div hawtio-confirm-dialog="connectToContainerDialog.show" title="Connect to {{targetContainer.id}}?" ok-button-text="Connect" on-ok="connect()">
<div class="dialog-body">
<p>Please enter the JMX user name and password for {{targetContainer.id}}:</p>
<div class="control-group">
Expand All @@ -218,7 +218,7 @@ <h1>{{row.id}}</h1>
</div>
</div>

<div hawtio-confirm-dialog="deleteProfileDialog"
<div hawtio-confirm-dialog="deleteProfileDialog.show"
ok-button-text="Delete"
on-ok="deleteProfiles()">
<div class="dialog-body">
Expand All @@ -232,19 +232,19 @@ <h1>{{row.id}}</h1>
</div>
</div>

<div modal="addProfileDialog">
<div modal="addProfileDialog.show">
<form name="addProfile" class="form-horizontal no-bottom-margin" ng-submit="addProfiles()">
<div class="modal-header"><h4>Add profiles to container: {{row.id}}</h4></div>
<div id="dialog-body" class="modal-body">
<label>Select one or more profiles to add to this container: </label>

<div fabric-profile-selector="selectedProfilesDialog" version-id="row.versionId" excluded-profiles="row.profileIds"></div>
<div fabric-profile-selector="$parent.selectedProfilesDialog" version-id="row.versionId" excluded-profiles="row.profileIds"></div>

</div>
<div class="modal-footer">
<input class="btn btn-success" ng-disabled="selectedProfilesDialog.length == 0" type="submit"
value="Add">
<input class="btn btn-primary" ng-click="addProfileDialog = false" value="Cancel">
<input class="btn btn-primary" ng-click="addProfileDialog.close()" value="Cancel">
</div>
</form>
</div>
Expand Down
16 changes: 12 additions & 4 deletions hawtio-web/src/main/webapp/app/fabric/js/container.ts
Expand Up @@ -11,7 +11,9 @@ module Fabric {
// TODO at least obfusicate this
$scope.password = localStorage['fabric.password'];


$scope.addProfileDialog = new Core.Dialog();
$scope.connectToContainerDialog = new Core.Dialog();
$scope.deleteProfileDialog = new Core.Dialog();

$scope.$watch('selectedProfiles', (newValue, oldValue) => {
if (newValue !== oldValue) {
Expand All @@ -23,7 +25,7 @@ module Fabric {
}, true);

$scope.doConnect = (container) => {
$scope.connectToContainerDialog = true;
$scope.connectToContainerDialog.open();
}


Expand All @@ -34,7 +36,7 @@ module Fabric {
localStorage['fabric.password'] = $scope.password;
}
Fabric.connect(localStorage, $scope.row, $scope.userName, $scope.password, true);
$scope.connectToContainerDialog = false;
$scope.connectToContainerDialog.close();
};

$scope.stop = () => {
Expand Down Expand Up @@ -87,9 +89,14 @@ module Fabric {
}
}

$scope.$watch('selectedProfilesDialog', (newValue, oldValue) => {
if (newValue !== oldValue) {
console.log("Selected profiles: ", $scope.selectedProfilesDialog);
}
}, true);

$scope.addProfiles = () => {
$scope.addProfileDialog = false;
$scope.addProfileDialog.close();
var addedProfiles = $scope.selectedProfilesDialog.map((p) => { return p.id });
var text = Core.maybePlural(addedProfiles.length, "profile");
addProfilesToContainer(jolokia, $scope.row.id, addedProfiles, () => {
Expand All @@ -105,6 +112,7 @@ module Fabric {


$scope.deleteProfiles = () => {
$scope.deleteProfileDialog.close();
var removedProfiles = $scope.selectedProfiles.map((p) => { return p.id });
var text = Core.maybePlural(removedProfiles.length, "profile");
removeProfilesFromContainer(jolokia, $scope.row.id, removedProfiles, () => {
Expand Down

0 comments on commit 34c1b2c

Please sign in to comment.