Merge branch 'develop' into backend/michael

This commit is contained in:
Michael 2019-04-17 01:33:21 +02:00
commit c98894bb08
16 changed files with 709 additions and 7913 deletions

File diff suppressed because it is too large Load Diff

View File

@ -16,10 +16,10 @@
"@quasar/extras": "^1.1.1", "@quasar/extras": "^1.1.1",
"ajv": "6.8.1", "ajv": "6.8.1",
"axios": "^0.18.0", "axios": "^0.18.0",
"quasar": "^1.0.0-beta.13" "quasar": "^1.0.0-beta.17"
}, },
"devDependencies": { "devDependencies": {
"@quasar/app": "^1.0.0-beta.13", "@quasar/app": "^1.0.0-beta.17",
"@vue/eslint-config-prettier": "^4.0.0", "@vue/eslint-config-prettier": "^4.0.0",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"eslint": "^5.10.0", "eslint": "^5.10.0",

View File

@ -100,7 +100,15 @@ module.exports = function (ctx) {
loader: 'eslint-loader', loader: 'eslint-loader',
exclude: /node_modules/ exclude: /node_modules/
}) })
} },
env: ctx.dev
? { // Base URL for API-Calls: DEV
API: JSON.stringify('http://localhost:8080')
}
: { // Base URL for API-Calls: PRODUCTION (build)
API: JSON.stringify('http://se.hs-heilbronn.de:8090')
//API: JSON.stringify('http://se.hs-heilbronn.de:8090')
}
}, },
devServer: { devServer: {

View File

@ -1,5 +1,14 @@
import axios from "axios"; import axios from "axios";
const axiosInstance = axios.create({
baseURL: process.env.API
});
console.log("process.env.DEV: "+process.env.DEV);
console.log("process.env.API: "+process.env.API);
export default async ({ Vue }) => { export default async ({ Vue }) => {
Vue.prototype.$axios = axios; //Vue.prototype.$axios = axios;
Vue.prototype.$axios = axiosInstance;
}; };
export { axiosInstance }

View File

@ -105,6 +105,23 @@
<q-page-container> <q-page-container>
<router-view/> <router-view/>
</q-page-container> </q-page-container>
<q-dialog v-model="dialogShow" persistent transition-show="scale" transition-hide="scale">
<q-card :class="dialogColorBg" style="min-width: 300px">
<q-card-section>
<div class="text-h6">Fehler</div>
</q-card-section>
<q-card-section>
{{ dialogMessage }}
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn @click="dialogClose" flat label="OK" :color="dialogColorBtn" v-close-popup/>
</q-card-actions>
</q-card>
</q-dialog>
</q-layout> </q-layout>
</template> </template>
@ -115,14 +132,54 @@
name: "MyLayout", name: "MyLayout",
data() { data() {
return { return {
// dialog: {
// color: this,
// show: true,
// message: "Hallo Fehler! Dies ist ein Beispiel Fehler."
// },
leftDrawerOpen: this.$q.platform.is.desktop, leftDrawerOpen: this.$q.platform.is.desktop,
//menuButtonVisible: !this.$q.platform.is.desktop, //menuButtonVisible: !this.$q.platform.is.desktop,
//leftDrawerOpen: true, //leftDrawerOpen: true,
//miniState: true //miniState: true
}; };
}, },
computed: {
dialogShow: {
get() {
console.log("get dialogShow: "+this.$store.state.dialog.dialog.show)
return this.$store.state.dialog.dialog.show;
},
set(val) {
console.log("set dialogShow: "+val)
this.$store.state.dialog.dialog.show = val;
}
},
dialogMessage: {
get() {
console.log("get dialogMessage: "+this.$store.state.dialog.dialog.message)
return this.$store.state.dialog.dialog.message;
},
},
dialogColorBg: {
get() {
console.log("get dialogColorBg: " + this.$store.state.dialog.dialog.colorBackground)
return this.$store.state.dialog.dialog.colorBackground;
},
},
dialogColorBtn: {
get() {
console.log("get dialogColorBtn: "+this.$store.state.dialog.dialog.colorButton)
return this.$store.state.dialog.dialog.colorButton;
},
}
},
methods: { methods: {
openURL //openURL
dialogClose() {
console.log("dialogClose(): ")
this.$store.commit('dialog/RESET_MESSAGE_DIALOG');
},
} }
}; };
</script> </script>

View File

@ -74,21 +74,6 @@
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
<q-dialog v-model="dialog" persistent transition-show="scale" transition-hide="scale">
<q-card class="bg-red-9 text-white" style="">
<q-card-section>
<div class="text-h6">Fehler</div>
</q-card-section>
<q-card-section>
{{ dialogMsg }}
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn flat label="OK" color="red-9" v-close-popup/>
</q-card-actions>
</q-card>
</q-dialog>
</div> </div>
</q-page> </q-page>
@ -107,8 +92,6 @@
return { return {
tab: 'list', tab: 'list',
caches: [], caches: [],
dialog: false,
dialogMsg: "",
} }
}, },
mounted: function () { mounted: function () {
@ -130,7 +113,7 @@
}, },
methods: { methods: {
fetchAllCaches() { fetchAllCaches() {
this.$axios.get('http://localhost:8080/api/allCaches') this.$axios.get('/api/allCaches')
.then((response) => { .then((response) => {
console.log("Caches: " + this.caches); console.log("Caches: " + this.caches);
this.caches = response.data; this.caches = response.data;
@ -143,7 +126,7 @@
}, },
deleteCache(id) { deleteCache(id) {
console.log('delete cache: ' + id) console.log('delete cache: ' + id)
this.$axios.delete('http://localhost:8080/api/deleteCache', {params: {cacheID: id}}) this.$axios.delete('/api/deleteCache', {params: {cacheID: id}})
.then((response) => { .then((response) => {
this.fetchAllCaches() this.fetchAllCaches()
}) })

View File

@ -29,7 +29,7 @@
<q-card class="q-mb-md" v-for="startedCache in startedCaches" :key="startedCache.id"> <q-card class="q-mb-md" v-for="startedCache in startedCaches" :key="startedCache.id">
<q-expansion-item <q-expansion-item
class="" class=""
v-if="startedCache.cacheAccesDefinition.description == 'angefangen'" v-if="startedCache.cacheAccesDefinition.description === 'angefangen'"
expand-icon-toggle expand-icon-toggle
expand-separator expand-separator
icon="location_on" icon="location_on"
@ -51,7 +51,7 @@
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item class="q-pr-sm reverse q-gutter-x-sm"> <q-item class="q-pr-sm reverse q-gutter-x-sm">
<q-btn @click="startCache(startedCache.id)" unelevated color="positive" stack icon="arrow_forward" <q-btn @click="continueCache(startedCache.id)" unelevated color="positive" stack icon="arrow_forward"
label="Fortfahren" size="sm"/> label="Fortfahren" size="sm"/>
</q-item> </q-item>
</q-expansion-item> </q-expansion-item>
@ -64,7 +64,7 @@
<q-card class="q-mb-md" v-for="startedCache in startedCaches" :key="startedCache.id"> <q-card class="q-mb-md" v-for="startedCache in startedCaches" :key="startedCache.id">
<q-expansion-item <q-expansion-item
class="" class=""
v-if="startedCache.cacheAccesDefinition.description == 'abgeschlossen'" v-if="startedCache.cacheAccesDefinition.description === 'abgeschlossen'"
expand-icon-toggle expand-icon-toggle
expand-separator expand-separator
icon="location_on" icon="location_on"
@ -105,7 +105,7 @@
export default { export default {
data() { data() {
return { return {
tab: 'startedCaches' + 'finishedCaches', tab: 'profile',
startedCaches: [], startedCaches: [],
} }
}, },

View File

@ -9,7 +9,6 @@
active-bg-color="bg-grey-1" active-bg-color="bg-grey-1"
active-color="cyan-14" active-color="cyan-14"
indicator-color="cyan-14" indicator-color="cyan-14"
narrow-indicator
switch-indicator switch-indicator
> >
<q-tab name="solo" label="Solo-Cacher" icon="person"/> <q-tab name="solo" label="Solo-Cacher" icon="person"/>
@ -83,6 +82,8 @@
console.log("Rankinglist: "); console.log("Rankinglist: ");
console.log(response.data); console.log(response.data);
this.rankinglist = response.data; this.rankinglist = response.data;
}).catch((error) => {
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: error })
}) })
} }
} }

View File

@ -25,22 +25,21 @@ const routes = [
component: () => import("layouts/MyLayout.vue"), component: () => import("layouts/MyLayout.vue"),
children: [{ path: "", component: () => import("pages/StationEdit.vue") }] children: [{ path: "", component: () => import("pages/StationEdit.vue") }]
}, },
{
path: "/station-l/:pos",
component: () => import("layouts/MyLayout.vue"),
children: [{path: "", component: () => import("pages/StationEdit.vue")}]
},
{ {
path: "/station/:cache/:id", path: "/station/:cache/:id",
component: () => import("layouts/MyLayout.vue"), component: () => import("layouts/MyLayout.vue"),
children: [{ path: "", component: () => import("pages/StationView.vue") }] children: [{ path: "", component: () => import("pages/StationView.vue") }]
}, },
{ {
path: "/station-l/:pos",
path: "/ranking/", path: "/ranking/",
component: () => import("layouts/MyLayout.vue"), component: () => import("layouts/MyLayout.vue"),
children: [{path: "", component: () => import("pages/ranking.vue")}] children: [{path: "", component: () => import("pages/ranking.vue")}]
}, },
{
path: "/station/",
component: () => import("layouts/MyLayout.vue"),
children: [{ path: "", component: () => import("pages/StationEdit.vue") }]
},
{ {
path: "/login/", path: "/login/",
component: () => import("layouts/MyLayout.vue"), component: () => import("layouts/MyLayout.vue"),

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,47 @@
export function NEW_MESSAGE_DIALOG (state, messageObject) {
console.log("NEW_MESSAGE_DIALOG");
if (messageObject == null) {
state.dialog.show = true;
return;
}
console.log(messageObject);
if (messageObject.hasOwnProperty('color')) {
switch (messageObject.color) {
case "red": {
let color = "red-9";
state.dialog.colorBackground = "bg-"+color+" text-white";
state.dialog.colorButton = color;
}
case "amber": {
let color = "amber";
state.dialog.colorBackground = "bg-"+color+" text-white";
state.dialog.colorButton = color;
}
case "blue": {
let color = "primary";
state.dialog.colorBackground = "bg-"+color+" text-white";
state.dialog.colorButton = color;
}
}
}
if (messageObject.hasOwnProperty('title')) {
state.dialog.title = messageObject.title;
}
if (messageObject.hasOwnProperty('message')) {
state.dialog.message = messageObject.message;
}
state.dialog.show = true;
}
export function RESET_MESSAGE_DIALOG (state) {
console.log("RESET_MESSAGE_DIALOG");
state.dialog.colorBackground = "bg-red-9 text-white";
state.dialog.colorButton = "red-9";
state.dialog.message = "Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es noch einmal.";
state.dialog.title = "Fehler";
state.dialog.show = false;
}

View File

@ -0,0 +1,9 @@
export default {
dialog: {
colorBackground: "bg-red-9 text-white",
colorButton: "red-9",
show: false,
title: "Fehler",
message: "Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es noch einmal."
},
}

View File

@ -3,6 +3,7 @@ import Vuex from "vuex";
import Axios from "axios"; import Axios from "axios";
import auth from "./auth" import auth from "./auth"
import cacheCollector from "./cacheCollector" import cacheCollector from "./cacheCollector"
import dialog from "./dialog"
// import example from './module-example' // import example from './module-example'
@ -17,7 +18,8 @@ export default function (/* { ssrContext } */) {
const Store = new Vuex.Store({ const Store = new Vuex.Store({
modules: { modules: {
auth, auth,
cacheCollector cacheCollector,
dialog
}, },
// enable strict mode (adds overhead!) // enable strict mode (adds overhead!)
@ -41,6 +43,10 @@ export default function (/* { ssrContext } */) {
const cacheCollector = require('./cacheCollector').default; const cacheCollector = require('./cacheCollector').default;
store.hotUpdate({ modules: { cacheCollector: newCacheCollector } }) store.hotUpdate({ modules: { cacheCollector: newCacheCollector } })
}) })
module.hot.accept(['./dialog'], () => {
const dialog = require('./dialog').default;
store.hotUpdate({ modules: { dialog: newDialog } })
})
} }
return Store return Store

File diff suppressed because it is too large Load Diff