mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 02:25:56 +00:00
fix(docker): connect Grouped/List toggle to table view state
The Grouped/List toggle buttons in DockerFilter were updating the external groupingMode state, but DockerUnifiedTable had its own internal sortKey state for determining whether to show grouped vs flat view. These two states were completely disconnected. Added groupingMode prop to DockerUnifiedTable and a createEffect to sync the external state with the internal sort state. Fixes #1100
This commit is contained in:
@@ -623,6 +623,7 @@ export const DockerHosts: Component<DockerHostsProps> = (props) => {
|
||||
dockerHostMetadata={dockerHostMetadata()}
|
||||
onCustomUrlUpdate={handleCustomUrlUpdate}
|
||||
batchUpdateState={batchUpdateState}
|
||||
groupingMode={groupingMode() === 'flat' ? 'flat' : 'grouped'}
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
||||
@@ -76,6 +76,7 @@ interface DockerUnifiedTableProps {
|
||||
dockerHostMetadata?: Record<string, DockerHostMetadata>;
|
||||
onCustomUrlUpdate?: (resourceId: string, url: string) => void;
|
||||
batchUpdateState?: Record<string, 'updating' | 'queued' | 'error'>;
|
||||
groupingMode?: 'grouped' | 'flat';
|
||||
}
|
||||
|
||||
type SortKey =
|
||||
@@ -2481,6 +2482,17 @@ const DockerUnifiedTable: Component<DockerUnifiedTableProps> = (props) => {
|
||||
|
||||
const isGroupedView = createMemo(() => sortKey() === 'host');
|
||||
|
||||
// Sync external groupingMode prop with internal sort state
|
||||
createEffect(() => {
|
||||
const mode = props.groupingMode;
|
||||
if (mode === 'grouped' && sortKey() !== 'host') {
|
||||
setSortKey('host');
|
||||
} else if (mode === 'flat' && sortKey() === 'host') {
|
||||
// Switch to resource sort for flat view
|
||||
setSortKey('resource');
|
||||
}
|
||||
});
|
||||
|
||||
const handleSort = (key: SortKey) => {
|
||||
if (sortKey() === key) {
|
||||
setSortDirection(sortDirection() === 'asc' ? 'desc' : 'asc');
|
||||
|
||||
Reference in New Issue
Block a user