Skip to content

Commit aab785c

Browse files
author
Lasim
committed
feat(frontend): make repository URL optional in GitHub step
1 parent 51472b6 commit aab785c

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

services/frontend/src/components/admin/mcp-catalog/GitHubRepositoryStep.vue

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,28 @@ const repositoryUrl = ref(props.modelValue?.repository_url || '')
3131
const validationError = ref<string | null>(null)
3232

3333
// Basic repository URL validation (supports any Git platform)
34+
// Returns true if URL is empty (optional) or if it's a valid format
3435
const isValidRepositoryUrl = computed(() => {
35-
if (!repositoryUrl.value) return false
36-
// Basic validation - check if it looks like a repository URL
36+
if (!repositoryUrl.value || repositoryUrl.value.trim() === '') return true
37+
// If URL is provided, check if it looks like a repository URL
3738
return repositoryUrl.value.length > 0 && repositoryUrl.value.includes('/')
3839
})
3940

4041
// Validate URL format
4142
const validateUrl = () => {
42-
if (!repositoryUrl.value) {
43+
// If URL is empty or whitespace only, clear error and update with empty values
44+
if (!repositoryUrl.value || repositoryUrl.value.trim() === '') {
4345
validationError.value = null
46+
emit('update:modelValue', {
47+
repository_url: '',
48+
repository_source: 'github',
49+
git_branch: 'main',
50+
auto_populated: false
51+
})
4452
return
4553
}
4654

55+
// URL is provided - validate format
4756
if (!isValidRepositoryUrl.value) {
4857
validationError.value = 'Please enter a valid repository URL'
4958
return
@@ -84,7 +93,7 @@ watch(repositoryUrl, validateUrl)
8493
</div>
8594

8695
<div class="space-y-2">
87-
<Label for="repository-url">Repository URL *</Label>
96+
<Label for="repository-url">Repository URL (Optional)</Label>
8897
<Input
8998
id="repository-url"
9099
v-model="repositoryUrl"
@@ -93,7 +102,7 @@ watch(repositoryUrl, validateUrl)
93102
@blur="validateUrl"
94103
/>
95104
<p class="text-sm text-muted-foreground">
96-
Enter a valid repository URL (GitHub, GitLab, Bitbucket, etc.)
105+
Enter a repository URL to auto-populate server details, or leave blank to enter manually
97106
</p>
98107
</div>
99108

services/frontend/src/components/admin/mcp-catalog/McpServerAddFormWizard.vue

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,8 @@ const canGoNext = computed(() => !isLastStep.value)
222222
const canGoPrevious = computed(() => !isFirstStep.value)
223223

224224
const canProceedFromGitHub = computed(() => {
225-
const repositoryUrl = formData.value.repository.repository_url
226-
return repositoryUrl &&
227-
repositoryUrl.length > 0 &&
228-
!isFetchingGitHub.value
225+
// Always allow proceeding from GitHub step (URL is optional)
226+
return !isFetchingGitHub.value
229227
})
230228

231229
const canProceedFromClaudeConfig = computed(() => {
@@ -236,7 +234,6 @@ const canProceedFromClaudeConfig = computed(() => {
236234
const canSubmit = computed(() => {
237235
return formData.value.basic.name &&
238236
formData.value.basic.description &&
239-
formData.value.repository.repository_url &&
240237
canProceedFromClaudeConfig.value
241238
})
242239

@@ -312,11 +309,19 @@ const handleCancel = () => {
312309
const handleGitHubStepNext = async () => {
313310
if (currentStep.value !== 0) return
314311

312+
const repositoryUrl = formData.value.repository.repository_url
313+
314+
// If no GitHub URL provided, skip fetching and go to next step
315+
if (!repositoryUrl || repositoryUrl.trim() === '') {
316+
nextStep()
317+
return
318+
}
319+
320+
// GitHub URL provided - fetch and validate
315321
try {
316322
isFetchingGitHub.value = true
317323
githubFetchError.value = null
318324

319-
const repositoryUrl = formData.value.repository.repository_url
320325
const gitBranch = formData.value.repository.git_branch
321326

322327
// Call backend API to fetch repository data
@@ -413,7 +418,7 @@ const submitForm = async () => {
413418
}
414419

415420
// Construct the final payload for the backend API
416-
const finalPayload = {
421+
const finalPayload: any = {
417422
// Basic Info
418423
name: formData.value.basic.name,
419424
description: formData.value.basic.description,
@@ -427,14 +432,6 @@ const submitForm = async () => {
427432
featured: formData.value.basic.featured,
428433
auto_install_new_default_team: formData.value.basic.auto_install_new_default_team,
429434

430-
// Repository Info
431-
repository_url: formData.value.repository.repository_url,
432-
repository_source: formData.value.repository.repository_source,
433-
git_branch: formData.value.repository.git_branch,
434-
435-
// From auto-population or manual entry
436-
website_url: formData.value.repository.repo_data?.homepage,
437-
438435
// New Configuration Schema (ADR-007)
439436
configuration_schema: formData.value.configuration_schema,
440437

@@ -449,6 +446,19 @@ const submitForm = async () => {
449446
remotes: extractedRemotes,
450447
};
451448

449+
// Only include repository fields if repository URL is provided
450+
const repositoryUrl = formData.value.repository.repository_url;
451+
if (repositoryUrl && repositoryUrl.trim() !== '') {
452+
finalPayload.repository_url = repositoryUrl;
453+
finalPayload.repository_source = formData.value.repository.repository_source;
454+
finalPayload.git_branch = formData.value.repository.git_branch;
455+
456+
// From auto-population or manual entry
457+
if (formData.value.repository.repo_data?.homepage) {
458+
finalPayload.website_url = formData.value.repository.repo_data.homepage;
459+
}
460+
}
461+
452462
await emit('submit', finalPayload)
453463

454464
} catch (error) {

0 commit comments

Comments
 (0)