You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by da...@apache.org on 2015/05/12 03:07:47 UTC

[1/2] stratos git commit: implement update functionality with schema [STRATOS-1385]

Repository: stratos
Updated Branches:
  refs/heads/master 9fd334e74 -> 4dfd8f9b2


implement update functionality with schema [STRATOS-1385]


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/4dfd8f9b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/4dfd8f9b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/4dfd8f9b

Branch: refs/heads/master
Commit: 4dfd8f9b2d7288049e75a8637e1c45e9a01a77d7
Parents: 90ab95b
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Tue May 12 06:32:03 2015 +0530
Committer: Dakshika Jayathilaka <si...@gmail.com>
Committed: Tue May 12 06:32:59 2015 +0530

----------------------------------------------------------------------
 .../console/configure_form.jag                  |  70 +-
 .../configure/configure_requests.jag            |  15 +
 .../console/controllers/rest/rest_calls.jag     |  16 +
 .../themes/theme0/partials/configure_form.hbs   | 984 ++++++++++---------
 .../themes/theme0/renderers/configure_form.js   |   5 +-
 5 files changed, 628 insertions(+), 462 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/4dfd8f9b/components/org.apache.stratos.manager.console/console/configure_form.jag
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/configure_form.jag b/components/org.apache.stratos.manager.console/console/configure_form.jag
index aa6df6b..beeaa56 100644
--- a/components/org.apache.stratos.manager.console/console/configure_form.jag
+++ b/components/org.apache.stratos.manager.console/console/configure_form.jag
@@ -33,10 +33,10 @@ var log = new Log("apachestratos.configure_form"),
         uriMatcher = new URIMatcher(request.getRequestURI()),
         elements = uriMatcher.match('/{context}/configure/{formtype}/'),
         breadcrumbPathLevelOne = 'configure',
-        formDataEdit = editorCartridges = applicationHbs = '',
+        formDataEdit = formDataUpdate = editorCartridges = applicationHbs = '',
         isEdit = false,
         dependancy = '',
-        isForm = false;
+        isForm = isUpdate = false;
 
 //create left menu
 var leftMenu = menuGenerator(context, menuJson.menu, userPermissions);
@@ -44,11 +44,22 @@ var leftMenu = menuGenerator(context, menuJson.menu, userPermissions);
 
 if (!elements) {
     elements = uriMatcher.match('/{context}/configure/{formtype}/{action}/');
-    isForm = true;
 
-    if (elements.action != 'new') {
-        isEdit = true;
+    if(elements) {
+        isForm = true;
+
+        if (elements.action != 'new') {
+            isEdit = true;
+        }
+
+    }else{
+        elements = uriMatcher.match('/{context}/configure/{formtype}/{action}/{edit}');
+        if(elements.edit== 'edit'){
+            isUpdate = true;
+            isForm = true;
+        }
     }
+
     //load schema files to JSON editor
     try {
         var formData = require('controllers/forms/schema/configure/' + elements.formtype + '.json'),
@@ -56,11 +67,11 @@ if (!elements) {
                 formTitle = formData.title,
                 buttonText = formData.name;
     } catch (e) {
-            log.error(e.message);
-            error.push({"errorMessage": e.message});
+        log.error(e.message);
+        error.push({"errorMessage": e.message});
     }
 
-    if(elements.formtype == 'groups' && elements.action == 'new'){
+    if (elements.formtype == 'groups' && elements.action == 'new') {
         applicationHbs = 'applicationsGroupEditor';
         editorCartridges = util.RESTCalls.getCartridges();
     }
@@ -77,7 +88,7 @@ if(isEdit == false && elements.action != 'new') {
             formTitle = "Network Partition",
                     buttonText = "Network Partition";
             list_data = util.RESTCalls.getPartitions();
-            if (list_data.statusCode == '404') {
+            if (list_data.status == 'error') {
                 list_data = null;
             }
             break;
@@ -86,7 +97,7 @@ if(isEdit == false && elements.action != 'new') {
             formTitle = "Auto-scaling Policie",
                     buttonText = "Auto-scaling Policy";
             list_data = util.RESTCalls.getPolicyAutoScales();
-            if(list_data.statusCode == '404'){
+            if(list_data.status == 'error'){
                 list_data = null;
             }
             break;
@@ -95,7 +106,7 @@ if(isEdit == false && elements.action != 'new') {
             formTitle = "Deployment Policie",
                     buttonText = "Deployment Policy";
             list_data = util.RESTCalls.getPolicyDeployments();
-            if (list_data.statusCode == '404') {
+            if (list_data.status == 'error') {
                 list_data = null;
             }
             break;
@@ -104,7 +115,7 @@ if(isEdit == false && elements.action != 'new') {
             formTitle = "Cartridge",
                     buttonText = "Cartridge Definition";
             list_data = util.RESTCalls.getCartridges();
-            if (list_data.statusCode == '404') {
+            if (list_data.status == 'error') {
                 list_data = null;
             }
             break;
@@ -113,7 +124,7 @@ if(isEdit == false && elements.action != 'new') {
             formTitle = "Cartridge Group Definition",
                     buttonText = "Cartridge Group Definition";
             list_data = util.RESTCalls.getGroups();
-            if (list_data.statusCode == '404') {
+            if (list_data.status == 'error') {
                 list_data = null;
             }
             break;
@@ -122,7 +133,7 @@ if(isEdit == false && elements.action != 'new') {
             formTitle = "Kubernetes Cluster",
                     buttonText = "Kubernetes Cluster";
             list_data = util.RESTCalls.getKubernetesClusters();
-            if (list_data.statusCode == '404') {
+            if (list_data.status == 'error') {
                 list_data = null; //TODO endpoint doesn't return correct info
             }
             break;
@@ -150,7 +161,7 @@ if(isEdit == false && elements.action != 'new') {
 
 //get the detail view for each listing
 if (elements.action != 'new' && isEdit) {
-    formTitle = formData.title + ' Details - ' + elements.action;
+    formTitle = formData.title + ' Details: ' + elements.action;
 
     var formtype = elements.formtype,
             id = escape(elements.action);
@@ -185,6 +196,33 @@ if (elements.action != 'new' && isEdit) {
     }
 }
 
+//get the details for update view
+if(elements.action != 'new' && isUpdate){
+
+    formTitle = formData.title + ': ' + elements.action;
+
+    var formtype = elements.formtype,
+            id = escape(elements.action);
+
+    switch (formtype) {
+        case "partitions":
+            formDataUpdate = util.RESTCalls.getPartition(id);
+            break;
+        case "autoscalingpolicies":
+            formDataUpdate = util.RESTCalls.getPolicyAutoScale(id);
+            break;
+        case "deploymentpolicies":
+            formDataUpdate = util.RESTCalls.getPolicyDeployment(id);
+            break;
+        case "applicationpolicies":
+            formDataUpdate = util.RESTCalls.getPolicyApplication(id);
+            break;
+        case "cartridges":
+            formDataUpdate = util.RESTCalls.getCartridge(id);
+            break;
+    }
+}
+
 
 var caramelData = {
     breadcrumbPathLevelOne: breadcrumbPathLevelOne,
@@ -192,10 +230,12 @@ var caramelData = {
     left_menu: leftMenu,
     isForm: isForm,
     isEdit: isEdit,
+    isUpdate: isUpdate,
     dependancy:dependancy,
     editorCartridges: JSON.stringify(editorCartridges),
     applicationHbs: applicationHbs,
     formDataEdit: JSON.stringify(formDataEdit),
+    formDataUpdate: JSON.stringify(formDataUpdate),
     formTitle: formTitle,
     formDataRaw: JSON.stringify(formDataRaw),
     formData: JSON.stringify(formData),

http://git-wip-us.apache.org/repos/asf/stratos/blob/4dfd8f9b/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag b/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag
index caa8df1..3f9e24d 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag
+++ b/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag
@@ -72,6 +72,21 @@ try {
         case "delete-kubernetes-cluster":
             formSubmit = util.RESTCalls.deleteKubernetesClusterDefinition(formPayload);
             break;
+        case "update-partitions":
+            formSubmit = util.RESTCalls.updatePartitionDefinition(formPayload);
+            break;
+        case "update-autoscalingpolicies":
+            formSubmit = util.RESTCalls.updateAutoscalePolicyDefinition(formPayload);
+            break;
+        case "update-deploymentpolicies":
+            formSubmit = util.RESTCalls.updateDeploymentPolicyDefinition(formPayload);
+            break;
+        case "update-applicationpolicies":
+            formSubmit = util.RESTCalls.updateApplicationPolicyDefinition(formPayload);
+            break;
+        case "update-cartridges":
+            formSubmit = util.RESTCalls.updateCartridgeDefinition(formPayload);
+            break;
         default:
             session.put("deploy-status", { "message": "Sorry Endpoint Error", "status": "error" });
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/4dfd8f9b/components/org.apache.stratos.manager.console/console/controllers/rest/rest_calls.jag
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/rest/rest_calls.jag b/components/org.apache.stratos.manager.console/console/controllers/rest/rest_calls.jag
index 1fe0df2..7d5992d 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/rest/rest_calls.jag
+++ b/components/org.apache.stratos.manager.console/console/controllers/rest/rest_calls.jag
@@ -39,6 +39,10 @@ RESTCalls = new function(){
         return this.send("POST","/cartridges", cartridgeDefinition);
     };
 
+    this.updateCartridgeDefinition = function(cartridgeDefinition){
+        return this.send("PUT","/cartridges", cartridgeDefinition);
+    };
+
     this.deletePartiions = function(networkPartitionId){
         return this.send("DELETE","/networkPartitions/" + networkPartitionId,{});
     };
@@ -72,10 +76,18 @@ RESTCalls = new function(){
         return this.send("POST","/deploymentPolicies", policyDefinition);
     };
 
+    this.updateDeploymentPolicyDefinition = function(policyDefinition){
+        return this.send("PUT","/deploymentPolicies", policyDefinition);
+    };
+
     this.deployAutoscalePolicyDefinition = function(policyDefinition){
         return this.send("POST","/autoscalingPolicies",policyDefinition);
     };
 
+    this.updateAutoscalePolicyDefinition = function(policyDefinition){
+        return this.send("PUT","/autoscalingPolicies",policyDefinition);
+    };
+
     this.deleteDeploymentPolicyDefinition = function(deploymentPolicyId){
         return this.send("DELETE","/deploymentPolicies/" + deploymentPolicyId,{});
     };
@@ -104,6 +116,10 @@ RESTCalls = new function(){
         return this.send("POST","/applicationPolicies", applicationPolicyDefinition);
     };
 
+    this.updateApplicationPolicyDefinition = function(applicationPolicyDefinition){
+        return this.send("PUT","/applicationPolicies", applicationPolicyDefinition);
+    };
+
     this.deleteApplication = function(applicationId){
         return this.send("DELETE","/applications/" + applicationId,{});
     };

http://git-wip-us.apache.org/repos/asf/stratos/blob/4dfd8f9b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs
index c65f04f..dd941e9 100644
--- a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs
@@ -6,7 +6,11 @@
                     {{#if isEdit}}
                         <h1>{{formTitle}}</h1>
                     {{else}}
-                        <h1>Add New {{formTitle}}</h1>
+                        {{#if isUpdate}}
+                            <h1> {{formTitle}}</h1>
+                        {{else}}
+                            <h1>Add New {{formTitle}}</h1>
+                        {{/if}}
                     {{/if}}
                 {{else}}
                     <h1>{{formTitle}}</h1>
@@ -29,20 +33,37 @@
                                 </div>
                             </div>
                         {{else}}
-                        <div class='col-md-5'>
-                            <div class="editor-button">
-                                <span class='pull-left'>Editor
-                                <input type="checkbox" name="editor-view" id='editortoggle' checked>
-                                </span>
-                                <span class="auto-correct"><input type="checkbox" checked id="auto-correct-check">Auto correct with schema</span>
-                            </div>
+                            {{#if isUpdate}}
+                                <div class='col-md-5'>
+                                    <div class="editor-button">
+                                        <span class='pull-left'>Editor
+                                        <input type="checkbox" name="editor-view" id='editortoggle' checked>
+                                        </span>
+                                        <span class="auto-correct"><input type="checkbox" checked id="auto-correct-check">Auto correct with schema</span>
+                                    </div>
 
-                        </div>
-                        <div class='col-md-7'>
-                            <button class='btn btn-info btn-lg pull-right' type='button' id='deploy' data-form='{{formContext}}'> Add {{formTitle}}</button>
-                            <button class='btn btn-default btn-lg pull-right button-gap' type='button' onclick='window.location.replace(document.referrer)'> Cancel</button>
+                                </div>
+                                <div class='col-md-7'>
+                                    <button class='btn btn-info btn-lg pull-right' type='button' id='update' data-form='update-{{formContext}}'> Save</button>
+                                    <button class='btn btn-default btn-lg pull-right button-gap' type='button' onclick='window.location.replace(document.referrer)'> Cancel</button>
 
-                        </div>
+                                </div>
+                            {{else}}
+                                <div class='col-md-5'>
+                                    <div class="editor-button">
+                                        <span class='pull-left'>Editor
+                                        <input type="checkbox" name="editor-view" id='editortoggle' checked>
+                                        </span>
+                                        <span class="auto-correct"><input type="checkbox" checked id="auto-correct-check">Auto correct with schema</span>
+                                    </div>
+
+                                </div>
+                                <div class='col-md-7'>
+                                    <button class='btn btn-info btn-lg pull-right' type='button' id='deploy' data-form='{{formContext}}'> Add {{formTitle}}</button>
+                                    <button class='btn btn-default btn-lg pull-right button-gap' type='button' onclick='window.location.replace(document.referrer)'> Cancel</button>
+
+                                </div>
+                            {{/if}}
                         {{/if}}
                     </div>
                 </div>
@@ -64,487 +85,558 @@
         </div>
     </div>
     <div class="container content">
-        <div class="row text-center">
-
-            {{#if content_body.sections}}
-                <div class="row form-toolbar ">
-                    <div class="col-md-5 col-sm-3 text-left">
-                        <!--<input type="text" class="form-control" placeholder="Search">-->
-                        <div class="btn-group">
-                            <a href="#" id="list" class="btn btn-default">
-                                <i class="fa fa-list-ul"></i> List
-                            </a>
-                            <a href="#" id="grid" class="btn btn-default active">
-                                <i class="fa fa-th"></i> Grid
-                            </a>
-                        </div>
-                    </div>
-                    <div class="col-md-7 col-sm-3 text-right">
-                        <a type="button" class="btn btn-primary btn-lg add-button" href="new/">Add
-                            New {{buttonText}}</a>
-                    </div>
+    <div class="row text-center">
+
+    {{#if content_body.sections}}
+        <div class="row form-toolbar ">
+            <div class="col-md-5 col-sm-3 text-left">
+                <!--<input type="text" class="form-control" placeholder="Search">-->
+                <div class="btn-group">
+                    <a href="#" id="list" class="btn btn-default">
+                        <i class="fa fa-list-ul"></i> List
+                    </a>
+                    <a href="#" id="grid" class="btn btn-default active">
+                        <i class="fa fa-th"></i> Grid
+                    </a>
                 </div>
-            {{else}}
-                <div class="row no-item row-overide">
-                    <div class="row title">
-                        <h2>No {{buttonText}} Found..</h2>
-                        {{#if dependancy}}
-                            <h3>You need to add <i>{{dependancy}}</i> before {{formTitle}}</h3>
-                            <a type="button" class="btn btn-primary btn-lg" href="../{{dependancy}}/new/">Add New {{dependancy}}</a>
-                            {{else}}
-                            <a type="button" class="btn btn-primary btn-lg" href="new/">Add New {{buttonText}}</a>
-                        {{/if}}
+            </div>
+            <div class="col-md-7 col-sm-3 text-right">
+                <a type="button" class="btn btn-primary btn-lg add-button" href="new/">Add
+                    New {{buttonText}}</a>
+            </div>
+        </div>
+    {{else}}
+        <div class="row no-item row-overide">
+            <div class="row title">
+                <h2>No {{buttonText}} Found..</h2>
+                {{#if dependancy}}
+                    <h3>You need to add <i>{{dependancy}}</i> before {{formTitle}}</h3>
+                    <a type="button" class="btn btn-primary btn-lg" href="../{{dependancy}}/new/">Add New {{dependancy}}</a>
+                {{else}}
+                    <a type="button" class="btn btn-primary btn-lg" href="new/">Add New {{buttonText}}</a>
+                {{/if}}
 
+            </div>
+        </div>
+    {{/if}}
+
+    <div class="row general-table row-overide">
+        {{#ifCond formtype "==" "docker"}}
+            {{#each content_body.sections}}
+                <div class="block col-md-4 grid-group-item border-right">
+                    <div class="toggle-menu-icon">
+                        <i class="fa fa-gears "></i>
                     </div>
-                </div>
-            {{/if}}
-
-            <div class="row general-table row-overide">
-                {{#ifCond formtype "==" "docker"}}
-                    {{#each content_body.sections}}
-                        <div class="block col-md-4 grid-group-item border-right">
-                            <div class="toggle-menu-icon">
-                                <i class="fa fa-gears "></i>
-                            </div>
-                            <h2 class="truncate">{{clusterId}} </h2>
-
-                            <div class="toggle-menu-description">{{description}}</div>
-                            <div class="list-button" style="display: none;">
-                                <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                        id="{{clusterId}}" data-formtype="delete-kubernetes-cluster"> Delete</button>
-                                <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
-                                        data-url="{{url ""}}/configure/docker/{{clusterId}}/" > Details
-                                </button>
-                            </div>
-                            <div class="bottom-bar-wrapper">
-                                <div class="bottom-bar">
-                                    <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                            id="{{clusterId}}" data-formtype="delete-kubernetes-cluster"> Delete</button>
-                                    <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
-                                            data-url="{{url ""}}/configure/docker/{{clusterId}}/" > Details
-                                    </button>
-                                </div>
-                            </div>
+                    <h2 class="truncate">{{clusterId}} </h2>
+
+                    <div class="toggle-menu-description">{{description}}</div>
+                    <div class="list-button" style="display: none;">
+                        <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                id="{{clusterId}}" data-formtype="delete-kubernetes-cluster"> Delete</button>
+                        <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/docker/{{clusterId}}/" > Details
+                        </button>
+                    </div>
+                    <div class="bottom-bar-wrapper">
+                        <div class="bottom-bar">
+                            <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                    id="{{clusterId}}" data-formtype="delete-kubernetes-cluster"> Delete</button>
+                            <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
+                                    data-url="{{url ""}}/configure/docker/{{clusterId}}/" > Details
+                            </button>
                         </div>
-                    {{/each}}
-                {{/ifCond}}
-                {{#ifCond formtype "==" "cartridges"}}
-                    {{#each content_body.sections}}
-                        <div class="block col-md-4 grid-group-item border-right">
-                            <div class="toggle-menu-icon">
-                                <i class="fa icon-{{type}} fa-inbox "></i>
-                            </div>
-                            <h2 class="truncate">{{displayName}} </h2>
-
-                            <div class="toggle-menu-description">{{description}}</div>
-                            <div class="list-button" style="display: none;">
-                                <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                        id="{{type}}" data-formtype="delete-cartridge"> Delete</button>
-                                <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
-                                        data-url="{{url ""}}/configure/{{../formtype}}/{{type}}/" > Details
-                                </button>
-                            </div>
-                            <div class="bottom-bar-wrapper">
-                                <div class="bottom-bar">
-                                    <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                            id="{{type}}" data-formtype="delete-cartridge"> Delete</button>
-                                    <button class="btn btn-info btn-lg hover-details" type="button" id="details_"
-                                            data-url="{{url ""}}/configure/{{../formtype}}/{{type}}/" > Details
-                                    </button>
+                    </div>
+                </div>
+            {{/each}}
+        {{/ifCond}}
+        {{#ifCond formtype "==" "cartridges"}}
+            {{#each content_body.sections}}
+                <div class="block col-md-4 grid-group-item border-right">
+                    <div class="toggle-menu-icon">
+                        <i class="fa icon-{{type}} fa-inbox "></i>
+                    </div>
+                    <h2 class="truncate">{{displayName}} </h2>
+
+                    <div class="toggle-menu-description">{{description}}</div>
+                    <div class="list-button" style="display: none;">
+                        <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                id="{{type}}" data-formtype="delete-cartridge"> Delete</button>
+                        <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/{{../formtype}}/{{type}}/edit" > Edit
+                        </button>
+                        <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/{{../formtype}}/{{type}}/" > Details
+                        </button>
+                    </div>
+                    <div class="bottom-bar-wrapper">
+                        <div class="bottom-bar">
+                            <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                    id="{{type}}" data-formtype="delete-cartridge"> Delete</button>
+                            <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                    data-url="{{url ""}}/configure/{{../formtype}}/{{type}}/edit" > Edit
+                            </button>
+                            <button class="btn btn-info btn-lg hover-details" type="button" id="details_"
+                                    data-url="{{url ""}}/configure/{{../formtype}}/{{type}}/" > Details
+                            </button>
 
 
-                                </div>
-                            </div>
                         </div>
-                    {{/each}}
-                {{/ifCond}}
-                {{#ifCond formtype "==" "autoscalingpolicies"}}
-                    {{#each content_body.sections}}
-                        <div class="block col-md-4 col-xs-4 grid-group-item border-right">
-                            <div class="toggle-menu-icon">
-                                <i class="fa fa-expand "></i>
-                            </div>
-                            <h2 class="truncate">{{id}} </h2>
-
-                            <div class="toggle-menu-description">{{description}}</div>
-                            <div class="list-button" style="display: none;">
-                                <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                        id="{{id}}" data-formtype="delete-autoscalingpolicy"> Delete</button>
-                                <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
-                                        data-url="{{url ""}}/configure/autoscalingpolicies/{{id}}/" > Details
-                                </button>
-                            </div>
-                            <div class="bottom-bar-wrapper">
-                                <div class="bottom-bar">
-                                    <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                            id="{{id}}" data-formtype="delete-autoscalingpolicy"> Delete</button>
-                                    <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
-                                            data-url="{{url ""}}/configure/autoscalingpolicies/{{id}}/" > Details
-                                    </button>
-                                </div>
-                            </div>
+                    </div>
+                </div>
+            {{/each}}
+        {{/ifCond}}
+        {{#ifCond formtype "==" "autoscalingpolicies"}}
+            {{#each content_body.sections}}
+                <div class="block col-md-4 col-xs-4 grid-group-item border-right">
+                    <div class="toggle-menu-icon">
+                        <i class="fa fa-expand "></i>
+                    </div>
+                    <h2 class="truncate">{{id}} </h2>
+
+                    <div class="toggle-menu-description">{{description}}</div>
+                    <div class="list-button" style="display: none;">
+                        <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                id="{{id}}" data-formtype="delete-autoscalingpolicy"> Delete</button>
+                        <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/autoscalingpolicies/{{id}}/edit" > Edit
+                        </button>
+                        <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/autoscalingpolicies/{{id}}/" > Details
+                        </button>
+                    </div>
+                    <div class="bottom-bar-wrapper">
+                        <div class="bottom-bar">
+                            <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                    id="{{id}}" data-formtype="delete-autoscalingpolicy"> Delete</button>
+                            <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                    data-url="{{url ""}}/configure/autoscalingpolicies/{{id}}/edit" > Edit
+                            </button>
+                            <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
+                                    data-url="{{url ""}}/configure/autoscalingpolicies/{{id}}/" > Details
+                            </button>
                         </div>
-                    {{/each}}
-                {{/ifCond}}
-                {{#ifCond formtype "==" "partitions"}}
-                    {{#each content_body.sections}}
-                        <div class="block col-md-4 col-xs-4 grid-group-item border-right">
-                            <div class="toggle-menu-icon">
-                                <i class="fa fa-expand "></i>
-                            </div>
-                            <h2 class="truncate">{{id}} </h2>
-
-                            <div class="toggle-menu-description">{{description}}</div>
-                            <div class="list-button" style="display: none;">
-                                <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                        id="{{id}}" data-formtype="delete-partitions"> Delete</button>
-                                <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
-                                        data-url="{{url ""}}/configure/partitions/{{id}}/" > Details
-                                </button>
-                            </div>
-                            <div class="bottom-bar-wrapper">
-                                <div class="bottom-bar">
-                                    <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                            id="{{id}}" data-formtype="delete-partitions"> Delete</button>
-                                    <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
-                                            data-url="{{url ""}}/configure/partitions/{{id}}/" > Details
-                                    </button>
-                                </div>
-                            </div>
+                    </div>
+                </div>
+            {{/each}}
+        {{/ifCond}}
+        {{#ifCond formtype "==" "partitions"}}
+            {{#each content_body.sections}}
+                <div class="block col-md-4 col-xs-4 grid-group-item border-right">
+                    <div class="toggle-menu-icon">
+                        <i class="fa fa-expand "></i>
+                    </div>
+                    <h2 class="truncate">{{id}} </h2>
+
+                    <div class="toggle-menu-description">{{description}}</div>
+                    <div class="list-button" style="display: none;">
+                        <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                id="{{id}}" data-formtype="delete-partitions"> Delete</button>
+                        <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/partitions/{{id}}/edit" > Edit
+                        </button>
+                        <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/partitions/{{id}}/" > Details
+                        </button>
+                    </div>
+                    <div class="bottom-bar-wrapper">
+                        <div class="bottom-bar">
+                            <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                    id="{{id}}" data-formtype="delete-partitions"> Delete</button>
+                            <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                    data-url="{{url ""}}/configure/partitions/{{id}}/edit" > Edit
+                            </button>
+                            <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
+                                    data-url="{{url ""}}/configure/partitions/{{id}}/" > Details
+                            </button>
                         </div>
-                    {{/each}}
-                {{/ifCond}}
-                {{#ifCond formtype "==" "deploymentpolicies"}}
-                    {{#each content_body.sections}}
-                        <div class="block col-md-4 col-xs-4 grid-group-item border-right">
-                            <div class="toggle-menu-icon">
-                                <i class="fa fa-expand "></i>
-                            </div>
-                            <h2 class="truncate">{{id}} </h2>
-
-                            <div class="toggle-menu-description">{{description}}</div>
-                            <div class="list-button" style="display: none;">
-                                <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                        id="{{id}}" data-formtype="delete-deploymentpolicy"> Delete</button>
-                                <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
-                                        data-url="{{url ""}}/configure/deploymentpolicies/{{id}}/" > Details
-                                </button>
-                            </div>
-                            <div class="bottom-bar-wrapper">
-                                <div class="bottom-bar">
-                                    <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                            id="{{id}}" data-formtype="delete-deploymentpolicy"> Delete</button>
-                                    <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
-                                            data-url="{{url ""}}/configure/deploymentpolicies/{{id}}/" > Details
-                                    </button>
-                                </div>
-                            </div>
+                    </div>
+                </div>
+            {{/each}}
+        {{/ifCond}}
+        {{#ifCond formtype "==" "deploymentpolicies"}}
+            {{#each content_body.sections}}
+                <div class="block col-md-4 col-xs-4 grid-group-item border-right">
+                    <div class="toggle-menu-icon">
+                        <i class="fa fa-expand "></i>
+                    </div>
+                    <h2 class="truncate">{{id}} </h2>
+
+                    <div class="toggle-menu-description">{{description}}</div>
+                    <div class="list-button" style="display: none;">
+                        <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                id="{{id}}" data-formtype="delete-deploymentpolicy"> Delete</button>
+                        <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/deploymentpolicies/{{id}}/edit" > Edit
+                        </button>
+                        <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/deploymentpolicies/{{id}}/" > Details
+                        </button>
+                    </div>
+                    <div class="bottom-bar-wrapper">
+                        <div class="bottom-bar">
+                            <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                    id="{{id}}" data-formtype="delete-deploymentpolicy"> Delete</button>
+                            <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                    data-url="{{url ""}}/configure/deploymentpolicies/{{id}}/edit" > Edit
+                            </button>
+                            <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
+                                    data-url="{{url ""}}/configure/deploymentpolicies/{{id}}/" > Details
+                            </button>
                         </div>
-                    {{/each}}
-                {{/ifCond}}
-                {{#ifCond formtype "==" "applicationpolicies"}}
-                    {{#each content_body.sections}}
-                        <div class="block col-md-4 grid-group-item border-right">
-                            <div class="toggle-menu-icon">
-                                <i class="fa fa-th-large"></i>
-                            </div>
-                            <h2 class="truncate">{{id}} </h2>
-
-                            <div class="toggle-menu-description">{{description}} </div>
-                            <div class="list-button" style="display: none;">
-                                <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                        id="{{id}}"  data-formtype="delete-applicationpolicies"> Delete</button>
-                                <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
-                                        data-url="{{url ""}}/configure/applicationpolicies{{id}}/" > Details
-                                </button>
-                            </div>
-                            <div class="bottom-bar-wrapper">
-                                <div class="bottom-bar">
-                                    <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                            id="{{id}}" data-formtype="delete-applicationpolicies"> Delete</button>
-                                    <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
-                                            data-url="{{url ""}}/configure/applicationpolicies/{{id}}/" > Details
-                                    </button>
-                                </div>
-                            </div>
+                    </div>
+                </div>
+            {{/each}}
+        {{/ifCond}}
+        {{#ifCond formtype "==" "applicationpolicies"}}
+            {{#each content_body.sections}}
+                <div class="block col-md-4 grid-group-item border-right">
+                    <div class="toggle-menu-icon">
+                        <i class="fa fa-th-large"></i>
+                    </div>
+                    <h2 class="truncate">{{id}} </h2>
+
+                    <div class="toggle-menu-description">{{description}} </div>
+                    <div class="list-button" style="display: none;">
+                        <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                id="{{id}}"  data-formtype="delete-applicationpolicies"> Delete</button>
+                        <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/applicationpolicies/{{id}}/edit" > Edit
+                        </button>
+                        <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                data-url="{{url ""}}/configure/applicationpolicies/{{id}}/" > Details
+                        </button>
+                    </div>
+                    <div class="bottom-bar-wrapper">
+                        <div class="bottom-bar">
+                            <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                    id="{{id}}" data-formtype="delete-applicationpolicies"> Delete</button>
+                            <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
+                                    data-url="{{url ""}}/configure/applicationpolicies/{{id}}/edit" > Edit
+                            </button>
+                            <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{id}}"
+                                    data-url="{{url ""}}/configure/applicationpolicies/{{id}}/" > Details
+                            </button>
                         </div>
-                    {{/each}}
-                {{/ifCond}}
-                {{#ifCond formtype "==" "groups"}}
-                    {{#each content_body.sections}}
-                        <div class="block col-md-4 grid-group-item border-right">
-                            <div class="toggle-menu-icon">
-                                <i class="fa fa-th-large"></i>
-                            </div>
-                            <h2 class="truncate">{{name}} </h2>
-
-                            <div class="toggle-menu-description">{{description}} </div>
-                            <div class="list-button" style="display: none;">
-                                <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                        id="{{name}}" data-formtype="delete-groups"> Delete</button>
-                                <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{name}}"
-                                        data-url="{{url ""}}/configure/groups/{{name}}/" > Details
-                                </button>
-                            </div>
-                            <div class="bottom-bar-wrapper">
-                                <div class="bottom-bar">
-                                    <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                            id="{{name}}" data-formtype="delete-groups"> Delete</button>
-                                    <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{name}}"
-                                            data-url="{{url ""}}/configure/groups/{{name}}/" > Details
-                                    </button>
-                                </div>
-                            </div>
+                    </div>
+                </div>
+            {{/each}}
+        {{/ifCond}}
+        {{#ifCond formtype "==" "groups"}}
+            {{#each content_body.sections}}
+                <div class="block col-md-4 grid-group-item border-right">
+                    <div class="toggle-menu-icon">
+                        <i class="fa fa-th-large"></i>
+                    </div>
+                    <h2 class="truncate">{{name}} </h2>
+
+                    <div class="toggle-menu-description">{{description}} </div>
+                    <div class="list-button" style="display: none;">
+                        <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                id="{{name}}" data-formtype="delete-groups"> Delete</button>
+                        <button class="btn btn-info btn-lg hover-details" type="button" id="details_list_{{name}}"
+                                data-url="{{url ""}}/configure/groups/{{name}}/" > Details
+                        </button>
+                    </div>
+                    <div class="bottom-bar-wrapper">
+                        <div class="bottom-bar">
+                            <button class="btn btn-danger btn-lg hover-delete" type="button"
+                                    id="{{name}}" data-formtype="delete-groups"> Delete</button>
+                            <button class="btn btn-info btn-lg hover-details" type="button" id="details_{{name}}"
+                                    data-url="{{url ""}}/configure/groups/{{name}}/" > Details
+                            </button>
                         </div>
-                    {{/each}}
-                {{/ifCond}}
-            </div>
-        </div>
+                    </div>
+                </div>
+            {{/each}}
+        {{/ifCond}}
+    </div>
+    </div>
     </div>
 {{/if}}
 <script>
 
-    $(document).ready(function () {
+$(document).ready(function () {
 
-        //handled Ajax base session expire issue
-        $(document).ajaxError(function (e, xhr, settings) {
-            window.location.href = '../';
-        });
+    //handled Ajax base session expire issue
+    $(document).ajaxError(function (e, xhr, settings) {
+        window.location.href = '../';
+    });
 
-        {{#if isForm}}
-            // Set the default CSS theme and icon library globally
-            JSONEditor.defaults.theme = 'bootstrap3';
-            JSONEditor.defaults.iconlib = 'fontawesome4';
-            JSONEditor.defaults.show_errors = "always";
-
-            // This is the starting value for the editor
-            // We will use this to seed the initial editor
-            // and to provide a "Restore to Default" button.
-            {{#if isEdit}}
-                var starting_value = {{{formDataEdit}}};
+    {{#if isForm}}
+        // Set the default CSS theme and icon library globally
+        JSONEditor.defaults.theme = 'bootstrap3';
+        JSONEditor.defaults.iconlib = 'fontawesome4';
+        JSONEditor.defaults.show_errors = "always";
+
+        // This is the starting value for the editor
+        // We will use this to seed the initial editor
+        // and to provide a "Restore to Default" button.
+        {{#if isEdit}}
+            var starting_value = {{{formDataEdit}}};
+        {{else}}
+            {{#if isUpdate}}
+                var starting_value = {{{formDataUpdate}}};
             {{else}}
                 var starting_value = {{{formDataRaw}}};
             {{/if}}
+        {{/if}}
+
+        // Initialize the editor
+        var editor = new JSONEditor(document.getElementById('textform'), {
+            // Enable fetching schemas via ajax
+            ajax: false,
+            disable_edit_json: true,
+            //  disable_properties:true,
+            // The schema for the editor
+            schema: {{{formData}}},
+            format: "grid",
+
+            // Seed the form with a starting value
+            startval: starting_value
+        });
 
-            // Initialize the editor
-            var editor = new JSONEditor(document.getElementById('textform'), {
-                // Enable fetching schemas via ajax
-                ajax: false,
-                disable_edit_json: true,
-                //  disable_properties:true,
-                // The schema for the editor
-                schema: {{{formData}}},
-                format: "grid",
-
-                // Seed the form with a starting value
-                startval: starting_value
-            });
-
-            JSONEditor.prototype.showErrors = function () {
-                this.setOption('show_errors', 'always');
+        JSONEditor.prototype.showErrors = function () {
+            this.setOption('show_errors', 'always');
+        }
+        {{#if isEdit}}
+            editor.disable();
+            $('#jsoneditor').attr('readonly','readonly');
+        {{/if}}
+        {{#if isUpdate}}
+            if(editor.getEditor('root.id')){
+                editor.getEditor('root.id').disable();
+            }else if(editor.getEditor('root.type')){
+                editor.getEditor('root.type').disable();
             }
-            {{#if isEdit}}
-                editor.disable();
-                $('#jsoneditor').attr('readonly','readonly');
-            {{/if}}
+       {{/if}}
+
+        //    Hook up the validation indicator to update its
+        //    status whenever the editor changes
+        editor.on('change', function () {
+            // Get an array of errors from the validator
+            var errors = editor.validate();
+            if (errors.length) {
+                for (var i = 0; i < errors.length; i++) {
+                    var n = noty({text: errors[i].message + ' in ' + errors[i].path, layout: 'bottomRight',
+                        type: 'error', timeout: 2000});
+                }
 
-            //    Hook up the validation indicator to update its
-            //    status whenever the editor changes
-            editor.on('change', function () {
-                // Get an array of errors from the validator
-                var errors = editor.validate();
-                if (errors.length) {
-                    for (var i = 0; i < errors.length; i++) {
-                        var n = noty({text: errors[i].message + ' in ' + errors[i].path, layout: 'bottomRight',
-                            type: 'error', timeout: 2000});
-                    }
+            }
 
-                }
+        });
 
-            });
+        /**
+         * Function to handle hiding and showing the JSON form
+         */
+        $('input[name="editor-view"]').on('switchChange.bootstrapSwitch', function(event, state) {
+            if (isForm) {
+
+                changeDisplayMode('#textform', '#jsonform');
+                $('#editortoggle').text('Form View');
+                isForm = false;
+                $('textarea#jsoneditor').val(JSON.stringify(editor.getValue(), null, '\t'));
+            } else {
+
+                changeDisplayMode('#jsonform', '#textform');
+                $('#editortoggle').text('JSON Editor');
+                editor.validate();
+                editor.setValue(JSON.parse($('textarea#jsoneditor').val()));
+                isForm = true;
+                // Fire a change event to force revalidation
+                editor.onChange();
+            }
 
-            /**
-             * Function to handle hiding and showing the JSON form
-             */
-            $('input[name="editor-view"]').on('switchChange.bootstrapSwitch', function(event, state) {
-                if (isForm) {
+            if(state){
+                $('.auto-correct').css({"display":"block"});
+            }else{
+                $('.auto-correct').css({"display":"none"});
+            }
+        });
 
-                    changeDisplayMode('#textform', '#jsonform');
-                    $('#editortoggle').text('Form View');
-                    isForm = false;
-                    $('textarea#jsoneditor').val(JSON.stringify(editor.getValue(), null, '\t'));
-                } else {
 
-                    changeDisplayMode('#jsonform', '#textform');
-                    $('#editortoggle').text('JSON Editor');
-                    editor.validate();
-                    editor.setValue(JSON.parse($('textarea#jsoneditor').val()));
-                    isForm = true;
-                    // Fire a change event to force revalidation
-                    editor.onChange();
-                }
+        // Finding the height of the rendered form, and setting the JSON
+        // editor to the same height
+        var formHeight = $('#textform').height();
+        $('#jsoneditor').css('height', formHeight);
+
+        //handle changes happens on json editor
+        $('textarea#jsoneditor').on('keyup', function (event) {
+            //valiadate raw json and do validation
+            try {
+                var rawEditValidate = JSON.parse($('textarea#jsoneditor').val());
+                $(this).addClass("has-success").removeClass('has-error');
+                $('input[name="editor-view"]').bootstrapSwitch('readonly', false, true);
+                $('#deploy').prop('disabled', false);
+            } catch (e) {
+                $(this).addClass("has-error").removeClass('has-success');
+                $('#deploy').prop('disabled', true);
+                $('input[name="editor-view"]').bootstrapSwitch('readonly', true, false);
+                return false;
+            }
 
-                if(state){
-                    $('.auto-correct').css({"display":"block"});
+            var autoCorrect = $('#auto-correct-check:checked').val();
+
+            if (rawEditValidate && autoCorrect ) {
+
+                editor.setValue(rawEditValidate);
+                editor.onChange();
+                if (event.keyCode == '13' || event.keyCode == '32') {
                 }else{
-                    $('.auto-correct').css({"display":"none"});
-                }
-            });
-
-
-            // Finding the height of the rendered form, and setting the JSON
-            // editor to the same height
-            var formHeight = $('#textform').height();
-            $('#jsoneditor').css('height', formHeight);
-
-            //handle changes happens on json editor
-            $('textarea#jsoneditor').on('keyup', function (event) {
-                //valiadate raw json and do validation
-                try {
-                    var rawEditValidate = JSON.parse($('textarea#jsoneditor').val());
-                    $(this).addClass("has-success").removeClass('has-error');
-                    $('input[name="editor-view"]').bootstrapSwitch('readonly', false, true);
-                    $('#deploy').prop('disabled', false);
-                } catch (e) {
-                    $(this).addClass("has-error").removeClass('has-success');
-                    $('#deploy').prop('disabled', true);
-                    $('input[name="editor-view"]').bootstrapSwitch('readonly', true, false);
-                    return false;
+                    $('textarea#jsoneditor').val(JSON.stringify(editor.getValue(), null, '\t'));
                 }
 
-                var autoCorrect = $('#auto-correct-check:checked').val();
+            }else if(rawEditValidate){
+                editor.setValue(rawEditValidate);
+                editor.onChange();
+            }
 
-                if (rawEditValidate && autoCorrect ) {
+        });
 
-                    editor.setValue(rawEditValidate);
-                    editor.onChange();
-                    if (event.keyCode == '13' || event.keyCode == '32') {
-                    }else{
-                        $('textarea#jsoneditor').val(JSON.stringify(editor.getValue(), null, '\t'));
-                    }
+    {{else}}
+        $('.general-table .grid-group-item').hover(function () {
+            if($(this).hasClass('grid-group-item')) {
+                $(this).find('.bottom-bar').stop().animate({bottom: '37px'}, 'slow');
+            }
+        }, function () {
+            if($(this).hasClass('grid-group-item')) {
+                $(this).find('.bottom-bar').stop().animate({bottom: '-32px'}, 'slow');
+            }
+        });
 
-                }else if(rawEditValidate){
-                    editor.setValue(rawEditValidate);
-                    editor.onChange();
+        $('.general-table').on('click', '.hover-details', function (event) {
+            window.location = $(this).attr("data-url");
+        });
+    {{/if}}
+
+
+
+    $('#deploy').click(function () {
+
+        var payload = editor.getValue();
+        var btn = $(this);
+        var formtype = '{{formContext}}';
+        btn.html("<i class='fa fa-spinner fa-spin'></i> Adding...");
+        $.ajax({
+            type: "POST",
+            url: caramel.context + "/controllers/configure/configure_requests.jag",
+            dataType: 'json',
+            data: { "formPayload": JSON.stringify(payload), "formtype": formtype },
+            success: function (data) {
+                if (data.status == 'error') {
+                    var n = noty({text: data.message, layout: 'bottomRight', type: 'error'});
+                } else if (data.status == 'warning') {
+                    var n = noty({text: data.message, layout: 'bottomRight', type: 'warning'});
+                } else {
+                    var n = noty({text: data.message, layout: 'bottomRight', type: 'success'});
+                    window.setTimeout(function(){
+                        window.location.href = '../';
+                    }, 1500);
+                }
+            }
+        })
+                .always(function () {
+                    btn.html('Add ' + '{{formTitle}}');
+                });
+
+    });//end of deploy button trigger
+
+    $('#update').click(function () {
+
+        var payload = editor.getValue();
+        var btn = $(this);
+        var formtype = $(this).attr("data-form");
+        btn.html("<i class='fa fa-spinner fa-spin'></i> Saving...");
+        $.ajax({
+            type: "POST",
+            url: caramel.context + "/controllers/configure/configure_requests.jag",
+            dataType: 'json',
+            data: { "formPayload": JSON.stringify(payload), "formtype": formtype },
+            success: function (data) {
+                if (data.status == 'error') {
+                    var n = noty({text: data.message, layout: 'bottomRight', type: 'error'});
+                } else if (data.status == 'warning') {
+                    var n = noty({text: data.message, layout: 'bottomRight', type: 'warning'});
+                } else {
+                    var n = noty({text: data.message, layout: 'bottomRight', type: 'success'});
+                    window.setTimeout(function(){
+                        window.location.href = '../';
+                    }, 1500);
                 }
+            }
+        })
+                .always(function () {
+                    btn.html('Save');
+                });
+
+    });//end of deploy button trigger
+
+    $('.general-table').on('click', '.hover-delete', function (event) {
+
+        var payload =$(this).attr("id");
+        var formtype = $(this).attr("data-formtype");
+        var configType = '{{formtype}}';
+        noty({
+            layout: 'bottomRight',
+            type: 'warning',
+            text: 'Are you sure you want to delete '+configType+': <strong>'+$(this).attr("id") + "</strong> ?",
+            buttons: [
+                {addClass: 'btn btn-primary', text: 'Yes', onClick: function($noty) {
+                    $noty.close();
+
+                    $.ajax({
+                        type: "POST",
+                        url: caramel.context + "/controllers/configure/configure_requests.jag",
+                        dataType: 'json',
+                        data: { "formPayload": payload, "formtype": formtype },
+                        success: function (data) {
+                            if (data.status == 'error') {
+                                var n = noty({text: data.message, layout: 'bottomRight', type: 'error'});
+                            } else if (data.status == 'warning') {
+                                var n = noty({text: data.message, layout: 'bottomRight', type: 'warning'});
+                            } else {
+                                var n = noty({text: data.message, layout: 'bottomRight', type: 'success'});
+                                window.setTimeout(function(){
+                                    location.reload();
+                                }, 1000);
+                            }
+                        }
+                    }).always(function () {
 
-            });
+                    });
 
-        {{else}}
-            $('.general-table .grid-group-item').hover(function () {
-                if($(this).hasClass('grid-group-item')) {
-                    $(this).find('.bottom-bar').stop().animate({bottom: '37px'}, 'slow');
                 }
-            }, function () {
-                if($(this).hasClass('grid-group-item')) {
-                    $(this).find('.bottom-bar').stop().animate({bottom: '-32px'}, 'slow');
+                },
+                {addClass: 'btn btn-danger', text: 'No', onClick: function($noty) {
+                    $noty.close();
                 }
-            });
-
-            $('.general-table').on('click', '.hover-details', function (event) {
-                window.location = $(this).attr("data-url");
-            });
-        {{/if}}
-
-
-
-        $('#deploy').click(function () {
-
-            var payload = editor.getValue();
-            var btn = $(this);
-            var formtype = '{{formContext}}';
-                    btn.html("<i class='fa fa-spinner fa-spin'></i> Adding...");
-            $.ajax({
-                type: "POST",
-                url: caramel.context + "/controllers/configure/configure_requests.jag",
-                dataType: 'json',
-                data: { "formPayload": JSON.stringify(payload), "formtype": formtype },
-                success: function (data) {
-                    if (data.status == 'error') {
-                        var n = noty({text: data.message, layout: 'bottomRight', type: 'error'});
-                    } else if (data.status == 'warning') {
-                        var n = noty({text: data.message, layout: 'bottomRight', type: 'warning'});
-                    } else {
-                        var n = noty({text: data.message, layout: 'bottomRight', type: 'success'});
-                        window.setTimeout(function(){
-                            window.location.href = '../';
-                        }, 1500);
-                    }
                 }
-            })
-                    .always(function () {
-                        btn.html('Add ' + '{{formTitle}}');
-                    });
-
-        });//end of deploy button trigger
-
-        $('.general-table').on('click', '.hover-delete', function (event) {
-
-            var payload =$(this).attr("id");
-            var formtype = $(this).attr("data-formtype");
-            var configType = '{{formtype}}';
-            noty({
-                layout: 'bottomRight',
-                type: 'warning',
-                text: 'Are you sure you want to delete '+configType+': <strong>'+$(this).attr("id") + "</strong> ?",
-                buttons: [
-                    {addClass: 'btn btn-primary', text: 'Yes', onClick: function($noty) {
-                        $noty.close();
-
-                        $.ajax({
-                            type: "POST",
-                            url: caramel.context + "/controllers/configure/configure_requests.jag",
-                            dataType: 'json',
-                            data: { "formPayload": payload, "formtype": formtype },
-                            success: function (data) {
-                                if (data.status == 'error') {
-                                    var n = noty({text: data.message, layout: 'bottomRight', type: 'error'});
-                                } else if (data.status == 'warning') {
-                                    var n = noty({text: data.message, layout: 'bottomRight', type: 'warning'});
-                                } else {
-                                    var n = noty({text: data.message, layout: 'bottomRight', type: 'success'});
-                                    window.setTimeout(function(){
-                                        location.reload();
-                                    }, 1000);
-                                }
-                            }
-                        }).always(function () {
-
-                        });
-
-                    }
-                    },
-                    {addClass: 'btn btn-danger', text: 'No', onClick: function($noty) {
-                        $noty.close();
-                    }
-                    }
-                ]
-            });
+            ]
         });
+    });
 
-      //  $('div[data-schemapath="root"]').find('h3 span').first().css({"display":"none"} );
-
-        $.fn.bootstrapSwitch.defaults.onText = 'JSON';
-        $.fn.bootstrapSwitch.defaults.offText = 'UI';
-        $("[name='editor-view']").bootstrapSwitch('state', false, true);
+    //  $('div[data-schemapath="root"]').find('h3 span').first().css({"display":"none"} );
 
-        //handling inline help
-        $('.help-block').each(function( index ) {
-            $(this).addClass('notification');
-            if($(this).text() !=''){
-                $(this).parent().find('.control-label').after('<i class="fa fa-question-circle input-help-inline" ></i>');
-            }
-        });
+    $.fn.bootstrapSwitch.defaults.onText = 'JSON';
+    $.fn.bootstrapSwitch.defaults.offText = 'UI';
+    $("[name='editor-view']").bootstrapSwitch('state', false, true);
 
-        $('.help-block').hide();
-        $('.fa-question-circle').click(function(){
-            $(this).parent().find('.notification').toggle();
-        });
+    //handling inline help
+    $('.help-block').each(function( index ) {
+        $(this).addClass('notification');
+        if($(this).text() !=''){
+            $(this).parent().find('.control-label').after('<i class="fa fa-question-circle input-help-inline" ></i>');
+        }
+    });
 
-        $('.notification').on('click', function(){
-            $(this).hide();
-        });
+    $('.help-block').hide();
+    $('.fa-question-circle').click(function(){
+        $(this).parent().find('.notification').toggle();
+    });
 
+    $('.notification').on('click', function(){
+        $(this).hide();
     });
 
+});
+
 </script>

http://git-wip-us.apache.org/repos/asf/stratos/blob/4dfd8f9b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure_form.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure_form.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure_form.js
index a4992ed..b204a33 100644
--- a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure_form.js
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure_form.js
@@ -79,6 +79,7 @@ var render = function (theme, data, meta, require) {
                                 formDataEdit: data.formDataEdit,
                                 isForm: data.isForm,
                                 isEdit: data.isEdit,
+                                isUpdate: data.isUpdate,
                                 formTitle: data.formTitle
 
                             }
@@ -89,7 +90,7 @@ var render = function (theme, data, meta, require) {
                 break;
 
             default:
-            theme
+                theme
                 ('index', {
                     page_meta: [
                         {
@@ -146,6 +147,8 @@ var render = function (theme, data, meta, require) {
                                 dependancy: data.dependancy,
                                 isForm: data.isForm,
                                 isEdit: data.isEdit,
+                                isUpdate: data.isUpdate,
+                                formDataUpdate: data.formDataUpdate,
                                 formDataEdit: data.formDataEdit,
                                 content_body: {sections: data.list_data
                                 }


[2/2] stratos git commit: add partitionMax to network partitions

Posted by da...@apache.org.
add partitionMax to network partitions


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/90ab95bd
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/90ab95bd
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/90ab95bd

Branch: refs/heads/master
Commit: 90ab95bd1785708558ee15b86ffe1b397054b6b5
Parents: 9fd334e
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Tue May 12 04:53:47 2015 +0530
Committer: Dakshika Jayathilaka <si...@gmail.com>
Committed: Tue May 12 06:32:59 2015 +0530

----------------------------------------------------------------------
 .../controllers/forms/default/configure/partitions.json        | 3 ++-
 .../console/controllers/forms/schema/configure/partitions.json | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/90ab95bd/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/partitions.json
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/partitions.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/partitions.json
index 466da28..7002953 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/partitions.json
+++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/partitions.json
@@ -9,7 +9,8 @@
                     "name": "region",
                     "value": "default"
                 }
-            ]
+            ],
+            "partitionMax":0
         }
     ]
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/90ab95bd/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/partitions.json
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/partitions.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/partitions.json
index 2f6e3dc..495716f 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/partitions.json
+++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/partitions.json
@@ -57,6 +57,12 @@
                                 }
                             }
                         }
+                    },
+                    "partitionMax":{
+                        "id": "root/partitions/0/partitionMax",
+                        "type": "number",
+                        "format":"number",
+                        "title":"Partition Max"
                     }
                 }
             }