Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Restore compact infrastructure source badges

rcourtman4dfe69fe6fe9
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceSourceBadgeCell.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceSourceBadgeCell.tsx
index c4a435fe57..ecb765acf7 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceSourceBadgeCell.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceSourceBadgeCell.tsx
@@ -16,6 +16,11 @@ const getVisibleSourceBadgeLimit = (layoutMode: UnifiedResourceTableLayoutMode):
const compactSourceBadgeLabel = (label: string): string =>
label === 'Containers' ? 'Cont' : label;
+const getSourceBadgeDisplayLabel = (
+ label: string,
+ layoutMode: UnifiedResourceTableLayoutMode,
+): string => (layoutMode === 'wide' ? label : compactSourceBadgeLabel(label));
+
const getCompactSourceDotClasses = (classes: string): string => {
const toneClasses = classes
.split(/\s+/)
@@ -50,12 +55,12 @@ export const UnifiedResourceSourceBadgeCell: Component<UnifiedResourceSourceBadg
.join(', '),
);
const shouldUseCompactSourceList = createMemo(
- () => props.layoutMode !== 'wide' && badges().length > 0,
+ () => (props.layoutMode === 'mobile' || props.layoutMode === 'tablet') && badges().length > 0,
);
return (
<div
- class="flex min-w-0 max-w-full items-center justify-start gap-1 overflow-hidden"
+ class="flex min-w-0 max-w-full items-center justify-center gap-1 overflow-hidden"
aria-label={title() ? `Sources: ${title()}` : undefined}
title={title()}
>
@@ -69,7 +74,9 @@ export const UnifiedResourceSourceBadgeCell: Component<UnifiedResourceSourceBadg
class={`${badge.classes} min-w-0 max-w-full overflow-hidden px-1`}
title={badge.title}
>
- <span class="min-w-0 truncate">{badge.label}</span>
+ <span class="min-w-0 truncate">
+ {getSourceBadgeDisplayLabel(badge.label, props.layoutMode)}
+ </span>
</span>
)}
</For>
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts
index 14ce3cabd7..7463757c5b 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts
@@ -147,11 +147,12 @@ describe('unifiedResourceTableStateModel', () => {
expect(tabletColumns.ioColumn.width).toBe('12%');
expect(tabletColumns.sourceColumn.width).toBe('12%');
expect(tabletColumns.serviceSourceColumn.width).toBe('8%');
- expect(compactColumns.resourceColumn.width).toBe('18%');
+ expect(compactColumns.resourceColumn.width).toBe('16%');
expect(compactColumns.serviceResourceColumn.width).toBe('18%');
- expect(compactColumns.metricColumn.width).toBe('10.5%');
+ expect(compactColumns.metricColumn.width).toBe('10%');
+ expect(compactColumns.sourceColumn.width).toBe('13%');
expect(compactColumns.serviceSourceColumn.width).toBe('9.5%');
- expect(compactColumns.tempColumn.width).toBe('7%');
+ expect(compactColumns.tempColumn.width).toBe('6.5%');
expect(wideColumns.resourceColumn.width).toBe('18%');
expect(wideColumns.serviceResourceColumn.width).toBe('18%');
expect(wideColumns.serviceSourceColumn.width).toBe('10%');
diff --git a/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts b/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts
index ed20708973..b8b3e2caa7 100644
--- a/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts
+++ b/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts
@@ -404,14 +404,14 @@ export const getUnifiedResourceTableColumnPresentations = (
if (layoutMode === 'compact') {
return {
- resourceColumn: buildUnifiedResourceTableColumnPresentation('', '18%'),
+ resourceColumn: buildUnifiedResourceTableColumnPresentation('', '16%'),
serviceResourceColumn: buildUnifiedResourceTableColumnPresentation('', '18%'),
- metricColumn: buildUnifiedResourceTableColumnPresentation('', '10.5%'),
- ioColumn: buildUnifiedResourceTableColumnPresentation('', '13%'),
- sourceColumn: buildUnifiedResourceTableColumnPresentation('', '9.5%'),
+ metricColumn: buildUnifiedResourceTableColumnPresentation('', '10%'),
+ ioColumn: buildUnifiedResourceTableColumnPresentation('', '12.5%'),
+ sourceColumn: buildUnifiedResourceTableColumnPresentation('', '13%'),
serviceSourceColumn: buildUnifiedResourceTableColumnPresentation('', '9.5%'),
- uptimeColumn: buildUnifiedResourceTableColumnPresentation('', '8%'),
- tempColumn: buildUnifiedResourceTableColumnPresentation('', '7%'),
+ uptimeColumn: buildUnifiedResourceTableColumnPresentation('', '7.5%'),
+ tempColumn: buildUnifiedResourceTableColumnPresentation('', '6.5%'),
serviceCountColumn: buildUnifiedResourceTableColumnPresentation('', '9.5%'),
serviceQueueColumn: buildUnifiedResourceTableColumnPresentation('', '9.5%'),
serviceHealthColumn: buildUnifiedResourceTableColumnPresentation('', '14%'),