From 95ad37c16478a2c8739ef8f0f8ffe227f166fdfa Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Mon, 17 Sep 2018 12:00:28 +0100 Subject: [PATCH] Linked Site and Tutor retrieval to front end. --- .../Observations/ObservationsApplication.java | 3 + .../Observations/resources/SiteResource.java | 29 ++++++++ frontend/package-lock.json | 27 +++++-- frontend/package.json | 3 + frontend/src/main.js | 8 ++ frontend/src/views/Home.vue | 73 ++++++++++++++++--- 6 files changed, 128 insertions(+), 15 deletions(-) create mode 100644 backend/src/main/java/uk/co/neviyn/Observations/resources/SiteResource.java diff --git a/backend/src/main/java/uk/co/neviyn/Observations/ObservationsApplication.java b/backend/src/main/java/uk/co/neviyn/Observations/ObservationsApplication.java index ee5a618..f7efe74 100644 --- a/backend/src/main/java/uk/co/neviyn/Observations/ObservationsApplication.java +++ b/backend/src/main/java/uk/co/neviyn/Observations/ObservationsApplication.java @@ -12,6 +12,7 @@ import uk.co.neviyn.Observations.dao.SiteDao; import uk.co.neviyn.Observations.dao.TutorDao; import uk.co.neviyn.Observations.resources.ObservationResource; import uk.co.neviyn.Observations.resources.TutorResource; +import uk.co.neviyn.Observations.resources.SiteResource; public class ObservationsApplication extends Application { @@ -44,5 +45,7 @@ public class ObservationsApplication extends Application> allSites(){ + return dao.allSites().stream().map(x -> new SelectOption<>(x.getName(), x.getId())).collect(Collectors.toList()); + } +} diff --git a/frontend/package-lock.json b/frontend/package-lock.json index a9272b8..e2c650d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1979,6 +1979,15 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, + "axios": { + "version": "0.18.0", + "resolved": "http://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "requires": { + "follow-redirects": "^1.3.0", + "is-buffer": "^1.1.5" + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -5751,7 +5760,6 @@ "version": "1.5.8", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.8.tgz", "integrity": "sha512-sy1mXPmv7kLAMKW/8XofG7o9T+6gAjzdZK4AJF6ryqQYUa/hnzgiypoeUecZ53x7XiqKNEpNqLtS97MshW2nxg==", - "dev": true, "requires": { "debug": "=3.1.0" }, @@ -5760,7 +5768,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, "requires": { "ms": "2.0.0" } @@ -5768,11 +5775,15 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }, + "font-awesome": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz", + "integrity": "sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM=" + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -7530,8 +7541,7 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, "is-builtin-module": { "version": "1.0.0", @@ -14362,6 +14372,11 @@ "resolved": "https://registry.npmjs.org/vue/-/vue-2.5.17.tgz", "integrity": "sha512-mFbcWoDIJi0w0Za4emyLiW72Jae0yjANHbCVquMKijcavBGypqlF7zHRgMa5k4sesdv7hv2rB4JPdZfR+TPfhQ==" }, + "vue-awesome": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/vue-awesome/-/vue-awesome-3.1.2.tgz", + "integrity": "sha512-5Ax5GvbCQDz0zx4PvqJ8b8MEMRQ1IGYtOVQ6u2NBGcWjFnxq0tprCk/YtGAGlYGKwx+OQSoYKb0qZHc4qVfAIg==" + }, "vue-axios": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/vue-axios/-/vue-axios-2.1.3.tgz", diff --git a/frontend/package.json b/frontend/package.json index 51f3bb4..7054b7d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,8 +9,11 @@ "test:unit": "vue-cli-service test:unit" }, "dependencies": { + "axios": "^0.18.0", "bootstrap-vue": "^2.0.0-rc.11", + "font-awesome": "^4.7.0", "vue": "^2.5.17", + "vue-awesome": "^3.1.2", "vue-axios": "^2.1.3", "vue-router": "^3.0.1", "vuex": "^3.0.1" diff --git a/frontend/src/main.js b/frontend/src/main.js index 3a47006..f0c9679 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -2,8 +2,16 @@ import Vue from "vue"; import App from "./App.vue"; import router from "./router"; import store from "./store"; +import axios from 'axios'; +import VueAxios from 'vue-axios'; +import BootstrapVue from 'bootstrap-vue'; +import Icon from 'vue-awesome/components/Icon'; Vue.config.productionTip = false; +axios.defaults.baseUrl = "http://localhost:8090/api"; +Vue.use(VueAxios, axios); +Vue.use(BootstrapVue); +Vue.component('v-icon', Icon); new Vue({ router, diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue index 31ecbd6..d8d0da6 100644 --- a/frontend/src/views/Home.vue +++ b/frontend/src/views/Home.vue @@ -1,18 +1,73 @@