-
Notifications
You must be signed in to change notification settings - Fork 504
dbeaver/pro#4999 Data editor icons to see pk details #4040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
dbeaver/pro#4999 Data editor icons to see pk details #4040
Conversation
…tooltips for key detection
…y connection state and improve tooltips
|
|
||
| const firstColumn = tableDataContext.columns[1]; | ||
| const firstColumnData = | ||
| firstColumn?.key !== null && firstColumn?.key !== undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| firstColumn?.key !== null && firstColumn?.key !== undefined | |
| isNotNullDefined(firstColumn?.key) |
| {readonly && ( | ||
| <IconOrImage title={translate('data_grid_table_readonly_tooltip')} icon="/icons/lock.png" className={s(styles, { iconOrImage: true })} /> | ||
| )} | ||
| <TableStatusIndicator readOnlyConnection={dataGridContext.model.isReadonly(dataGridContext.resultIndex)} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this prop not needed, component itself uses dataGridContext and can retrieve this information by itself
| <div | ||
| className={clsx( | ||
| 'tw:w-3 tw:h-3 tw:rounded-full tw:shrink-0 tw:bg-transparent tw:border', | ||
| "tw:before:content-[''] tw:before:block tw:before:w-1.5 tw:before:h-1.5 tw:before:rounded-full tw:before:m-0.5", | ||
| `tw:border-(--theme-${themeColor}) tw:before:bg-(--theme-${themeColor})`, | ||
| )} | ||
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need to always show this indicator? if table is normal table without restrictions and limitations, what the purpose of this indicator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (readOnlyConnection) { | ||
| tooltipParts.push(translate('data_grid_table_readonly_connection_tooltip')); | ||
| } | ||
|
|
||
| if (readOnlyStatus) { | ||
| if (!readOnlyConnection) { | ||
| tooltipParts.push(translate('data_grid_table_readonly_tooltip')); | ||
| } | ||
| tooltipParts.push(readOnlyStatus); | ||
| } | ||
|
|
||
| if (hasRowIdentifier) { | ||
| // TEMPORARY: Detect primary key by checking for required and not read-only columns | ||
| // TODO: Remove when backend provides the information | ||
| const pkColumn = tableDataContext.columns.find(col => { | ||
| const colData = col.key && (tableDataContext.data.getColumn(col.key) as SqlResultColumn | undefined); | ||
| return colData?.required && !colData?.readOnly; | ||
| })?.key; | ||
|
|
||
| if (pkColumn) { | ||
| tooltipParts.push(`Unique key: ${(tableDataContext.data.getColumn(pkColumn) as SqlResultColumn | undefined)?.name}`); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure that it's good idea to try to implement this logic on frontend, because it might be different from dbeaver or incomplete

For read-only connection we write "Read-only connection" in the tooltip,
If. there is other reason, we just write "Read-only" with the reason on the next line