You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/02/27 15:46:27 UTC

[04/50] [abbrv] stratos git commit: deployment policy added to configure section

deployment policy added to configure section


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

Branch: refs/heads/master-deployment-policy-fix-merge
Commit: 7395c2ef398705450b594e911018c900c0e10564
Parents: a3877dd
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Sun Feb 22 10:46:35 2015 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Fri Feb 27 19:40:39 2015 +0530

----------------------------------------------------------------------
 .../console/configure_form.jag                  | 12 ++++
 .../configure/configure_requests.jag            |  6 ++
 .../default/configure/deploymentpolicies.json   | 15 +++++
 .../schema/configure/deploymentpolicies.json    | 65 ++++++++++++++++++++
 .../console/controllers/menu/menu.json          |  9 +++
 .../console/controllers/rest/rest_calls.jag     | 17 ++++-
 .../themes/theme0/partials/configure_form.hbs   | 28 +++++++++
 7 files changed, 149 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/7395c2ef/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 93f41a4..9ed9882 100644
--- a/components/org.apache.stratos.manager.console/console/configure_form.jag
+++ b/components/org.apache.stratos.manager.console/console/configure_form.jag
@@ -86,6 +86,15 @@ if(isEdit == false && elements.action != 'new') {
             }
             break;
 
+        case "deploymentpolicies":
+            formTitle = "Deployment Policie",
+                    buttonText = "Deployment Policy";
+            list_data = util.RESTCalls.getPolicyDeployments();
+            if (list_data && list_data.length === 0) {
+                list_data = null;
+            }
+            break;
+
         case "cartridges":
             formTitle = "Cartridge",
                     buttonText = "Cartridge";
@@ -127,6 +136,9 @@ if (elements.action != 'new' && isEdit) {
         case "autoscalingpolicies":
             formDataEdit = util.RESTCalls.getPolicyAutoScale(id);
             break;
+        case "deploymentpolicies":
+            formDataEdit = util.RESTCalls.getPolicyDeployment(id);
+            break;
 
         case "partitions":
             formDataEdit = util.RESTCalls.getPartition(id);

http://git-wip-us.apache.org/repos/asf/stratos/blob/7395c2ef/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 8f8a58f..3cb0e6e 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
@@ -36,6 +36,9 @@ try {
         case "autoscalingpolicies":
             formSubmit = util.RESTCalls.deployAutoscalePolicyDefinition(formPayload);
             break;
+        case "deploymentpolicies":
+            formSubmit = util.RESTCalls.deployDeploymentPolicyDefinition(formPayload);
+            break;
         case "cartridges":
             formSubmit = util.RESTCalls.deployCartridgeDefinition(formPayload);
             break;
@@ -51,6 +54,9 @@ try {
         case "delete-autoscalingpolicy":
             formSubmit = util.RESTCalls.deleteAutoscalePolicyDefinition(formPayload);
             break;
+        case "delete-deploymentpolicy":
+            formSubmit = util.RESTCalls.deleteAutoscalePolicyDefinition(formPayload);
+            break;
         case "delete-kubernetes-cluster":
             formSubmit = util.RESTCalls.deleteKubernetesClusterDefinition(formPayload);
             break;

http://git-wip-us.apache.org/repos/asf/stratos/blob/7395c2ef/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/deploymentpolicies.json
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/deploymentpolicies.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/deploymentpolicies.json
new file mode 100644
index 0000000..a26afd8
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/deploymentpolicies.json
@@ -0,0 +1,15 @@
+{
+    "id": "deployment-policy-1",
+    "networkPartition": [
+        {
+            "id": "network-partition-1",
+            "partitionAlgo": "one-after-another",
+            "partitions": [
+                {
+                    "id": "partition-1",
+                    "max": 5
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/7395c2ef/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/deploymentpolicies.json
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/deploymentpolicies.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/deploymentpolicies.json
new file mode 100644
index 0000000..7155d1f
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/deploymentpolicies.json
@@ -0,0 +1,65 @@
+{
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "id": "root",
+    "type": "object",
+    "title":"Deployment Policy Definition",
+    "name": "Deployment Policy",
+    "options": {
+        "disable_properties": true,
+        "disable_collapse": true
+    },
+    "properties": {
+        "id": {
+            "id": "root/id",
+            "type": "string",
+            "title":"Deployment policy ID"
+        },
+        "networkPartition": {
+            "id": "root/networkPartition",
+            "title":"Network Partitions",
+            "type": "array",
+            "items": {
+                "id": "root/networkPartition/0",
+                "type": "object",
+                "properties": {
+                    "id": {
+                        "id": "root/networkPartition/0/id",
+                        "type": "string",
+                        "title":"Network Partition ID",
+                    },
+                    "partitionAlgo": {
+                        "id": "root/networkPartition/0/partitionAlgo",
+                        "type": "string",
+                        "title":"Network Partition Algorithm",
+                        "enum": ["round-robin", "one-after-another"],
+                        "maxItems":1
+                    },
+                    "partitions": {
+                        "id": "root/networkPartition/0/partitions",
+                        "type": "array",
+                        "items": {
+                            "id": "root/networkPartition/0/partitions/0",
+                            "type": "object",
+                            "properties": {
+                                "id": {
+                                    "id": "root/networkPartition/0/partitions/0/id",
+                                    "type": "string",
+                                    "title":"Partition ID",
+                                },
+                                "max": {
+                                    "id": "root/networkPartition/0/partitions/0/max",
+                                    "type": "integer",
+                                    "format": "number"
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    },
+    "required": [
+        "id",
+        "networkPartition"
+    ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/7395c2ef/components/org.apache.stratos.manager.console/console/controllers/menu/menu.json
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/menu/menu.json b/components/org.apache.stratos.manager.console/console/controllers/menu/menu.json
index 8f70645..1bfda32 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/menu/menu.json
+++ b/components/org.apache.stratos.manager.console/console/controllers/menu/menu.json
@@ -28,6 +28,15 @@
                     "description": "Define policies which specify inbound requests, memory usage and CPU usage etc."
                 },
                 {
+                    "link": "configure/deploymentpolicies/",
+                    "linkexternal": false,
+                    "context": "/configure",
+                    "title": "Deployment Policies",
+                    "icon": "fa-road",
+                    "permissionPaths": ["/permission", "/permission/admin"],
+                    "description": "Define specific policies for application deployment."
+                },
+                {
                     "link": "configure/cartridges/",
                     "linkexternal": false,
                     "context": "/configure",

http://git-wip-us.apache.org/repos/asf/stratos/blob/7395c2ef/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 b61d591..93fbfa9 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
@@ -60,15 +60,23 @@ RESTCalls = new function(){
         return this.send("POST","/tenant/availability/" + tenantDomain,{});
     };
 
-    this.deployDeploymentPolicyDefinition = function(applicationID, policyDefinition){
+    this.deployApplicationDeployment = function(applicationID, policyDefinition){
         return this.send("POST","/applications/"+applicationID+"/deploy",policyDefinition);
     };
 
+    this.deployDeploymentPolicyDefinition = function(policyDefinition){
+        return this.send("POST","/deploymentPolicies", policyDefinition);
+    };
+
     this.deployAutoscalePolicyDefinition = function(policyDefinition){
         return this.send("POST","/autoscalingPolicies",policyDefinition);
     };
 
-    this.deleteAutoscalePolicyDefinition = function(autoscalePolicyId){
+    this.deleteAutoscalePolicyDefinition = function(deploymentPolicyId){
+        return this.send("DELETE","/deploymentPolicies/" + deploymentPolicyId,{});
+    };
+
+    this.deleteDeploymentPolicyDefinition = function(autoscalePolicyId){
         return this.send("DELETE","/autoscalingPolicies/" + autoscalePolicyId,{});
     };
 
@@ -160,8 +168,11 @@ RESTCalls = new function(){
     this.getPolicyAutoScale = function(autoscalePolicyId){
         return this.sendReceive("GET","/autoscalingPolicies/"+autoscalePolicyId,{});
     };
+    this.getPolicyDeployment = function(deployemntPolicyId){
+        return this.sendReceive("GET","/deploymentPolicies/" + deployemntPolicyId ,{});
+    };
 
-    this.getPolicyDeployment = function(){
+    this.getPolicyDeployments = function(){
         return this.sendReceive("GET","/deploymentPolicies",{});
     };
     this.unsubscribeCartridge = function(alias){

http://git-wip-us.apache.org/repos/asf/stratos/blob/7395c2ef/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 64e240c..41aebb3 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
@@ -205,6 +205,34 @@
                         </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>
+                    {{/each}}
+                {{/ifCond}}
             </div>
         </div>
     </div>