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

[2/3] stratos git commit: Adding remove-signup button

Adding remove-signup button


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

Branch: refs/heads/stratos-4.1.x
Commit: a695fc53e1bfa0f43f4ae484377fb8771d980001
Parents: 8c1c568
Author: anuruddhal <an...@gmail.com>
Authored: Thu Sep 10 14:06:02 2015 +0530
Committer: anuruddhal <an...@gmail.com>
Committed: Thu Sep 10 16:48:09 2015 +0530

----------------------------------------------------------------------
 .../applications/application_requests.jag       |  3 +
 .../console/controllers/rest/rest_calls.jag     |  4 ++
 .../console/themes/theme0/css/custom.css        |  2 +-
 .../theme0/partials/applications_form.hbs       | 62 ++++++++++++++++++--
 4 files changed, 66 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


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

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

http://git-wip-us.apache.org/repos/asf/stratos/blob/a695fc53/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 bc2b889..22e0d53 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-signup{
+button.hover-undeploy, button.hover-signup, button.hover-remove-signup{
     margin-top: .7em;
 }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/a695fc53/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 d5b433c..1237af6 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
@@ -124,12 +124,17 @@
                                                 data-url="{{url ""}}/applications/{{applicationId}}/" > View
                                         </button>
                                         {{#if multiTenant}}
-                                            {{#unless signUpsExist}}
+                                            {{#if signUpsExist}}
+                                                <button class="btn btn-warning btn-lg hover-remove-signup" type="button"
+                                                        id="{{applicationId}}"
+                                                        data-appid='{{applicationName}}' >Remove Signup
+                                                </button>
+                                            {{else}}
                                                 <button class="btn btn-warning btn-lg hover-signup" type="button"
                                                         id="signup_{{applicationId}}"
                                                         data-url="{{url ""}}/applications/{{applicationId}}/signup" > Signup
                                                 </button>
-                                            {{/unless}}
+                                            {{/if}}
                                         {{/if}}
                                     </div>
                                     <div class="bottom-bar-wrapper">
@@ -141,12 +146,17 @@
                                                     data-url="{{url ""}}/applications/{{applicationId}}/" > View
                                             </button>
                                             {{#if multiTenant}}
-                                                {{#unless signUpsExist}}
+                                                {{#if signUpsExist}}
+                                                    <button class="btn btn-warning btn-lg hover-remove-signup" type="button"
+                                                            id="{{applicationId}}"
+                                                            data-appid='{{applicationName}}' >Remove Signup
+                                                    </button>
+                                                {{else}}
                                                     <button class="btn btn-warning btn-lg hover-signup" type="button"
                                                             id="signup_{{applicationId}}"
                                                             data-url="{{url ""}}/applications/{{applicationId}}/signup" > Signup
                                                     </button>
-                                                {{/unless}}
+                                                {{/if}}
                                             {{/if}}
                                         </div>
                                 {{else}}
@@ -472,4 +482,48 @@
             ]
         });
     });
+
+      $('.general-table').on('click', '.hover-remove-signup', function (event) {
+
+        var payload =$(this).attr("id");
+        noty({
+            layout: 'bottomRight',
+            type: 'warning',
+            text: 'Are you sure you want to remove signup for application: <strong>'+$(this).attr("id") + "</strong> ?",
+            buttons: [
+                {addClass: 'btn btn-primary', text: 'Yes', onClick: function($noty) {
+                    var formtype = 'unsignupapplication';
+                    $noty.close();
+
+                    $.ajax({
+                        type: "POST",
+                        url: caramel.context + "/controllers/applications/application_requests.jag",
+                        dataType: 'json',
+                        data: { "applicationId": payload, "formtype": formtype },
+                        success: function (data) {
+                            if (data.status == 'error') {
+                                var n = noty({text: data.message, layout: 'bottomRight', type: 'error'});
+                            } else if (data.status == 'warning') {
+                                var n = noty({text: data.message, layout: 'bottomRight', type: 'warning'});
+                            } else {
+                                var n = noty({text: data.message, layout: 'bottomRight', type: 'success'});
+                            }
+                            window.setTimeout(function(){
+                                location.reload();
+                            }, 1000);
+                        }
+                    }).always(function () {
+
+                    });
+
+                }
+                },
+                {addClass: 'btn btn-danger', text: 'No', onClick: function($noty) {
+                    $noty.close();
+                }
+                }
+            ]
+        });
+    });
+
 </script>