2020-03-28 04:33:11 -06:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<portal to="icon"><fa :icon="faPlug"/></portal>
|
2020-07-24 10:56:52 -06:00
|
|
|
<portal to="title">{{ $t('installedApps') }}</portal>
|
2020-03-28 04:33:11 -06:00
|
|
|
|
|
|
|
<mk-pagination :pagination="pagination" class="bfomjevm" ref="list">
|
|
|
|
<template #empty>
|
|
|
|
<div class="_fullinfo">
|
|
|
|
<img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
|
2020-07-24 10:56:52 -06:00
|
|
|
<div>{{ $t('nothing') }}</div>
|
2020-03-28 04:33:11 -06:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #default="{items}">
|
|
|
|
<div class="token _panel" v-for="token in items" :key="token.id">
|
|
|
|
<img class="icon" :src="token.iconUrl" alt=""/>
|
|
|
|
<div class="body">
|
|
|
|
<div class="name">{{ token.name }}</div>
|
|
|
|
<div class="description">{{ token.description }}</div>
|
|
|
|
<div class="_keyValue">
|
|
|
|
<div>{{ $t('installedDate') }}:</div>
|
|
|
|
<div><mk-time :time="token.createdAt"/></div>
|
|
|
|
</div>
|
|
|
|
<div class="_keyValue">
|
|
|
|
<div>{{ $t('lastUsedDate') }}:</div>
|
|
|
|
<div><mk-time :time="token.lastUsedAt"/></div>
|
|
|
|
</div>
|
|
|
|
<div class="actions">
|
|
|
|
<button class="_button" @click="revoke(token)"><fa :icon="faTrashAlt"/></button>
|
|
|
|
</div>
|
2020-03-29 02:06:36 -06:00
|
|
|
<details>
|
2020-07-24 10:56:52 -06:00
|
|
|
<summary>{{ $t('details') }}</summary>
|
2020-03-29 02:06:36 -06:00
|
|
|
<ul>
|
|
|
|
<li v-for="p in token.permission" :key="p">{{ $t(`_permissions.${p}`) }}</li>
|
|
|
|
</ul>
|
|
|
|
</details>
|
2020-03-28 04:33:11 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</mk-pagination>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import { faTrashAlt, faPlug } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import MkPagination from '../components/ui/pagination.vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
metaInfo() {
|
|
|
|
return {
|
|
|
|
title: this.$t('installedApps') as string
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
components: {
|
|
|
|
MkPagination
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
pagination: {
|
|
|
|
endpoint: 'i/apps',
|
|
|
|
limit: 100,
|
2020-03-28 04:40:03 -06:00
|
|
|
params: {
|
|
|
|
sort: '+lastUsedAt'
|
|
|
|
}
|
2020-03-28 04:33:11 -06:00
|
|
|
},
|
|
|
|
faTrashAlt, faPlug
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
revoke(token) {
|
|
|
|
this.$root.api('i/revoke-token', { tokenId: token.id }).then(() => {
|
|
|
|
this.$refs.list.reload();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.bfomjevm {
|
|
|
|
> .token {
|
|
|
|
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>
|