Skip to content

Commit 0607e39

Browse files
committed
feat(frontend): add source type and label helpers for MCP installations
1 parent 39b4c09 commit 0607e39

File tree

3 files changed

+91
-11
lines changed

3 files changed

+91
-11
lines changed

services/frontend/src/components/mcp-server/McpInstallationsList.vue

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,29 @@ const formatDate = (dateString: string) => {
105105
})
106106
}
107107
108+
// Helper to determine server source type
109+
const getServerSourceType = (installation: McpInstallation): 'github' | 'remote' | 'catalog' => {
110+
if (installation.server?.source === 'github') return 'github'
111+
if (installation.server?.runtime === 'http' || installation.server?.runtime === 'sse') return 'remote'
112+
return 'catalog'
113+
}
114+
115+
// Helper to get source label
116+
const getSourceLabel = (installation: McpInstallation): string => {
117+
const type = getServerSourceType(installation)
118+
if (type === 'github') return t('mcpCatalog.source.github')
119+
if (type === 'remote') return t('mcpCatalog.source.remote')
120+
return t('mcpCatalog.source.catalog')
121+
}
122+
123+
// Helper to extract GitHub repo name from URL
124+
const getGitHubRepoName = (repositoryUrl: string | null | undefined): string | null => {
125+
if (!repositoryUrl) return null
126+
// Extract "owner/repo" from "https://github.com/owner/repo.git"
127+
const match = repositoryUrl.match(/github\.com\/([^\/]+\/[^\/\.]+)/)
128+
return match?.[1] ?? null
129+
}
130+
108131
const handleViewInstallation = (installationId: string) => {
109132
router.push(`/mcp-server/installation/${installationId}`)
110133
}
@@ -246,14 +269,19 @@ onUnmounted(() => {
246269
class="shrink-0 hidden sm:flex"
247270
/>
248271

249-
<dl class="flex-1 grid grid-cols-2 gap-x-8 gap-y-1 text-xs/5 text-gray-500 sm:grid-cols-3">
250-
<div>
251-
<dt class="font-medium text-gray-700">Satellite</dt>
252-
<dd>{{ installation.installation_type }}</dd>
272+
<dl class="flex-1 grid grid-cols-2 gap-x-8 gap-y-1 text-xs/5 text-gray-500 sm:grid-cols-3 items-start">
273+
<div class="flex flex-col">
274+
<dt class="font-medium text-gray-700 leading-5">{{ t('mcpCatalog.source.label') }}</dt>
275+
<dd class="leading-5">{{ getSourceLabel(installation) }}</dd>
253276
</div>
254-
<div>
255-
<dt class="font-medium text-gray-700">{{ t('mcpInstallations.table.columns.category') }}</dt>
256-
<dd>
277+
<div class="flex flex-col">
278+
<dt class="font-medium text-gray-700 leading-5">
279+
{{ getServerSourceType(installation) === 'github' ? t('mcpCatalog.repository.label') : t('mcpInstallations.table.columns.category') }}
280+
</dt>
281+
<dd v-if="getServerSourceType(installation) === 'github'" class="leading-5">
282+
{{ getGitHubRepoName(installation.server?.repository_url) || 'N/A' }}
283+
</dd>
284+
<dd v-else class="leading-5">
257285
<CategoryDisplay
258286
:category-id="installation.server?.category_id"
259287
:show-not-provided="true"
@@ -262,9 +290,9 @@ onUnmounted(() => {
262290
/>
263291
</dd>
264292
</div>
265-
<div>
266-
<dt class="font-medium text-gray-700">{{ t('mcpInstallations.table.columns.runtime') }}</dt>
267-
<dd>{{ installation.server?.runtime }}</dd>
293+
<div class="flex flex-col">
294+
<dt class="font-medium text-gray-700 leading-5">{{ t('mcpInstallations.table.columns.runtime') }}</dt>
295+
<dd class="leading-5">{{ installation.server?.runtime }}</dd>
268296
</div>
269297
</dl>
270298
</div>
@@ -273,7 +301,7 @@ onUnmounted(() => {
273301
<div
274302
class="flex shrink-0 items-center gap-x-4"
275303
>
276-
<div class="hidden sm:flex sm:flex-col sm:items-end">
304+
<div class="hidden sm:flex sm:flex-col sm:items-end sm:min-w-[140px]">
277305
<InstallationStatusBadge
278306
:status-data="installation.status ? {
279307
installation_id: installation.id,
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script setup lang="ts">
2+
import { computed } from 'vue'
3+
import { useI18n } from 'vue-i18n'
4+
import { Badge } from '@/components/ui/badge'
5+
import { Package, Github, Cloud } from 'lucide-vue-next'
6+
7+
interface Props {
8+
source?: 'official_registry' | 'manual' | 'github' | null
9+
runtime?: string | null
10+
}
11+
12+
const props = defineProps<Props>()
13+
const { t } = useI18n()
14+
15+
const sourceType = computed(() => {
16+
if (props.source === 'github') return 'github'
17+
if (props.runtime === 'http' || props.runtime === 'sse') return 'remote'
18+
return 'catalog'
19+
})
20+
21+
const sourceLabel = computed(() => {
22+
if (sourceType.value === 'github') return t('mcpCatalog.source.github')
23+
if (sourceType.value === 'remote') return t('mcpCatalog.source.remote')
24+
return t('mcpCatalog.source.catalog')
25+
})
26+
27+
const badgeVariant = computed(() => {
28+
if (sourceType.value === 'github') return 'default'
29+
if (sourceType.value === 'remote') return 'secondary'
30+
return 'outline'
31+
})
32+
</script>
33+
34+
<template>
35+
<Badge :variant="badgeVariant" class="flex items-center gap-1">
36+
<Github v-if="sourceType === 'github'" class="h-3 w-3" />
37+
<Cloud v-else-if="sourceType === 'remote'" class="h-3 w-3" />
38+
<Package v-else class="h-3 w-3" />
39+
<span>{{ sourceLabel }}</span>
40+
</Badge>
41+
</template>

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,17 @@ export default {
870870
rowsSelected: '{selected} of {total} row(s) selected.'
871871
},
872872

873+
source: {
874+
catalog: 'Catalog',
875+
github: 'GitHub',
876+
remote: 'Remote',
877+
label: 'Source'
878+
},
879+
880+
repository: {
881+
label: 'Repository'
882+
},
883+
873884
filters: {
874885
button: 'Filters',
875886
clear: 'Clear Filters',

0 commit comments

Comments
 (0)