diff options
author | Magdalena GrodziĆska <mag.grodzinska@gmail.com> | 2019-11-24 21:01:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-24 21:01:06 +0100 |
commit | c1a662b6d3652256c7a2f6147abbbb1832c624e0 (patch) | |
tree | 2327beb48d11e32c36823d0b86f04b8784650d34 /src/main/java | |
parent | bc208bbea11c4e0babdad30bd13a70ec7c3b70f1 (diff) | |
parent | 95ff5829c1010f50ae7b389717c3426d963861c8 (diff) |
Merge pull request #37 from m-chrzan/uninstall_query
Add query uninstall backend
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java index 80a331e..fe958ae 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -61,8 +61,8 @@ public class ClientController { return "queryForm"; } - @PostMapping("/query") - public String submitQuery(@ModelAttribute Query queryObject, Model model) { + @PostMapping("/installQuery") + public String installQuery(@ModelAttribute Query queryObject, Model model) { boolean success = true; try { @@ -76,7 +76,32 @@ public class ClientController { if (success) { model.addAttribute( "homeMessage", - "Query submitted successfully"); + "Query installed successfully"); + } else { + model.addAttribute( + "homeMessage", + "Query submission failed with a remote exception"); + } + + return "home"; + } + + @PostMapping("/uninstallQuery") + public String uninstallQuery(@ModelAttribute Query queryObject, Model model) { + boolean success = true; + + try { + this.api.uninstallQuery(queryObject.getName()); + } catch (Exception e) { + success = false; + System.err.println("Client exception:"); + e.printStackTrace(); + } + + if (success) { + model.addAttribute( + "homeMessage", + "Query uninstalled successfully"); } else { model.addAttribute( "homeMessage", |