1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-23 19:18:44 +09:00
MisskeyIO/packages/frontend/src/pages/settings/apps.vue

99 lines
2.3 KiB
Vue
Raw Normal View History

<template>
2023-01-06 13:40:17 +09:00
<div class="_gaps_m">
2021-11-19 19:36:12 +09:00
<FormPagination ref="list" :pagination="pagination">
<template #empty>
<div class="_fullinfo">
<img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
<div>{{ i18n.ts.nothing }}</div>
</div>
</template>
<template #default="{items}">
2023-01-05 21:04:56 +09:00
<div v-for="token in items" :key="token.id" class="_panel bfomjevm">
2021-11-19 19:36:12 +09:00
<img v-if="token.iconUrl" class="icon" :src="token.iconUrl" alt=""/>
<div class="body">
<div class="name">{{ token.name }}</div>
<div class="description">{{ token.description }}</div>
2023-01-05 21:04:56 +09:00
<MkKeyValue oneline>
2023-01-05 19:50:52 +09:00
<template #key>{{ i18n.ts.installedDate }}</template>
<template #value><MkTime :time="token.createdAt"/></template>
</MkKeyValue>
2023-01-05 21:04:56 +09:00
<MkKeyValue oneline>
2023-01-05 19:50:52 +09:00
<template #key>{{ i18n.ts.lastUsedDate }}</template>
<template #value><MkTime :time="token.lastUsedAt"/></template>
</MkKeyValue>
2023-01-05 21:04:56 +09:00
<details>
<summary>{{ i18n.ts.details }}</summary>
<ul>
2023-04-01 14:01:57 +09:00
<li v-for="p in token.permission" :key="p">{{ i18n.t(`_permissions.${p}`) }}</li>
</ul>
</details>
2023-01-05 19:50:52 +09:00
<div class="actions">
<MkButton inline danger @click="revoke(token)"><i class="ti ti-trash"></i></MkButton>
</div>
</div>
</div>
</template>
</FormPagination>
2022-01-04 18:21:00 +09:00
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import FormPagination from '@/components/MkPagination.vue';
2021-11-12 02:02:25 +09:00
import * as os from '@/os';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
2023-01-05 19:50:52 +09:00
import MkKeyValue from '@/components/MkKeyValue.vue';
import MkButton from '@/components/MkButton.vue';
const list = ref<any>(null);
const pagination = {
endpoint: 'i/apps' as const,
limit: 100,
params: {
sort: '+lastUsedAt',
},
};
function revoke(token) {
os.api('i/revoke-token', { tokenId: token.id }).then(() => {
list.value.reload();
});
}
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
definePageMetadata({
title: i18n.ts.installedApps,
icon: 'ti ti-plug',
});
</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>