[Extensions UI] Passing config_file to the configuration tab.

This commit is contained in:
Fabio Manganiello 2023-10-17 16:38:46 +02:00
parent 66cba233e5
commit 033317e0a7
Signed by: blacklight
GPG key ID: D90FBA7F76362774
3 changed files with 23 additions and 3 deletions

View file

@ -18,17 +18,23 @@ export default {
components: {
CopyButton,
},
props: {
extension: {
type: Object,
required: true,
},
configFile: {
type: String,
},
},
computed: {
highlightedConfigSnippet() {
return hljs.highlight(
'yaml',
`# Add this configuration template to ${this.configFile}\n` +
this.extension.config_snippet,
).value.trim()
},

View file

@ -26,7 +26,9 @@
<div class="extension-body">
<Doc v-if="selectedTab === 'doc'" :extension="extension" />
<Config v-else-if="selectedTab === 'config'" :extension="extension" />
<Config v-else-if="selectedTab === 'config'"
:extension="extension"
:config-file="configFile" />
<Install v-else-if="selectedTab === 'install'" :extension="extension" />
</div>
</div>
@ -54,6 +56,10 @@ export default {
type: Object,
required: true,
},
configFile: {
type: String,
},
},
data() {

View file

@ -24,7 +24,8 @@
<div class="extension-body-container until tablet"
v-if="selectedExtension && name === selectedExtension">
<Extension :extension="extensions[selectedExtension]" />
<Extension :extension="extensions[selectedExtension]"
:config-file="configFile" />
</div>
</div>
</div>
@ -32,7 +33,8 @@
<div class="extension-body-container from desktop"
v-if="selectedExtension">
<Extension :extension="extensions[selectedExtension]" />
<Extension :extension="extensions[selectedExtension]"
:config-file="configFile" />
</div>
</main>
</div>
@ -59,6 +61,7 @@ export default {
backends: {},
filter: '',
selectedExtension: null,
configFile: null,
}
},
@ -127,9 +130,14 @@ export default {
this.loading = false
}
},
async loadConfigFile() {
this.configFile = await this.request('config.get_config_file')
},
},
mounted() {
this.loadConfigFile()
this.loadExtensions()
bus.on('update:extension', (ext) => this.onInput(ext, false))
this.$nextTick(() => this.$refs.filter.focus())