fix for [STRATOS-1057], [STRATOS-1059], [STRATOS-1061], [STRATOS-1062], 
[STRATOS-1063], [STRATOS-1064], [STRATOS-1071], [STRATOS-1072], [STRATOS-1073], 
[STRATOS-1074]


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

Branch: refs/heads/master
Commit: 0251ad3aae15578a9bd00914bdbcea5859afa481
Parents: bb28c54
Author: Dakshika Jayathilaka <[email protected]>
Authored: Fri Jan 16 12:53:48 2015 +0530
Committer: Manula Thantriwatte <[email protected]>
Committed: Fri Jan 16 08:44:24 2015 +0000

----------------------------------------------------------------------
 .../console/applications_form.jag               |  51 +-
 .../console/config/acl.json                     |   6 -
 .../console/configure_form.jag                  | 129 +++--
 .../applications/application_requests.jag       |   3 +
 .../cartridges/subscription_requests.jag        |  43 --
 .../cartridges/unsubscription_requests.jag      |  39 --
 .../forms/default/applications/deployments.json |  17 -
 .../forms/default/configure/docker.json         |   2 +-
 .../forms/schema/applications/deployments.json  | 103 ----
 .../schema/configure/autoscalingpolicies.json   |   4 +-
 .../forms/schema/configure/cartridges.json      |   4 +
 .../forms/schema/configure/docker.json          |   4 +-
 .../controllers/forms/schema/users/tenants.json |   1 +
 .../controllers/forms/schema/users/users.json   |   6 +-
 .../console/controllers/menu/menu.json          |   2 +-
 .../console/controllers/menu/menu_generator.jag |   6 +-
 .../console/controllers/rest/rest_calls.jag     |  18 +-
 .../console/jaggery.conf                        |   8 -
 .../console/my_cartridges.jag                   |  71 ---
 .../console/my_cartridges_info.jag              |  65 ---
 .../console/themes/theme0/css/custom.css        |   2 +-
 .../theme0/css/custom/application_editor.css    |   4 +-
 .../css/custom/application_group_editor.css     | 156 +++++
 .../theme0/css/custom/applications_deploy.css   |   7 +
 .../console/themes/theme0/css/custom/style.css  |   9 +-
 .../jquery.contextMenu/jquery.contextMenu.css   | 142 +++++
 .../theme0/helpers/applications_editor.js       |   3 +-
 .../theme0/helpers/applications_group_editor.js |   9 +
 .../theme0/helpers/applications_topology.js     |   3 +-
 .../themes/theme0/helpers/applications_view.js  |   8 +
 .../themes/theme0/helpers/my_cartridges.js      |   7 -
 .../theme0/js/custom/applications-deploy.js     | 175 ++++++
 .../theme0/js/custom/applications-editor.js     | 198 ++++---
 .../theme0/js/custom/applications-view.js       | 203 +++++++
 .../js/custom/applications_group_editor.js      | 479 ++++++++++++++++
 .../theme0/js/custom/applications_topology.js   | 284 ++++++++++
 .../theme0/partials/applications_deploy.hbs     |   3 +-
 .../theme0/partials/applications_form.hbs       |  47 ++
 .../partials/applications_group_editor.hbs      | 147 +++++
 .../theme0/partials/applications_topology.hbs   | 288 +---------
 .../theme0/partials/applications_view.hbs       |  25 +
 .../themes/theme0/partials/configure_form.hbs   |  14 +-
 .../themes/theme0/partials/my_cartridges.hbs    | 122 ----
 .../theme0/partials/my_cartridges_info.hbs      |  22 -
 .../themes/theme0/partials/users_form.hbs       |  18 +-
 .../theme0/renderers/applications_form.js       | 568 ++++++++++++-------
 .../themes/theme0/renderers/configure.js        |   3 +-
 .../themes/theme0/renderers/my_cartridges.js    | 118 ----
 .../theme0/renderers/my_cartridges_info.js      | 116 ----
 .../console/themes/theme0/theme.js              |   7 +
 .../console/users_form.jag                      |  16 +-
 51 files changed, 2350 insertions(+), 1435 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/applications_form.jag
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/applications_form.jag 
b/components/org.apache.stratos.manager.console/console/applications_form.jag
index bdac23e..15b91a0 100644
--- 
a/components/org.apache.stratos.manager.console/console/applications_form.jag
+++ 
b/components/org.apache.stratos.manager.console/console/applications_form.jag
@@ -32,9 +32,8 @@ var log = new Log("apachestratos.applications_form"),
         uriMatcher = new URIMatcher(request.getRequestURI()),
         elements = uriMatcher.match('/{context}/applications/{formtype}/'),
         breadcrumbPathLevelOne = 'applications',
-        formDataEdit = topology_data = editorGroups = editorCartridges = '',
-        isEdit = applicationView = applicationEditor = isForm = false,
-        applicationDeploy = false,
+        formDataEdit = topologyData = editorGroups = editorCartridges = 
applicationHbs ='',
+        isEdit  = isForm = false,
         userPermissions = session.get('PERMISSIONS');
 
 //create left menu
@@ -46,27 +45,34 @@ if (!elements) {
 
     if(!elements){
         elements = 
uriMatcher.match('/{context}/applications/{formtype}/{applicationId}/{action}');
-        if(elements.action == 'view'){
+        var applicationName = elements.applicationId;
+        //get application json
+        var applicationJSON = 
util.RESTCalls.getApplicationJSON(applicationName);
 
+        if(elements.action == 'view'){
+            applicationHbs = 'applicationView';
         }else if(elements.action == 'deploy'){
-            var applicationName = elements.applicationId;
-            applicationDeploy = true;
-            //get application json
-            var applicationJSON = 
util.RESTCalls.getApplicationJSON(applicationName);
+            applicationHbs = 'applicationDeploy';
         }
 
     }else{
         isForm = true;
         if (elements.formtype == 'applications' && elements.action != 'new') {
-            applicationView = true;
-            topology_data = 
util.RESTCalls.getApplicationTopology(elements.action);
+
+            applicationHbs = 'applicationTopology';
+            topologyData = 
util.RESTCalls.getApplicationTopology(elements.action);
         }else if(elements.formtype == 'applications' && elements.action == 
'new'){
-            applicationEditor = true;
+            applicationHbs = 'applicationEditor';
             editorGroups =  util.RESTCalls.getGroups();
             editorCartridges = util.RESTCalls.getCartridges();
-        }else  if(elements.action != 'new'){
+        }else  if(elements.formtype == 'groups' && elements.action == 'new'){
+            applicationHbs = 'applicationsGroupEditor';
+            editorCartridges = util.RESTCalls.getCartridges();
+        }else  if(elements.formtype == 'groups' && elements.action != 'new'){
             isEdit = true;
+
         }
+
     }
 
 }
@@ -103,21 +109,6 @@ switch (formtype) {
             list_data = null;
         }
         break;
-    case "deployments":
-        list_data = util.RESTCalls.getPolicyDeployment(); //TODO fix with 
correct JSON
-        if(list_data == null) {
-            list_data = null;
-        }else{
-            formDataEdit = list_data;
-            for (specNumber in list_data) {
-                if (list_data[specNumber].id == elements.action) {
-                    formDataEdit = list_data[specNumber];
-                }
-
-            }
-            //TODO need to add listing with corrected JSON
-        }
-        break;
     default:
         error.push({"errorMessage":"Incorrect resource path found"});
 }
@@ -128,12 +119,10 @@ var caramelData = {
     isForm: isForm,
     isEdit: isEdit,
     appName: elements.action,
-    topology_data: JSON.stringify(topology_data),
+    topologyData: JSON.stringify(topologyData),
     editorGroups: JSON.stringify(editorGroups),
     editorCartridges: JSON.stringify(editorCartridges),
-    applicationView: applicationView,
-    applicationEditor: applicationEditor,
-    applicationDeploy:applicationDeploy,
+    applicationHbs: applicationHbs,
     applicationName:applicationName,
     applicationJSON:JSON.stringify(applicationJSON),
     formTitle: formTitle,

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/config/acl.json
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/config/acl.json 
b/components/org.apache.stratos.manager.console/console/config/acl.json
deleted file mode 100644
index 3101a67..0000000
--- a/components/org.apache.stratos.manager.console/console/config/acl.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-    "resourcePaths":{
-        "/permission/admin/restlogin":"/",
-        "":""
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/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 d7d9d0b..ed99962 100644
--- a/components/org.apache.stratos.manager.console/console/configure_form.jag
+++ b/components/org.apache.stratos.manager.console/console/configure_form.jag
@@ -49,82 +49,87 @@ if (!elements) {
     if (elements.action != 'new') {
         isEdit = true;
     }
-}
-
-try {
-    var formData = require('controllers/forms/schema/configure/' + 
elements.formtype + '.json'),
-            formDataRaw = require('controllers/forms/default/configure/' + 
elements.formtype + '.json'),
-            formTitle = formData.title,
-            buttonText = formData.name;
-} catch (e) {
-    log.error(e.message);
-    error.push({"errorMessage": e.message});
-}
+    //load schema files to JSON editor
+    try {
+        var formData = require('controllers/forms/schema/configure/' + 
elements.formtype + '.json'),
+                formDataRaw = require('controllers/forms/default/configure/' + 
elements.formtype + '.json'),
+                formTitle = formData.title,
+                buttonText = formData.name;
+    } catch (e) {
+            log.error(e.message);
+            error.push({"errorMessage": e.message});
+    }
 
-//get the title for view option
-if (elements.action != 'new' && isEdit) {
-    formTitle = formData.title + ' Details - ' + elements.action;
 }
 
-var formtype = elements.formtype;
+//get data for listing pages
+if(isEdit == false && elements.action != 'new') {
+    var formtype = elements.formtype;
 
-switch (formtype) {
-
-    case "autoscalingpolicies":
-        list_data = util.RESTCalls.getPolicyAutoScale();
-        if (list_data && list_data.length === 0) {
-            list_data = null;
-        }else{
-            formDataEdit = list_data;
-            for (specNumber in list_data) {
-                if (list_data[specNumber].id == elements.action) {
-                    formDataEdit = list_data[specNumber];
-                }
+    switch (formtype) {
 
+        case "autoscalingpolicies":
+            formTitle = "Auto-scaling Policie",
+                    buttonText = "Auto-scaling Policy";
+            list_data = util.RESTCalls.getPolicyAutoScales();
+            if (list_data && list_data.length === 0) {
+                list_data = null;
             }
-        }
-        break;
-
-    case "cartridges":
-        list_data = util.RESTCalls.getCartridges();
-        if (list_data && list_data.length === 0) {
-            list_data = null;
-        } else{
-            formDataEdit = list_data;
-            for (specNumber in list_data) {
-                if (list_data[specNumber].type == elements.action) {
-                    formDataEdit = list_data[specNumber];
-                }
-
+            break;
+
+        case "cartridges":
+            formTitle = "Cartridge",
+                    buttonText = "Cartridge";
+            list_data = util.RESTCalls.getCartridges();
+            if (list_data && list_data.length === 0) {
+                list_data = null;
             }
-        }
-        break;
-
-    case "docker":
-        list_data = util.RESTCalls.getKubernetesClusters();
-        if(list_data == null){
-            list_data = null; //TODO endpoint doesn't return correct info
-        }else{
-            formDataEdit = list_data.kubernetesCluster;
-            for (specNumber in list_data) {
-                if (list_data[specNumber].groupId == elements.action) {
-                    formDataEdit = list_data[specNumber];
-                }
-
+            break;
+
+        case "docker":
+            formTitle = "Docker Cluster",
+                    buttonText = "Docker Cluster";
+            list_data = util.RESTCalls.getKubernetesClusters();
+            if (list_data == null) {
+                list_data = null; //TODO endpoint doesn't return correct info
             }
-        }
-        break;
+            break;
 
-    default:
-        error.push({"errorMessage":"Incorrect resource path found"});
+        default:
+            error.push({"errorMessage": "Incorrect resource path found"});
 
-}
+    }
 
 //check user has permission to access endpoints
-if (list_data != null && list_data.hasOwnProperty('Error')) {
-    error.push(list_data.Error);
+    if (list_data != null && list_data.hasOwnProperty('Error')) {
+        error.push(list_data.Error);
+    }
+
 }
 
+//get the detail view for each listing
+if (elements.action != 'new' && isEdit) {
+    formTitle = formData.title + ' Details - ' + elements.action;
+
+    var formtype = elements.formtype,
+            id = escape(elements.action);
+
+    switch (formtype) {
+        case "autoscalingpolicies":
+            formDataEdit = util.RESTCalls.getPolicyAutoScale(id);
+            break;
+
+        case "cartridges":
+            formDataEdit = util.RESTCalls.getCartridge(id);
+            break;
+
+        case "docker":
+            formDataEdit = util.RESTCalls.getKubernetesCluster(id);
+            break;
+    }
+}
+
+
 var caramelData = {
     breadcrumbPathLevelOne: breadcrumbPathLevelOne,
     breadcrumbPathLevelTwo: elements.formtype,

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/applications/application_requests.jag
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/applications/application_requests.jag
 
b/components/org.apache.stratos.manager.console/console/controllers/applications/application_requests.jag
index 5d1534b..87ea0b0 100644
--- 
a/components/org.apache.stratos.manager.console/console/controllers/applications/application_requests.jag
+++ 
b/components/org.apache.stratos.manager.console/console/controllers/applications/application_requests.jag
@@ -34,6 +34,9 @@ try {
         case "groups":
             formSubmit = util.RESTCalls.deployGroupDefinition(formPayload);
             break;
+        case "deletegroups":
+            formSubmit = util.RESTCalls.deleteGroup(formPayload);
+            break;
         case "applications":
             formSubmit = 
util.RESTCalls.deployApplicationDefinition(formPayload);
             break;

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/cartridges/subscription_requests.jag
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/cartridges/subscription_requests.jag
 
b/components/org.apache.stratos.manager.console/console/controllers/cartridges/subscription_requests.jag
deleted file mode 100644
index 1ede803..0000000
--- 
a/components/org.apache.stratos.manager.console/console/controllers/cartridges/subscription_requests.jag
+++ /dev/null
@@ -1,43 +0,0 @@
-<%
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-var log = new Log("apachestratos.subscription_request"),
-        util = require('/controllers/rest/rest_calls.jag'),
-        formPayload = request.getParameter('formPayload'),
-        formtype = request.getParameter('formtype'),
-        formSubmit;
-
-//add login validator for pages
-include('/controllers/login/validator.jag');
-
-try {
-    if(formtype == 'subscribe'){
-        formSubmit = 
util.RESTCalls.subscribeToCartridge(JSON.parse(formPayload));
-
-    }
-
-}catch(e){
-    log.info(e);
-}
-
-
-print(session.get("get-status"));
-%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/cartridges/unsubscription_requests.jag
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/cartridges/unsubscription_requests.jag
 
b/components/org.apache.stratos.manager.console/console/controllers/cartridges/unsubscription_requests.jag
deleted file mode 100644
index fed63fc..0000000
--- 
a/components/org.apache.stratos.manager.console/console/controllers/cartridges/unsubscription_requests.jag
+++ /dev/null
@@ -1,39 +0,0 @@
-<%
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-var log = new Log("apachestratos.subscription_request"),
-        util = require('/controllers/rest/rest_calls.jag'),
-        cartridge_name = request.getParameter('cartridge_name'),
-        formSubmit;
-
-//add login validator for pages
-include('/controllers/login/validator.jag');
-
-try {
-    formSubmit = util.RESTCalls.unsubscribeCartridge(cartridge_name);
-}catch(e){
-    log.info(e);
-}
-
-log.info(formSubmit)
-
-print(session.get("deploy-status"));
-%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/deployments.json
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/deployments.json
 
b/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/deployments.json
deleted file mode 100644
index feb94cb..0000000
--- 
a/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/deployments.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-    "id":"dakshika-ec2",
-    "description":"Deployment policy description",
-    "isPublic":false,
-    "partitionGroup":{
-        "id":"ec2",
-        "partitionAlgo":"one-after-another",
-        "partition":[
-            {
-                "id":"P1",
-                "description":"description",
-                "partitionMax":"3",
-                "partitionMin":"1"
-            }
-        ]
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/docker.json
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/docker.json
 
b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/docker.json
index 0f5b02b..7c05cd0 100644
--- 
a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/docker.json
+++ 
b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/docker.json
@@ -1,5 +1,5 @@
 {
-    "groupId": "KubGrp1",
+    "clusterId": "KubGrp1",
     "description": "Kubernetes CoreOS cluster on EC2 ",
     "kubernetesMaster": {
         "hostId": "KubHostMaster1",

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/deployments.json
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/deployments.json
 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/deployments.json
deleted file mode 100644
index 647d028..0000000
--- 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/deployments.json
+++ /dev/null
@@ -1,103 +0,0 @@
-{
-    "type":"object",
-    "$schema": "http://json-schema.org/draft-04/schema";,
-    "id": "root",
-    "title": "Deployment Definition",
-    "name": "Deployment Policy",
-    "options": {
-        "disable_properties": true,
-        "disable_collapse": true
-    },
-    "required":[],
-    "properties":{
-        "id": {
-            "type":"string",
-            "id": "root/id",
-            "title": "Deployment Policy ID",
-            "name": "Deployment Policy ID",
-            "default": "isuruh-ec2",
-            "maxItems":1
-        },
-        "description": {
-            "type":"string",
-            "id": "root/description",
-            "title": "Description",
-            "name": "Description",
-            "maxItems":1
-        },
-        "isPublic": {
-            "type":"boolean",
-            "id": "root/isPublic",
-            "title": "Is Public",
-            "name": "Is Public",
-            "default": false,
-            "maxItems":1
-        },
-        "partitionGroup": {
-            "type":"object",
-            "id": "root/partitionGroup",
-            "title": "Partition Group",
-            "name": "Partition Group",
-            "required":["id","partitionAlgo","partition"],
-            "properties":{
-                "id": {
-                    "type":"string",
-                    "id": "root/partitionGroup/id",
-                    "title": "Partition Group ID",
-                    "name": "Partition Group ID",
-                    "default": "ec2",
-                    "maxItems":1
-                },
-                "partitionAlgo": {
-                    "type":"string",
-                    "id": "root/partitionGroup/partitionAlgo",
-                    "title": "Partition Algorithm",
-                    "name": "Partition Algorithm",
-                    "default": "one-after-another",
-                    "enum": ["round-robin", "one-after-another"],
-                    "maxItems":1
-                },
-                "partition": {
-                    "type":"array",
-                    "id": "root/partitionGroup/partition",
-                    "title": "Partition",
-                    "name": "Partition",
-                    "minItems":1,
-                    "items":
-                    {
-                        "type":"object",
-                        "id": "root/partitionGroup/partition/0",
-                        "required":["id","partitionMin","partitionMax"],
-                        "format": "grid",
-                        "properties":{
-                            "id": {
-                                "type":"string",
-                                "id": "root/partitionGroup/partition/0/id",
-                                "default": "P1",
-
-                            },
-                            "partitionMax": {
-                                "type":"string",
-                                "id": 
"root/partitionGroup/partition/0/partitionMax",
-                                "default": "3",
-                            },
-                            "partitionMin": {
-                                "type":"string",
-                                "id": 
"root/partitionGroup/partition/0/partitionMin",
-                                "default": "1",
-                            },
-                            "description": {
-                                "type": "string",
-                                "id": 
"root/partitionGroup/partition/0/description",
-                                "default": "description",
-
-                            }
-                        }
-                    }
-
-
-                }
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/autoscalingpolicies.json
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/autoscalingpolicies.json
 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/autoscalingpolicies.json
index f65e758..70f88c8 100644
--- 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/autoscalingpolicies.json
+++ 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/autoscalingpolicies.json
@@ -2,8 +2,8 @@
     "type":"object",
     "$schema": "http://json-schema.org/draft-04/schema";,
     "id": "root",
-    "title":"Auto Scaling Policy Definition",
-    "name": "Auto Scaling Policy",
+    "title":"Auto-scaling Policy Definition",
+    "name": "Auto-scaling Policy",
     "options": {
         "disable_properties": true,
         "disable_collapse": true

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/cartridges.json
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/cartridges.json
 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/cartridges.json
index f48590c..a3076e1 100644
--- 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/cartridges.json
+++ 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/cartridges.json
@@ -16,6 +16,7 @@
             "id": "root/type",
             "title": "Type",
             "name": "Type",
+            "minLength":2,
             "default": "php",
             "propertyOrder": 1,
             "maxItems": 1
@@ -46,6 +47,7 @@
             "title": "Provider",
             "name": "Provider",
             "default": "apache",
+            "minLength":2,
             "propertyOrder": 3,
             "maxItems": 1
         },
@@ -56,6 +58,7 @@
             "name": "Host",
             "default": "stratos.org",
             "propertyOrder": 4,
+            "minLength":2,
             "maxItems": 1
         },
         "displayName": {
@@ -73,6 +76,7 @@
             "title": "Description",
             "name": "Description",
             "default": "LB Cartridge",
+            "minLength":5,
             "propertyOrder": 6,
             "maxItems": 1
         },

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/docker.json
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/docker.json
 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/docker.json
index 4f2e710..2f23e59 100644
--- 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/docker.json
+++ 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/docker.json
@@ -11,9 +11,9 @@
             "default": "Kubernetes CoreOS cluster on EC2 ",
             "required":false
         },
-        "groupId": {
+        "clusterId": {
             "type":"string",
-            "id": "root/groupId",
+            "id": "root/clusterId",
             "default": "KubGrp1",
             "required":false
         },

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/tenants.json
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/tenants.json
 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/tenants.json
index d8b07ee..a8a7ed2 100644
--- 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/tenants.json
+++ 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/tenants.json
@@ -20,6 +20,7 @@
         "adminPassword": {
             "type":"string",
             "id": "root/adminPassword",
+            "format":"password",
             "default": "admin123",
             "title": "Admin user password",
             "name": "Admin user password"

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/users.json
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/users.json
 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/users.json
index 8c0218e..93fa6f3 100644
--- 
a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/users.json
+++ 
b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/users.json
@@ -2,7 +2,7 @@
     "type":"object",
     "$schema": "http://json-schema.org/draft-04/schema";,
     "id": "root",
-    "title": "Users",
+    "title": "User",
     "options": {
         "disable_properties": true,
         "disable_collapse": true
@@ -14,11 +14,15 @@
             "id": "root/userName",
             "title": "User Name",
             "name": "User Name",
+            "minLength":4,
+            "required":true,
             "default": ""
         },
         "credential": {
             "type":"string",
             "id": "root/credential",
+            "minLength":6,
+            "format":"password",
             "title": "Password",
             "name": "Password",
             "default": ""

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/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 8019ddb..84f731b 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
@@ -13,7 +13,7 @@
                     "link": "configure/autoscalingpolicies/",
                     "linkexternal": false,
                     "context": "/configure",
-                    "title": "Autoscaling Policies",
+                    "title": "Auto-scaling Policies",
                     "icon": "fa-expand",
                     "permissionPaths": ["/permission", "/permission/admin", 
"/permission/admin/manage/view/autoscalingpolicy"],
                     "description": "Define policies which specify inbound 
requests, memory usage and CPU usage etc."

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/controllers/menu/menu_generator.jag
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/controllers/menu/menu_generator.jag
 
b/components/org.apache.stratos.manager.console/console/controllers/menu/menu_generator.jag
index e075964..5cd8e26 100644
--- 
a/components/org.apache.stratos.manager.console/console/controllers/menu/menu_generator.jag
+++ 
b/components/org.apache.stratos.manager.console/console/controllers/menu/menu_generator.jag
@@ -30,6 +30,7 @@ var log = new Log("controller.menu_generator");
 function menuGenerator(context, jsonobject, permissions) {
     var menupermission,
             link='',
+            target = '_self',
             menu_html = '';
 
     if (permissions instanceof Array) {
@@ -40,10 +41,11 @@ function menuGenerator(context, jsonobject, permissions) {
             if (hasPermission.length > 0) {
                 if(jsonPermission.linkexternal){
                     link = jsonPermission.link;
+                    target = "_blank";
                 }else{
                     link = context + '/' + jsonPermission.link;
                 }
-                menu_html += '<li><a href="'+ link + '">' +
+                menu_html += '<li><a href="'+ link + '" target="'+target+'">' +
                         '<i class="fa ' + jsonPermission.icon + '"></i>' +
                         jsonPermission.title + '</a>';
                 if (jsonPermission.hasOwnProperty('sub-menu')) {
@@ -55,7 +57,7 @@ function menuGenerator(context, jsonobject, permissions) {
 
                         if (hasSubmenuPermission.length > 0) {
                             menu_html += '<li><a href="' + context + '/' + 
jsonSubmenuPermission.link +
-                                    '"><i class="fa ' + 
jsonSubmenuPermission.icon + '"></i>' + jsonSubmenuPermission.title + 
'</a></li>';
+                                    '" target="'+target+'"><i class="fa ' + 
jsonSubmenuPermission.icon + '"></i>' + jsonSubmenuPermission.title + 
'</a></li>';
                         }
                     }
                     menu_html += '</ul></li>';

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/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 be8beb6..9ff5dfe 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
@@ -79,6 +79,10 @@ RESTCalls = new function(){
         return this.send("POST","/applications/"+applicationId+"/undeploy",{});
     };
 
+    this.deleteGroup = function(groupName){
+        return this.send("DELETE","/groups/" + groupName,{});
+    };
+
     this.subscribeToCartridge = function(cartridgeBeanInfo){
         return this.sendReceive("POST","/cartridge/subscribe", 
cartridgeBeanInfo);
     };
@@ -108,6 +112,10 @@ RESTCalls = new function(){
         return this.sendReceive("GET","/kubernetesClusters",{});
     };
 
+    this.getKubernetesCluster = function(kubernetesClusterId){
+        return 
this.sendReceive("GET","/kubernetesClusters/"+kubernetesClusterId,{});
+    };
+
     this.getApplicableDeploymentPolicies = function(cartridgeType){
         return this.sendReceive("GET","/" + cartridgeType + 
"/policy/deployment/",{});
     };
@@ -120,10 +128,14 @@ RESTCalls = new function(){
         return this.sendReceive("GET","/service/" + cartridgeType,{});
     };
 
-    this.getPolicyAutoScale = function(){
+    this.getPolicyAutoScales = function(){
         return this.sendReceive("GET","/autoscalingPolicies",{});
     };
 
+    this.getPolicyAutoScale = function(autoscalePolicyId){
+        return 
this.sendReceive("GET","/autoscalingPolicies/"+autoscalePolicyId,{});
+    };
+
     this.getPolicyDeployment = function(){
         return this.sendReceive("GET","/deploymentPolicies",{});
     };
@@ -134,6 +146,10 @@ RESTCalls = new function(){
         return this.sendReceive("GET","/cartridges",{});
     };
 
+    this.getCartridge = function(cartridgeType){
+        return this.sendReceive("GET","/cartridges/"+cartridgeType,{});
+    };
+
     this.getGroups = function(){
         return this.sendReceive("GET","/groups",{});
     };

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/jaggery.conf
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/jaggery.conf 
b/components/org.apache.stratos.manager.console/console/jaggery.conf
index 9936c4e..7f9b6f5 100644
--- a/components/org.apache.stratos.manager.console/console/jaggery.conf
+++ b/components/org.apache.stratos.manager.console/console/jaggery.conf
@@ -39,14 +39,6 @@
             "path": "/applications_form.jag"
         },
         {
-            "url": "/mycartridges/",
-            "path": "/my_cartridges.jag"
-        },
-        {
-            "url": "/mycartridges/*",
-            "path": "/my_cartridges_info.jag"
-        },
-        {
             "url": "/wizard/*",
             "path": "/wizard.jag"
          }

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/my_cartridges.jag
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/my_cartridges.jag 
b/components/org.apache.stratos.manager.console/console/my_cartridges.jag
deleted file mode 100644
index 4341c08..0000000
--- a/components/org.apache.stratos.manager.console/console/my_cartridges.jag
+++ /dev/null
@@ -1,71 +0,0 @@
-<%
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-//add login validator for pages
-include('/controllers/login/validator.jag');
-include('/controllers/menu/menu_generator.jag');
-
-var log = new Log("apacheStratos.mycartridges");
-var error = [],
-        caramel = require('caramel'),
-        context = caramel.configs().context,
-        menuJson = require('/controllers/menu/menu.json'),
-        userPermissions = session.get('PERMISSIONS'),
-        uriMatcher = new URIMatcher(request.getRequestURI()),
-        util = require('/controllers/rest/rest_calls.jag');
-
-var myCartridges, cartridgeAlias, myCartridgeInfo, myCartridgeInfoStatus;
-//create left menu
-var leftMenu = menuGenerator(context, menuJson.menu, userPermissions);
-
-try {
-    myCartridges = util.RESTCalls.getSubscribedCartridges();
-} catch (e) {
-    log.warn(e);
-}
-
-
-elements = uriMatcher.match('/{context}/mycartridges/{formtype}/{aliasType}')
-
-if (elements != null) {
-    cartridgeAlias = elements.aliasType;
-    myCartridgeInfoStatus = true;
-    try {
-        myCartridgeInfo = util.RESTCalls.getCartridgeInfo(cartridgeAlias);
-    } catch (e) {
-        log.warn(e);
-    }
-} else {
-    myCartridgeInfoStatus = false;
-}
-
-log.info(myCartridgeInfoStatus);
-
-caramel.render({
-    error: error,
-    breadcrumbPathLevelOne: 'mycartridges',
-    left_menu: leftMenu,
-    myCartridgeInfoStatus: myCartridgeInfoStatus,
-    myCartridgeInfo: myCartridgeInfo,
-    myCartridges: myCartridges.cartridge
-});
-
-%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/my_cartridges_info.jag
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/my_cartridges_info.jag 
b/components/org.apache.stratos.manager.console/console/my_cartridges_info.jag
deleted file mode 100644
index b999e10..0000000
--- 
a/components/org.apache.stratos.manager.console/console/my_cartridges_info.jag
+++ /dev/null
@@ -1,65 +0,0 @@
-<%
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-//add login validator for pages
-include('/controllers/login/validator.jag');
-include('/controllers/menu/menu_generator.jag');
-
-var log = new Log("apacheStratos.mycartridges");
-var error = [],
-        caramel = require('caramel'),
-        context = caramel.configs().context,
-        menuJson = require('/controllers/menu/menu.json'),
-        userPermissions = session.get('PERMISSIONS'),
-        uriMatcher = new URIMatcher(request.getRequestURI()),
-        cartridgeHtml = '',
-        util = require('/controllers/rest/rest_calls.jag');
-var myCartridgeInfo, myCartridgeInfoStatus;
-
-//create left menu
-var leftMenu = menuGenerator(context, menuJson.menu, userPermissions);
-
-elements = uriMatcher.match('/{context}/mycartridges/{formtype}/{aliasType}')
-
-if (elements != null) {
-    cartridgeAlias = elements.aliasType;
-    myCartridgeInfoStatus = true;
-    try {
-        myCartridgeInfo = util.RESTCalls.getCartridgeInfo(cartridgeAlias);
-        for (specNumber in myCartridgeInfo.cartridge) {
-            log.info(myCartridgeInfo.cartridge[specNumber])
-            cartridgeHtml +='<tr><td>' + specNumber +' </td><td>'+ 
myCartridgeInfo.cartridge[specNumber] + '</td></tr>';
-        }
-    } catch (e) {
-
-    }
-} else {
-    myCartridgeInfoStatus = false;
-}
-
-caramel.render({
-    error: error,
-    breadcrumbPathLevelOne: 'mycartridges',
-    left_menu: leftMenu,
-    myCartridgeInfo: cartridgeHtml
-});
-
-%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom.css
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom.css
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom.css
index 5964fba..5e99274 100644
--- 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom.css
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom.css
@@ -192,6 +192,6 @@ a.btn:hover {
     margin-top: 0.7em;
 }
 
-button.hover-unsubscribe, button.hover-details, button.hover-delete, 
button.hover-undeploy{
+button.hover-unsubscribe, button.hover-details, 
button.hover-delete,button.hover-delete-group, button.hover-undeploy{
     margin-top: .7em;
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/application_editor.css
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/application_editor.css
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/application_editor.css
index 24fd886..482dfcf 100644
--- 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/application_editor.css
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/application_editor.css
@@ -121,8 +121,8 @@
 
 .link {
     fill: none;
-    stroke: #ccc;
-    stroke-width: 2px;
+    stroke: rgb(0, 0, 255);
+    stroke-width: 0.5px;
 }
 
 .input-false{

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/application_group_editor.css
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/application_group_editor.css
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/application_group_editor.css
new file mode 100644
index 0000000..3dd7528
--- /dev/null
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/application_group_editor.css
@@ -0,0 +1,156 @@
+
+#general>div>h3{
+    display: none;
+}
+.left-side{
+    float: left;
+    width: 20%;
+}
+
+.right-side{
+    float: left;
+    width: 79%;
+    margin-top:20px;
+}
+#group-base{
+    left: 318px;
+    top: 33px;
+}
+
+.stepnode {
+    border: 1px solid silver;
+    position: absolute !important;
+    width: 5em;
+    height: 5em;
+    padding: 0.5em;
+    z-index: 1;
+    border-radius: 0.5em;
+    box-shadow: 2px 2px 19px #aaa;
+    background: white;
+    word-wrap: break-word;
+    padding-top: 24px;
+    text-align: center;
+    cursor: pointer;
+}
+
+.block-cartridge {
+    border: 1px solid silver;
+    border-radius: 0.5em;
+    width: 80px;
+    height: 80px;
+    background-color:#CCC;
+    float: left;
+    margin: 5px;
+    padding: 5px;
+    word-wrap: break-word;
+    padding-top: 24px;
+    cursor: pointer;
+}
+
+.block-group {
+    border: 1px solid silver;
+    border-radius: 0.5em;
+    width: 80px;
+    height: 80px;
+    background-color: #CCC;
+    float: left;
+    margin: 5px;
+    padding: 5px;
+    word-wrap: break-word;
+    padding-top: 24px;
+    cursor: pointer;
+}
+
+.app-creator {
+    height: 600px;
+    background-color: rgb(244, 244, 244);
+    border: 1px solid #ddd;
+    border-radius: 4px;
+    margin-left: 10px;
+    position: relative;
+}
+
+#whiteboard{
+    width: 100%;
+    height: 585px;
+    position: absolute;
+    overflow: auto;
+}
+
+.description{
+    min-height: 300px;
+    max-height: 400px;
+}
+.component-section{
+    max-height: 200px;
+    overflow: auto;
+    min-height: 200px;
+}
+
+.description-section{
+    min-height: 260px;
+    max-height: 400px;
+    overflow: auto;
+}
+
+.app-details {
+    margin: 10px;
+}
+
+.app-details-tab-content{
+    border: 1px solid #ddd;
+    border-top: transparent;
+    min-height: 233px;
+    padding: 20px;
+    border-radius:  0 0 4px 4px;
+}
+.dragActive {
+    border: 2px dotted orange;
+
+}
+
+.input-false{
+    background-color: #CCC;
+    border-color: #ddd;
+    border-width: 1px;
+}
+
+#component-info-update{
+    margin-top: -5px;
+    margin-bottom: 20px;
+    float: right;
+    z-index: 100;
+    position: relative;
+}
+
+.stepnode i {
+    margin-top: 2px;
+    color: #e67e22;
+}
+
+.notification {
+    position: absolute;
+    background-color: #fff;
+    width: 30px;
+    height: 30px;
+    border-radius: 15px;
+    top: 52px;
+    left: 52px;
+}
+.reposition {
+    float: right;
+    margin: 11px 20px;
+    padding: 5px;
+    background-color: white;
+    border-radius: 40px;
+    width: 40px;
+    z-index: 9999;
+    position: relative;
+    cursor: pointer;
+}
+
+.reposition i{
+    padding-left: 4px;
+    color: rgb(93, 170, 254);
+    padding-top: 2px;
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/applications_deploy.css
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/applications_deploy.css
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/applications_deploy.css
index 38d9a09..61b8792 100644
--- 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/applications_deploy.css
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/applications_deploy.css
@@ -49,3 +49,10 @@
     left: 52px;
 }
 
+.stepnode-disable{
+    background-color: rgb(228, 228, 228);
+}
+
+#deploy-ui>div>h3{
+     display: none;
+ }

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/style.css
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/style.css
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/style.css
index 47f590e..a8fd6b0 100644
--- 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/style.css
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/style.css
@@ -218,4 +218,11 @@
 /*.has-success{background-color: rgb(219, 255, 195);border: 1px solid rgb(219, 
255, 195) !important;}*/
 .editor-button{margin-top: 0.4em;font-size: 18px;}
 
-.auto-correct{display: none}
\ No newline at end of file
+.auto-correct{display: none}
+
+.well {
+    border: none !important;
+    border-radius: 0px !important;
+    -webkit-box-shadow: inset 0 0px 0px rgba(0,0,0,.05);
+    box-shadow: inset 0 0px 0px rgba(0,0,0,.05);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/css/jquery.contextMenu/jquery.contextMenu.css
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/css/jquery.contextMenu/jquery.contextMenu.css
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/jquery.contextMenu/jquery.contextMenu.css
new file mode 100644
index 0000000..81b6d4a
--- /dev/null
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/css/jquery.contextMenu/jquery.contextMenu.css
@@ -0,0 +1,142 @@
+/*!
+ * jQuery contextMenu - Plugin for simple contextMenu handling
+ *
+ * Version: git-master
+ *
+ * Authors: Rodney Rehm, Addy Osmani (patches for FF)
+ * Web: http://medialize.github.com/jQuery-contextMenu/
+ *
+ * Licensed under
+ *   MIT License http://www.opensource.org/licenses/mit-license
+ *   GPL v3 http://opensource.org/licenses/GPL-3.0
+ *
+ */
+
+.context-menu-list {
+    margin:0;
+    padding:0;
+
+    min-width: 120px;
+    max-width: 250px;
+    display: inline-block;
+    position: absolute;
+    list-style-type: none;
+
+    border: 1px solid #DDD;
+    background: #EEE;
+
+    -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+    -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+    -ms-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+    -o-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+
+    font-family: Verdana, Arial, Helvetica, sans-serif;
+    font-size: 11px;
+}
+
+.context-menu-item {
+    padding: 2px 2px 2px 24px;
+    background-color: #EEE;
+    position: relative;
+    -webkit-user-select: none;
+    -moz-user-select: -moz-none;
+    -ms-user-select: none;
+    user-select: none;
+}
+
+.context-menu-separator {
+    padding-bottom:0;
+    border-bottom: 1px solid #DDD;
+}
+
+.context-menu-item > label > input,
+.context-menu-item > label > textarea {
+    -webkit-user-select: text;
+    -moz-user-select: text;
+    -ms-user-select: text;
+    user-select: text;
+}
+
+.context-menu-item.hover {
+    cursor: pointer;
+    background-color: #39F;
+}
+
+.context-menu-item.disabled {
+    color: #666;
+}
+
+.context-menu-input.hover,
+.context-menu-item.disabled.hover {
+    cursor: default;
+    background-color: #EEE;
+}
+
+.context-menu-submenu:after {
+    content: ">";
+    color: #666;
+    position: absolute;
+    top: 0;
+    right: 3px;
+    z-index: 1;
+}
+
+/* icons
+    #protip:
+    In case you want to use sprites for icons (which I would suggest you do) 
have a look at
+    http://css-tricks.com/13224-pseudo-spriting/ to get an idea of how to 
implement
+    .context-menu-item.icon:before {}
+ */
+.context-menu-item.icon { min-height: 18px; background-repeat: no-repeat; 
background-position: 4px 2px; }
+.context-menu-item.icon-edit { background-image: 
url(../../images/ContextMenu/page_white_edit.png); }
+.context-menu-item.icon-cut { background-image: 
url(../../images/ContextMenu/cut.png); }
+.context-menu-item.icon-copy { background-image: 
url(../../images/ContextMenu/page_white_copy.png); }
+.context-menu-item.icon-paste { background-image: 
url(../../images/ContextMenu/page_white_paste.png); }
+.context-menu-item.icon-delete { background-image: 
url(../../images/ContextMenu/page_white_delete.png); }
+.context-menu-item.icon-add { background-image: 
url(../../images/ContextMenu/page_white_add.png); }
+.context-menu-item.icon-quit { background-image: 
url(../../images/ContextMenu/door.png); }
+
+/* vertically align inside labels */
+.context-menu-input > label > * { vertical-align: top; }
+
+/* position checkboxes and radios as icons */
+.context-menu-input > label > input[type="checkbox"],
+.context-menu-input > label > input[type="radio"] {
+    margin-left: -17px;
+}
+.context-menu-input > label > span {
+    margin-left: 5px;
+}
+
+.context-menu-input > label,
+.context-menu-input > label > input[type="text"],
+.context-menu-input > label > textarea,
+.context-menu-input > label > select {
+    display: block;
+    width: 100%;
+
+    -webkit-box-sizing: border-box;
+    -moz-box-sizing: border-box;
+    -ms-box-sizing: border-box;
+    -o-box-sizing: border-box;
+    box-sizing: border-box;
+}
+
+.context-menu-input > label > textarea {
+    height: 100px;
+}
+.context-menu-item > .context-menu-list {
+    display: none;
+    /* re-positioned by js */
+    right: -5px;
+    top: 5px;
+}
+
+.context-menu-item.hover > .context-menu-list {
+    display: block;
+}
+
+.context-menu-accesskey {
+    text-decoration: underline;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_editor.js
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_editor.js
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_editor.js
index abec326..8032fcb 100644
--- 
a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_editor.js
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_editor.js
@@ -3,6 +3,7 @@ var resources = function (page, meta) {
         js: 
['JSONEditor-0.7.12/jsoneditor-0.7.12.js','bootstrap-switch-3.0.2/bootstrap-switch.min.js',
 'custom/script.js','custom/form.js', 'd3js-v3/d3.v3.min.js',
             'jquery.contextMenu/jquery.contextMenu.js', 
'jquery.contextMenu/jquery.ui.position.js', 
'jsplumb-1.7.2/dom.jsPlumb-1.7.2-min.js',
             'dagre-v0.7.0/dagre.min.js','custom/applications-editor.js'],
-        css: ['bootstrap-switch-3.0.2/bootstrap-switch.min.css', 
'custom/style.css', 'custom/application_editor.css']
+        css: ['bootstrap-switch-3.0.2/bootstrap-switch.min.css', 
'custom/style.css', 'custom/application_editor.css',
+        'jquery.contextMenu/jquery.contextMenu.css']
     };
 };

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_group_editor.js
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_group_editor.js
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_group_editor.js
new file mode 100644
index 0000000..83291e7
--- /dev/null
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_group_editor.js
@@ -0,0 +1,9 @@
+var resources = function (page, meta) {
+    return {
+        js: 
['JSONEditor-0.7.12/jsoneditor-0.7.12.js','bootstrap-switch-3.0.2/bootstrap-switch.min.js',
 'custom/script.js','custom/form.js', 'd3js-v3/d3.v3.min.js',
+            'jquery.contextMenu/jquery.contextMenu.js', 
'jquery.contextMenu/jquery.ui.position.js', 
'jsplumb-1.7.2/dom.jsPlumb-1.7.2-min.js',
+            'dagre-v0.7.0/dagre.min.js','custom/applications_group_editor.js'],
+        css: ['bootstrap-switch-3.0.2/bootstrap-switch.min.css', 
'custom/style.css', 'custom/application_group_editor.css',
+        'jquery.contextMenu/jquery.contextMenu.css']
+    };
+};

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_topology.js
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_topology.js
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_topology.js
index 3dab726..dc73200 100644
--- 
a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_topology.js
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_topology.js
@@ -1,6 +1,7 @@
 var resources = function (page, meta) {
     return {
-        js: 
['JSONEditor-0.7.12/jsoneditor-0.7.12.js','bootstrap-switch-3.0.2/bootstrap-switch.min.js',
 'custom/script.js', 'd3js-v3/d3.v3.min.js' ],
+        js: 
['JSONEditor-0.7.12/jsoneditor-0.7.12.js','bootstrap-switch-3.0.2/bootstrap-switch.min.js',
 'custom/script.js', 'd3js-v3/d3.v3.min.js' ,
+        'custom/applications_topology.js'],
         css: ['bootstrap-switch-3.0.2/bootstrap-switch.min.css', 
'custom/style.css', 'custom/topology.css']
     };
 };

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_view.js
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_view.js
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_view.js
new file mode 100644
index 0000000..a40efa5
--- /dev/null
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_view.js
@@ -0,0 +1,8 @@
+var resources = function (page, meta) {
+    return {
+        js: 
['JSONEditor-0.7.12/jsoneditor-0.7.12.js','bootstrap-switch-3.0.2/bootstrap-switch.min.js',
 'custom/script.js','custom/form.js',
+            'jquery.contextMenu/jquery.contextMenu.js', 
'jquery.contextMenu/jquery.ui.position.js', 
'jsplumb-1.7.2/dom.jsPlumb-1.7.2-min.js',
+            'dagre-v0.7.0/dagre.min.js','custom/applications-view.js'],
+        css: ['bootstrap-switch-3.0.2/bootstrap-switch.min.css', 
'custom/style.css', 'custom/applications_deploy.css']
+    };
+};

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/my_cartridges.js
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/my_cartridges.js
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/my_cartridges.js
deleted file mode 100644
index faa4740..0000000
--- 
a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/my_cartridges.js
+++ /dev/null
@@ -1,7 +0,0 @@
-
-var resources = function (page, meta) {
-    return {
-        js: ['custom/form.js' ],
-        css: [ 'custom/style.css','font-mfizz-1.2/font-mfizz.css']
-    };
-};

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-deploy.js
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-deploy.js
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-deploy.js
index 2d435f9..2cfc093 100644
--- 
a/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-deploy.js
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-deploy.js
@@ -112,6 +112,7 @@ function addJsplumbGroup(groupJSON, cartridgeCounter){
     var divRoot = 
$('<div>').attr({'id':cartridgeCounter+'-'+groupJSON.alias,'data-type':'group','data-ctype':groupJSON.alias})
         .text(groupJSON.alias)
         .addClass('input-false')
+        .addClass('application')
         .addClass('stepnode')
         .appendTo('#whiteboard');
     $(divRoot).append('<div class="notification"><i class="fa 
fa-exclamation-circle fa-2x"></i></div>');
@@ -135,7 +136,9 @@ function addJsplumbGroup(groupJSON, cartridgeCounter){
                 .addClass('input-false')
                 .addClass('stepnode')
                 .appendTo('#whiteboard');
+
             $(divCartridge).append('<div class="notification"><i class="fa 
fa-exclamation-circle fa-2x"></i></div>');
+
             jsPlumb.addEndpoint($(divCartridge), {
                 anchor: "TopCenter"
             }, generatedCartridgeEndpointOptions);
@@ -161,7 +164,9 @@ function addJsplumbGroup(groupJSON, cartridgeCounter){
                 .addClass('stepnode')
                 .addClass('input-false')
                 .appendTo('#whiteboard');
+
             $(divGroup).append('<div class="notification"><i class="fa 
fa-exclamation-circle fa-2x"></i></div>');
+
             jsPlumb.addEndpoint($(divGroup), {
                 anchor:"BottomCenter"
             }, bottomConnectorOptions);
@@ -202,9 +207,177 @@ jsPlumb.bind("ready", function() {
     dagrePosition();
 });
 
+//use to activate tab
+function activateTab(tab){
+    $('.nav-tabs a[href="#' + tab + '"]').tab('show');
+};
 
+var applicationPolicyTemplate = {
+    "$schema": "http://json-schema.org/draft-04/schema#";,
+    "id": "root",
+    "type": "object",
+    "options": {
+        "disable_properties": true,
+        "disable_collapse": true
+    },
+    "properties": {
+        "applicationId": {
+            "id": "root/applicationId",
+            "type": "string",
+            "title":"Application Id"
+        },
+        "applicationPolicy": {
+            "id": "root/applicationPolicy",
+            "type": "object",
+            "options": {
+                "disable_properties": true,
+                "disable_collapse": true
+            },
+            "properties": {
+                "networkPartition": {
+                    "id": "root/applicationPolicy/networkPartition",
+                    "type": "array",
+                    "items": {
+                        "id": "root/applicationPolicy/networkPartition/0",
+                        "type": "object",
+                        "properties": {
+                            "id": {
+                                "id": 
"root/applicationPolicy/networkPartition/0/id",
+                                "type": "string"
+                            },
+                            "activeByDefault": {
+                                "id": 
"root/applicationPolicy/networkPartition/0/activeByDefault",
+                                "type": "boolean"
+                            },
+                            "partitions": {
+                                "id": 
"root/applicationPolicy/networkPartition/0/partitions",
+                                "type": "array",
+                                "items": {
+                                    "id": 
"root/applicationPolicy/networkPartition/0/partitions/0",
+                                    "type": "object",
+                                    "properties": {
+                                        "id": {
+                                            "id": 
"root/applicationPolicy/networkPartition/0/partitions/0/id",
+                                            "type": "string"
+                                        },
+                                        "provider": {
+                                            "id": 
"root/applicationPolicy/networkPartition/0/partitions/0/provider",
+                                            "type": "string"
+                                        },
+                                        "property": {
+                                            "id": 
"root/applicationPolicy/networkPartition/0/partitions/0/property",
+                                            "type": "array",
+                                            "items": {
+                                                "id": 
"root/applicationPolicy/networkPartition/0/partitions/0/property/0",
+                                                "type": "object",
+                                                "properties": {
+                                                    "name": {
+                                                        "id": 
"root/applicationPolicy/networkPartition/0/partitions/0/property/0/name",
+                                                        "type": "string"
+                                                    },
+                                                    "value": {
+                                                        "id": 
"root/applicationPolicy/networkPartition/0/partitions/0/property/0/value",
+                                                        "type": "string"
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+};
+
+var applicationPolicyDefault = {
+    "applicationId": "app_cartridge_v1",
+    "applicationPolicy": {
+        "networkPartition": [
+            {
+                "id": "openstack_R1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "mock",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "RegionOne"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    }
+};
 // Document ready events
 $(document).ready(function(){
+
+    //*******************Adding JSON editor *************//
+    JSONEditor.defaults.theme = 'bootstrap3';
+    JSONEditor.defaults.iconlib = 'fontawesome4';
+    JSONEditor.defaults.show_errors = "always";
+    var applicationPolicyEditor, childPolicyEditor;
+
+/*    applicationPolicyDefault['applicationId']= applicationJSON.applicationId;
+
+    applicationPolicyEditor = new 
JSONEditor(document.getElementById('deploy-ui'), {
+        ajax: false,
+        disable_edit_json: true,
+        schema: applicationPolicyTemplate,
+        format: "grid",
+        startval: applicationPolicyDefault
+    });
+    applicationPolicyEditor.getEditor('root.applicationId').disable();*/
+
+    $('#whiteboard').on('click', '.stepnode', function(){
+        tabData($(this));
+        treeActivation($(this));
+    });
+
+    function tabData(node){
+        //get tab activated
+        if(node.hasClass( "application" )){
+            activateTab('general');
+        }else{
+            activateTab('components');
+        }
+
+    }
+
+    function treeActivation(node){
+        var treePath = jsPlumb.getAllConnections();
+
+        for (var i = 0; i < treePath.length; i++) {
+            var nodeitem = treePath[i];
+            var nodeid = node.attr('id');
+            if(nodeitem.source.id == nodeid){
+                $('#'+nodeitem.target.id).addClass('stepnode-disable');
+            }else if(nodeitem.target.id == nodeid){
+                $('#'+nodeitem.source.id).addClass('stepnode-disable');
+            }
+        }
+
+    }
+
+    function generateHtmlBlock(schema, startval){
+        // Initialize the editor
+        childPolicyEditor = new 
JSONEditor(document.getElementById('component-data'), {
+            ajax: false,
+            disable_edit_json: true,
+            schema: schema,
+            format: "grid",
+            startval: startval
+        });
+
+    }
+
     //trigger deploy button
     $('#deploy').click(function(){
         var deployjson = $('textarea#deployjsonedit').val();
@@ -233,4 +406,6 @@ $(document).ready(function(){
             });
 
     });
+
+
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-editor.js
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-editor.js
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-editor.js
index 33daac6..d3d4685 100644
--- 
a/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-editor.js
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-editor.js
@@ -305,7 +305,7 @@ function generateGroupPreview(data) {
         links = tree.links(nodes);
 
     // Normalize for fixed-depth.
-    nodes.forEach(function(d) { d.y = d.depth * 100; });
+    nodes.forEach(function(d) { d.y = d.depth * 60; });
 
     // Declare the nodes…
     var node = svg.selectAll("g.node")
@@ -317,8 +317,15 @@ function generateGroupPreview(data) {
         .attr("transform", function(d) {
             return "translate(" + d.x + "," + d.y + ")"; });
 
-    nodeEnter.append("circle")
-        .attr("r", 4)
+    nodeEnter.append("rect")
+        .attr("x", -10)
+        .attr("y", -10)
+        .attr("rx",2)
+        .attr("ry",2)
+        .attr("width", 20)
+        .attr("height", 20)
+        .attr("stroke-width", 1)
+        .attr("stroke", "silver")
         .style("fill", "#fff");
 
     nodeEnter.append("text")
@@ -340,46 +347,6 @@ function generateGroupPreview(data) {
 
 }
 
-// ************* Add context menu for nodes ******************
-//remove nodes from workarea
-function deleteNode(endPoint){
-    if(endPoint.attr('id') != 'applicationId'){
-        var that=endPoint;      //get all of your DIV tags having endpoints
-        for (var i=0;i<that.length;i++) {
-            var endpoints = jsPlumb.getEndpoints($(that[i])); //get all 
endpoints of that DIV
-            for (var m=0;m<endpoints.length;m++) {
-                // if(endpoints[m].anchor.type=="TopCenter") //Endpoint on 
right side
-                jsPlumb.deleteEndpoint(endpoints[m]);  //remove endpoint
-            }
-        }
-        jsPlumb.detachAllConnections(endPoint);
-        endPoint.remove();
-    }
-
-}
-
-//genrate context menu for nodes
-$(function(){
-    /*$.contextMenu({
-        selector: '.stepnode',
-        callback: function(key, options) {
-            var m = "clicked: " + key + $(this);
-            if(key == 'delete'){
-                deleteNode($(this));
-            }else if(key == 'edit'){
-
-            }
-        },
-        items: {
-            "edit": {name: "Edit", icon: "edit"},
-            "delete": {name: "Delete", icon: "delete"},
-            "sep1": "---------",
-            "quit": {name: "Quit", icon: "quit"}
-        }
-    });*/
-
-});
-
 var applicationJson = {};
 //Definition JSON builder
 function generateJsplumbTree(collector, connections){
@@ -616,15 +583,20 @@ var groupBlockDefault = {
 //create cartridge list
 var cartridgeListHtml='';
 function generateCartridges(data){
-    for(var cartridge in data){
-        var cartridgeData = data[cartridge];
-        cartridgeListHtml += '<div class="block-cartridge" ' +
-            'data-info="'+cartridgeData.description+ '"'+
-            'data-toggle="tooltip" data-placement="bottom" title="Single Click 
to view details. Double click to add"'+
-            'id="'+cartridgeData.type+'">'
-            + cartridgeData.displayName+
-            '</div>'
+    if(data.length == 0){
+        cartridgeListHtml = 'No Cartridges found..';
+    }else{
+        for(var cartridge in data){
+            var cartridgeData = data[cartridge];
+            cartridgeListHtml += '<div class="block-cartridge" ' +
+                'data-info="'+cartridgeData.description+ '"'+
+                'data-toggle="tooltip" data-placement="bottom" title="Single 
Click to view details. Double click to add"'+
+                'id="'+cartridgeData.type+'">'
+                + cartridgeData.displayName+
+                '</div>'
+        }
     }
+
     //append cartridge into html content
     $('#cartridge-list').append(cartridgeListHtml);
 }
@@ -632,13 +604,17 @@ function generateCartridges(data){
 //create group list
 var groupListHtml='';
 function generateGroups(data){
-    for(var group in data){
-        var groupData = data[group];
-        groupListHtml += '<div class="block-group" ' +
-            ' data-info="'+encodeURIComponent(JSON.stringify(groupData))+'"'+
-            'id="'+groupData.name+'">'
-            + groupData.name+
-            '</div>'
+    if(data.length == 0){
+        groupListHtml = 'No Groups found..';
+    }else {
+        for (var group in data) {
+            var groupData = data[group];
+            groupListHtml += '<div class="block-group" ' +
+                ' data-info="' + encodeURIComponent(JSON.stringify(groupData)) 
+ '"' +
+                'id="' + groupData.name + '">'
+                + groupData.name +
+                '</div>'
+        }
     }
     //append cartridge into html content
     $('#group-list').append(groupListHtml);
@@ -666,7 +642,6 @@ function dagrePosition(){
 
     // Applying the calculated layout
     g.nodes().forEach(function(v) {
-        console.log(g.nodes(v).x)
         $("#" + v).css("left", g.node(v).x + "px");
         $("#" + v).css("top", g.node(v).y + "px");
     });
@@ -715,18 +690,22 @@ $(document).ready(function(){
     Repaint();
 
     $('#whiteboard').on('click', '.stepnode', function(){
+        tabData($(this));
+    });
+
+    function tabData(node){
         //get tab activated
-        if($(this).attr('id') == 'applicationId'){
+        if(node.attr('id') == 'applicationId'){
             activateTab('general');
         }else{
             activateTab('components');
             $('#component-info-update').prop("disabled", false);
         }
 
-        blockId = $(this).attr('id');
-        var blockType = $(this).attr('data-type');
+        blockId = node.attr('id');
+        var blockType = node.attr('data-type');
         var startval;
-        var ctype = $(this).attr('data-ctype');
+        var ctype = node.attr('data-ctype');
         if(blockType == 'cartridge' || blockType == 'group-cartridge'){
             startval = cartridgeBlockDefault;
             startval['type'] = ctype;
@@ -735,8 +714,8 @@ $(document).ready(function(){
             startval['name'] = ctype;
         }
 
-        if($(this).attr('data-generated')) {
-            startval = 
JSON.parse(decodeURIComponent($(this).attr('data-generated')));
+        if(node.attr('data-generated')) {
+            startval = 
JSON.parse(decodeURIComponent(node.attr('data-generated')));
         }
         $('#component-data').html('');
 
@@ -753,8 +732,7 @@ $(document).ready(function(){
                 generateHtmlBlock(cartridgeBlockTemplate, startval);
                 break;
         }
-
-    });
+    }
 
     function generateHtmlBlock(schema, startval){
         // Initialize the editor
@@ -822,9 +800,93 @@ $(document).ready(function(){
         dagrePosition();
     });
 
+    //genrate context menu for nodes
+    $.contextMenu({
+        selector: '.stepnode',
+        callback: function(key, options) {
+            var m = "clicked: " + key + $(this);
+            if(key == 'delete'){
+                deleteNode($(this));
+            }else if(key == 'edit'){
+                document.getElementById('component-data').scrollIntoView();
+                tabData($(this));
+            }
+        },
+        items: {
+            "edit": {name: "Edit", icon: "edit"},
+            "delete": {name: "Delete", icon: "delete"}
+        }
+    });
+
 });
 
 //bootstrap tooltip added
 $(function () {
     $('[data-toggle="tooltip"]').tooltip()
-})
\ No newline at end of file
+})
+
+
+// ************* Add context menu for nodes ******************
+//remove nodes from workarea
+function deleteNode(endPoint){
+    if(endPoint.attr('id') != 'applicationId'){
+        var allnodes = $(".stepnode");
+        var superParent = 
endPoint.attr('id').split("-")[0]+endPoint.attr('id').split("-")[1];
+        var nodeName = endPoint.attr('data-ctype');
+        var nodeType = endPoint.attr('data-type');
+        var notyText = '';
+
+        if(nodeType == 'group'){
+            notyText = 'This will remove related nodes from the Editor. Are 
you sure you want to delete '
+                            +nodeType + ': '+nodeName+'?';
+        }else{
+            notyText = 'Are you sure you want to delete '+nodeType + ': 
'+nodeName+'?';
+        }
+        noty({
+            layout: 'bottomRight',
+            type: 'warning',
+            text:  notyText,
+            buttons: [
+                {addClass: 'btn btn-primary', text: 'Yes', onClick: 
function($noty) {
+                    $noty.close();
+
+                    allnodes.each(function(){
+                        var currentId = 
$(this).attr('id').split("-")[0]+$(this).attr('id').split("-")[1];
+                        if(currentId == superParent){
+                            var that=$(this);      //get all of your DIV tags 
having endpoints
+                            for (var i=0;i<that.length;i++) {
+                                var endpoints = 
jsPlumb.getEndpoints($(that[i])); //get all endpoints of that DIV
+                                if(endpoints){
+                                    for (var m=0;m<endpoints.length;m++) {
+                                        // 
if(endpoints[m].anchor.type=="TopCenter") //Endpoint on right side
+                                        jsPlumb.deleteEndpoint(endpoints[m]);  
//remove endpoint
+                                    }
+                                }
+
+                            }
+                            jsPlumb.detachAllConnections($(this));
+                            $(this).remove();
+                        }
+
+                    });
+
+                    //clear html area
+                    $('#component-data').html('');
+                    activateTab('general');
+                }
+                },
+                {addClass: 'btn btn-danger', text: 'No', onClick: 
function($noty) {
+                    $noty.close();
+                }
+                }
+            ]
+        });
+
+
+
+    }else{
+        var n = noty({text: 'Sorry you can\'t remove application node' , 
layout: 'bottomRight', type: 'warning'});
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/0251ad3a/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-view.js
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-view.js
 
b/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-view.js
new file mode 100644
index 0000000..87eb679
--- /dev/null
+++ 
b/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-view.js
@@ -0,0 +1,203 @@
+// repaint
+function Repaint(){
+    $("#whiteboard").resize(function(){
+        jsPlumb.repaintEverything();
+    });
+}
+// drag
+function DragEl(el){
+    jsPlumb.draggable($(el) ,{
+        containment:"#whiteboard"
+    });
+}
+
+
+// JsPlumb Config
+var color = "gray",
+    exampleColor = "#00f",
+    arrowCommon = { foldback:0.7, fillStyle:color, width:14 };
+
+jsPlumb.importDefaults({
+    Connector : [ "Bezier", { curviness:63 } ],
+    /*Overlays: [
+     [ "Arrow", { location:0.7 }, arrowCommon ],
+     ]*/
+});
+
+
+var nodeDropOptions = {
+    activeClass:"dragActive"
+};
+
+var bottomConnectorOptions = {
+    endpoint:"Rectangle",
+    paintStyle:{ width:25, height:21, fillStyle:'#666' },
+    isSource:true,
+    connectorStyle : { strokeStyle:"#666" },
+    isTarget:false,
+    maxConnections:20
+};
+
+var endpointOptions = {
+    isTarget:true,
+    endpoint:"Dot",
+    paintStyle:{
+        fillStyle:"gray"
+    },
+    dropOptions: nodeDropOptions,
+    maxConnections:1
+};
+
+var groupOptions = {
+    isTarget:true,
+    endpoint:"Dot",
+    paintStyle:{
+        fillStyle:"gray"
+    },
+    dropOptions: nodeDropOptions,
+    maxConnections:1
+};
+
+var generatedCartridgeEndpointOptions = {
+    isTarget:false,
+    endpoint:"Dot",
+    paintStyle:{
+        fillStyle:"gray"
+    },
+    dropOptions: '',
+    maxConnections:1
+};
+
+var generatedGroupOptions = {
+    isTarget:false,
+    endpoint:"Dot",
+    paintStyle:{
+        fillStyle:"gray"
+    },
+    dropOptions: nodeDropOptions,
+    maxConnections:1
+};
+
+function dagrePosition(){
+    // construct dagre graph from JsPlumb graph
+    var g = new dagre.graphlib.Graph();
+    g.setGraph({ranksep:'80'});
+    g.setDefaultEdgeLabel(function() { return {}; });
+    var nodes = $(".stepnode");
+
+    for (var i = 0; i < nodes.length; i++) {
+        var n = nodes[i];
+        g.setNode(n.id, {width: 52, height: 52});
+    }
+    var edges = jsPlumb.getAllConnections();
+    for (var i = 0; i < edges.length; i++) {
+        var c = edges[i];
+        g.setEdge(c.source.id,c.target.id );
+    }
+    // calculate the layout (i.e. node positions)
+    dagre.layout(g);
+
+    // Applying the calculated layout
+    g.nodes().forEach(function(v) {
+        $("#" + v).css("left", g.node(v).x + "px");
+        $("#" + v).css("top", g.node(v).y + "px");
+    });
+    jsPlumb.repaintEverything();
+}
+//add group to editor
+var cartridgeCounter =0;
+//add group to editor
+function addJsplumbGroup(groupJSON, cartridgeCounter){
+
+    var divRoot = 
$('<div>').attr({'id':cartridgeCounter+'-'+groupJSON.alias,'data-type':'group','data-ctype':groupJSON.alias})
+        .text(groupJSON.alias)
+        .addClass('input-false')
+        .addClass('stepnode')
+        .appendTo('#whiteboard');
+    $(divRoot).append('<div class="notification"><i class="fa 
fa-exclamation-circle fa-2x"></i></div>');
+    jsPlumb.addEndpoint($(divRoot), {
+        anchor:"BottomCenter"
+    }, bottomConnectorOptions);
+
+    DragEl($(divRoot));
+    if(groupJSON['components']['cartridges']) {
+        genJsplumbCartridge(groupJSON['components']['cartridges'], divRoot, 
groupJSON.alias);
+    }
+    if(groupJSON['components']['groups']){
+        genJsplumbGroups(groupJSON['components']['groups'], divRoot, 
groupJSON.alias);
+    }
+
+    function genJsplumbCartridge(item, currentParent, parentName){
+        for (var prop in item) {
+            var id = item[prop].type;
+            var divCartridge = 
$('<div>').attr({'id':cartridgeCounter+'-'+parentName+'-'+item[prop].type} )
+                .text(item[prop].type)
+                .addClass('input-false')
+                .addClass('stepnode')
+                .appendTo('#whiteboard');
+            $(divCartridge).append('<div class="notification"><i class="fa 
fa-exclamation-circle fa-2x"></i></div>');
+            jsPlumb.addEndpoint($(divCartridge), {
+                anchor: "TopCenter"
+            }, generatedCartridgeEndpointOptions);
+
+            //add connection options
+            jsPlumb.connect({
+                source:$(currentParent),
+                target:$(divCartridge),
+                paintStyle:{strokeStyle:"blue", lineWidth:1 },
+                Connector : [ "Bezier", { curviness:63 } ],
+                anchors:["BottomCenter", "TopCenter"],
+                endpoint:"Dot"
+            });
+
+            DragEl($(divCartridge));
+        }
+    }
+
+    function genJsplumbGroups(item, currentParent, parentName) {
+        for (var prop in item) {
+            var divGroup = 
$('<div>').attr({'id':cartridgeCounter+'-'+parentName+'-'+item[prop]['name'],'data-type':'group','data-ctype':item[prop]['name']
 })
+                .text(item[prop]['name'])
+                .addClass('stepnode')
+                .addClass('input-false')
+                .appendTo('#whiteboard');
+            $(divGroup).append('<div class="notification"><i class="fa 
fa-exclamation-circle fa-2x"></i></div>');
+            jsPlumb.addEndpoint($(divGroup), {
+                anchor:"BottomCenter"
+            }, bottomConnectorOptions);
+
+            jsPlumb.addEndpoint($(divGroup), {
+                anchor: "TopCenter"
+            }, generatedGroupOptions);
+
+            //add connection options
+            jsPlumb.connect({
+                source:$(currentParent),
+                target:$(divGroup),
+                paintStyle:{strokeStyle:"blue", lineWidth:1 },
+                Connector : [ "Bezier", { curviness:63 } ],
+                anchors:["BottomCenter", "TopCenter"],
+                endpoint:"Dot"
+            });
+
+            DragEl($(divGroup));
+
+            if(item[prop].hasOwnProperty('cartridges')) {
+                genJsplumbCartridge(item[prop].cartridges, divGroup, 
parentName+'-'+item[prop]['name'] );
+            }
+            if(item[prop].hasOwnProperty('groups')) {
+                genJsplumbGroups(item[prop].groups, divGroup, 
parentName+'-'+item[prop]['name'])
+            }
+        }
+    }
+
+
+
+}
+
+
+jsPlumb.bind("ready", function() {
+    addJsplumbGroup(applicationJSON, cartridgeCounter);
+    //reposition after group add
+    dagrePosition();
+});
\ No newline at end of file

Reply via email to