Skip to content

Commit 041a3e0

Browse files
committed
feat: persist column size prefs
1 parent 88163fe commit 041a3e0

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

web/eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const vueRules = {
7171
'vue/no-unsupported-features': [
7272
'error',
7373
{
74-
version: '^3.3.0',
74+
version: '^3.4.0',
7575
},
7676
],
7777
'vue/no-unused-properties': [

web/src/components/Common/BaseTreeTable.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ interface Props {
5454
canDrag?: (row: TreeRow<T>) => boolean;
5555
canDropInside?: (row: TreeRow<T>) => boolean;
5656
enableResizing?: boolean;
57+
columnSizing?: Record<string, number>;
5758
}
5859
5960
const props = withDefaults(defineProps<Props>(), {
@@ -67,6 +68,7 @@ const props = withDefaults(defineProps<Props>(), {
6768
// searchableKeys default removed, will handle in getter if needed or empty
6869
includeMetaInSearch: true,
6970
enableResizing: false,
71+
columnSizing: () => ({}),
7072
});
7173
7274
const emit = defineEmits<{
@@ -81,6 +83,7 @@ const emit = defineEmits<{
8183
): void;
8284
(e: 'row:drop', payload: DropEvent<T>): void;
8385
(e: 'update:selectedIds', value: string[]): void;
86+
(e: 'update:columnSizing', value: Record<string, number>): void;
8487
}>();
8588
8689
const UButton = resolveComponent('UButton');
@@ -92,6 +95,8 @@ const selectedIdsRef = ref(props.selectedIds);
9295
const tableContainerRef = ref<HTMLElement | null>(null);
9396
const columnVisibility = ref<Record<string, boolean>>({});
9497
98+
const columnSizing = defineModel<Record<string, number>>('columnSizing', { default: () => ({}) });
99+
95100
type ColumnHeaderRenderer = TableColumn<TreeRow<T>>['header'];
96101
97102
watch(
@@ -459,6 +464,7 @@ function enhanceRowInstance(row: TableInstanceRow<T>): EnhancedRow<T> {
459464
ref="tableRef"
460465
v-model:row-selection="rowSelection"
461466
v-model:column-visibility="columnVisibility"
467+
v-model:column-sizing="columnSizing"
462468
:data="flattenedData"
463469
:columns="processedColumns"
464470
:get-row-id="(row: any) => row.id"

web/src/components/Docker/DockerContainersTable.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { computed, h, reactive, ref, resolveComponent, watch } from 'vue';
33
import { useMutation, useSubscription } from '@vue/apollo-composable';
4+
import { useStorage } from '@vueuse/core';
45
56
import BaseTreeTable from '@/components/Common/BaseTreeTable.vue';
67
import MultiValueCopyBadges from '@/components/Common/MultiValueCopyBadges.vue';
@@ -207,6 +208,7 @@ const { visibleFolders, expandedFolders, toggleExpandFolder, setExpandedFolders
207208
flatEntries: flatEntriesRef,
208209
});
209210
const busyRowIds = ref<Set<string>>(new Set());
211+
const columnSizing = useStorage<Record<string, number>>('docker-table-column-sizing', {});
210212
211213
const logs = useDockerLogSessions();
212214
const contextMenu = useContextMenu<DockerContainer>();
@@ -966,6 +968,7 @@ function handleSelectAllChildren(row: TreeRow<DockerContainer>) {
966968
:busy-row-ids="busyRowIds"
967969
:enable-drag-drop="!!flatEntries"
968970
enable-resizing
971+
v-model:column-sizing="columnSizing"
969972
:searchable-keys="searchableKeys"
970973
:search-accessor="dockerSearchAccessor"
971974
:can-expand="(row: TreeRow<DockerContainer>) => row.type === 'folder'"

0 commit comments

Comments
 (0)