m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl
diff options
context:
space:
mode:
authorMagdalena GrodziƄska <m.grodzinska@gmx.com>2019-11-19 20:08:21 +0100
committerGitHub <noreply@github.com>2019-11-19 20:08:21 +0100
commit562b0d451d9a58188a279844efe0efc548ac8f1f (patch)
tree79f3e66982a57100a3e5d7f279912a3d91f25dec /src/main/java/pl
parenteef8436d8e58623b431810471f92f12b20c87434 (diff)
parent5f8ccad41f03b75acb9e3c1d5b46f86c344a721a (diff)
Merge pull request #21 from m-chrzan/basic_frontend
Basic frontend
Diffstat (limited to 'src/main/java/pl')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java54
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/client/Controller.java25
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java22
3 files changed, 76 insertions, 25 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
new file mode 100644
index 0000000..62f77ee
--- /dev/null
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
@@ -0,0 +1,54 @@
+package pl.edu.mimuw.cloudatlas.client;
+
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.stereotype.Controller;
+
+/*
+should enable reading attribute values stored by the agent
+installing and
+uninstalling queries, and
+setting fallback contacts.
+
+Apart from providing forms for queries and fallback contacts,
+and presenting the information fetched from the agent in a textual form (with automatic refreshment),
+plotting the attributes with numeric values as real-time graphs.
+*/
+
+@Controller
+public class ClientController {
+
+ @GetMapping("/")
+ public String homePage(Model model) {
+ model.addAttribute("homeMessage", "Welcome to CloudaAtlas client interface");
+ return "home";
+ }
+
+ @GetMapping("/query")
+ public String queryPage(Model model) {
+ model.addAttribute("queryObject", new Query());
+ return "queryForm";
+ }
+
+ @PostMapping("/query")
+ public String submitQuery(@ModelAttribute Query queryObject, Model model) {
+ model.addAttribute("homeMessage", "Query submitted successfully");
+ return "home";
+ }
+
+ @GetMapping("/contacts")
+ public String contactPage(Model model) {
+ return "contactsForm";
+ }
+
+ @PostMapping("/contacts")
+ public String contactPage(@ModelAttribute String contactsObject, Model model) {
+ model.addAttribute("homeMessage", "Contact list submitted successfully");
+ return "home";
+ }
+
+ @GetMapping("/attribs")
+ public String attribPage(Model model) {
+ return "attribChart";
+ }
+}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/Controller.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/Controller.java
deleted file mode 100644
index 3b0ec63..0000000
--- a/src/main/java/pl/edu/mimuw/cloudatlas/client/Controller.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package pl.edu.mimuw.cloudatlas.client;
-
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/*
-should enable reading attribute values stored by the agent
-installing and
-uninstalling queries, and
-setting fallback contacts.
-
-Apart from providing forms for queries and fallback contacts,
-and presenting the information fetched from the agent in a textual form (with automatic refreshment),
-plotting the attributes with numeric values as real-time graphs.
-*/
-
-@RestController
-public class Controller {
-
- @GetMapping("/")
- public String homePage(Model model) {
- return "home";
- }
-}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java
new file mode 100644
index 0000000..ff9b7f4
--- /dev/null
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java
@@ -0,0 +1,22 @@
+package pl.edu.mimuw.cloudatlas.client;
+
+class Query {
+ private String name;
+ private String value;
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}