Repository: stratos
Updated Branches:
  refs/heads/master 93243b8dd -> 1f7224f09


application delete support added


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

Branch: refs/heads/master
Commit: 228dd183dfe0fcd48ead75abf32cc900afa9002e
Parents: 93243b8
Author: Dakshika Jayathilaka <[email protected]>
Authored: Thu Dec 18 13:45:17 2014 +0530
Committer: Imesh Gunaratne <[email protected]>
Committed: Thu Dec 18 17:43:20 2014 +0530

----------------------------------------------------------------------
 .../applications/application_requests.jag       |  3 ++
 .../console/controllers/rest/rest_calls.jag     |  4 ++
 .../theme0/partials/applications_form.hbs       | 43 ++++++++++++++++++++
 3 files changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/228dd183/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 6d583b0..e85e34d 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
@@ -39,6 +39,9 @@ try {
         case "deployments":
             formSubmit = 
util.RESTCalls.deployDeploymentPolicyDefinition(formPayload);
             break;
+        case "deleteapplication":
+            formSubmit = util.RESTCalls.deleteApplication(formPayload);
+            break;
         default:
             session.put("deploy-status", { "message": "Sorry Endpoint Error", 
"status": "error" });
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/228dd183/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 09232fb..0e2a019 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
@@ -71,6 +71,10 @@ RESTCalls = new function(){
         return this.send("POST","/applications", applicationDefinition);
     };
 
+    this.deleteApplication = function(applicationId){
+        return this.send("DELETE","/applications/" + applicationId,{});
+    };
+
     this.subscribeToCartridge = function(cartridgeBeanInfo){
         return this.sendReceive("POST","/cartridge/subscribe", 
cartridgeBeanInfo);
     };

http://git-wip-us.apache.org/repos/asf/stratos/blob/228dd183/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 ac893e3..ad6e2a2 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
@@ -339,6 +339,7 @@
 
         });//end of deploy button trigger
 
+
         //  $('div[data-schemapath="root"]').find('h3 
span').first().css({"display":"none"} );
 
         $.fn.bootstrapSwitch.defaults.onText = 'JSON';
@@ -347,4 +348,46 @@
 
     });
 
+    $('.general-table').on('click', '.hover-delete', function (event) {
+
+        var payload =$(this).attr("id");
+        noty({
+            layout: 'bottomRight',
+            type: 'warning',
+            text: 'Are you sure you want to delete application: 
'+$(this).attr("id"),
+            buttons: [
+                {addClass: 'btn btn-primary', text: 'Yes', onClick: 
function($noty) {
+                    var formtype = 'deleteapplication';
+                    $noty.close();
+
+                    $.ajax({
+                        type: "POST",
+                        url: caramel.context + 
"/controllers/applications/application_requests.jag",
+                        dataType: 'json',
+                        data: { "formPayload": payload, "formtype": formtype },
+                        success: function (data) {
+                            if (data.status == 'error') {
+                                var n = noty({text: data.message, layout: 
'bottomRight', type: 'error'});
+                            } else if (data.status == 'warning') {
+                                var n = noty({text: data.message, layout: 
'bottomRight', type: 'warning'});
+                            } else {
+                                var n = noty({text: data.message, layout: 
'bottomRight', type: 'success'});
+                            }
+                            window.setTimeout(function(){
+                                location.reload();
+                            }, 1000);
+                        }
+                    }).always(function () {
+
+                    });
+
+                }
+                },
+                {addClass: 'btn btn-danger', text: 'No', onClick: 
function($noty) {
+                    $noty.close();
+                }
+                }
+            ]
+        });
+    });
 </script>

Reply via email to