2020-03-28 10:33:11 +00:00
|
|
|
<template>
|
2020-11-25 12:31:34 +00:00
|
|
|
<FormBase>
|
|
|
|
<FormPagination :pagination="pagination" ref="list">
|
2020-03-28 10:33:11 +00:00
|
|
|
<template #empty>
|
|
|
|
<div class="_fullinfo">
|
|
|
|
<img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
|
2020-07-24 16:56:52 +00:00
|
|
|
<div>{{ $t('nothing') }}</div>
|
2020-03-28 10:33:11 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #default="{items}">
|
2020-11-25 12:31:34 +00:00
|
|
|
<div class="_formPanel bfomjevm" v-for="token in items" :key="token.id">
|
|
|
|
<img class="icon" :src="token.iconUrl" alt="" v-if="token.iconUrl"/>
|
2020-03-28 10:33:11 +00:00
|
|
|
<div class="body">
|
|
|
|
<div class="name">{{ token.name }}</div>
|
|
|
|
<div class="description">{{ token.description }}</div>
|
|
|
|
<div class="_keyValue">
|
|
|
|
<div>{{ $t('installedDate') }}:</div>
|
2020-10-17 11:12:00 +00:00
|
|
|
<div><MkTime :time="token.createdAt"/></div>
|
2020-03-28 10:33:11 +00:00
|
|
|
</div>
|
|
|
|
<div class="_keyValue">
|
|
|
|
<div>{{ $t('lastUsedDate') }}:</div>
|
2020-10-17 11:12:00 +00:00
|
|
|
<div><MkTime :time="token.lastUsedAt"/></div>
|
2020-03-28 10:33:11 +00:00
|
|
|
</div>
|
|
|
|
<div class="actions">
|
2020-10-17 11:12:00 +00:00
|
|
|
<button class="_button" @click="revoke(token)"><Fa :icon="faTrashAlt"/></button>
|
2020-03-28 10:33:11 +00:00
|
|
|
</div>
|
2020-03-29 08:06:36 +00:00
|
|
|
<details>
|
2020-07-24 16:56:52 +00:00
|
|
|
<summary>{{ $t('details') }}</summary>
|
2020-03-29 08:06:36 +00:00
|
|
|
<ul>
|
|
|
|
<li v-for="p in token.permission" :key="p">{{ $t(`_permissions.${p}`) }}</li>
|
|
|
|
</ul>
|
|
|
|
</details>
|
2020-03-28 10:33:11 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2020-11-25 12:31:34 +00:00
|
|
|
</FormPagination>
|
|
|
|
</FormBase>
|
2020-03-28 10:33:11 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 11:12:00 +00:00
|
|
|
import { defineComponent } from 'vue';
|
2020-03-28 10:33:11 +00:00
|
|
|
import { faTrashAlt, faPlug } from '@fortawesome/free-solid-svg-icons';
|
2020-11-25 12:31:34 +00:00
|
|
|
import FormPagination from '@/components/form/pagination.vue';
|
|
|
|
import FormSelect from '@/components/form/select.vue';
|
|
|
|
import FormLink from '@/components/form/link.vue';
|
|
|
|
import FormBase from '@/components/form/base.vue';
|
|
|
|
import FormGroup from '@/components/form/group.vue';
|
|
|
|
import FormButton from '@/components/form/button.vue';
|
2020-10-17 11:12:00 +00:00
|
|
|
import * as os from '@/os';
|
2020-03-28 10:33:11 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
export default defineComponent({
|
2020-03-28 10:33:11 +00:00
|
|
|
components: {
|
2020-11-25 12:31:34 +00:00
|
|
|
FormBase,
|
|
|
|
FormPagination,
|
2020-03-28 10:33:11 +00:00
|
|
|
},
|
|
|
|
|
2020-11-25 12:31:34 +00:00
|
|
|
emits: ['info'],
|
|
|
|
|
2020-03-28 10:33:11 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2020-10-17 11:12:00 +00:00
|
|
|
INFO: {
|
2020-11-03 11:36:12 +00:00
|
|
|
title: this.$t('installedApps'),
|
|
|
|
icon: faPlug,
|
2020-10-17 11:12:00 +00:00
|
|
|
},
|
2020-03-28 10:33:11 +00:00
|
|
|
pagination: {
|
|
|
|
endpoint: 'i/apps',
|
|
|
|
limit: 100,
|
2020-03-28 10:40:03 +00:00
|
|
|
params: {
|
|
|
|
sort: '+lastUsedAt'
|
|
|
|
}
|
2020-03-28 10:33:11 +00:00
|
|
|
},
|
|
|
|
faTrashAlt, faPlug
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-11-25 12:31:34 +00:00
|
|
|
mounted() {
|
|
|
|
this.$emit('info', this.INFO);
|
|
|
|
},
|
|
|
|
|
2020-03-28 10:33:11 +00:00
|
|
|
methods: {
|
|
|
|
revoke(token) {
|
2020-10-17 11:12:00 +00:00
|
|
|
os.api('i/revoke-token', { tokenId: token.id }).then(() => {
|
2020-03-28 10:33:11 +00:00
|
|
|
this.$refs.list.reload();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.bfomjevm {
|
2020-11-25 12:31:34 +00:00
|
|
|
display: flex;
|
|
|
|
padding: 16px;
|
2020-03-28 10:33:11 +00:00
|
|
|
|
2020-11-25 12:31:34 +00:00
|
|
|
> .icon {
|
|
|
|
display: block;
|
|
|
|
flex-shrink: 0;
|
|
|
|
margin: 0 12px 0 0;
|
|
|
|
width: 50px;
|
|
|
|
height: 50px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
2020-03-28 10:33:11 +00:00
|
|
|
|
2020-11-25 12:31:34 +00:00
|
|
|
> .body {
|
|
|
|
width: calc(100% - 62px);
|
|
|
|
position: relative;
|
2020-03-28 10:33:11 +00:00
|
|
|
|
2020-11-25 12:31:34 +00:00
|
|
|
> .name {
|
|
|
|
font-weight: bold;
|
2020-03-28 10:33:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|