Report custom labels set by agent admins back (#4141)

This commit is contained in:
6543
2024-10-06 17:13:41 +02:00
committed by GitHub
parent 0f7b607a40
commit f8cfda1ea9
22 changed files with 441 additions and 234 deletions

View File

@@ -316,6 +316,10 @@
"desc": "The max amount of parallel pipelines executed by this agent.",
"badge": "capacity"
},
"custom_labels": {
"custom_labels": "Custom Labels",
"desc": "The custom labels set by the agent admin on agent startup."
},
"org": {
"badge": "org"
},

View File

@@ -33,6 +33,15 @@
<TextField :id="id" v-model="agent.platform" disabled />
</InputField>
<InputField
v-if="agent.custom_labels && Object.keys(agent.custom_labels).length > 0"
v-slot="{ id }"
:label="$t('admin.settings.agents.custom_labels.custom_labels')"
>
<span class="text-wp-text-alt-100">{{ $t('admin.settings.agents.custom_labels.desc') }}</span>
<TextField :id="id" :model-value="formatCustomLabels(agent.custom_labels)" disabled />
</InputField>
<InputField
v-slot="{ id }"
:label="$t('admin.settings.agents.capacity.capacity')"
@@ -101,4 +110,10 @@ const agent = computed({
function updateAgent(newValues: Partial<Agent>) {
emit('update:modelValue', { ...agent.value, ...newValues });
}
function formatCustomLabels(labels: Record<string, string>): string {
return Object.entries(labels)
.map(([key, value]) => `${key}=${value}`)
.join(', ');
}
</script>

View File

@@ -12,4 +12,5 @@ export interface Agent {
capacity: number;
version: string;
no_schedule: boolean;
custom_labels: Record<string, string>;
}