Skip to content

Commit 606d5cc

Browse files
committed
⚡ perf(ui): enable virtual scrolling for the grouped containers table
- Grouped container tables no longer render every row eagerly, keeping the DOM light on large deployments
1 parent da613f7 commit 606d5cc

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

ui/src/components/containers/ContainersGroupedViews.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ function selectTableRow(row: Record<string, unknown>) {
232232
:sort-asc="containerSortAsc"
233233
:selected-key="selectedContainerKey"
234234
:show-actions="true"
235-
:virtual-scroll="false"
235+
:virtual-scroll="true"
236236
:full-width-row="isTableRowFullWidth"
237237
:row-interactive="isTableRowInteractive"
238238
:row-class="tableRowClass"

ui/tests/components/containers/ContainersGroupedViews.spec.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ vi.mock('@/components/containers/containersViewTemplateContext', () => ({
1212
}));
1313

1414
const DataTableStub = defineComponent({
15-
props: ['rows', 'rowClass', 'rowClickable', 'fullWidthRow', 'rowKey'],
15+
props: ['rows', 'rowClass', 'rowClickable', 'fullWidthRow', 'rowKey', 'virtualScroll'],
1616
emits: ['update:sort-key', 'update:sort-asc', 'row-click'],
1717
setup(props, { emit }) {
1818
const isFullWidth = (row: Record<string, unknown>) =>
@@ -722,6 +722,38 @@ describe('ContainersGroupedViews', () => {
722722
expect(wrapper.text()).toContain('stack-b');
723723
});
724724

725+
it('enables virtual scrolling for grouped table mode', async () => {
726+
const alpha = makeContainer({
727+
id: 'c-alpha',
728+
name: 'alpha',
729+
newTag: '1.1.0',
730+
updateKind: 'minor',
731+
status: 'running',
732+
});
733+
734+
const { context } = makeContext();
735+
context.groupByStack.value = true;
736+
context.containerViewMode.value = 'table';
737+
context.filteredContainers.value = [alpha];
738+
context.displayContainers.value = [alpha];
739+
context.renderGroups.value = [
740+
{
741+
key: 'stack-a',
742+
name: 'stack-a',
743+
containers: [alpha],
744+
containerCount: 1,
745+
updatesAvailable: 1,
746+
updatableCount: 1,
747+
},
748+
];
749+
mocked.context = context;
750+
751+
const wrapper = mountSubject();
752+
await nextTick();
753+
754+
expect(wrapper.findComponent(DataTableStub).props('virtualScroll')).toBe(true);
755+
});
756+
725757
it('covers card/list view events and footer action handlers', async () => {
726758
const running = makeContainer({
727759
id: 'c-card-1',

ui/tests/views/ContainersView.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,10 @@ describe('ContainersView', () => {
635635
expect(wrapper.findAll('button[disabled]').length).toBeGreaterThan(0);
636636
});
637637

638-
it('disables virtual scrolling so the table flows with the page', async () => {
638+
it('enables virtual scrolling for the grouped containers table', async () => {
639639
const wrapper = await mountContainersView([makeContainer()]);
640640
const dataTable = wrapper.findComponent(childStubs.DataTable as any);
641-
expect(dataTable.props('virtualScroll')).toBe(false);
641+
expect(dataTable.props('virtualScroll')).toBe(true);
642642
});
643643

644644
it('renders DataFilterBar', async () => {

0 commit comments

Comments
 (0)