m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMagdalena Grodzińska <mag.grodzinska@gmail.com>2019-11-21 18:42:24 +0100
committerMagdalena Grodzińska <mag.grodzinska@gmail.com>2019-11-21 18:42:24 +0100
commit6770de681fa2f6cce05f709b2fce93a606194faf (patch)
tree22a592d9bd3828660c83d26dfc5326d3f3fc03fa /src
parentd81a616cfbcd0148ce2f8914693527ec164d80d9 (diff)
Add zone fetch backend for zone prompt
Diffstat (limited to 'src')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java23
1 files changed, 23 insertions, 0 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 be853b9..df32f50 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
@@ -200,8 +200,30 @@ public class ClientController {
return "home";
}
+ private String getAvailableZonesString() {
+ boolean success = true;
+ Set<String> availableZones;
+ String availableZonesString = "";
+
+ try {
+ availableZones = api.getZoneSet();
+ availableZonesString = availableZones.toString().substring(1, availableZones.toString().length() - 1);
+ } catch (Exception e) {
+ success = false;
+ System.err.println("Client exception:");
+ e.printStackTrace();
+ }
+
+ if (success) {
+ return "Available zones are: " + availableZonesString;
+ } else {
+ return "No zones available, error occured during fetch";
+ }
+ }
+
@GetMapping("/values")
public String valuesPage(Model model) {
+ model.addAttribute("availableZones", getAvailableZonesString());
model.addAttribute("zoneName", new ContactsString());
return "attribChart";
}
@@ -219,6 +241,7 @@ public class ClientController {
e.printStackTrace();
}
+ model.addAttribute("availableZones", getAvailableZonesString());
return "attribChart";
}
}