Skip to content

Conversation

@artemmufazalov
Copy link
Member

@artemmufazalov artemmufazalov commented May 15, 2024

Test stand: https://nda.ya.ru/t/xCSdBmdn75ueXj

All tables are resizeable. Resize values are stored to localStorage. Exception - tables without predefined set of columns (query result, preview, hotkeys), their resize values are stored only while component is mounted

Closes #807

Comment on lines +10 to +17
outline: none;
background: transparent;
}

&__input:focus,
&__input:focus-visible {
border: 1px solid var(--g-color-line-generic-hover);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes fix light outline, which doesn't correspond to dark mode and makes control height more, than others

Before:
Screen Shot 2024-05-15 at 17 09 31

After:
Screen Shot 2024-05-15 at 17 11 56

import i18n from './i18n';
import {b} from './shared';

export const CLUSTERS_COLUMNS_WIDTH_LS_KEY = 'clustersTableColumnsWidth';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made every columns width localStorage key a constant for possible use of the same key for the same set of columns in case these columns are used in different tables

onResize?: (width: number) => void;
}

export function ResizeHandler({
Copy link
Member Author

@artemmufazalov artemmufazalov May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There and in other virtual table diffs some parts are copied from react-data-table with some changes, since tables are different

@artemmufazalov artemmufazalov marked this pull request as ready for review May 15, 2024 15:09
@Raubzeug
Copy link
Contributor

What do you think about making a bigger minWidth for columns, which contain tablets? For now I may shrink this columns for some reason, but it will be quite a tricky to enlarge it to previous size.

@Raubzeug
Copy link
Contributor

Is it possible to add action for double click on resize panel? It will be handy if double click restores initial column width.

@Raubzeug
Copy link
Contributor

Why didn't you make resizable columns with Vdisks and Pdisks in Storage page?

import type {DataTableProps, Settings} from '@gravity-ui/react-data-table';
import DataTable, {updateColumnsWidth} from '@gravity-ui/react-data-table';

import {cn} from '../..//utils/cn';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in path

@artemmufazalov
Copy link
Member Author

Is it possible to add action for double click on resize panel? It will be handy if double click restores initial column width.

It's possible, but it requires changes to react-data-table. Currently, we replace initial value with saved value, so initial value isn't accessible.

I made an issue for this: #824

@artemmufazalov
Copy link
Member Author

Why didn't you make resizable columns with Vdisks and Pdisks in Storage page?

They have their own styles with overflow: visible. Reasons:

  1. Disks could have donors, donors displayed in stack, when expanded it's height bigger, than the row's height
  2. There may be a lot of disks, up to 25 VDisks and 144 PDisks, they expand column width

We need some rework, if we want to change it. For now I decided to left it as it was. Also It's the last column, so its width isn't a big issue since it doesn't affect other columns and always have the width of the content

import React from 'react';

import {useTypedSelector} from '../../lib';
import {useTypedSelector} from '../../utils/hooks';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated such imports as well to prevent circular deps when embedded-ui is used as package

@artemmufazalov artemmufazalov merged commit ff27390 into main May 16, 2024
@artemmufazalov artemmufazalov deleted the tables-resize branch May 16, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make tables resizeable

3 participants