Skip to content

Commit

Permalink
Start on a create profile dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Apr 26, 2013
1 parent 2be480c commit 64864d6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
25 changes: 21 additions & 4 deletions hawtio-web/src/main/webapp/app/fabric/html/profiles.html
Expand Up @@ -4,7 +4,7 @@
<form class="form-inline no-bottom-margin">
<fieldset>
<div class="btn-group inline-block">
<a href="" title="Create new Profile" class="btn"><i class="icon-plus"></i></a>
<a href="" title="Create new Profile" class="btn" ng-click="createProfileDialog.open()"><i class="icon-plus"></i></a>
<a href="" title="Delete selected Profiles" class="btn" ng-disabled="selected.length == 0 || selectedHasContainers()" ng-click="deleteProfileDialog.open()"><i class="icon-minus"></i></a>
</div>

Expand Down Expand Up @@ -70,10 +70,27 @@
</form>
</div>

<div ng-hide="profiles.length > 0" class="row-fluid">
Please wait, loading profile data...
<div modal="createProfileDialog.show" close="createProfileDialog.close()" options="createProfileDialog.options">
<form name="createProfile" class="form-horizontal no-bottom-margin" ng-submit="createProfileDialog.close()">
<div class="modal-header"><h4>Create new Profile in Version {{version.id}}...</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_-]*$/">
<span class="help-block" ng-show="createProfile.id.$error.required">Please enter a name for this profile</span>
<span class="help-block" ng-show="createProfile.id.$error.pattern">Name can only contain letters, numbers, '-', and '_'</span>

<p></p>
<label>Select one or more parent profiles as needed: </label>
<div style="height: 250px;" ng-grid="createProfileGridOptions"></div>
</div>
<div class="modal-footer">
<input class="btn btn-success" ng-disabled="!createProfile.$valid" type="submit" ng-click="createProfile()" value="Create">
<input class="btn btn-primary" ng-click="createProfileDialog.close()" value="Cancel">
</div>
</form>
</div>
<div ng-show="profiles.length > 0" class="row-fluid">

<div class="row-fluid">
<div class="gridStyle" ng-grid="gridOptions"></div>
</div>
</div>
24 changes: 24 additions & 0 deletions hawtio-web/src/main/webapp/app/fabric/js/profiles.ts
Expand Up @@ -4,11 +4,16 @@ module Fabric {

$scope.defaultVersion = jolokia.execute(managerMBean, "defaultVersion()");
$scope.version = { id: $scope.defaultVersion.id };

$scope.selected = [];
$scope.selectedParents = [];

$scope.deleteVersionDialog = new Core.Dialog();
$scope.deleteProfileDialog = new Core.Dialog();

$scope.createProfileDialog = new Core.Dialog();
$scope.newProfileName = '';

var key = $location.search()['pv'];
if (key) {
$scope.version = { id: key };
Expand Down Expand Up @@ -40,6 +45,10 @@ module Fabric {
var q = $location.search();
q['pv'] = $scope.version.id;
$location.search(q);

if (oldValue === newValue) {
notification('info', "Please wait, fetching profile data for version" + $scope.version.id);
}

Core.unregister(jolokia, $scope);
Core.register(jolokia, $scope,[
Expand All @@ -62,6 +71,21 @@ module Fabric {
return $scope.profiles.findAll(function(item) {return item.containerCount > 0 }).length > 0;
}

$scope.createProfileGridOptions = {
data: 'profiles',
selectedItems: $scope.selectedParents,
showSelectionCheckbox: true,
multiSelect: true,
selectWithCheckboxOnly: false,
keepLastSelected: false,
columnDefs: [
{
field: 'id',
displayName: 'Name'
}]
}


$scope.gridOptions = {
data: 'profiles',
showFilter: false,
Expand Down

0 comments on commit 64864d6

Please sign in to comment.