1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-11 13:18:54 +09:00
This commit is contained in:
syuilo 2019-04-18 21:29:19 +09:00
parent 4beb3e5755
commit 8b92feac71
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
3 changed files with 36 additions and 3 deletions

View File

@ -14,7 +14,7 @@
<section> <section>
<header><fa icon="terminal"/> {{ $t('console.title') }}</header> <header><fa icon="terminal"/> {{ $t('console.title') }}</header>
<ui-input v-model="endpoint"> <ui-input v-model="endpoint" :datalist="endpoints">
<span>{{ $t('console.endpoint') }}</span> <span>{{ $t('console.endpoint') }}</span>
</ui-input> </ui-input>
<ui-textarea v-model="body"> <ui-textarea v-model="body">
@ -39,15 +39,23 @@ import * as JSON5 from 'json5';
export default Vue.extend({ export default Vue.extend({
i18n: i18n('common/views/components/api-settings.vue'), i18n: i18n('common/views/components/api-settings.vue'),
data() { data() {
return { return {
endpoint: '', endpoint: '',
body: '{}', body: '{}',
res: null, res: null,
sending: false sending: false,
endpoints: []
}; };
}, },
created() {
this.$root.api('endpoints').then(endpoints => {
this.endpoints = endpoints;
});
},
methods: { methods: {
regenerateToken() { regenerateToken() {
this.$root.dialog({ this.$root.dialog({

View File

@ -23,6 +23,7 @@
@focus="focused = true" @focus="focused = true"
@blur="focused = false" @blur="focused = false"
@keydown="$emit('keydown', $event)" @keydown="$emit('keydown', $event)"
:list="id"
> >
<input v-else ref="input" <input v-else ref="input"
:type="type" :type="type"
@ -37,7 +38,11 @@
@focus="focused = true" @focus="focused = true"
@blur="focused = false" @blur="focused = false"
@keydown="$emit('keydown', $event)" @keydown="$emit('keydown', $event)"
:list="id"
> >
<datalist :id="id" v-if="datalist">
<option v-for="data in datalist" :value="data"/>
</datalist>
</template> </template>
<template v-else> <template v-else>
<input ref="input" <input ref="input"
@ -130,6 +135,10 @@ export default Vue.extend({
required: false, required: false,
default: false default: false
}, },
datalist: {
type: Array,
required: false,
},
inline: { inline: {
type: Boolean, type: Boolean,
required: false, required: false,
@ -147,7 +156,8 @@ export default Vue.extend({
return { return {
v: this.value, v: this.value,
focused: false, focused: false,
passwordStrength: '' passwordStrength: '',
id: Math.random().toString()
}; };
}, },
computed: { computed: {

View File

@ -0,0 +1,15 @@
import define from '../define';
import endpoints from '../endpoints';
export const meta = {
requireCredential: false,
tags: ['meta'],
params: {
},
};
export default define(meta, async () => {
return endpoints.map(x => x.name);
});