From 89b3f1164af4d157a1419e203575fe9a56f25794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 19 Nov 2019 19:22:13 +0100 Subject: Add working home page front-end --- .../mimuw/cloudatlas/client/ClientController.java | 26 ++++++++++++ .../pl/edu/mimuw/cloudatlas/client/Controller.java | 25 ------------ .../java/pl/edu/mimuw/cloudatlas/client/Query.java | 4 ++ src/main/resources/application.properties | 6 +++ .../mimuw/cloudatlas/client/templates/error.html | 10 +++++ .../client/templates/fragments/navbar.html | 46 ++++++++++++++++++++++ .../mimuw/cloudatlas/client/templates/home.html | 24 +++++++++++ 7 files changed, 116 insertions(+), 25 deletions(-) create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java delete mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/client/Controller.java create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java create mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/error.html create mode 100644 src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html create mode 100644 src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html (limited to 'src') 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..ce3ee81 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -0,0 +1,26 @@ +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"; + } +} 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..468c869 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java @@ -0,0 +1,4 @@ +package pl.edu.mimuw.cloudatlas.client; + +public class Query { +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..cf15d4a --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,6 @@ +spring.application.name=CloudAtlas Client + +spring.thymeleaf.cache=false +spring.thymeleaf.enabled=true +spring.thymeleaf.prefix=classpath:/pl/edu/mimuw/cloudatlas/client/templates/ +spring.thymeleaf.suffix=.html \ No newline at end of file diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/error.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/error.html new file mode 100644 index 0000000..9b42db1 --- /dev/null +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/error.html @@ -0,0 +1,10 @@ + +Error + +

Error

+[status] + error + +

message

+ + \ No newline at end of file diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html new file mode 100644 index 0000000..c2beaa9 --- /dev/null +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html @@ -0,0 +1,46 @@ + + + + + + CloudAtlas Client + + + + + +
+ +
+ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html new file mode 100644 index 0000000..c8f3031 --- /dev/null +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html @@ -0,0 +1,24 @@ + + + + + + + CloudAtlas Client - home + + + + + +
+
+

+
+ + + + + + + + \ No newline at end of file -- cgit v1.2.3 From e2ca01c0c0cb3dc1a470141292cc5c420d572cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 19 Nov 2019 19:31:33 +0100 Subject: Fix EOF newlines so that Github doesn't complain --- src/main/resources/application.properties | 2 +- src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/error.html | 2 +- .../pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html | 2 +- src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index cf15d4a..9cbc2e8 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -3,4 +3,4 @@ spring.application.name=CloudAtlas Client spring.thymeleaf.cache=false spring.thymeleaf.enabled=true spring.thymeleaf.prefix=classpath:/pl/edu/mimuw/cloudatlas/client/templates/ -spring.thymeleaf.suffix=.html \ No newline at end of file +spring.thymeleaf.suffix=.html diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/error.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/error.html index 9b42db1..b449bda 100644 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/error.html +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/error.html @@ -7,4 +7,4 @@

message

- \ No newline at end of file + diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html index c2beaa9..8d7af3b 100644 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html @@ -43,4 +43,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html index c8f3031..47b19af 100644 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html @@ -21,4 +21,4 @@ - \ No newline at end of file + -- cgit v1.2.3 From b5b9ab553ee97019021098028738ed8d253c0bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 19 Nov 2019 19:33:10 +0100 Subject: Add query submission form --- .../mimuw/cloudatlas/client/ClientController.java | 13 ++++++++ .../java/pl/edu/mimuw/cloudatlas/client/Query.java | 30 ++++++++++++++++++- .../cloudatlas/client/templates/queryForm.html | 35 ++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/queryForm.html (limited to 'src') 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 ce3ee81..56237f0 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -23,4 +23,17 @@ public class ClientController { 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("/submitQuery") + public String submitQuery(@ModelAttribute Query queryObject, Model model) { + System.out.println(queryObject.toString()); + model.addAttribute("homeMessage", "Query submitted successfully"); + 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 index 468c869..de6a18e 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java @@ -1,4 +1,32 @@ package pl.edu.mimuw.cloudatlas.client; -public class Query { +class Query { + private String name; + private String value; + +// Query() { +// this.name = ""; +// this.value = ""; +// } +// +// Query(String name, String value){ +// this.name = name; +// this.value = 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; + } } diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/queryForm.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/queryForm.html new file mode 100644 index 0000000..eb9a971 --- /dev/null +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/queryForm.html @@ -0,0 +1,35 @@ + + + + + + Query form + + + + + +
+
+
+
+ + +
+
+ + +
+ +
+ +

+
+ + + + + + + + -- cgit v1.2.3 From 5baaff8082847b2cfb8243fac63a05bfaa1ef35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 19 Nov 2019 19:35:46 +0100 Subject: Simplify query addressing --- src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java | 2 +- .../resources/pl/edu/mimuw/cloudatlas/client/templates/queryForm.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 56237f0..01a0b94 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -30,7 +30,7 @@ public class ClientController { return "queryForm"; } - @PostMapping("/submitQuery") + @PostMapping("/query") public String submitQuery(@ModelAttribute Query queryObject, Model model) { System.out.println(queryObject.toString()); model.addAttribute("homeMessage", "Query submitted successfully"); diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/queryForm.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/queryForm.html index eb9a971..ac00645 100644 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/queryForm.html +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/queryForm.html @@ -11,7 +11,7 @@
-
+
-- cgit v1.2.3 From fc3fffece6905e1baf2482c844533c7fb4c0a885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 19 Nov 2019 19:48:18 +0100 Subject: Add contact list submission front-end --- .../mimuw/cloudatlas/client/ClientController.java | 12 +++++++++ .../cloudatlas/client/templates/contactsForm.html | 29 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/contactsForm.html (limited to 'src') 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 01a0b94..c092d4f 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -36,4 +36,16 @@ public class ClientController { 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) { + System.out.println(contactsObject); + model.addAttribute("homeMessage", "Contact list submitted successfully"); + return "home"; + } } diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/contactsForm.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/contactsForm.html new file mode 100644 index 0000000..8ed563f --- /dev/null +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/contactsForm.html @@ -0,0 +1,29 @@ + + + + + + Query form + + + + + +
+
+ +
+ + +
+ + +
+ + + + + + + + \ No newline at end of file -- cgit v1.2.3 From c8891036b9d932926b93c0b519244046e54d01ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 19 Nov 2019 19:49:06 +0100 Subject: Stylistic fixes --- src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java | 2 -- .../pl/edu/mimuw/cloudatlas/client/templates/contactsForm.html | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src') 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 c092d4f..79676eb 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -32,7 +32,6 @@ public class ClientController { @PostMapping("/query") public String submitQuery(@ModelAttribute Query queryObject, Model model) { - System.out.println(queryObject.toString()); model.addAttribute("homeMessage", "Query submitted successfully"); return "home"; } @@ -44,7 +43,6 @@ public class ClientController { @PostMapping("/contacts") public String contactPage(@ModelAttribute String contactsObject, Model model) { - System.out.println(contactsObject); model.addAttribute("homeMessage", "Contact list submitted successfully"); return "home"; } diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/contactsForm.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/contactsForm.html index 8ed563f..027f831 100644 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/contactsForm.html +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/contactsForm.html @@ -26,4 +26,4 @@ - \ No newline at end of file + -- cgit v1.2.3 From 325d976ff7410a0bca08f452aee019fc768c4fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 19 Nov 2019 19:55:19 +0100 Subject: Fix small navbar issues --- .../pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html index 8d7af3b..c651f74 100644 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/fragments/navbar.html @@ -11,14 +11,14 @@
-- cgit v1.2.3 From 7805b12121837f38ab4b342b3768ca4dd5777d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 19 Nov 2019 19:58:46 +0100 Subject: Add atttibute plotting front-end skeleton --- .../mimuw/cloudatlas/client/ClientController.java | 5 +++ .../cloudatlas/client/templates/attribChart.html | 46 ++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html (limited to 'src') 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 79676eb..62f77ee 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -46,4 +46,9 @@ public class ClientController { model.addAttribute("homeMessage", "Contact list submitted successfully"); return "home"; } + + @GetMapping("/attribs") + public String attribPage(Model model) { + return "attribChart"; + } } diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html new file mode 100644 index 0000000..7e0b37f --- /dev/null +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html @@ -0,0 +1,46 @@ + + + + + + Attributes chart + + + + + + + +
+
+ + + + + + + + + -- cgit v1.2.3 From 5f8ccad41f03b75acb9e3c1d5b46f86c344a721a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 19 Nov 2019 20:01:09 +0100 Subject: Fix Query comments --- src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java index de6a18e..ff9b7f4 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/Query.java @@ -4,16 +4,6 @@ class Query { private String name; private String value; -// Query() { -// this.name = ""; -// this.value = ""; -// } -// -// Query(String name, String value){ -// this.name = name; -// this.value = value; -// } - public String getName() { return this.name; } -- cgit v1.2.3