Skip to content

Commit c4aa090

Browse files
author
Lasim
committed
feat(frontend): update argument field labels and placeholders
1 parent 45bd18b commit c4aa090

File tree

3 files changed

+18
-47
lines changed

3 files changed

+18
-47
lines changed

services/frontend/src/components/admin/mcp-catalog/steps/ConfigurationSchemaStepAdd.vue

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,6 @@ const validateForm = () => {
513513
}
514514
}
515515
516-
if (formDataLocal.value.category === 'template' && formDataLocal.value.type === 'arg' && !formDataLocal.value.value?.trim()) {
517-
errors.value = t('mcpCatalog.form.configurationSchema.modal.validation.valueRequired')
518-
}
519-
520516
formErrors.value = errors
521517
return Object.keys(errors).length === 0
522518
}
@@ -783,13 +779,15 @@ watch(localData, () => {
783779
</AlertDialogHeader>
784780

785781
<form @submit.prevent="handleSubmit" class="space-y-4">
786-
<!-- Name -->
782+
<!-- Argument/Environment Variable Name -->
787783
<div class="space-y-2">
788-
<Label for="item-name">{{ $t('mcpCatalog.form.configurationSchema.modal.fields.name.label') }}</Label>
784+
<Label for="item-name">
785+
{{ formDataLocal.type === 'arg' ? $t('mcpCatalog.form.configurationSchema.modal.fields.argument.label') : $t('mcpCatalog.form.configurationSchema.modal.fields.name.label') }}
786+
</Label>
789787
<Input
790788
id="item-name"
791789
v-model="formDataLocal.name"
792-
:placeholder="$t(`mcpCatalog.form.configurationSchema.modal.fields.name.placeholders.${formDataLocal.type === 'arg' ? 'argument' : 'environment'}`)"
790+
:placeholder="formDataLocal.type === 'arg' ? $t('mcpCatalog.form.configurationSchema.modal.fields.argument.placeholder') : $t('mcpCatalog.form.configurationSchema.modal.fields.name.placeholders.environment')"
793791
:class="{ 'border-destructive': formErrors.name }"
794792
class="font-mono"
795793
required
@@ -799,22 +797,6 @@ watch(localData, () => {
799797
</div>
800798
</div>
801799

802-
<!-- Value (for template args only) -->
803-
<div v-if="formDataLocal.type === 'arg' && formDataLocal.category === 'template'" class="space-y-2">
804-
<Label for="item-value">{{ $t('mcpCatalog.form.configurationSchema.modal.fields.value.label') }}</Label>
805-
<Input
806-
id="item-value"
807-
v-model="formDataLocal.value"
808-
:placeholder="$t('mcpCatalog.form.configurationSchema.modal.fields.value.placeholder')"
809-
:class="{ 'border-destructive': formErrors.value }"
810-
class="font-mono"
811-
required
812-
/>
813-
<div v-if="formErrors.value" class="text-sm text-destructive">
814-
{{ formErrors.value }}
815-
</div>
816-
</div>
817-
818800
<!-- Category -->
819801
<div class="space-y-2">
820802
<Label for="item-category">{{ $t('mcpCatalog.form.configurationSchema.modal.fields.category.label') }}</Label>

services/frontend/src/components/admin/mcp-catalog/steps/ConfigurationSchemaStepEdit.vue

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,6 @@ const validateForm = () => {
390390
}
391391
}
392392
393-
if (formDataLocal.value.category === 'template' && formDataLocal.value.type === 'arg' && !formDataLocal.value.value?.trim()) {
394-
errors.value = t('mcpCatalog.form.configurationSchema.modal.validation.valueRequired')
395-
}
396-
397393
formErrors.value = errors
398394
return Object.keys(errors).length === 0
399395
}
@@ -408,6 +404,11 @@ const handleSubmit = () => {
408404
id: formDataLocal.value.id || `${formDataLocal.value.type}_${Date.now()}`
409405
}
410406
407+
// For template args, set both name and value to the same argument value
408+
if (newItem.type === 'arg' && newItem.category === 'template') {
409+
newItem.value = newItem.name
410+
}
411+
411412
if (modalMode.value === 'add') {
412413
updatedData.push(newItem)
413414
} else {
@@ -704,13 +705,13 @@ onUnmounted(() => {
704705
</AlertDialogHeader>
705706

706707
<form @submit.prevent="handleSubmit" class="space-y-4">
707-
<!-- Name -->
708+
<!-- Argument -->
708709
<div class="space-y-2">
709-
<Label for="item-name">{{ $t('mcpCatalog.form.configurationSchema.modal.fields.name.label') }}</Label>
710+
<Label for="item-argument">{{ formDataLocal.type === 'arg' ? 'Argument' : 'Environment Variable' }}</Label>
710711
<Input
711-
id="item-name"
712+
id="item-argument"
712713
v-model="formDataLocal.name"
713-
:placeholder="$t(`mcpCatalog.form.configurationSchema.modal.fields.name.placeholders.${formDataLocal.type === 'arg' ? 'argument' : 'environment'}`)"
714+
:placeholder="formDataLocal.type === 'arg' ? 'e.g. --api-key or -y' : 'e.g. API_KEY'"
714715
:class="{ 'border-destructive': formErrors.name }"
715716
class="font-mono"
716717
required
@@ -720,22 +721,6 @@ onUnmounted(() => {
720721
</div>
721722
</div>
722723

723-
<!-- Value (for template args only) -->
724-
<div v-if="formDataLocal.type === 'arg' && formDataLocal.category === 'template'" class="space-y-2">
725-
<Label for="item-value">{{ $t('mcpCatalog.form.configurationSchema.modal.fields.value.label') }}</Label>
726-
<Input
727-
id="item-value"
728-
v-model="formDataLocal.value"
729-
:placeholder="$t('mcpCatalog.form.configurationSchema.modal.fields.value.placeholder')"
730-
:class="{ 'border-destructive': formErrors.value }"
731-
class="font-mono"
732-
required
733-
/>
734-
<div v-if="formErrors.value" class="text-sm text-destructive">
735-
{{ formErrors.value }}
736-
</div>
737-
</div>
738-
739724
<!-- Category -->
740725
<div class="space-y-2">
741726
<Label for="item-category">{{ $t('mcpCatalog.form.configurationSchema.modal.fields.category.label') }}</Label>

services/frontend/src/i18n/locales/en/mcp-catalog.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ export default {
202202
environment: 'ENV_VAR_NAME'
203203
}
204204
},
205+
argument: {
206+
label: 'Argument',
207+
placeholder: 'e.g., --api-key, -y, package-name'
208+
},
205209
value: {
206210
label: 'Value',
207211
placeholder: 'Example: --verbose or package-name'

0 commit comments

Comments
 (0)