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-spacer></v-spacer>
<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-if="this.$store.state.loggedIn && this.$store.getters.getMe.developer"
:to="{path: '/apps'}"
flat
>Apps</v-btn>
>Developer</v-btn>

View file

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

View file

@ -2,7 +2,7 @@ import axios from 'axios'
export default() => {
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/`,
withCredentials: false,
headers: {

View file

@ -13,6 +13,9 @@ export default {
getAppByKey(key) {
return Api().get("/v1/app/find?apiKey="+key);
},
getStartPageApps() {
return Api().get("/v1/app/find?webpage=1");
},
getAccess(id) {
return Api().get('/v1/app/'+id+'/access?create=1')
},
@ -24,5 +27,8 @@ export default {
},
getUser(id) {
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>
<h1>Dashboard</h1>
<br><br>
Hello {{$store.getters.getMe["username"]}},<br>
soon here will be an Dashboard.
<h3>Hello {{$store.getters.getMe["username"]}}, login to</h3>
<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>
@ -21,32 +53,33 @@
<script>
import ServerService from '../services/Server'
import UserService from '../services/User'
import AppService from '../services/Apps'
export default {
data () {
return {
nameBig: '',
nameSmall: '',
username: '',
password: '',
errorMessage: ''
apps: []
}
},
methods: {
'login': function () {
UserService.login(this.username, this.password).then((res) => {
this.errorMessage = '';
UserService.setAccessToken(res.data.data["access_token"]);
console.log("Login ok, dispatch event");
this.$store.dispatch('checkAccount');
}, (res) => {
this.errorMessage = res.response.data.msg;
'getImageUrl' : function (id) {
return AppService.getAppImage(id);
},
'navigateToApp': function(item) {
location.href = item.directUrl;
},
'getStartpageApps': function () {
AppService.getStartPageApps().then((res) => {
this.apps = res.data.data;
});
}
},
mounted: function() {
this.nameBig = this.$store.getters.getSettingValue("name_big");
this.nameSmall = this.$store.getters.getSettingValue("name_small");
this.getStartpageApps();
}
}
</script>

View file

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