Skip to content

Commit 5c488a8

Browse files
committed
Fix: Node card layout and various updates
1 parent 57bc6a2 commit 5c488a8

File tree

4 files changed

+18
-27
lines changed

4 files changed

+18
-27
lines changed

src/public/index.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,7 @@
354354
</div>
355355
</div>
356356
<div id="pbs" class="tab-content hidden bg-white dark:bg-gray-800 p-4 border border-t-0 border-gray-300 dark:border-gray-700 rounded-b-lg shadow-sm">
357-
<!-- Sub-tab navigation -->
358-
<div id="pbs-sub-tabs-nav" class="flex border-b border-gray-200 dark:border-gray-700 mb-4">
359-
<!-- Sub-tab buttons will be dynamically inserted here by JavaScript -->
360-
</div>
361-
<!-- Sub-tab content panels -->
362-
<div id="pbs-sub-tabs-content" class="space-y-6">
363-
<!-- Content for each PBS instance will be dynamically inserted here -->
357+
<div id="pbs-instances-container" class="space-y-6">
364358
<p id="pbs-loading-message" class="text-gray-500 dark:text-gray-400">Loading PBS data...</p>
365359
</div>
366360
</div>

src/public/js/state.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ PulseApp.state = (() => {
22
const savedSortState = JSON.parse(localStorage.getItem('pulseSortState')) || {};
33
const savedFilterState = JSON.parse(localStorage.getItem('pulseFilterState')) || {};
44
const savedThresholdState = JSON.parse(localStorage.getItem('pulseThresholdState')) || {};
5-
const savedPbsShowDetails = JSON.parse(localStorage.getItem('pulsePbsShowDetails')) || {};
65

76
let internalState = {
87
nodesData: [],
@@ -36,8 +35,7 @@ PulseApp.state = (() => {
3635
},
3736
activeLogSessions: {},
3837
thresholdLogEntries: [],
39-
activeLoggingThresholds: null,
40-
pbsShowDetails: savedPbsShowDetails
38+
activeLoggingThresholds: null
4139
};
4240

4341
// Initialize thresholdState by merging saved state with defaults
@@ -83,10 +81,6 @@ PulseApp.state = (() => {
8381
localStorage.setItem('pulseSortState', JSON.stringify(stateToSave));
8482
}
8583

86-
function savePbsShowDetailsState() {
87-
localStorage.setItem('pulsePbsShowDetails', JSON.stringify(internalState.pbsShowDetails));
88-
}
89-
9084
return {
9185
get: (key) => internalState[key],
9286
set: (key, value) => {
@@ -140,16 +134,6 @@ PulseApp.state = (() => {
140134
},
141135
clearDashboardHistoryEntry: (guestId) => {
142136
delete internalState.dashboardHistory[guestId];
143-
},
144-
getPbShowDetailsState: (instanceId, defaultValue) => {
145-
if (typeof internalState.pbsShowDetails[instanceId] === 'boolean') {
146-
return internalState.pbsShowDetails[instanceId];
147-
}
148-
return defaultValue;
149-
},
150-
setPbShowDetailsState: (instanceId, value) => {
151-
internalState.pbsShowDetails[instanceId] = !!value;
152-
savePbsShowDetailsState();
153137
}
154138
};
155139
})();

src/public/js/ui/nodes.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,18 @@ PulseApp.ui.nodes = (() => {
143143
function calculateOptimalColumns(numItems, defaultCols) {
144144
if (numItems <= 0) return defaultCols; // No items, use default or let it be empty
145145
if (defaultCols <= 1) return 1; // Cannot reduce further, or already 1
146-
// If numItems is less than or equal to defaultCols, it will fit in one row, so use defaultCols.
147-
if (numItems <= defaultCols) return defaultCols;
148-
// If numItems % defaultCols leaves a single orphan, reduce columns by 1.
146+
// If numItems is less than or equal to defaultCols, use numItems as the column count.
147+
if (numItems <= defaultCols) return numItems;
148+
149+
// Now numItems > defaultCols (multiple rows expected)
150+
// Avoid a single orphan, but don't reduce to 1 column if defaultCols is 2.
149151
if (numItems % defaultCols === 1) {
152+
if (defaultCols === 2) {
153+
// If default is 2 cols (sm), and we have an odd number of items (e.g., 3, 5),
154+
// use 2 columns to avoid stacking. (Results in 2 side-by-side, then 1 or more).
155+
return defaultCols;
156+
}
157+
// For other defaultCols (>=3), reducing by 1 to avoid an orphan is fine.
150158
return Math.max(1, defaultCols - 1); // Ensure at least 1 column
151159
}
152160
return defaultCols;

src/tailwind.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ module.exports = {
1010
{
1111
pattern: /^(bg|text)-(red|yellow|green|blue)-(100|200|300|400|500|600|700|800|900)(\/50)?$/,
1212
},
13+
'grid-cols-1', 'grid-cols-2', 'grid-cols-3', 'grid-cols-4',
14+
'sm:grid-cols-1', 'sm:grid-cols-2', 'sm:grid-cols-3', 'sm:grid-cols-4',
15+
'md:grid-cols-1', 'md:grid-cols-2', 'md:grid-cols-3', 'md:grid-cols-4',
16+
'lg:grid-cols-1', 'lg:grid-cols-2', 'lg:grid-cols-3', 'lg:grid-cols-4',
17+
'xl:grid-cols-1', 'xl:grid-cols-2', 'xl:grid-cols-3', 'xl:grid-cols-4',
1318
'vm-icon',
1419
'ct-icon',
1520
],

0 commit comments

Comments
 (0)