reordered for custom views

This commit is contained in:
Sebastian Frank
2017-08-29 15:51:50 +02:00
parent 5b250b02fe
commit f7de209197
10 changed files with 51 additions and 51 deletions

15
src/views/dashboard.vue Normal file
View File

@@ -0,0 +1,15 @@
<template>
<div class="Dashboard">
Dashboard
</div>
</template>
<script>
export default {
name: "Dashboard",
data() {
return {
}
}
}
</script>

55
src/views/forms/login.vue Normal file
View File

@@ -0,0 +1,55 @@
<template>
<div class="LoginForm">
<h2>Login</h2>
<my-form :elements="elements" :buttons="buttons" :submitHandler="login"></my-form>
</div>
</template>
<script>
import MyForm from '../../components/my-form.vue';
export default {
name: 'LoginForm',
components: {
MyForm
},
data() {
return {
username: '',
password: '',
elements: {
username: {
label: 'Benutzername',
type: 'text',
required: true
},
password: {
label: 'Passwort',
type: 'password',
required: true
}
},
buttons: [
{
label: 'login',
type: 'submit'
}
]
}
},
methods: {
login(formData) {
this.$store.dispatch("login", formData)
.then(user => {
console.log("---- user login --------");
console.log(user);
this.$router.go(-1);
})
.catch(error => {
console.log("---- login error -------");
console.log(error);
});
}
}
}
</script>

View File

@@ -0,0 +1,17 @@
<template>
<div>
Sie werden ausgeloggt....
</div>
</template>
<script>
export default {
name: 'logout',
created() {
this.$store.commit('clearLogin');
setTimeout(() => {
this.$router.replace('/login');
}, 2000);
}
}
</script>

View File

@@ -0,0 +1,73 @@
<template>
<div class="Userlist">
<h1>Userlist</h1>
<scroll-table :columns="columns" :new-rows="newRows" :has-more="hasMore" :loading="loading" :handler="more" orderBy="id" :orderDesc="true"></scroll-table>
</div>
</template>
<script>
import ScrollTable from '../../components/scroll-table.vue';
export default {
name: "Userlist",
components: {
ScrollTable
},
data() {
return {
columns: [
{
heading: 'ID',
prop: 'ID',
orderBy: 'id'
},
{
heading: 'Benutzername',
prop: 'Username',
orderBy: 'username'
},
{
heading: 'Reseller',
prop: 'Reseller.Username'
},
{
heading: 'Render',
render(row) {
return 'ID:' + row.ID;
}
}
],
newRows: [ ],
hasMore: true,
loading: false
}
},
methods: {
more(offset, limit, orderBy, orderDesc, search) {
this.loading = true;
this.$store.dispatch('apiRequest', {
endpoint: 'users',
params: {
start: offset,
length: limit,
orderBy,
orderDesc,
search
}
})
.then(rows => {
this.hasMore = (rows.length >= limit);
this.newRows = rows;
this.loading = false;
})
.catch(error => {
this.loading = false;
this.hasMore = false;
console.log(error);
});
}
}
}
</script>

11
src/views/views.js Normal file
View File

@@ -0,0 +1,11 @@
import Dashboard from './dashboard.vue';
import LoginForm from './forms/login.vue';
import Logout from './forms/logout.vue';
import Userlist from './lists/userlist.vue';
export default {
Dashboard,
LoginForm,
Logout,
Userlist
}