wip
This commit is contained in:
parent
7f7fe3f94c
commit
3575b1ecd8
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<x-window ref="window" :width="400" :height="450" :no-padding="true" @closed="() => { $emit('closed'); destroyDom(); }" :with-ok-button="true" :ok-button-disabled="false" @ok="ok()" :can-close="false">
|
||||
<x-window ref="window" :width="400" :height="450" :no-padding="true" @close="$emit('done')" :with-ok-button="true" :ok-button-disabled="false" @ok="ok()" :can-close="false">
|
||||
<template #header>{{ title || $t('generateAccessToken') }}</template>
|
||||
<div class="ugkkpisj">
|
||||
<div v-if="information">
|
||||
|
@ -62,6 +62,8 @@ export default defineComponent({
|
|||
}
|
||||
},
|
||||
|
||||
emits: ['done'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
name: this.initialName,
|
||||
|
@ -73,11 +75,11 @@ export default defineComponent({
|
|||
created() {
|
||||
if (this.initialPermissions) {
|
||||
for (const kind of this.initialPermissions) {
|
||||
Vue.set(this.permissions, kind, true);
|
||||
this.permissions[kind] = true;
|
||||
}
|
||||
} else {
|
||||
for (const kind of this.kinds) {
|
||||
Vue.set(this.permissions, kind, false);
|
||||
this.permissions[kind] = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,33 +1,26 @@
|
|||
<template>
|
||||
<x-modal ref="modal" @closed="$emit('closed')" :can-close="canClose">
|
||||
<div class="ebkgoccj" :class="{ noPadding }" @keydown="onKeydown" :style="{ width: `${width}px`, height: `${height}px` }">
|
||||
<div class="header">
|
||||
<button class="_button" v-if="withOkButton" @click="close()"><fa :icon="faTimes"/></button>
|
||||
<span class="title">
|
||||
<mk-avatar :user="avatar" v-if="avatar" class="avatar"/>
|
||||
<slot name="header"></slot>
|
||||
</span>
|
||||
<button class="_button" v-if="!withOkButton" @click="close()"><fa :icon="faTimes"/></button>
|
||||
<button class="_button" v-if="withOkButton" @click="() => { $emit('ok'); close(); }" :disabled="okButtonDisabled"><fa :icon="faCheck"/></button>
|
||||
</div>
|
||||
<div class="body">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div class="ebkgoccj" :class="{ noPadding }" @keydown="onKeydown" :style="{ width: `${width}px`, height: `${height}px` }">
|
||||
<div class="header">
|
||||
<button class="_button" v-if="withOkButton" @click="close()"><fa :icon="faTimes"/></button>
|
||||
<span class="title">
|
||||
<mk-avatar :user="avatar" v-if="avatar" class="avatar"/>
|
||||
<slot name="header"></slot>
|
||||
</span>
|
||||
<button class="_button" v-if="!withOkButton" @click="close()"><fa :icon="faTimes"/></button>
|
||||
<button class="_button" v-if="withOkButton" @click="$emit('ok')" :disabled="okButtonDisabled"><fa :icon="faCheck"/></button>
|
||||
</div>
|
||||
</x-modal>
|
||||
<div class="body">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { faTimes, faCheck } from '@fortawesome/free-solid-svg-icons';
|
||||
import XModal from './modal.vue';
|
||||
import * as os from '@/os';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
XModal,
|
||||
},
|
||||
|
||||
props: {
|
||||
avatar: {
|
||||
type: Object,
|
||||
|
@ -65,6 +58,8 @@ export default defineComponent({
|
|||
},
|
||||
},
|
||||
|
||||
emits: ['close', 'ok'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
faTimes, faCheck
|
||||
|
@ -73,7 +68,7 @@ export default defineComponent({
|
|||
|
||||
methods: {
|
||||
close() {
|
||||
this.$refs.modal.close();
|
||||
this.$emit('close');
|
||||
},
|
||||
|
||||
onKeydown(e) {
|
||||
|
|
|
@ -452,7 +452,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
addPinUser() {
|
||||
os.modal(MkUserSelect, {}).$once('selected', user => {
|
||||
os.modal(MkUserSelect, {}).then(user => {
|
||||
this.pinnedUsers = this.pinnedUsers.trim();
|
||||
this.pinnedUsers += '\n@' + getAcct(user);
|
||||
this.pinnedUsers = this.pinnedUsers.trim();
|
||||
|
@ -460,7 +460,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
chooseProxyAccount() {
|
||||
os.modal(MkUserSelect, {}).$once('selected', user => {
|
||||
os.modal(MkUserSelect, {}).then(user => {
|
||||
this.proxyAccount = user;
|
||||
this.proxyAccountId = user.id;
|
||||
this.save(true);
|
||||
|
|
|
@ -26,8 +26,7 @@ export default defineComponent({
|
|||
},
|
||||
methods: {
|
||||
async generateToken() {
|
||||
os.modal(await import('@/components/token-generate-window.vue'), {
|
||||
}).$on('ok', async ({ name, permissions }) => {
|
||||
os.modal(await import('@/components/token-generate-window.vue'), {}).then(async ({ name, permissions }) => {
|
||||
const { token } = await os.api('miauth/gen-token', {
|
||||
session: null,
|
||||
name: name,
|
||||
|
|
|
@ -123,7 +123,7 @@ export default defineComponent({
|
|||
information: this.$t('pluginTokenRequestedDescription'),
|
||||
initialName: name,
|
||||
initialPermissions: permissions
|
||||
}).$on('ok', async ({ name, permissions }) => {
|
||||
}).then(async ({ name, permissions }) => {
|
||||
const { token } = await os.api('miauth/gen-token', {
|
||||
session: null,
|
||||
name: name,
|
||||
|
|
Loading…
Reference in New Issue