This commit is contained in:
Michael 2019-04-06 11:06:26 +02:00
commit 3d78f0bc42
11 changed files with 156 additions and 38 deletions

View File

@ -64,6 +64,8 @@ module.exports = function (ctx) {
'QExpansionItem',
'QParallax',
'QEditor',
'QSelect',
'QField',
],
directives: [

View File

@ -1,18 +1,75 @@
<template>
<div>
<div class="q-pa-md">
<p class="text-h6">Cache erstellen/bearbeiten</p>
<p>Cache Name</p>
<p>Cache Beschreibung</p>
<p>Cache Punkte</p>
<p>Stationen</p>
<form>
<div class="q-pa-md q-gutter-y-md">
<p class="text-h5">Cache erstellen/bearbeiten</p>
<q-input class="col" dense stack-label filled v-model="text" label="Name"/>
<q-input
v-model="description"
dense
stack-label
filled
autogrow
type="textarea"
label="Beschreibung"
/>
<q-input class="col" dense stack-label filled v-model="text" label="Punktewert"/>
<p class="text-h6">Stationen</p>
<q-list bordered separator class="rounded-borders" >
<q-item>
<q-item-section avatar>
<q-avatar color="primary" text-color="white">
1
</q-avatar>
</q-item-section>
<q-item-section top>
<q-item-label lines="1">
<!--<span class="text-weight-medium">[quasarframework/quasar]</span>-->
<span class="text-grey-8">Beschreibung:</span>
</q-item-label>
<q-item-label lines="1" class="q-mt-xs text-body2">
<span class="cursor-pointer">Dies ist der Anfang der Beschreibung...</span>
</q-item-label>
</q-item-section>
<q-item-section side>
<div class="text-grey-8 q-gutter-xs">
<q-btn class="" color="" flat dense round icon="delete" />
<q-btn class="" color="" flat dense round icon="edit" />
</div>
</q-item-section>
</q-item>
</q-list>
<div class="row reverse">
<q-btn @click="addStation" unelevated color="primary" label="Station hinzufügen" icon-right="add"/>
</div>
<div class="row q-mt-xl">
<q-btn @click="saveCache" class="full-width" unelevated stack color="positive" label="Cache speichern" icon="save_alt"/>
</div>
</div>
</form>
</div>
</template>
<script>
export default {
name: "Cache"
name: "Cache",
data() {
return {
text: ""
}
},
methods: {
addStation() {
},
saveCache() {
}
}
}
</script>

View File

@ -119,7 +119,9 @@
this.$axios.get('http://localhost:8080/api/startCache', { params })
.then((response) => {
console.log("Angefangen: " + response.data);
this.$router.push({ path: `/station/${cacheID}` })
let stationID = response.data.aktuelleStation.id;
console.log(stationID);
this.$router.push({ path: `/station/${stationID}` })
})
}
}

View File

@ -1,33 +1,38 @@
<template>
<q-page class="q-ma-md">
<h4 class="text-h4">Neue Station</h4>
<div class="q-ma-md">
<p class="text-h5">Neue Station</p>
<q-editor
:toolbar="[
['bold', 'italic', 'strike', 'underline'],
['undo', 'redo']
]"
v-model="description" min-height="10rem" />
v-model="station.description" min-height="10rem" />
<!--<q-input-->
<!--v-model="description"-->
<!--filled-->
<!--type="textarea"-->
<!--/>-->
<p class="text-h5 q-mt-md">Location</p>
<p class="text-h6 q-mt-md">Location</p>
<q-img transition="fade"
class="q-mb-md "
:ratio="16/9"
src="https://www.buga2019.de/we-bilder/3.Gartenausstellung/Gelaendeplan/190320_Gelaendeplan-quadratisch.jpg"
></q-img>
<div class="row q-col-gutter-md">
<q-input class="col" dense stack-label filled v-model="text" label="Längengrad/Breitengrad" />
<q-input class="col" dense stack-label filled v-model="latlang" @input="separateLatlang" label="Längengrad/Breitengrad" />
<div class="col-shrink">
<q-btn unelevated color="primary" class="full-height" icon="my_location"/>
</div>
</div>
<p class="text-h5 q-mt-md">Lösung</p>
<q-input class="col" dense stack-label filled v-model="text" label="Lösung" />
<q-input class="col q-mt-md" dense stack-label filled v-model="text" label="Code" readonly/>
</q-page>
<p class="text-h6 q-mt-md">Lösung</p>
<q-input class="col" dense stack-label filled v-model="station.solution" label="Lösung" />
<q-input class="col q-mt-md" dense stack-label filled v-model="station.code" label="Code" readonly/>
<div class="row reverse q-mt-md q-gutter-x-md">
<q-btn @click="addStation" unelevated color="primary" label="Speichern" icon-right="add"/>
<q-btn @click="dismiss" unelevated color="negative" label="verwerfen" icon-right="delete"/>
</div>
</div>
</template>
<script>
@ -37,7 +42,15 @@
data() {
return {
description: "Rätsel, Aufgabe und Informationen zur Station.",
text:"v-model !!"
text:"v-model !!",
latlang: "",
station: {
description: "description",
lattitude: 0.06470,
longitude: 0.05551,
solution: "solution",
code: 357547
},
}
},
created: function() {
@ -45,11 +58,33 @@
beforeMount: function() {
},
mounted: function() {
console.log("'id' from url: "+this.$route.params.id)
console.log("'id' from url: "+this.$route.params.id);
this.concatLatlang();
},
computed: {
// concatLatlang() {
// return this.station.lattitude+", "+this.station.longitude
// }
},
methods: {
separateLatlang() {
//console.log("separateLatlang()");
if (this.latlang.includes(',')) {
this.station.lattitude = this.latlang.substr(0, this.latlang.indexOf(',')).trim();
this.station.longitude = this.latlang.substr(this.latlang.indexOf(',')+1, this.latlang.length).trim();
console.log(this.latlang);
console.log(this.station.lattitude + ", " + this.station.longitude);
}
},
concatLatlang() {
this.latlang = this.station.lattitude+", "+this.station.longitude;
},
addStation() {
},
dismiss() {
}
}
}
</script>

View File

@ -0,0 +1,4 @@
/*
export function someAction (context) {
}
*/

View File

@ -0,0 +1,4 @@
/*
export function someGetter (state) {
}
*/

View File

@ -0,0 +1,12 @@
import state from './state'
import * as getters from './getters'
import * as mutations from './mutations'
import * as actions from './actions'
export default {
namespaced: true,
state,
getters,
mutations,
actions
}

View File

@ -0,0 +1,4 @@
/*
export function someMutation (state) {
}
*/

View File

@ -0,0 +1,3 @@
export default {
//
}

View File

@ -2,6 +2,7 @@ import Vue from "vue";
import Vuex from "vuex";
import Axios from "axios";
import auth from "./auth"
import cacheCollector from "./cacheCollector"
// import example from './module-example'
@ -12,24 +13,11 @@ Vue.use(Vuex, Axios);
* directly export the Store instantiation
*/
// 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 function (/* { ssrContext } */) {
const Store = new Vuex.Store({
modules: {
auth
auth,
cacheCollector
},
// enable strict mode (adds overhead!)
@ -47,6 +35,10 @@ export default function (/* { ssrContext } */) {
module.hot.accept(['./auth'], () => {
const auth = require('./auth').default;
store.hotUpdate({ modules: { auth: newAuth } })
});
module.hot.accept(['./cacheCollector'], () => {
const cacheCollector = require('./cacheCollector').default;
store.hotUpdate({ modules: { cacheCollector: newCacheCollector } })
})
}

View File

@ -109,7 +109,7 @@ public class Controller {
CacheAccesDefinition cacheAccesDefinition = cacheAccesDefinitionOptional.get();
bearbeitet.setCacheAccesDefinition(cacheAccesDefinition);
} else {
throw new IllegalParameterException("There is no cacheAccesDefinition with the ID " + 0);
return ResponseEntity.status(404).body("There is no cacheAccesDefinition with the ID " + 0);
}
bearbeitetRepository.save(bearbeitet);
@ -240,6 +240,9 @@ public class Controller {
@ResponseBody
public ResponseEntity checkAdmin(@RequestParam String token) {
User user = userRepository.findByUsername(token.substring(0, token.indexOf("$")));
if (user == null) {
return ResponseEntity.status(404).body("User was not found");
}
for (Role role : user.getRoles()) {
if (role.getId() == 0) { // is admin
return ResponseEntity.status(200).body("User is Admin");