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

[1/2] stratos git commit: [STRATOS-1501] Application signups not available in the UI

Repository: stratos
Updated Branches:
  refs/heads/master 94446b5bf -> 61214a30e


[STRATOS-1501] Application signups not available in the UI


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

Branch: refs/heads/master
Commit: 08f8963cf518b044dd3ad6b4494211856982ecd0
Parents: 94446b5
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Thu Aug 20 09:32:17 2015 +0530
Committer: Dakshika Jayathilaka <si...@gmail.com>
Committed: Thu Aug 20 09:32:17 2015 +0530

----------------------------------------------------------------------
 .../console/applications_form.jag               |   2 +
 .../applications/application_requests.jag       |   3 +
 .../console/controllers/rest/rest_calls.jag     |   4 +
 .../console/themes/theme0/css/custom.css        |   2 +-
 .../theme0/css/custom/applications_signup.css   | 224 +++++++++++
 .../theme0/helpers/applications_signup.js       |  29 ++
 .../theme0/js/custom/applications-signup.js     | 388 +++++++++++++++++++
 .../theme0/partials/applications_form.hbs       |  21 +-
 .../theme0/partials/applications_signup.hbs     |  64 +++
 .../theme0/renderers/applications_form.js       |  60 +++
 10 files changed, 795 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/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 ad1745c..6f63501 100644
--- a/components/org.apache.stratos.manager.console/console/applications_form.jag
+++ b/components/org.apache.stratos.manager.console/console/applications_form.jag
@@ -57,6 +57,8 @@ if (!elements) {
         }else if(elements.action == 'deploy'){
             applicationHbs = 'applicationDeploy';
             applicationPolicyData = util.RESTCalls.getApplicationPolicies();
+        }else if(elements.action == 'signup'){
+            applicationHbs = 'applicationSignup';
         }
 
     }else{

http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/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 2e51c7b..5721e7c 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
@@ -46,6 +46,9 @@ try {
         case "forceundeployapplication":
             formSubmit = util.RESTCalls.forceUndeployApplication(applicationId);
             break;
+        case "signupapplication":
+            formSubmit = util.RESTCalls.signupApplication(applicationId, formPayload);
+            break;
         default:
             session.put("deploy-status", { "message": "Sorry Endpoint Error", "status": "error" });
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/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 7b020fa..9876f63 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
@@ -140,6 +140,10 @@ RESTCalls = new function(){
         return this.send("POST","/applications/"+applicationId+"/undeploy",{});
     };
 
+    this.signupApplication = function(applicationId, signupJSON){
+        return this.send("POST","/applications/"+applicationId+"/signup",signupJSON);
+    };
+
     this.forceUndeployApplication = function(applicationId){
         return this.send("POST","/applications/"+applicationId+"/undeploy?force=true",{});
     };

http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/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 a8b1b3a..bc2b889 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
@@ -214,7 +214,7 @@ a.btn:hover {
 }
 
 button.hover-unsubscribe, button.hover-details, button.hover-delete,button.hover-delete-group, button.b-top,
-button.hover-undeploy{
+button.hover-undeploy, button.hover-signup{
     margin-top: .7em;
 }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/applications_signup.css
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/applications_signup.css b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/applications_signup.css
new file mode 100644
index 0000000..c86c79e
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/css/custom/applications_signup.css
@@ -0,0 +1,224 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+.right-side{
+    float: left;
+    width: 100%;
+    margin-top:20px;
+}
+#applicationId{
+    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;
+}
+
+.stepnode span{
+    position: absolute;
+    width: 4em;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    margin-left: -27px;
+}
+
+.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;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+}
+
+.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;
+
+}
+
+.node-disable{
+    background-color: #bdc3c7;
+}
+
+
+.node circle {
+    fill: #fff;
+    stroke: steelblue;
+    stroke-width: 3px;
+}
+
+.node text { font: 12px sans-serif; }
+
+.link {
+    fill: none;
+    stroke: rgb(0, 0, 255);
+    stroke-width: 0.5px;
+}
+
+.input-false{
+    background-color: #CCC;
+    border-color: #ddd;
+    border-width: 1px;
+}
+
+#component-data>div>h3{
+    display: none;
+}
+
+#component-info-update{
+    margin-top:-5px;margin-bottom: 20px;
+    float: right;
+}
+
+#component-data{margin-top: 20px}
+.stepnode i {
+    margin-top: 0px;
+    color: #e67e22;
+    margin-left: -7px;
+}
+
+.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;
+}
+
+div#general>div>h3 {
+    display: none;
+}
+.highlightme{
+    background-color: #6BCFFE;
+}
+
+.signup-default i{
+    color: #e67e22;
+}
+
+.signup-default h4{
+    text-align: center;
+    padding: 22px;
+    background-color: #CACACA;
+}
+
+.signup-details {
+    margin-top: 2em;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_signup.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_signup.js b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_signup.js
new file mode 100644
index 0000000..0efc591
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/helpers/applications_signup.js
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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 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-signup.js'],
+        css: ['bootstrap-switch-3.0.2/bootstrap-switch.min.css', 'custom/style.css', 'custom/applications_signup.css']
+    };
+};

http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-signup.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-signup.js b/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-signup.js
new file mode 100644
index 0000000..7977824
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/js/custom/applications-signup.js
@@ -0,0 +1,388 @@
+/*
+ *
+ * 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.
+ *
+ */
+// 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 } ]
+});
+
+
+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')
+        .attr('data-toggle', 'tooltip')
+        .attr('title',groupJSON.alias )
+        .appendTo('#whiteboard');
+    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, 'data-type':'cartridge',
+                'data-calias':item[prop]['subscribableInfo']['alias']} )
+                .text(item[prop].type)
+                .addClass('input-false')
+                .addClass('stepnode')
+                .attr('data-toggle', 'tooltip')
+                .attr('title',item[prop].type )
+                .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')
+                .attr('data-toggle', 'tooltip')
+                .attr('title',item[prop]['name'] )
+                .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();
+});
+
+
+var signupBlockTemplate = {
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "id": "root",
+    "type": "object",
+    "title": " ",
+    "options": {
+        "disable_properties": true,
+        "disable_collapse": true
+    },
+    "properties": {
+        "alias": {
+            "id": "root/alias",
+            "title": "Cartridge Alias: ",
+            "type": "string"
+        },
+        "privateRepo": {
+            "id": "root/privateRepo",
+            "title": "Is private repository: ",
+            "type": "boolean"
+        },
+        "repoUrl": {
+            "id": "root/repoUrl",
+            "title": "Repository URL: ",
+            "type": "string"
+        },
+        "repoUsername": {
+            "id": "root/repoUsername",
+            "title": "Repository User Name: ",
+            "type": "string"
+        },
+        "repoPassword": {
+            "id": "root/repoPassword",
+            "title": "Repository Password: ",
+            "type": "string"
+        }
+    }
+};
+
+var signupBlockDefault = {
+    "alias": "php",
+    "privateRepo": false,
+    "repoUrl": "https://github.com/imesh/stratos-php-applications.git",
+    "repoUsername": "",
+    "repoPassword": ""
+};
+
+
+// Document ready events
+$(document).ready(function(){
+    //handled Ajax base session expire issue
+    $(document).ajaxError(function (e, xhr, settings) {
+        window.location.href = '../';
+    });
+
+    //*******************Adding JSON editor *************//
+    JSONEditor.defaults.theme = 'bootstrap3';
+    JSONEditor.defaults.iconlib = 'fontawesome4';
+    JSONEditor.defaults.show_errors = "always";
+    var editor,blockId;
+
+    $('#whiteboard').on('click', '.stepnode', function(){
+        $('.signup-details').show();
+        $('.signup-default').hide();
+        $('.stepnode').removeClass("highlightme");
+        $(this).addClass('highlightme');
+        tabData($(this));
+    });
+
+    function tabData(node){
+
+        blockId = node.attr('id');
+        var blockType = node.attr('data-type');
+        var startval;
+        var calias = node.attr('data-calias');
+
+        if(blockType == 'cartridge'){
+            startval = signupBlockDefault;
+            startval['alias'] = calias;
+        }
+
+        if(node.attr('data-generated')) {
+            startval = JSON.parse(decodeURIComponent(node.attr('data-generated')));
+        }
+        $('#signup-details').html('');
+
+        switch (blockType){
+            case 'cartridge':
+                generateHtmlBlock(signupBlockTemplate, startval);
+                break;
+        }
+    }
+
+    function generateHtmlBlock(schema, startval){
+        // Initialize the editor
+        editor = new JSONEditor(document.getElementById('signup-details'), {
+            ajax: false,
+            disable_edit_json: true,
+            schema: schema,
+            format: "grid",
+            startval: startval
+        });
+
+        if(editor.getEditor('root.alias')){
+            editor.getEditor('root.alias').disable();
+        }
+
+    }
+
+
+    //get component JSON data
+    $('#component-info-update').on('click', function(){
+        $('#'+blockId).attr('data-generated', encodeURIComponent(JSON.stringify(editor.getValue())));
+        $('#'+blockId).removeClass('input-false');
+        $('#'+blockId).find('div>i').removeClass('fa-exclamation-circle').addClass('fa-check-circle-o').css('color','#2ecc71');
+    });
+
+
+    $('#signup').on('click', function(){
+        var btn = $(this);
+        var appid = btn.attr('data-appid');
+        var signupJSON = {"artifactRepositories":[]};
+        //generate raw data tree from connections
+        $.each(jsPlumb.getConnections(), function (idx, connection) {
+           var dataGen = $('#'+connection.targetId).attr('data-generated');
+            if(dataGen!=undefined){
+                var jsonContent = JSON.parse(decodeURIComponent(dataGen));
+                signupJSON['artifactRepositories'].push(jsonContent);
+            }
+
+        });
+
+        var formtype = 'signupapplication';
+        btn.html("<i class='fa fa-spinner fa-spin'></i> Adding...");
+        $.ajax({
+            type: "POST",
+            url: caramel.context + "/controllers/applications/application_requests.jag",
+            dataType: 'json',
+            data: { "formPayload": JSON.stringify(signupJSON), "formtype": formtype, "applicationId": appid },
+            success: function (data) {
+                if (data.status == 'error') {
+                    var n = noty({text: data.message, layout: 'bottomRight', type: 'error'});
+                } else if (data.status == 'warning') {
+                    var n = noty({text: data.message, layout: 'bottomRight', type: 'warning'});
+                } else {
+                    var n = noty({text: data.message, layout: 'bottomRight', type: 'success'});
+                    window.setTimeout(function(){
+                        window.location.href = '../';
+                    }, 1500);
+                }
+            }
+        })
+            .always(function () {
+                btn.html('Add Signup');
+            });
+
+    });
+
+
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_form.hbs
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_form.hbs b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_form.hbs
index 0c72fb9..d5b433c 100644
--- a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_form.hbs
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_form.hbs
@@ -123,6 +123,14 @@
                                                 id="details_list_{{applicationId}}"
                                                 data-url="{{url ""}}/applications/{{applicationId}}/" > View
                                         </button>
+                                        {{#if multiTenant}}
+                                            {{#unless signUpsExist}}
+                                                <button class="btn btn-warning btn-lg hover-signup" type="button"
+                                                        id="signup_{{applicationId}}"
+                                                        data-url="{{url ""}}/applications/{{applicationId}}/signup" > Signup
+                                                </button>
+                                            {{/unless}}
+                                        {{/if}}
                                     </div>
                                     <div class="bottom-bar-wrapper">
                                         <div class="bottom-bar">
@@ -132,7 +140,14 @@
                                                     id="details_{{applicationId}}"
                                                     data-url="{{url ""}}/applications/{{applicationId}}/" > View
                                             </button>
-
+                                            {{#if multiTenant}}
+                                                {{#unless signUpsExist}}
+                                                    <button class="btn btn-warning btn-lg hover-signup" type="button"
+                                                            id="signup_{{applicationId}}"
+                                                            data-url="{{url ""}}/applications/{{applicationId}}/signup" > Signup
+                                                    </button>
+                                                {{/unless}}
+                                            {{/if}}
                                         </div>
                                 {{else}}
                                     <div class="list-button" style="display: none;">
@@ -327,6 +342,10 @@
                 window.location = $(this).attr("data-url");
             });
 
+            $('.general-table').on('click', '.hover-signup', function (event) {
+                window.location = $(this).attr("data-url");
+            });
+
         {{/if}}
 
         $('#deploy').click(function () {

http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_signup.hbs
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_signup.hbs b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_signup.hbs
new file mode 100644
index 0000000..6374190
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_signup.hbs
@@ -0,0 +1,64 @@
+<!--
+
+ 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.
+
+-->
+
+<div id="centered">
+    <div class="row title">
+        <div class="title-main text-center">
+            <h1>Application - {{applicationAlias}}</h1>
+        </div>
+    </div>
+    <div class='container' id='content'>
+        <div class='row'>
+            <div class='container text-center form-toolbar'>
+                <div class='col-md-1'>
+
+                </div>
+
+                <div class='col-md-11'>
+                    <button class='btn btn-info btn-lg pull-right' type='button' id='signup' data-appid='{{applicationName}}'> Add Signup</button>
+                    <button class='btn btn-default btn-lg pull-right button-gap' type='button' onclick='window.location.replace(document.referrer)'> Cancel</button>
+
+                </div>
+            </div>
+        </div>
+        <div class="right-side">
+            <div class="app-creator">
+                <div id="whiteboard">
+
+                </div>
+            </div>
+            <div class="signup-default">
+                <h4 class="center">Click on <i class="fa fa-exclamation-circle"></i> icon to add subscriptions</h4>
+            </div>
+            <div class="signup-details" style="display: none;">
+                <button type="button" class="btn btn-primary" id="component-info-update" >Update</button>
+                <br/>
+                <div id="signup-details">
+
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
+<script>
+    var applicationJSON = {{{applicationJSON}}};
+</script>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/08f8963c/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications_form.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications_form.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications_form.js
index 80d9dad..e5efbce 100644
--- a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications_form.js
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications_form.js
@@ -292,6 +292,66 @@ var render = function (theme, data, meta, require) {
                 });
             break;
 
+            case "applicationSignup":
+                theme('index', {
+                    page_meta: [
+                        {
+                            partial: 'index_title',
+                            context: {
+                                page_title: 'Apache Stratos - Application Managment',
+                                page_description: 'Apache Stratos - Application Managment'
+                            }
+                        }
+                    ],
+                    header: [
+                        {
+                            partial: 'index_header',
+                            context: {
+                            }
+                        }
+                    ],
+                    sub_header: [
+                        {
+                            partial: 'index_sub_header',
+                            context: {
+                                breadcrumbPathLevelOne: data.breadcrumbPathLevelOne,
+                                breadcrumbPathLevelTwo: data.breadcrumbPathLevelTwo
+                            }
+                        }
+                    ],
+                    left_menu: [
+                        {
+                            partial: 'index_left_menu',
+                            context: {
+                                left_menu: data.left_menu
+                            }
+                        }
+                    ],
+                    right_menu_help: [
+                        {
+                            partial: 'index_right_menu_help',
+                            context: {
+
+                            }
+                        }
+                    ],
+                    content: [
+                        {
+                            partial: 'applications_signup',
+                            context: {
+                                applicationName: data.applicationName,
+                                applicationAlias: data.applicationAlias,
+                                formContext: data.breadcrumbPathLevelTwo,
+                                appName: data.appName,
+                                applicationJSON: data.applicationJSON,
+                                formTitle: data.formTitle
+                            }
+                        }
+
+                    ]
+                });
+                break;
+
             default:
                 theme('index', {
                     page_meta: [


[2/2] stratos git commit: clean up js logs

Posted by da...@apache.org.
clean up js logs


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

Branch: refs/heads/master
Commit: 61214a30eba0fd39f2d36474d074f24e3c90e830
Parents: 08f8963
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Thu Aug 20 09:32:40 2015 +0530
Committer: Dakshika Jayathilaka <si...@gmail.com>
Committed: Thu Aug 20 09:32:40 2015 +0530

----------------------------------------------------------------------
 .../console/themes/theme0/partials/users_form.hbs                  | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/61214a30/components/org.apache.stratos.manager.console/console/themes/theme0/partials/users_form.hbs
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/users_form.hbs b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/users_form.hbs
index 7472ccf..5d8ec66 100644
--- a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/users_form.hbs
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/users_form.hbs
@@ -207,11 +207,9 @@
             $('input[type=password]').after('<span class="hide-pass"><i class="fa fa-eye"></i> </span>');
             $('.hide-pass').click(function(){
                 if($(this).find('i').hasClass("fa-eye-slash")){
-                    console.log('hit me w22')
                     $('input[data-schemaformat=password]').attr('type', 'password');
                     $(this).find('i').removeClass( "fa-eye-slash" );
                 }else{
-                    console.log('hit me')
                     $(this).find('i').addClass( "fa-eye-slash" );
                     $('input[data-schemaformat=password]').attr('type', 'text');
                 }