This commit is contained in:
syuilo 2023-01-05 19:50:52 +09:00
parent 29f6f5fa5c
commit 58ae2ccbfa
3 changed files with 37 additions and 29 deletions

View file

@ -141,8 +141,8 @@ export default defineComponent({
margin-right: 0; margin-right: 0;
margin-bottom: 6px; margin-bottom: 6px;
font-size: 1.5em; font-size: 1.5em;
width: 54px; width: 60px;
height: 54px; height: 60px;
aspect-ratio: 1; aspect-ratio: 1;
background: var(--panel); background: var(--panel);
border-radius: 100%; border-radius: 100%;

View file

@ -11,20 +11,25 @@
@ok="ok()" @ok="ok()"
> >
<template #header>{{ title || $ts.generateAccessToken }}</template> <template #header>{{ title || $ts.generateAccessToken }}</template>
<div v-if="information" class="_section">
<MkSpacer :margin-min="20" :margin-max="28">
<div class="_formRoot">
<div v-if="information" class="_formBlock">
<MkInfo warn>{{ information }}</MkInfo> <MkInfo warn>{{ information }}</MkInfo>
</div> </div>
<div class="_section"> <div class="_formBlock">
<MkInput v-model="name"> <MkInput v-model="name">
<template #label>{{ $ts.name }}</template> <template #label>{{ $ts.name }}</template>
</MkInput> </MkInput>
</div> </div>
<div class="_section"> <div class="_formBlock"><b>{{ $ts.permission }}</b></div>
<div style="margin-bottom: 16px;"><b>{{ $ts.permission }}</b></div> <div style="display: flex; gap: var(--margin); flex-wrap: wrap;">
<MkButton inline @click="disableAll">{{ $ts.disableAll }}</MkButton> <MkButton inline @click="disableAll">{{ i18n.ts.disableAll }}</MkButton>
<MkButton inline @click="enableAll">{{ $ts.enableAll }}</MkButton> <MkButton inline @click="enableAll">{{ i18n.ts.enableAll }}</MkButton>
<MkSwitch v-for="kind in (initialPermissions || kinds)" :key="kind" v-model="permissions[kind]">{{ $t(`_permissions.${kind}`) }}</MkSwitch>
</div> </div>
<MkSwitch v-for="kind in (initialPermissions || kinds)" :key="kind" v-model="permissions[kind]" class="_formBlock">{{ $t(`_permissions.${kind}`) }}</MkSwitch>
</div>
</MkSpacer>
</XModalWindow> </XModalWindow>
</template> </template>
@ -36,6 +41,7 @@ import MkSwitch from './form/switch.vue';
import MkButton from './MkButton.vue'; import MkButton from './MkButton.vue';
import MkInfo from './MkInfo.vue'; import MkInfo from './MkInfo.vue';
import XModalWindow from '@/components/MkModalWindow.vue'; import XModalWindow from '@/components/MkModalWindow.vue';
import { i18n } from '@/i18n';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
title?: string | null; title?: string | null;

View file

@ -8,28 +8,28 @@
</div> </div>
</template> </template>
<template #default="{items}"> <template #default="{items}">
<div v-for="token in items" :key="token.id" class="_panel bfomjevm"> <div v-for="token in items" :key="token.id" class="_panel _formBlock bfomjevm">
<img v-if="token.iconUrl" class="icon" :src="token.iconUrl" alt=""/> <img v-if="token.iconUrl" class="icon" :src="token.iconUrl" alt=""/>
<div class="body"> <div class="body">
<div class="name">{{ token.name }}</div> <div class="name">{{ token.name }}</div>
<div class="description">{{ token.description }}</div> <div class="description">{{ token.description }}</div>
<div class=""> <MkKeyValue class="_formBlock" oneline>
<div>{{ i18n.ts.installedDate }}:</div> <template #key>{{ i18n.ts.installedDate }}</template>
<div><MkTime :time="token.createdAt"/></div> <template #value><MkTime :time="token.createdAt"/></template>
</div> </MkKeyValue>
<div class=""> <MkKeyValue class="_formBlock" oneline>
<div>{{ i18n.ts.lastUsedDate }}:</div> <template #key>{{ i18n.ts.lastUsedDate }}</template>
<div><MkTime :time="token.lastUsedAt"/></div> <template #value><MkTime :time="token.lastUsedAt"/></template>
</div> </MkKeyValue>
<div class="actions"> <details class="_formBlock">
<button class="_button" @click="revoke(token)"><i class="ti ti-trash"></i></button>
</div>
<details>
<summary>{{ i18n.ts.details }}</summary> <summary>{{ i18n.ts.details }}</summary>
<ul> <ul>
<li v-for="p in token.permission" :key="p">{{ $t(`_permissions.${p}`) }}</li> <li v-for="p in token.permission" :key="p">{{ $t(`_permissions.${p}`) }}</li>
</ul> </ul>
</details> </details>
<div class="actions">
<MkButton inline danger @click="revoke(token)"><i class="ti ti-trash"></i></MkButton>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -43,6 +43,8 @@ import FormPagination from '@/components/MkPagination.vue';
import * as os from '@/os'; import * as os from '@/os';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import MkKeyValue from '@/components/MkKeyValue.vue';
import MkButton from '@/components/MkButton.vue';
const list = ref<any>(null); const list = ref<any>(null);