hide list add string if not in expert mode

This commit is contained in:
Henry Jameson 2025-12-04 15:24:07 +02:00
commit 3fca18e248
4 changed files with 33 additions and 14 deletions

View file

@ -16,7 +16,10 @@
<BooleanSetting path=":pleroma.:media_proxy.:proxy_opts.:redirect_on_failure" />
</li>
<li>
<ListSetting path=":pleroma.:media_proxy.:whitelist" />
<ListSetting
ignore-suggestions
path=":pleroma.:media_proxy.:whitelist"
/>
</li>
</ul>
</li>
@ -44,6 +47,7 @@
</li>
<li>
<ListSetting
ignore-suggestions
:path="[':pleroma', 'Pleroma.Web.MediaProxy.Invalidation.Http', ':headers']"
parent-path=":pleroma.:media_proxy.:invalidation.:enabled"
/>

View file

@ -24,27 +24,46 @@ export default {
},
allowNew: {
required: false,
type: Set,
type: Boolean,
default: true
},
forceNew: {
required: false,
type: Boolean,
default: false
}
},
computed: {
...Setting.computed,
showNew () {
if (this.forceNew) return true
if (!this.allowNew) return false
const isExpert = this.$store.state.config.expertLevel > 0
const hasBuiltins = this.builtinEntries.length > 0
if (hasBuiltins) {
return isExpert
} else {
return true
}
},
valueSet () {
return new Set(this.visibleState)
},
suggestions () {
const suggestions = this.backendDescription?.suggestions
suggestionsSet () {
const suggestions = this.backendDescriptionSuggestions
if (suggestions) {
return new Set(this.backendDescription.suggestions)
return new Set(suggestions)
} else {
return new Set()
}
},
extraEntries () {
if (this.ignoreSuggestions) return [...this.valueSet.values()]
if (!this.suggestionsSet) return []
return [...this.valueSet.values()].filter((x) => {
return !this.suggestions?.has(x)
return !this.suggestionsSet?.has(x)
})
},
builtinEntries () {
@ -52,14 +71,12 @@ export default {
if (this.overrideAvailableOptions) {
return [...this.overrideAvailableOptions]
}
if (!this.suggestionsSet) return []
const builtins = [...this.valueSet.values()].filter((x) => {
return this.suggestions.has(x)
})
const builtins = [...this.suggestionsSet.values()]
return builtins.map((option) => ({
label: option,
value: option
value: this.valueSet.has(option)
}))
}
},

View file

@ -48,7 +48,7 @@
</button>
</div>
</li>
<li v-if="allowNew">
<li v-if="showNew">
<div class="btn-group">
<input
class="input string-input"

View file

@ -235,7 +235,6 @@ export default {
},
descriptionPath () {
if (this.path == null) return null
if (this.backendDescriptionPath) return this.backendDescriptionPath
const path = Array.isArray(this.path) ? this.path : this.path.split('.')
if (this.subgroup) {
return [
@ -279,7 +278,6 @@ export default {
}
},
reset () {
console.log('RS', this.state, this.draft)
if (this.realDraftMode) {
this.draft = cloneDeep(this.state)
} else {