Skip to content

Commit

Permalink
Fix #304
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed May 7, 2013
1 parent 45d9138 commit 7915c55
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Expand Up @@ -2,17 +2,17 @@

<div class="row-fluid">
<div class="tabbable hawtio-form-tabs" ng-model=activeTab>
<div class="tab-pane" title="Child Container" value='org.fusesource.fabric.api.CreateContainerChildOptions'>
<div class="tab-pane" title="Child Container" value='org_fusesource_fabric_api_CreateContainerChildOptions'>
<div simple-form name='create-child-container' data='schema' entity='entity'></div>
<button class='btn pull-right' ng-href="" hawtio-submit='create-child-container'><i class="icon-ok"></i> Create</button>
<button class='btn pull-right' ng-href="#/fabric/containers"><i class='icon-remove'></i> Cancel</button>
</div>
<div class="tab-pane" title="SSH Container" value='org.fusesource.fabric.api.CreateSshContainerOptions'>
<div class="tab-pane" title="SSH Container" value='org_fusesource_fabric_api_CreateSshContainerOptions'>
<div simple-form name='create-ssh-container' data='schema' entity='entity'></div>
<button class='btn pull-right' ng-href="" hawtio-submit='create-ssh-container'><i class="icon-ok"></i> Create</button>
<button class='btn pull-right' ng-href="#/fabric/containers"><i class='icon-remove'></i> Cancel</button>
</div>
<div class="tab-pane" title="Cloud Container" value='org.fusesource.fabric.api.CreateJCloudsContainerOptions'>
<div class="tab-pane" title="Cloud Container" value='org_fusesource_fabric_api_CreateJCloudsContainerOptions'>
<div simple-form name='create-cloud-container' data='schema' entity='entity'></div>
<button class='btn pull-right' ng-href="" hawtio-submit='create-cloud-container'><i class="icon-ok"></i> Create</button>
<button class='btn pull-right' ng-href="#/fabric/containers"><i class='icon-remove'></i> Cancel</button>
Expand Down
21 changes: 9 additions & 12 deletions hawtio-web/src/main/webapp/app/fabric/js/createContainer.ts
@@ -1,13 +1,15 @@
module Fabric {

export function CreateContainerController($scope, $window, workspace, jolokia) {
$scope.activeTab = 'org.fusesource.fabric.api.CreateContainerChildOptions';
$scope.activeTab = 'org_fusesource_fabric_api_CreateContainerChildOptions';
$scope.schema = {};
$scope.entity = {};

$scope.render = (response) => {
$scope.schema = $.parseJSON(response.value);
$scope.render = (optionSchema) => {

$scope.schema = Object.extended($window[optionSchema]).clone();
$scope.schema.description = '';

angular.forEach($scope.schema.properties, (value, key) => {
if (!value) {
delete $scope.schema.properties[key];
Expand All @@ -22,7 +24,7 @@ module Fabric {

switch($scope.activeTab) {

case 'org.fusesource.fabric.api.CreateContainerChildOptions':
case 'org_fusesource_fabric_api_CreateContainerChildOptions':
$scope.entity['providerType'] = 'child';

delete $scope.schema.properties['preferredAddress'];
Expand All @@ -33,17 +35,16 @@ module Fabric {

break;

case 'org.fusesource.fabric.api.CreateSshContainerOptions':
case 'org_fusesource_fabric_api_CreateSshContainerOptions':
$scope.entity['providerType'] = 'ssh';
delete $scope.schema.properties['parent'];
break;

case 'org.fusesource.fabric.api.CreateJCloudsContainerOptions':
case 'org_fusesource_fabric_api_CreateJCloudsContainerOptions':
$scope.entity['providerType'] = 'jclouds';
delete $scope.schema.properties['parent'];
break;
}
$scope.$apply();
}

$scope.onSubmit = (json, form) => {
Expand Down Expand Up @@ -75,11 +76,7 @@ module Fabric {
}

$scope.$watch('activeTab', () => {
jolokia.request({
type: 'exec', mbean: 'io.hawt.jsonschema:type=SchemaLookup',
operation: 'getSchemaForClass(java.lang.String)',
arguments: [$scope.activeTab]
}, onSuccess($scope.render));
$scope.render($scope.activeTab);
});
}

Expand Down

0 comments on commit 7915c55

Please sign in to comment.