Skip to content

Commit e035a86

Browse files
author
Lasim
committed
feat(frontend): add team usage indicator component and integration
1 parent 0befca8 commit e035a86

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<script setup lang="ts">
2+
import { ref, onMounted, watch } from 'vue'
3+
import { useI18n } from 'vue-i18n'
4+
import { TeamService, type TeamUsageData } from '@/services/teamService'
5+
6+
const { t } = useI18n()
7+
8+
interface Props {
9+
teamId: string
10+
}
11+
12+
const props = defineProps<Props>()
13+
14+
// State
15+
const usageData = ref<TeamUsageData | null>(null)
16+
const isLoading = ref(true)
17+
18+
// Load usage data
19+
const loadUsageData = async () => {
20+
try {
21+
isLoading.value = true
22+
usageData.value = await TeamService.getTeamUsage(props.teamId)
23+
} catch (err) {
24+
// Fail silently - hide the indicator on error
25+
usageData.value = null
26+
console.error('Error loading team usage indicator:', err)
27+
} finally {
28+
isLoading.value = false
29+
}
30+
}
31+
32+
// Watch for team changes and reload data
33+
watch(() => props.teamId, () => {
34+
loadUsageData()
35+
}, { immediate: false })
36+
37+
onMounted(() => {
38+
loadUsageData()
39+
})
40+
</script>
41+
42+
<template>
43+
<div
44+
v-if="usageData && !isLoading"
45+
class="flex items-center gap-2 text-sm text-muted-foreground"
46+
>
47+
<span>
48+
{{ t('teams.usageIndicator.totalMcpServers') }}
49+
<span class="font-medium text-foreground">
50+
{{ usageData.total_installed_mcp_servers }}/{{ usageData.limits.mcp_server_limit }}
51+
</span>
52+
</span>
53+
<span class="text-gray-300">|</span>
54+
<span>
55+
{{ t('teams.usageIndicator.stdioMcpServers') }}
56+
<span class="font-medium text-foreground">
57+
{{ usageData.non_http_mcp_servers }}/{{ usageData.limits.non_http_mcp_limit }}
58+
</span>
59+
</span>
60+
</div>
61+
</template>

services/frontend/src/i18n/locales/en/teams.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ export default {
286286
backToTeams: 'Back to Teams',
287287
loading: 'Loading...'
288288
}
289+
},
290+
usageIndicator: {
291+
totalMcpServers: 'Total MCP Servers',
292+
stdioMcpServers: 'stdio MCP Servers'
289293
}
290294
}
291295
}

services/frontend/src/views/dashboard/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import McpClientConnectionsCard from '@/components/mcp-server/McpClientConnectio
1414
import McpStats from '@/components/mcp-server/McpStats.vue'
1515
import ClientConfigurationModal from '@/components/gateway-config/ClientConfigurationModal.vue'
1616
import UserWalkthroughPopover from '@/components/walkthrough/UserWalkthroughPopover.vue'
17+
import TeamUsageIndicator from '@/components/teams/TeamUsageIndicator.vue'
1718
import type { McpInstallation } from '@/types/mcp-installations'
1819
import { McpInstallationService } from '@/services/mcpInstallationService'
1920
import { TeamService, type Team } from '@/services/teamService'
@@ -416,6 +417,7 @@ onUnmounted(() => {
416417
<!-- Header -->
417418
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
418419
<div class="flex-1">
420+
<TeamUsageIndicator v-if="selectedTeam" :team-id="selectedTeam.id" />
419421
</div>
420422
<div v-if="selectedTeam" class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
421423
<Button

services/frontend/src/views/mcp-server/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import McpInstallationsEmptyState from '@/components/mcp-server/McpInstallations
1313
import type { McpInstallation } from '@/types/mcp-installations'
1414
import { McpInstallationService } from '@/services/mcpInstallationService'
1515
import { TeamService, type Team } from '@/services/teamService'
16+
import TeamUsageIndicator from '@/components/teams/TeamUsageIndicator.vue'
1617
1718
const { t } = useI18n()
1819
const router = useRouter()
@@ -254,6 +255,7 @@ onUnmounted(() => {
254255
<!-- Header -->
255256
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
256257
<div class="flex-1">
258+
<TeamUsageIndicator v-if="selectedTeam" :team-id="selectedTeam.id" />
257259
</div>
258260
<div v-if="selectedTeam" class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
259261
<Button

0 commit comments

Comments
 (0)