86 lines
2.6 KiB
Vue
86 lines
2.6 KiB
Vue
<template lang="pug">
|
|
#clientlist
|
|
button(@click="editing = -1") New Client
|
|
.pgn
|
|
span.pagenum Page {{ pagination.page }} of {{ pagination.pages }}
|
|
.button(v-if='pagination.page > 1', v-on:click='getClients(pagination.page - 1)') Previous
|
|
.button(v-for='n in pagination.pages', v-on:click='getClients(n)', v-bind:class='{active: n == pagination.page}') {{ n }}
|
|
.button(v-if='pagination.page < pagination.pages', v-on:click='getClients(pagination.page + 1)') Next
|
|
.list.client
|
|
.message.error(v-if="error") {{ error }}
|
|
.application.list-item(v-else v-for="client in clients")
|
|
.picture
|
|
img(v-if="client.icon" :src="'/usercontent/images/' + client.icon")
|
|
.noicon(v-else)
|
|
i.fa.fa-fw.fa-gears
|
|
.info
|
|
.stamps
|
|
.verified(v-if="client.verified")
|
|
i.fa.fa-fw.fa-check
|
|
.name {{ client.title }}
|
|
.description {{ client.description }}
|
|
a.url(:href='client.url', target='_blank', rel='nofollow') {{ client.url }}
|
|
.scope Scopes: {{ client.scope }}
|
|
.redirect_url Redirect: {{ client.redirect_url }}
|
|
.id Client ID: {{ client.id }}
|
|
.secret
|
|
| Client Secret:
|
|
#showbutton Hover
|
|
#hiddensecret {{ client.secret }}
|
|
.button.edit(@click="editing = client.id") Edit
|
|
.button.delete(@click="deleteClient(client.id)") Delete
|
|
client-modal(:show="editing != 0" @close='editing = 0', :id='editing')
|
|
</template>
|
|
|
|
<script type="text/javascript">
|
|
import ClientModal from './ClientModal.vue'
|
|
|
|
export default {
|
|
data: function () {
|
|
return {
|
|
clients: [],
|
|
pagination: {
|
|
offset: 0,
|
|
page: 1,
|
|
pages: 1,
|
|
perPage: 6,
|
|
total: 0
|
|
},
|
|
editing: 0,
|
|
error: ''
|
|
}
|
|
},
|
|
components: {
|
|
ClientModal
|
|
},
|
|
methods: {
|
|
getClients: function (page) {
|
|
this.pagination.total = 0
|
|
this.error = ''
|
|
|
|
this.$http.get('/admin/api/clients?page=' + page).then(data => {
|
|
if (data.body && data.body.error) {
|
|
this.error = data.body.error
|
|
return
|
|
}
|
|
|
|
this.pagination = data.body.page
|
|
this.clients = data.body.clients
|
|
})
|
|
},
|
|
deleteClient: function (id) {
|
|
this.$http.post('/admin/api/client/delete/' + id).then(data => {
|
|
this.getClients(1)
|
|
})
|
|
}
|
|
},
|
|
mounted: function () {
|
|
this.getClients(1)
|
|
|
|
this.$root.$on('reload_clients', () => {
|
|
this.getClients(1)
|
|
})
|
|
}
|
|
}
|
|
</script>
|