diff options
Diffstat (limited to 'packages/client/src/pages/settings/apps.vue')
| -rw-r--r-- | packages/client/src/pages/settings/apps.vue | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/packages/client/src/pages/settings/apps.vue b/packages/client/src/pages/settings/apps.vue new file mode 100644 index 0000000000..6eec80d805 --- /dev/null +++ b/packages/client/src/pages/settings/apps.vue @@ -0,0 +1,113 @@ +<template> +<FormBase> + <FormPagination :pagination="pagination" ref="list"> + <template #empty> + <div class="_fullinfo"> + <img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/> + <div>{{ $ts.nothing }}</div> + </div> + </template> + <template #default="{items}"> + <div class="_debobigegoPanel bfomjevm" v-for="token in items" :key="token.id"> + <img class="icon" :src="token.iconUrl" alt="" v-if="token.iconUrl"/> + <div class="body"> + <div class="name">{{ token.name }}</div> + <div class="description">{{ token.description }}</div> + <div class="_keyValue"> + <div>{{ $ts.installedDate }}:</div> + <div><MkTime :time="token.createdAt"/></div> + </div> + <div class="_keyValue"> + <div>{{ $ts.lastUsedDate }}:</div> + <div><MkTime :time="token.lastUsedAt"/></div> + </div> + <div class="actions"> + <button class="_button" @click="revoke(token)"><i class="fas fa-trash-alt"></i></button> + </div> + <details> + <summary>{{ $ts.details }}</summary> + <ul> + <li v-for="p in token.permission" :key="p">{{ $t(`_permissions.${p}`) }}</li> + </ul> + </details> + </div> + </div> + </template> + </FormPagination> +</FormBase> +</template> + +<script lang="ts"> +import { defineComponent } from 'vue'; +import FormPagination from '@/components/debobigego/pagination.vue'; +import FormSelect from '@/components/form/select.vue'; +import FormLink from '@/components/debobigego/link.vue'; +import FormBase from '@/components/debobigego/base.vue'; +import FormGroup from '@/components/debobigego/group.vue'; +import FormButton from '@/components/debobigego/button.vue'; +import * as os from '@/os'; +import * as symbols from '@/symbols'; + +export default defineComponent({ + components: { + FormBase, + FormPagination, + }, + + emits: ['info'], + + data() { + return { + [symbols.PAGE_INFO]: { + title: this.$ts.installedApps, + icon: 'fas fa-plug', + bg: 'var(--bg)', + }, + pagination: { + endpoint: 'i/apps', + limit: 100, + params: { + sort: '+lastUsedAt' + } + }, + }; + }, + + mounted() { + this.$emit('info', this[symbols.PAGE_INFO]); + }, + + methods: { + revoke(token) { + os.api('i/revoke-token', { tokenId: token.id }).then(() => { + this.$refs.list.reload(); + }); + } + } +}); +</script> + +<style lang="scss" scoped> +.bfomjevm { + display: flex; + padding: 16px; + + > .icon { + display: block; + flex-shrink: 0; + margin: 0 12px 0 0; + width: 50px; + height: 50px; + border-radius: 8px; + } + + > .body { + width: calc(100% - 62px); + position: relative; + + > .name { + font-weight: bold; + } + } +} +</style> |