From 10ac55b36bebf69b01168e07c5a03bee3746165b Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Thu, 21 Mar 2019 23:24:10 +0100 Subject: [PATCH 01/10] first simple data from demo api in index.vue --- frontend/quasar.conf.js | 5 +- frontend/src/pages/Index.vue | 137 +++++++---------------------------- 2 files changed, 30 insertions(+), 112 deletions(-) diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index 3f82b10..f8f9711 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -46,7 +46,8 @@ module.exports = function (ctx) { 'QCardSection', 'QCardActions', 'QCheckbox', - 'QSeparator' + 'QSeparator', + 'QInput' ], directives: [ @@ -86,7 +87,7 @@ module.exports = function (ctx) { devServer: { // https: true, // port: 8080, - open: true // opens browser window automatically + open: false // opens browser window automatically }, // animations: 'all' --- includes all animations diff --git a/frontend/src/pages/Index.vue b/frontend/src/pages/Index.vue index 4f72725..03ae658 100644 --- a/frontend/src/pages/Index.vue +++ b/frontend/src/pages/Index.vue @@ -2,9 +2,9 @@
- + @@ -59,127 +59,44 @@ export default { denseOn: true, filter: '', selected: [], + todos: [], columns: [ { name: 'desc', required: true, label: 'Dessert (100g serving)', align: 'left', - field: row => row.name, + field: row => row.title, format: val => `${val}`, sortable: true }, - { name: 'calories', align: 'center', label: 'Calories', field: 'calories', sortable: true }, - { name: 'fat', label: 'Fat (g)', field: 'fat', sortable: true }, - { name: 'carbs', label: 'Carbs (g)', field: 'carbs' }, - { name: 'protein', label: 'Protein (g)', field: 'protein' }, - { name: 'sodium', label: 'Sodium (mg)', field: 'sodium' }, - { name: 'calcium', label: 'Calcium (%)', field: 'calcium', sortable: true, sort: (a, b) => parseInt(a, 10) - parseInt(b, 10) }, - { name: 'iron', label: 'Iron (%)', field: 'iron', sortable: true, sort: (a, b) => parseInt(a, 10) - parseInt(b, 10) } + { name: 'userId', align: 'center', label: 'ID', field: 'userId', sortable: true }, + { name: 'id', label: 'fID', field: 'id', sortable: true }, + { name: 'title', label: 'Titel', field: 'title' }, + { name: 'completed', label: 'Komplett', field: 'completed' }, ], data: [ { - name: 'Frozen Yogurt', - calories: 159, - fat: 6.0, - carbs: 24, - protein: 4.0, - sodium: 87, - calcium: '14%', - iron: '1%' - }, - { - name: 'Ice cream sandwich', - calories: 237, - fat: 9.0, - carbs: 37, - protein: 4.3, - sodium: 129, - calcium: '8%', - iron: '1%' - }, - { - name: 'Eclair', - calories: 262, - fat: 16.0, - carbs: 23, - protein: 6.0, - sodium: 337, - calcium: '6%', - iron: '7%' - }, - { - name: 'Cupcake', - calories: 305, - fat: 3.7, - carbs: 67, - protein: 4.3, - sodium: 413, - calcium: '3%', - iron: '8%' - }, - { - name: 'Gingerbread', - calories: 356, - fat: 16.0, - carbs: 49, - protein: 3.9, - sodium: 327, - calcium: '7%', - iron: '16%' - }, - { - name: 'Jelly bean', - calories: 375, - fat: 0.0, - carbs: 94, - protein: 0.0, - sodium: 50, - calcium: '0%', - iron: '0%' - }, - { - name: 'Lollipop', - calories: 392, - fat: 0.2, - carbs: 98, - protein: 0, - sodium: 38, - calcium: '0%', - iron: '2%' - }, - { - name: 'Honeycomb', - calories: 408, - fat: 3.2, - carbs: 87, - protein: 6.5, - sodium: 562, - calcium: '0%', - iron: '45%' - }, - { - name: 'Donut', - calories: 452, - fat: 25.0, - carbs: 51, - protein: 4.9, - sodium: 326, - calcium: '2%', - iron: '22%' - }, - { - name: 'KitKat', - calories: 518, - fat: 26.0, - carbs: 65, - protein: 7, - sodium: 54, - calcium: '12%', - iron: '6%' + "userId": 1, + "id": 1, + "title": "delectus aut autem", + "completed": false } ] } + }, + + created: function() { + this.fetchTodos(); + }, + + methods: { + fetchTodos () { + this.$axios.get('https://jsonplaceholder.typicode.com/todos') + .then((response) => { + this.todos = response.data; + }) + } } } From 2f2f0edff72e97cb079b3d262b9b6ff027c502b2 Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Sat, 23 Mar 2019 10:43:39 +0100 Subject: [PATCH 02/10] sample cards for caches --- .idea/modules.xml | 10 --- ....hhn.labsw.labswp_2019_sose_geocaching.iml | 12 ---- .idea/vcs.xml | 6 ++ frontend/quasar.conf.js | 3 +- frontend/src/pages/Index.vue | 72 ++++++++----------- 5 files changed, 37 insertions(+), 66 deletions(-) delete mode 100644 .idea/modules.xml delete mode 100644 .idea/modules/LabSWPS.de.hhn.labsw.labswp_2019_sose_geocaching.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 9db8a1d..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/LabSWPS.de.hhn.labsw.labswp_2019_sose_geocaching.iml b/.idea/modules/LabSWPS.de.hhn.labsw.labswp_2019_sose_geocaching.iml deleted file mode 100644 index 92b5305..0000000 --- a/.idea/modules/LabSWPS.de.hhn.labsw.labswp_2019_sose_geocaching.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index f8f9711..51b4962 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -47,7 +47,8 @@ module.exports = function (ctx) { 'QCardActions', 'QCheckbox', 'QSeparator', - 'QInput' + 'QInput', + 'QImg' ], directives: [ diff --git a/frontend/src/pages/Index.vue b/frontend/src/pages/Index.vue index 03ae658..0ad2ac0 100644 --- a/frontend/src/pages/Index.vue +++ b/frontend/src/pages/Index.vue @@ -1,49 +1,35 @@ From 9001b6d733efbc198b11020ee26f52e0be3ad5a1 Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Sat, 23 Mar 2019 11:36:02 +0100 Subject: [PATCH 03/10] fetch data from localhost/allCaches --- .gitignore | 5 ++++- frontend/src/pages/Index.vue | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 6c08a57..db2f45b 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,10 @@ labswp_2019_sose_geocaching.iml # public folder src/main/resources/public/ -.idea/ +# .idea/ +# nicht notwendig. alle problematischen files sind draußen. +# wenns trotzdem noch probleme macht muss man die entsprechenden +# files noch mit "git rm --cached untracken. # Gradle diff --git a/frontend/src/pages/Index.vue b/frontend/src/pages/Index.vue index 0ad2ac0..3e0e4ae 100644 --- a/frontend/src/pages/Index.vue +++ b/frontend/src/pages/Index.vue @@ -45,7 +45,7 @@ export default { denseOn: true, filter: '', selected: [], - todos: [], + caches: [], columns: [ { name: 'desc', @@ -61,14 +61,14 @@ export default { { name: 'title', label: 'Titel', field: 'title' }, { name: 'completed', label: 'Komplett', field: 'completed' }, ], - data: [ - { - "userId": 1, - "id": 1, - "title": "delectus aut autem", - "completed": false - } - ] + // data: [ + // { + // "userId": 1, + // "id": 1, + // "title": "delectus aut autem", + // "completed": false + // } + // ] } }, @@ -78,9 +78,9 @@ export default { methods: { fetchTodos () { - this.$axios.get('https://jsonplaceholder.typicode.com/todos') + this.$axios.get('http://localhost:8080/allCaches') .then((response) => { - this.todos = response.data; + this.caches = response.data; }) } } From 42e6d72fc3498313e4398d273c5421a370abd816 Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Sat, 23 Mar 2019 17:52:19 +0100 Subject: [PATCH 04/10] changed quasar dev port to 8081 and therefor added CORS policy to controller. tested allcaches api --- frontend/quasar.conf.js | 4 +- frontend/src/pages/Index.vue | 88 ------------------- frontend/src/router/routes.js | 5 ++ frontend/src/store/index.js | 52 ++++++++--- .../bugageocaching/controller/Controller.java | 2 + 5 files changed, 48 insertions(+), 103 deletions(-) delete mode 100644 frontend/src/pages/Index.vue diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index 51b4962..de6b87d 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -87,8 +87,8 @@ module.exports = function (ctx) { devServer: { // https: true, - // port: 8080, - open: false // opens browser window automatically + port: 8081, + open: true // opens browser window automatically }, // animations: 'all' --- includes all animations diff --git a/frontend/src/pages/Index.vue b/frontend/src/pages/Index.vue deleted file mode 100644 index 3e0e4ae..0000000 --- a/frontend/src/pages/Index.vue +++ /dev/null @@ -1,88 +0,0 @@ - - - - - diff --git a/frontend/src/router/routes.js b/frontend/src/router/routes.js index 8571b3d..554e56b 100644 --- a/frontend/src/router/routes.js +++ b/frontend/src/router/routes.js @@ -8,6 +8,11 @@ const routes = [ path: "/dashboard/", component: () => import("layouts/MyLayout.vue"), children: [{ path: "", component: () => import("pages/Dashboard.vue") }] + }, + { + path: "/testcaches/", + component: () => import("layouts/MyLayout.vue"), + children: [{ path: "", component: () => import("pages/TestCaches.vue") }] } ]; diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index ca79aab..e8a81c7 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -1,25 +1,51 @@ import Vue from "vue"; import Vuex from "vuex"; +import Axios from "axios"; // import example from './module-example' -Vue.use(Vuex); +Vue.use(Vuex, Axios); /* * If not building with SSR mode, you can * directly export the Store instantiation */ -export default function(/* { ssrContext } */) { - const Store = new Vuex.Store({ - modules: { - // example +// export default function(/* { ssrContext } */) { +// const Store = new Vuex.Store({ +// modules: { +// // example +// }, +// +// // enable strict mode (adds overhead!) +// // for dev mode only +// strict: process.env.DEV +// }); +// +// return Store; +// } + +export default new Vuex.Store({ + state: { + caches: [], + userToken: "", + userAuthenticated: true + }, + actions: {}, + mutations: { + checkAuth(state) { + console.log("checkAuth()"); + state.userAuthenticated = !state.userToken.isEmpty(); }, - - // enable strict mode (adds overhead!) - // for dev mode only - strict: process.env.DEV - }); - - return Store; -} + setUserToken(state, token) { + console.log("setUserToken()"); + state.userToken = token; + this.checkAuth(state); + } + }, + getters: { + userToken: state => state.userToken, + userAuthenticated: state => state.userAuthenticated + }, + modules: {} +}); diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index 8103518..9a03c55 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -5,6 +5,7 @@ import hhn.labsw.bugageocaching.repositories.CacheRepository; import hhn.labsw.bugageocaching.repositories.RewardRepository; import hhn.labsw.bugageocaching.repositories.StationRepository; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; @@ -21,6 +22,7 @@ public class Controller { @Autowired StationRepository stationRepository; + @CrossOrigin(origins = "http://localhost:8081") // only for dev purpose @RequestMapping("/allCaches") @ResponseBody public String getAllCaches(){ From b75f4d65e33d786891f68a849810adc0c55fc5df Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Sat, 23 Mar 2019 17:52:36 +0100 Subject: [PATCH 05/10] changed quasar dev port to 8081 and therefor added CORS policy to controller. tested allcaches api --- frontend/src/pages/TestCaches.vue | 83 +++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 frontend/src/pages/TestCaches.vue diff --git a/frontend/src/pages/TestCaches.vue b/frontend/src/pages/TestCaches.vue new file mode 100644 index 0000000..71e251c --- /dev/null +++ b/frontend/src/pages/TestCaches.vue @@ -0,0 +1,83 @@ + + + + + From 7db636b01a2da61d08caae6f6c1623a3a1309e89 Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Mon, 25 Mar 2019 19:22:48 +0100 Subject: [PATCH 06/10] some changes --- .gitignore | 5 +-- .idea/modules.xml | 10 +++++ frontend/.eslintrc.js | 2 +- frontend/quasar.conf.js | 1 - frontend/src/layouts/MyLayout.vue | 6 +-- frontend/src/pages/Dashboard.vue | 10 ----- frontend/src/pages/Index.vue | 54 ++++++++++++++++++++++ frontend/src/pages/Login.vue | 74 ++++++++++++++++--------------- frontend/src/pages/TestCaches.vue | 3 ++ 9 files changed, 110 insertions(+), 55 deletions(-) create mode 100644 .idea/modules.xml create mode 100644 frontend/src/pages/Index.vue diff --git a/.gitignore b/.gitignore index db2f45b..6c08a57 100644 --- a/.gitignore +++ b/.gitignore @@ -24,10 +24,7 @@ labswp_2019_sose_geocaching.iml # public folder src/main/resources/public/ -# .idea/ -# nicht notwendig. alle problematischen files sind draußen. -# wenns trotzdem noch probleme macht muss man die entsprechenden -# files noch mit "git rm --cached untracken. +.idea/ # Gradle diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9db8a1d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 6ef542c..c4e9e64 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -14,7 +14,7 @@ module.exports = { // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. extends: [ 'plugin:vue/essential', - '@vue/prettier' + // '@vue/prettier' ], // required to lint *.vue files diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index 1ffd38f..569ef43 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -47,7 +47,6 @@ module.exports = function (ctx) { 'QCardActions', 'QCheckbox', 'QSeparator', - 'QInput', 'QImg', 'QTabs', 'QTab', diff --git a/frontend/src/layouts/MyLayout.vue b/frontend/src/layouts/MyLayout.vue index 80c2afb..7dbfd97 100644 --- a/frontend/src/layouts/MyLayout.vue +++ b/frontend/src/layouts/MyLayout.vue @@ -1,7 +1,7 @@ diff --git a/frontend/src/pages/TestCaches.vue b/frontend/src/pages/TestCaches.vue index 71e251c..2f06321 100644 --- a/frontend/src/pages/TestCaches.vue +++ b/frontend/src/pages/TestCaches.vue @@ -23,6 +23,7 @@
+ Hallo
@@ -68,6 +69,7 @@ export default { }, created: function() { + console.log("created(): " + this.caches); this.fetchTodos(); }, @@ -75,6 +77,7 @@ export default { fetchTodos () { this.$axios.get('http://localhost:8080/allCaches') .then((response) => { + console.log("Caches: " + this.caches); this.caches = response.data; }) } From 9110c581ca7cc4694b98e4c08ef470da05128a2d Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Mon, 25 Mar 2019 19:33:43 +0100 Subject: [PATCH 07/10] uncached .idea/ --- .idea/checkstyle-idea.xml | 16 ---------------- .idea/compiler.xml | 13 ------------- .idea/encodings.xml | 4 ---- .idea/inspectionProfiles/Project_Default.xml | 6 ------ .idea/misc.xml | 9 --------- .idea/modules.xml | 10 ---------- .idea/vcs.xml | 6 ------ 7 files changed, 64 deletions(-) delete mode 100644 .idea/checkstyle-idea.xml delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml deleted file mode 100644 index 3918e38..0000000 --- a/.idea/checkstyle-idea.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 4aac343..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 15a15b2..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 03d9549..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index e62185c..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 9db8a1d..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From ab4a642619298a1f23c26113d6719a177c8d47c3 Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Mon, 25 Mar 2019 22:39:41 +0100 Subject: [PATCH 08/10] login implemented and wired --- frontend/src/layouts/MyLayout.vue | 11 +-- frontend/src/pages/Login.vue | 95 ++++++++++++++----- .../bugageocaching/controller/Controller.java | 5 + 3 files changed, 79 insertions(+), 32 deletions(-) diff --git a/frontend/src/layouts/MyLayout.vue b/frontend/src/layouts/MyLayout.vue index 7dbfd97..4faab9f 100644 --- a/frontend/src/layouts/MyLayout.vue +++ b/frontend/src/layouts/MyLayout.vue @@ -24,10 +24,7 @@ v-model="leftDrawerOpen" bordered show-if-above - :mini="miniState" - @mouseover="miniState = false" - @mouseout="miniState = true" - content-class="bg-green-1"> + content-class=""> Essential Links
- - +