Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85829103
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/components/admin_dashboard/tabs/typed_input.js b/src/components/admin_dashboard/tabs/typed_input.js
index dc4f6c1090..bb57016911 100644
--- a/src/components/admin_dashboard/tabs/typed_input.js
+++ b/src/components/admin_dashboard/tabs/typed_input.js
@@ -1,50 +1,56 @@
import Checkbox from 'src/components/checkbox/checkbox.vue'
import Select from 'src/components/select/select.vue'
const STRINGISH_TYPES = ['string', 'atom', 'module']
const TypedInput = {
name: 'TypedInput',
props: [
'modelValue',
'type',
'suggestions'
],
emits: ['update:modelValue'],
components: {
Checkbox,
Select
},
computed: {
isDropdown () {
return Array.isArray(this.type) && this.type[0] === 'dropdown'
},
isStringish () {
return STRINGISH_TYPES.includes(this.type)
},
isList () {
return Array.isArray(this.type) && this.type[0] === 'list'
},
subtype () {
return this.type[1]
+ },
+ listifiedModel () {
+ return this.modelValue || []
+ },
+ tupleList () {
+ return this.modelValue.tuple || ['', '']
}
},
methods: {
- listRemove (index) {
- const newVal = [...this.modelValue]
+ listRemove (list, index) {
+ const newVal = [...list]
newVal.splice(index, 1)
return newVal
},
- listSet (index, value) {
- const newVal = [...this.modelValue]
+ listSet (list, index, value) {
+ const newVal = [...list]
newVal[index] = value
return newVal
},
- listAdd () {
- const newVal = [...this.modelValue, '']
+ listAdd (list) {
+ const newVal = [...list, '']
return newVal
}
}
}
export default TypedInput
diff --git a/src/components/admin_dashboard/tabs/typed_input.vue b/src/components/admin_dashboard/tabs/typed_input.vue
index 9d227ea217..f05adf744a 100644
--- a/src/components/admin_dashboard/tabs/typed_input.vue
+++ b/src/components/admin_dashboard/tabs/typed_input.vue
@@ -1,84 +1,99 @@
<template>
<div
class="typed-input"
>
<Select
v-if="isDropdown"
:model-value="modelValue"
@update:modelValue="k => $emit('update:modelValue', k)"
>
<option
v-for="option in suggestions"
:key="option"
:value="option"
>
{{ option }}
</option>
</Select>
<input
v-else-if="type === 'integer'"
type="number"
:value="modelValue"
@change="$emit('update:modelValue', $event.target.value)"
>
<input
v-else-if="isStringish"
type="string"
:value="modelValue"
@change="$emit('update:modelValue', $event.target.value)"
>
<Checkbox
v-else-if="type === 'boolean'"
:value="modelValue"
@change="$emit('update:modelValue', $event.target.value)"
/>
+ <div
+ v-else-if="type === 'tuple'"
+ >
+ <input
+ type="string"
+ :value="tupleList[0]"
+ @change="$emit('update:modelValue', { tuple: listSet(tupleList, 0, $event.target.value) })"
+ >
+ {{ /* This is the Elixir pair constructing operator. */ '=>' }}
+ <input
+ type="string"
+ :value="tupleList[1]"
+ @change="$emit('update:modelValue', { tuple: listSet(tupleList, 1, $event.target.value) })"
+ >
+ </div>
<ol
v-else-if="isList"
>
<li
- v-for="(item, index) in modelValue"
+ v-for="(item, index) in listifiedModel"
:key="index"
>
<div
class="list-input-item"
>
<typed-input
:model-value="item"
:type="subtype"
:suggestions="suggestions"
- @update:modelValue="k => $emit('update:modelValue', listSet(index, k))"
+ @update:modelValue="k => $emit('update:modelValue', listSet(listifiedModel, index, k))"
/>
<button
class="button-default btn"
- @click="() => $emit('update:modelValue', listRemove(index))"
+ @click="() => $emit('update:modelValue', listRemove(listifiedModel, index))"
>
{{ $t('admin_dashboard.config.remove_item') }}
</button>
</div>
</li>
<li>
<button
class="button-default btn"
- @click="() => $emit('update:modelValue', listAdd())"
+ @click="() => $emit('update:modelValue', listAdd(listifiedModel))"
>
{{ $t('admin_dashboard.config.add_item') }}
</button>
</li>
</ol>
<p v-else>
Type: {{ type }}
Value: {{ modelValue }}
</p>
</div>
</template>
<script src="./typed_input.js"></script>
<style lang="scss">
.typed-input {
.list-input-item {
display: flex;
flex-direction: row;
}
}
</style>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Oct 31, 3:19 PM (18 h, 13 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1801540
Default Alt Text
(4 KB)
Attached To
Mode
rPUFE pleroma-fe-upstream
Attached
Detach File
Event Timeline