feat(client): AiScriptプラグインからAPIアクセスできるように

This commit is contained in:
syuilo
2020-07-18 14:28:32 +09:00
parent b9c5e95b85
commit b39850de01
5 changed files with 107 additions and 20 deletions

View File

@ -2,6 +2,9 @@
<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">
<template #header>{{ title || $t('generateAccessToken') }}</template>
<div class="ugkkpisj">
<div>
<mk-info warn v-if="information">{{ information }}</mk-info>
</div>
<div>
<mk-input v-model="name">{{ $t('name') }}</mk-input>
</div>
@ -9,7 +12,7 @@
<div style="margin-bottom: 16px;"><b>{{ $t('permission') }}</b></div>
<mk-button inline @click="disableAll">{{ $t('disableAll') }}</mk-button>
<mk-button inline @click="enableAll">{{ $t('enableAll') }}</mk-button>
<mk-switch v-for="kind in kinds" :key="kind" v-model="permissions[kind]">{{ $t(`_permissions.${kind}`) }}</mk-switch>
<mk-switch v-for="kind in (initialPermissions || kinds)" :key="kind" v-model="permissions[kind]">{{ $t(`_permissions.${kind}`) }}</mk-switch>
</div>
</div>
</x-window>
@ -23,6 +26,7 @@ import MkInput from './ui/input.vue';
import MkTextarea from './ui/textarea.vue';
import MkSwitch from './ui/switch.vue';
import MkButton from './ui/button.vue';
import MkInfo from './ui/info.vue';
export default Vue.extend({
components: {
@ -31,6 +35,7 @@ export default Vue.extend({
MkTextarea,
MkSwitch,
MkButton,
MkInfo,
},
props: {
@ -38,20 +43,41 @@ export default Vue.extend({
type: String,
required: false,
default: null
},
information: {
type: String,
required: false,
default: null
},
initialName: {
type: String,
required: false,
default: null
},
initialPermissions: {
type: Array,
required: false,
default: null
}
},
data() {
return {
name: null,
name: this.initialName,
permissions: {},
kinds
};
},
created() {
for (const kind of this.kinds) {
Vue.set(this.permissions, kind, false);
if (this.initialPermissions) {
for (const kind of this.initialPermissions) {
Vue.set(this.permissions, kind, true);
}
} else {
for (const kind of this.kinds) {
Vue.set(this.permissions, kind, false);
}
}
},