Dashboard ans stuff

This commit is contained in:
Kekskurse 2019-07-23 18:08:19 +02:00
parent 044b19e2d0
commit f4848dbb6b
7 changed files with 134 additions and 15 deletions

View file

@ -6,11 +6,16 @@
</v-toolbar-title> </v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-toolbar-items class="hidden-sm-and-down"> <v-toolbar-items class="hidden-sm-and-down">
<v-btn
v-if="this.$store.state.loggedIn"
:to="{path: '/dashboard'}"
flat
>Dashboard</v-btn>
<v-btn <v-btn
v-if="this.$store.state.loggedIn && this.$store.getters.getMe.developer" v-if="this.$store.state.loggedIn && this.$store.getters.getMe.developer"
:to="{path: '/apps'}" :to="{path: '/apps'}"
flat flat
>Apps</v-btn> >Developer</v-btn>

View file

@ -8,6 +8,7 @@ import store from '../store/store';
import OAuthPermission from '../views/OAuthPermission' import OAuthPermission from '../views/OAuthPermission'
import ListApps from '../views/ListApps' import ListApps from '../views/ListApps'
import AppDetails from '../views/AppDetails' import AppDetails from '../views/AppDetails'
import NewApp from '../views/NewApp'
Vue.use(Router) Vue.use(Router)
@ -49,6 +50,12 @@ export default new Router({
name: 'Apps', name: 'Apps',
component: ListApps component: ListApps
}, },
{
beforeEnter: guard,
path: '/apps/new',
name: 'newApp',
component: NewApp
},
{ {
beforeEnter: guard, beforeEnter: guard,
path: '/apps/:id', path: '/apps/:id',

View file

@ -2,7 +2,7 @@ import axios from 'axios'
export default() => { export default() => {
return axios.create({ return axios.create({
//baseURL: `http://127.0.0.1:8000/api/`, baseURL: `http://127.0.0.1:8000/api/`,
baseURL: `https://api.account.keks.cloud/api/`, baseURL: `https://api.account.keks.cloud/api/`,
withCredentials: false, withCredentials: false,
headers: { headers: {

View file

@ -13,6 +13,9 @@ export default {
getAppByKey(key) { getAppByKey(key) {
return Api().get("/v1/app/find?apiKey="+key); return Api().get("/v1/app/find?apiKey="+key);
}, },
getStartPageApps() {
return Api().get("/v1/app/find?webpage=1");
},
getAccess(id) { getAccess(id) {
return Api().get('/v1/app/'+id+'/access?create=1') return Api().get('/v1/app/'+id+'/access?create=1')
}, },
@ -24,5 +27,8 @@ export default {
}, },
getUser(id) { getUser(id) {
return Api().get('/v1/app/'+id+'/user') return Api().get('/v1/app/'+id+'/user')
},
newApp(name, description, url) {
return Api().post('/v1/app/', {name: name, description: description, url: url});
} }
} }

View file

@ -5,8 +5,40 @@
<v-flex md12> <v-flex md12>
<h1>Dashboard</h1> <h1>Dashboard</h1>
<br><br> <br><br>
Hello {{$store.getters.getMe["username"]}},<br> <h3>Hello {{$store.getters.getMe["username"]}}, login to</h3>
soon here will be an Dashboard.
<v-layout row wrap>
<v-flex md4 xs12 text-xs-center v-for="(item, index) in apps">
<v-card>
<v-layout>
<v-flex xs5>
<v-img
:src="getImageUrl(item.id)"
height="125px"
contain
></v-img>
</v-flex>
<v-flex xs7>
<v-card-title primary-title>
<div>
<div class="headline">{{ item.name }}</div>
<div>{{ item.description }}</div>
</div>
</v-card-title>
</v-flex>
</v-layout>
<v-divider light></v-divider>
<v-card-actions class="pa-3">
<v-spacer></v-spacer>
<v-btn icon>
<v-icon @click="navigateToApp(item)">input</v-icon>
</v-btn>
</v-card-actions>
</v-card>
</v-flex>
</v-layout>
</v-flex> </v-flex>
@ -21,32 +53,33 @@
<script> <script>
import ServerService from '../services/Server' import ServerService from '../services/Server'
import UserService from '../services/User' import UserService from '../services/User'
import AppService from '../services/Apps'
export default { export default {
data () { data () {
return { return {
nameBig: '', nameBig: '',
nameSmall: '', nameSmall: '',
username: '', apps: []
password: '',
errorMessage: ''
} }
}, },
methods: { methods: {
'login': function () { 'getImageUrl' : function (id) {
UserService.login(this.username, this.password).then((res) => { return AppService.getAppImage(id);
this.errorMessage = ''; },
UserService.setAccessToken(res.data.data["access_token"]); 'navigateToApp': function(item) {
console.log("Login ok, dispatch event"); location.href = item.directUrl;
this.$store.dispatch('checkAccount'); },
}, (res) => { 'getStartpageApps': function () {
this.errorMessage = res.response.data.msg; AppService.getStartPageApps().then((res) => {
this.apps = res.data.data;
}); });
} }
}, },
mounted: function() { mounted: function() {
this.nameBig = this.$store.getters.getSettingValue("name_big"); this.nameBig = this.$store.getters.getSettingValue("name_big");
this.nameSmall = this.$store.getters.getSettingValue("name_small"); this.nameSmall = this.$store.getters.getSettingValue("name_small");
this.getStartpageApps();
} }
} }
</script> </script>

View file

@ -3,6 +3,7 @@
<v-container grid-list-md> <v-container grid-list-md>
<v-layout row wrap> <v-layout row wrap>
<v-flex md12> <v-flex md12>
<v-btn color="success" style="float:right;" @click="$router.push({name: 'newApp'})">Add App</v-btn>
<h1>Apps</h1> <h1>Apps</h1>
<br><br> <br><br>
<p>Here you can Administrate your apps</p> <p>Here you can Administrate your apps</p>

67
src/views/NewApp.vue Normal file
View file

@ -0,0 +1,67 @@
<template>
<div style="">
<v-container grid-list-md>
<v-layout row wrap>
<v-flex md12>
<h1>New App</h1>
<v-text-field
label="Name"
value=""
type="text"
v-model="name"
error=true
error-messages="ja"
></v-text-field>
<v-text-field
label="Description"
value=""
type="text"
v-model="description"
error=true
error-messages="ja"
></v-text-field>
<v-text-field
label="URL"
value=""
type="text"
v-model="url"
error-messages=""
></v-text-field>
</v-flex>
</v-layout>
<v-btn
color="success"
@click="createApp"
>
Create App
</v-btn>
</v-container>
</div>
</template>
<script>
import AppService from '../services/Apps'
export default {
data () {
return {
name: '',
description: '',
url: ''
}
},
methods: {
createApp: function () {
AppService.newApp()
}
},
mounted: function() {
}
}
</script>