This commit is contained in:
Kekskurse 2019-11-26 17:52:19 +01:00
parent 67286e106f
commit da7455e553
6 changed files with 134 additions and 2 deletions

View file

@ -9,7 +9,7 @@
> >
<v-app-bar-nav-icon v-if="this.$store.getters.getSettingValue('registration_possible') || this.$store.getters.getSettingValue('invite')" class="d-flex d-md-none" @click="toggleMenu()"></v-app-bar-nav-icon> <v-app-bar-nav-icon class="d-flex d-md-none" @click="toggleMenu()"></v-app-bar-nav-icon>
<v-toolbar-title><b>{{nameBig}}</b>{{nameSmall}}</v-toolbar-title> <v-toolbar-title><b>{{nameBig}}</b>{{nameSmall}}</v-toolbar-title>
@ -63,7 +63,7 @@
left left
bottom bottom
offset-y offset-y
v-if="this.$store.state.loggedIn" v-if="this.$store.state.loggedIn && this.$store.getters.getMe.admin"
> >
<template v-slot:activator="{ on }"> <template v-slot:activator="{ on }">
<v-btn v-on="on" class="d-none d-md-flex" tile text height="100%"> <v-btn v-on="on" class="d-none d-md-flex" tile text height="100%">

View file

@ -124,6 +124,54 @@
</v-list-item> </v-list-item>
</v-list-group> </v-list-group>
<v-list-group
no-action
v-if="this.$store.state.loggedIn && this.$store.getters.getMe.admin"
>
<template v-slot:activator>
<v-list-item-icon>
<v-icon>mdi-account-badge</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Admin</v-list-item-title>
</v-list-item-content>
</template>
<v-list-item
link
:to="{path: '/admin/settings'}"
>
<v-list-item-content>
<v-list-item-title>Settings</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item
link
:to="{path: '/admin/user'}"
>
<v-list-item-content>
<v-list-item-title>Users</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item
link
:to="{path: '/admin/app'}"
>
<v-list-item-content>
<v-list-item-title>Apps</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item
link
:to="{path: '/admin/invite'}"
>
<v-list-item-content>
<v-list-item-title>Invites</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-group>
</v-list> </v-list>
</v-navigation-drawer> </v-navigation-drawer>

View file

@ -20,6 +20,7 @@ import AdminUserEdit from '../views/admin/UserEdit'
import AdminAppsList from '../views/admin/App' import AdminAppsList from '../views/admin/App'
import AdminAppDetails from '../views/admin/AppDetail' import AdminAppDetails from '../views/admin/AppDetail'
import AdminInvite from '../views/admin/Invite' import AdminInvite from '../views/admin/Invite'
import AdminInviteNew from '../views/admin/InviteNew'
Vue.use(Router) Vue.use(Router)
@ -146,6 +147,12 @@ export default new Router({
name: 'adminInvite', name: 'adminInvite',
component: AdminInvite component: AdminInvite
}, },
{
beforeEnter: admin,
path: '/admin/invite/new',
name: 'adminInviteNew',
component: AdminInviteNew
},
] ]

View file

@ -27,5 +27,8 @@ export default {
}, },
listInvites() { listInvites() {
return Api().get("/v1/admin/invite"); return Api().get("/v1/admin/invite");
},
newInvite(username, comment) {
return Api().post("/v1/admin/invite", {"username": username, "comment": comment});
} }
} }

View file

@ -3,6 +3,14 @@
<v-container grid-list-md pa-10> <v-container grid-list-md pa-10>
<v-layout row wrap> <v-layout row wrap>
<v-flex md12> <v-flex md12>
<v-btn
color="success"
to="/admin/invite/new"
class="text-right"
style="float:right;"
>
New Invite
</v-btn>
<h1>Invites</h1> <h1>Invites</h1>
<br><br> <br><br>
<v-simple-table> <v-simple-table>

View file

@ -0,0 +1,66 @@
<template>
<div style="margin-top: 50px;">
<v-container grid-list-md pa-10>
<v-layout row wrap>
<v-flex md12>
<h1>New Invite</h1>
<br><br>
<div v-if="inviteCreated">
Invite-Code: {{ invite.code }}
</div>
<div v-else>
<v-text-field
label="Username"
value=""
v-model="username"
></v-text-field>
<v-text-field
label="Comment"
value=""
v-model="comment"
></v-text-field>
<v-btn
color="success"
@click="create"
>
Create
</v-btn>
</div>
</v-flex>
</v-layout>
</v-container>
</div>
</template>
<script>
import AdminService from '../../services/Admin'
export default {
data () {
return {
username: "",
comment: "",
invite: {},
inviteCreated: false
}
},
methods: {
create: function() {
AdminService.newInvite(this.username, this.comment).then((res) => {
this.inviteCreated = true;
this.invite = res.data.data;
});
}
},
mounted: function() {
}
}
</script>