This commit is contained in:
Kekskurse 2019-11-26 17:30:03 +01:00
parent 95284448f8
commit 67286e106f
6 changed files with 253 additions and 2 deletions

View file

@ -78,10 +78,10 @@
<v-list-item to="/admin/user">
<v-list-item-title>User</v-list-item-title>
</v-list-item>
<v-list-item to="/access">
<v-list-item to="/admin/app">
<v-list-item-title>Apps</v-list-item-title>
</v-list-item>
<v-list-item to="/access">
<v-list-item to="/admin/invite">
<v-list-item-title>Invites</v-list-item-title>
</v-list-item>
</v-list>

View file

@ -17,6 +17,9 @@ import Profile from '../views/Profile'
import AdminSettings from '../views/admin/Settings'
import AdminUserList from '../views/admin/User'
import AdminUserEdit from '../views/admin/UserEdit'
import AdminAppsList from '../views/admin/App'
import AdminAppDetails from '../views/admin/AppDetail'
import AdminInvite from '../views/admin/Invite'
Vue.use(Router)
@ -125,5 +128,25 @@ export default new Router({
name: 'adminUserEdit',
component: AdminUserEdit
},
{
beforeEnter: admin,
path: '/admin/app',
name: 'adminListApp',
component: AdminAppsList
},
{
beforeEnter: admin,
path: '/admin/app/:id',
name: 'adminAppDetail',
component: AdminAppDetails
},
{
beforeEnter: admin,
path: '/admin/invite',
name: 'adminInvite',
component: AdminInvite
},
]
})

View file

@ -18,5 +18,14 @@ export default {
},
validateMail(id) {
return Api().put("/v1/admin/mail/"+id+"/status", {"status": "valide"});
},
getAppList() {
return Api().get("/v1/admin/app");
},
saveAppProperties(id, properties) {
return Api().put("/v1/admin/app/"+id+"/properties", properties);
},
listInvites() {
return Api().get("/v1/admin/invite");
}
}

49
src/views/admin/App.vue Normal file
View file

@ -0,0 +1,49 @@
<template>
<div style="margin-top: 50px;">
<v-container grid-list-md pa-10>
<v-layout row wrap>
<v-flex md12>
<h1>Apps</h1>
<br><br>
<AppCards :apps="apps" v-on:appClick="navigateToAppSettingPage"></AppCards>
</v-flex>
</v-layout>
</v-container>
</div>
</template>
<script>
import AdminService from '../../services/Admin'
import AppCardsComponente from '../../components/AppCards'
export default {
data () {
return {
apps: []
}
},
components: {
"AppCards": AppCardsComponente
},
methods: {
'loadApp': function () {
AdminService.getAppList().then((res) => {
this.apps = res.data.data;
})
},
'navigateToAppSettingPage': function(app) {
this.$router.push({"path": "/admin/app/"+app.id})
}
},
mounted: function() {
this.loadApp();
}
}
</script>

View file

@ -0,0 +1,107 @@
<template>
<div style="margin-top: 50px;">
<v-container grid-list-md pa-10>
<v-layout row wrap>
<v-flex md12>
<h1>App Detail: {{ app.name }}</h1>
<p>{{ app.description }}</p>
<a :href="app.url">{{ app.url }}</a>
<hr>
<v-simple-table>
<template v-slot:default>
<thead>
<tr>
<th class="text-left">Name</th>
<th class="text-left">Description</th>
<th class="text-right"></th>
</tr>
</thead>
<tbody>
<tr>
<td>Auto Accept</td>
<td>User dont have to click login, if the user is logged in he/she will immediately redirected back.</td>
<td class="text-right"><v-checkbox v-model="app.properties.autoAccept"></v-checkbox></td>
</tr>
<tr>
<td>Testing Warning</td>
<td>Show warning that the Application is just in testing mode</td>
<td class="text-right"><v-checkbox v-model="app.properties.testingWarning"></v-checkbox></td>
</tr>
<tr>
<td>Untrusted Warning</td>
<td>Show warning that the Application is untrusted</td>
<td class="text-right"><v-checkbox v-model="app.properties.untrustedWarning"></v-checkbox></td>
</tr>
<tr>
<td>Show on Webpage</td>
<td>Show this App on the Webpage.</td>
<td class="text-right"><v-checkbox v-model="app.properties.showOnWebpage"></v-checkbox></td>
</tr>
<tr>
<td>Hide in App list</td>
<td>User cant see this App in his app list</td>
<td class="text-right"><v-checkbox v-model="app.properties.hideInAppList"></v-checkbox></td>
</tr>
<tr>
<td>Disable remove Access</td>
<td>User can't remove Access to this App in the AppList</td>
<td class="text-right"><v-checkbox v-model="app.properties.userCantRemoveApp"></v-checkbox></td>
</tr>
<tr>
<td>Disable auto redirect</td>
<td>User always have to click a button to go to the App</td>
<td class="text-right"><v-checkbox v-model="app.properties.stopAutoRedirect"></v-checkbox></td>
</tr>
</tbody>
</template>
</v-simple-table>
<v-btn
color="success"
@click="save"
>
Save
</v-btn>
</v-flex>
</v-layout>
</v-container>
</div>
</template>
<script>
import AdminService from '../../services/Admin'
import AppService from '../../services/Apps'
export default {
data () {
return {
app: {}
}
},
components: {
},
methods: {
'loadApp': function () {
AppService.getApp(this.$route.params.id).then((res) => {
this.app = res.data.data
});
},
'save': function () {
AdminService.saveAppProperties(this.$route.params.id, this.app.properties).then((res) => {
alert("Changes saved");
this.loadApp();
}).catch((res) => {
alert("Something go wrong");
});
}
},
mounted: function() {
this.loadApp();
}
}
</script>

View file

@ -0,0 +1,63 @@
<template>
<div style="margin-top: 50px;">
<v-container grid-list-md pa-10>
<v-layout row wrap>
<v-flex md12>
<h1>Invites</h1>
<br><br>
<v-simple-table>
<template v-slot:default>
<thead>
<tr>
<th class="text-left">#</th>
<th class="text-left">Username</th>
<th class="text-left">Status</th>
<th class="text-left">Invide Token</th>
<th class="text-left">Comment</th>
</tr>
</thead>
<tbody>
<tr v-for="item in invites" :key="item.name">
<td>{{ item.id }}</td>
<td>{{ item.username }}</td>
<td>{{ item.status }}</td>
<td>{{ item.code }}</td>
<td>{{ item.comment }}</td>
</tr>
</tbody>
</template>
</v-simple-table>
</v-flex>
</v-layout>
</v-container>
</div>
</template>
<script>
import AdminService from '../../services/Admin'
export default {
data () {
return {
invites: []
}
},
methods: {
'loadApp': function () {
AdminService.listInvites().then((res) => {
this.invites = res.data.data;
})
}
},
mounted: function() {
this.loadApp();
}
}
</script>