[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: { components: {
CopyButton, CopyButton,
}, },
props: { props: {
extension: { extension: {
type: Object, type: Object,
required: true, required: true,
}, },
configFile: {
type: String,
},
}, },
computed: { computed: {
highlightedConfigSnippet() { highlightedConfigSnippet() {
return hljs.highlight( return hljs.highlight(
'yaml', 'yaml',
`# Add this configuration template to ${this.configFile}\n` +
this.extension.config_snippet, this.extension.config_snippet,
).value.trim() ).value.trim()
}, },

View file

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

View file

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