summaryrefslogtreecommitdiff
path: root/src/client/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/components')
-rw-r--r--src/client/components/token-generate-window.vue34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/client/components/token-generate-window.vue b/src/client/components/token-generate-window.vue
index 5486ae92e7..e58dcbda78 100644
--- a/src/client/components/token-generate-window.vue
+++ b/src/client/components/token-generate-window.vue
@@ -3,13 +3,16 @@
<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>
<div>
<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);
+ }
}
},