Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ const props = defineProps<{
class="ml-2 text-xs text-red-400 flex items-center gap-1"
>
<i class="bi bi-exclamation-triangle" />
{{ $t('collaboration.presence.offline') }}
{{ $t('collaboration.presenceIndicator.offline') }}
</span>
</div>

<!-- Expanded View -->
<div v-else class="space-y-2">
<div class="text-xs font-medium text-autobot-text-muted mb-2">
{{ $t('collaboration.presence.participants', { count: sessionPresence.length }) }}
{{ $t('collaboration.presenceIndicator.participants', { count: sessionPresence.length }) }}
</div>

<!-- My entry -->
Expand All @@ -118,11 +118,11 @@ const props = defineProps<{
<span class="text-sm font-medium text-autobot-text-primary truncate">
{{ myPresence.username }}
</span>
<span class="text-xs text-blue-400">{{ $t('collaboration.presence.you') }}</span>
<span class="text-xs text-blue-400">{{ $t('collaboration.presenceIndicator.you') }}</span>
</div>
<div class="flex items-center gap-1 text-xs text-autobot-text-muted">
<i :class="`bi bi-${getTabIcon(myPresence.currentTab)}`" />
<span>{{ $t('collaboration.presence.tabLabel', { tab: myPresence.currentTab || $t('collaboration.presence.unknownTab') }) }}</span>
<span>{{ $t('collaboration.presenceIndicator.tabLabel', { tab: myPresence.currentTab || $t('collaboration.presenceIndicator.unknownTab') }) }}</span>
</div>
</div>
</div>
Expand All @@ -142,7 +142,7 @@ const props = defineProps<{
</div>
<div class="flex items-center gap-1 text-xs text-autobot-text-muted">
<i :class="`bi bi-${getTabIcon(collaborator.currentTab)}`" />
<span>{{ $t('collaboration.presence.tabLabel', { tab: collaborator.currentTab || $t('collaboration.presence.unknownTab') }) }}</span>
<span>{{ $t('collaboration.presenceIndicator.tabLabel', { tab: collaborator.currentTab || $t('collaboration.presenceIndicator.unknownTab') }) }}</span>
</div>
</div>
<div class="text-xs text-autobot-text-muted">
Expand All @@ -156,7 +156,7 @@ const props = defineProps<{
class="text-center py-4 text-autobot-text-muted"
>
<i class="bi bi-people text-lg mb-1" />
<div class="text-xs">{{ $t('collaboration.presence.noParticipants') }}</div>
<div class="text-xs">{{ $t('collaboration.presenceIndicator.noParticipants') }}</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import { describe, it, expect, vi } from 'vitest'
import { mount } from '@vue/test-utils'
import { ref } from 'vue'
import { createI18n } from 'vue-i18n'
import en from '@/i18n/locales/en.json'
import type { UserPresence } from '@/composables/useSessionCollaboration'

const state = vi.hoisted(() => ({ presence: [] as unknown[], me: null as unknown }))
Expand Down Expand Up @@ -68,6 +70,21 @@ describe('PresenceIndicator renders who is present (#16754)', () => {

it('the expanded view counts everyone present, me included', () => {
const wrapper = mountWith([person('u1', 'ada'), person('u2', 'bob')], true)
expect(wrapper.text()).toContain('collaboration.presence.participants{"count":3}')
expect(wrapper.text()).toContain('collaboration.presenceIndicator.participants{"count":3}')
})

// #19416: with the real English bundle, the placeholders resolve: the count and each tab show.
it('the expanded view renders the count and every participant\'s tab from the real strings', () => {
const me = person('me', 'Alex Doe')
state.me = me
state.presence = [me, { ...person('u1', 'ada'), currentTab: 'knowledge' } as UserPresence]
const wrapper = mount(PresenceIndicator, {
props: { expanded: true },
global: { plugins: [createI18n({ legacy: false, globalInjection: true, locale: 'en', messages: { en } })] },
})
const text = wrapper.text()
expect(text).toContain('Participants (2)')
expect(text).toContain('chat tab')
expect(text).toContain('knowledge tab')
})
})
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -6498,16 +6498,6 @@
"roleOwner": "Owner",
"roleViewer": "Viewer"
},
"presence": {
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"you": "You",
"noParticipants": "No participants",
"participants": "Participants",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status"
},
"panel": {
"title": "التعاون",
"invite": "دعوة",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -6498,16 +6498,6 @@
"roleOwner": "Owner",
"roleViewer": "Viewer"
},
"presence": {
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"you": "You",
"noParticipants": "No participants",
"participants": "Participants",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status"
},
"panel": {
"title": "Zusammenarbeit",
"invite": "Einladen",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6862,16 +6862,6 @@
"roleOwner": "Owner",
"roleViewer": "Viewer"
},
"presence": {
"collaboratorTooltip": "Collaborator",
"noParticipants": "No participants",
"offline": "Offline",
"participants": "Participants",
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"you": "You",
"youStatus": "Your status"
},
"panel": {
"title": "Collaboration",
"invite": "Invite",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -6498,16 +6498,6 @@
"roleOwner": "Owner",
"roleViewer": "Viewer"
},
"presence": {
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"you": "You",
"noParticipants": "No participants",
"participants": "Participants",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status"
},
"panel": {
"title": "Colaboración",
"invite": "Invitar",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -5120,16 +5120,6 @@
"selectUserError": "Please select a user to invite",
"sendFailed": "Failed to send invitation"
},
"presence": {
"participants": "Participants",
"you": "You",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status",
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"noParticipants": "No participants"
},
"participants": {
"invite": "Invite",
"collaborationOffline": "Collaboration offline",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -6498,16 +6498,6 @@
"roleOwner": "Owner",
"roleViewer": "Viewer"
},
"presence": {
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"you": "You",
"noParticipants": "No participants",
"participants": "Participants",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status"
},
"panel": {
"title": "Espace collaboratif",
"invite": "Inviter",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -5120,16 +5120,6 @@
"selectUserError": "Please select a user to invite",
"sendFailed": "Failed to send invitation"
},
"presence": {
"participants": "Participants",
"you": "You",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status",
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"noParticipants": "No participants"
},
"participants": {
"invite": "Invite",
"collaborationOffline": "Collaboration offline",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/lv.json
Original file line number Diff line number Diff line change
Expand Up @@ -6498,16 +6498,6 @@
"roleOwner": "Owner",
"roleViewer": "Viewer"
},
"presence": {
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"you": "You",
"noParticipants": "No participants",
"participants": "Participants",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status"
},
"panel": {
"title": "Sadarbība",
"invite": "Uzaicināt",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -6498,16 +6498,6 @@
"roleOwner": "Owner",
"roleViewer": "Viewer"
},
"presence": {
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"you": "You",
"noParticipants": "No participants",
"participants": "Participants",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status"
},
"panel": {
"title": "Współpraca",
"invite": "Zaproś",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -6498,16 +6498,6 @@
"roleOwner": "Owner",
"roleViewer": "Viewer"
},
"presence": {
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"you": "You",
"noParticipants": "No participants",
"participants": "Participants",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status"
},
"panel": {
"title": "Colaboração",
"invite": "Convidar",
Expand Down
10 changes: 0 additions & 10 deletions autobot-frontend/src/i18n/locales/ur.json
Original file line number Diff line number Diff line change
Expand Up @@ -5120,16 +5120,6 @@
"selectUserError": "Please select a user to invite",
"sendFailed": "Failed to send invitation"
},
"presence": {
"participants": "Participants",
"you": "You",
"offline": "Offline",
"collaboratorTooltip": "Collaborator",
"youStatus": "Your status",
"tabLabel": "Active tab",
"unknownTab": "Unknown tab",
"noParticipants": "No participants"
},
"participants": {
"invite": "Invite",
"collaborationOffline": "Collaboration offline",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,13 @@ async function refreshData(): Promise<void> {

// Fetch per-worker configs for priority/weight display
const nodeMetrics = fleetMetrics.value?.node_metrics ?? []
await Promise.all(
// One node's failed config read is logged and does not hide the others' (the store rethrows it).
const results = await Promise.allSettled(
nodeMetrics.map(m => fleetStore.fetchNpuWorkerConfig(m.node_id))
)
results.forEach((r, i) => {
if (r.status === 'rejected') logger.warn(`Worker config load failed for ${nodeMetrics[i].node_id}`, r.reason)
})
} catch (e) {
const msg = e instanceof Error ? e.message : t('fleet.loadBalancingView.failedToLoadData')
error.value = msg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ vi.mock('@/stores/fleet', () => ({
useFleetStore: () => ({ fetchNpuWorkerConfig, fetchNpuNodeMetrics }),
}))

vi.mock('@/i18n', () => ({ default: { global: { t: (k: string) => k } } }))

// The panel translates its save notice through useI18n; the tests mount without the plugin.
vi.mock('vue-i18n', () => ({ useI18n: () => ({ t: (k: string) => k }) }))

Expand Down Expand Up @@ -122,4 +124,16 @@ describe('NPUDetailsPanel node switch', () => {
expect(wrapper.findAll('input[type="checkbox"]:checked')).toHaveLength(0)
expect((wrapper.find('select').element as HTMLSelectElement).value).toBe('retry')
})

it('shows a per-node error when a load fails, and clears it for the next node (#19068)', async () => {
fetchNpuNodeMetrics.mockRejectedValueOnce(new Error('metrics unreachable')).mockResolvedValue(metrics(5))
fetchNpuWorkerConfig.mockResolvedValue(config(2))
const wrapper = mountPanel()
await flushPromises()
expect(wrapper.text()).toContain('metrics unreachable')

await wrapper.setProps({ node: nodeB as never })
await flushPromises()
expect(wrapper.text()).not.toContain('metrics unreachable')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useI18n } from 'vue-i18n'
import { useFleetStore } from '@/stores/fleet'
import type { SLMNode, NPUNodeStatus, NPUWorkerMetrics, NPUWorkerConfig } from '@/types/slm'
import { formatFleetDateTime } from '@/composables/useTimezone'
import { errorText } from '@/utils/errorText'

const props = defineProps<{
node: SLMNode
Expand Down Expand Up @@ -173,7 +174,7 @@ watch(
const token = ++loadToken
resetNodeState()
Promise.all([loadLiveMetrics(token), loadWorkerConfig(token)]).catch((e: unknown) => {
if (isCurrent(token)) error.value = e instanceof Error ? e.message : String(e)
if (isCurrent(token)) error.value = errorText(e)
})
},
{ immediate: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@ function isExpanded(nodeId: string): boolean {

const { t } = useI18n()

/** One tick; the store reports a failed read as null, so the tick throws for the poller to count. */
/** One tick; the store rethrows a failed read, so the poller counts it. */
async function loadMetrics(): Promise<void> {
try {
const metrics = await fleetStore.fetchNpuFleetMetrics()
if (metrics === null) throw new Error(fleetStore.error ?? 'NPU fleet metrics unavailable')
await fleetStore.fetchNpuFleetMetrics()
} finally {
isLoading.value = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,9 @@ const formatTimestamp = createDateFormatter({ kind: 'time', emptyText: 'Never' }

const { t } = useI18n()

/** The store reports a failed read as null; throw it, so refresh() shows it and the poller counts it. */
/** The store rethrows a failed read, so refresh() shows it and the poller counts it. */
async function fetchMetrics(): Promise<void> {
const fleetMetrics = await fleetStore.fetchNpuFleetMetrics()
if (fleetMetrics === null) throw new Error(fleetStore.error ?? t('fleet.nPUWorkerMonitor.metricsUnavailable'))
if (fleetMetrics.node_metrics) {
const newMap = new Map<string, NPUWorkerMetrics>()
for (const m of fleetMetrics.node_metrics) {
Expand Down
Loading
Loading