WebUI: agent edit/detail view: change the **HELP** url based on the b… (#4219)

This commit is contained in:
tori-27 2024-10-12 01:12:06 +02:00 committed by GitHub
parent 03e9546ac7
commit ac4136f9c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,11 +21,7 @@
<TextField :id="id" :model-value="agent.id?.toString()" disabled />
</InputField>
<InputField
v-slot="{ id }"
:label="$t('admin.settings.agents.backend.backend')"
docs-url="docs/next/administration/backends/docker"
>
<InputField v-slot="{ id }" :label="$t('admin.settings.agents.backend.backend')" :docs-url="backendDocsUrl">
<TextField :id="id" v-model="agent.backend" disabled />
</InputField>
@ -107,6 +103,16 @@ const agent = computed({
set: (value) => emit('update:modelValue', value),
});
const baseDocsUrl = 'https://woodpecker-ci.org/docs/next/administration/backends/';
const backendDocsUrl = computed(() => {
let backendUrlSuffix = agent.value.backend?.toLowerCase();
if (backendUrlSuffix === 'custom') {
backendUrlSuffix = 'custom-backends';
}
return `${baseDocsUrl}${backendUrlSuffix === '' ? 'docker' : backendUrlSuffix}`;
});
function updateAgent(newValues: Partial<Agent>) {
emit('update:modelValue', { ...agent.value, ...newValues });
}