Skip to content

Commit 16075c9

Browse files
authored
Fix/control panel styling (#331)
* fix: evoting groups * fix: search UI & pagination * chore: change layout
1 parent 0350bac commit 16075c9

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

infrastructure/control-panel/src/routes/+page.svelte

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,15 @@
127127
}
128128
};
129129
130-
const tableHeadings = ['eName', 'Uptime', 'IP', 'URI'];
131-
132-
const pages = [
133-
{ name: '1', href: '#' },
134-
{ name: '2', href: '#' },
135-
{ name: '3', href: '#' }
136-
];
137-
138130
// Handle eVault selection changes
139131
function handleEVaultSelectionChange(index: number, checked: boolean) {
132+
// Convert page-relative index to global index
133+
const globalIndex = (currentPage - 1) * itemsPerPage + index;
134+
140135
if (checked) {
141-
selectedEVaults = [...selectedEVaults, index];
136+
selectedEVaults = [...selectedEVaults, globalIndex];
142137
} else {
143-
selectedEVaults = selectedEVaults.filter((i) => i !== index);
138+
selectedEVaults = selectedEVaults.filter((i) => i !== globalIndex);
144139
}
145140
146141
// Store selections immediately in sessionStorage
@@ -332,7 +327,7 @@
332327
bind:searchValue={evaultsSearchValue}
333328
rightTitle={selectedEVaults.length > 0
334329
? `${selectedEVaults.length} eVault${selectedEVaults.length === 1 ? '' : 's'} selected`
335-
: 'Monitoring all eVault pods across Kubernetes clusters'}
330+
: ''}
336331
showClearSelection={selectedEVaults.length > 0}
337332
onClearSelection={clearEVaultSelection}
338333
/>
@@ -359,14 +354,22 @@
359354
{:else}
360355
<Table
361356
class="mb-4"
362-
tableData={mappedEVaultsData}
357+
tableData={mappedEVaultsData()}
363358
withSelection={true}
364-
{handlePreviousPage}
365-
{handleNextPage}
359+
withPagination={false}
366360
handleSelectedRow={handleEVaultRowClick}
367361
onSelectionChange={handleEVaultSelectionChange}
368362
onSelectAllChange={handleSelectAllEVaults}
369-
selectedIndices={selectedEVaults}
363+
selectedIndices={selectedEVaults
364+
.map((globalIndex) => {
365+
const pageStart = (currentPage - 1) * itemsPerPage;
366+
const pageEnd = pageStart + itemsPerPage;
367+
if (globalIndex >= pageStart && globalIndex < pageEnd) {
368+
return globalIndex - pageStart;
369+
}
370+
return -1; // Not on current page
371+
})
372+
.filter((index) => index !== -1)}
370373
/>
371374

372375
<!-- Pagination Info -->
@@ -408,7 +411,7 @@
408411
bind:searchValue={platformsSearchQuery}
409412
rightTitle={selectedPlatforms.length > 0
410413
? `${selectedPlatforms.length} platform${selectedPlatforms.length === 1 ? '' : 's'} selected`
411-
: 'No platform selected. Select a platform to monitor logs'}
414+
: ''}
412415
showClearSelection={selectedPlatforms.length > 0}
413416
onClearSelection={clearPlatformSelection}
414417
/>
@@ -433,8 +436,9 @@
433436
{:else}
434437
<Table
435438
class="mb-4"
436-
tableData={mappedPlatformsData}
439+
tableData={mappedPlatformsData()}
437440
withSelection={true}
441+
withPagination={false}
438442
onSelectionChange={handlePlatformSelectionChange}
439443
onSelectAllChange={handleSelectAllPlatforms}
440444
selectedIndices={selectedPlatforms}

0 commit comments

Comments
 (0)