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 --- build.gradle | 2 + .../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 +++++++++++ 8 files changed, 118 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 diff --git a/build.gradle b/build.gradle index 498d29b..751927a 100644 --- a/build.gradle +++ b/build.gradle @@ -27,6 +27,8 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web:2.2.1.RELEASE' + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:2.2.1.RELEASE' + // Use JUnit test framework testImplementation 'junit:junit:4.12' 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