Skip to content
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

fix : Foreign key dropdown width oversize issue in create and edit row #9799

Merged
merged 11 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ const DropDownSelect = ({
fetchTables,
onTableClick,
referencedForeignKeyDetails = [],
isCreateRow = false,
isEditRow = false,
isCreateColumn = false,
isEditColumn = false,
isEditTable = false,
isCreateTable = false,
customChildren,
isForeignKeyInEditCell = false,
shouldCloseFkMenu,
Expand Down Expand Up @@ -208,6 +214,12 @@ const DropDownSelect = ({
actions={actions}
actionName={actionName}
referencedForeignKeyDetails={referencedForeignKeyDetails}
isCreateRow={isCreateRow}
isEditRow={isEditRow}
isEditColumn={isEditColumn}
isCreateColumn={isCreateColumn}
isEditTable={isEditTable}
isCreateTable={isCreateTable}
customChildren={customChildren}
isForeignKeyInEditCell={isForeignKeyInEditCell}
closeFKMenu={closeFKMenu}
Expand All @@ -225,9 +237,7 @@ const DropDownSelect = ({
setShowMenu(true);
}}
>
<span style={{ display: 'inline-block', width: '100%', color: darkMode ? '#fff' : '' }}>
{selected.label}
</span>
<span style={{ display: 'inline-block', color: darkMode ? '#fff' : '' }}>{selected.label}</span>
</div>
) : (
<div className={`col-auto ${buttonClasses}`} id={popoverBtnId.current}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ function DataSourceSelect({
actions,
actionName,
referencedForeignKeyDetails,
isCreateRow,
isEditRow,
isEditColumn,
isCreateColumn,
isEditTable,
isCreateTable,
customChildren,
isForeignKeyInEditCell,
closeFKMenu,
Expand Down Expand Up @@ -314,14 +320,36 @@ function DataSourceSelect({
/>
))}

<span
className={cx({
'ms-1 ': props?.data?.icon,
'flex-grow-1': !showDescription,
})}
<ToolTip
message={children}
placement="top"
tooltipClassName="tjdb-cell-tooltip"
show={
(isCellEdit ||
isCreateRow ||
isEditRow ||
isCreateColumn ||
isEditColumn ||
isEditTable ||
isCreateTable) &&
children?.length > 30
}
>
{children}
</span>
<span
className={cx({
'ms-1 ': props?.data?.icon,
'flex-grow-1': !showDescription,
})}
style={{
width: '80%',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
}}
>
{children}
</span>
</ToolTip>

{foreignKeyAccess && showRedirection && props.isFocused && (
<Maximize
Expand Down
1 change: 1 addition & 0 deletions frontend/src/TooljetDatabase/Forms/ColumnForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ const ColumnForm = ({
setReferencedColumnDetails={setReferencedColumnDetails}
scrollEventForColumnValus={true}
cellColumnName={columnName}
isCreateColumn={true}
/>
)}
</div>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/TooljetDatabase/Forms/EditColumnForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ const ColumnForm = ({
setReferencedColumnDetails={setReferencedColumnDetails}
scrollEventForColumnValus={true}
cellColumnName={selectedColumn?.Header}
isEditColumn={true}
/>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/TooljetDatabase/Forms/EditRowForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ const EditRowForm = ({
setReferencedColumnDetails={setReferencedColumnDetails}
scrollEventForColumnValus={true}
cellColumnName={columnName}
isEditRow={true}
/>
) : (
<input
Expand All @@ -330,7 +331,6 @@ const EditRowForm = ({
}`}
data-cy={`${String(columnName).toLocaleLowerCase().replace(/\s+/g, '-')}-input-field`}
autoComplete="off"
ref={(el) => (inputRefs.current[columnName] = el)}
// onFocus={onFocused}
/>
)}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/TooljetDatabase/Forms/RowForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ const RowForm = ({
setReferencedColumnDetails={setReferencedColumnDetails}
scrollEventForColumnValus={true}
cellColumnName={columnName}
isCreateRow={true}
/>
) : (
<input
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/TooljetDatabase/Forms/TableSchema.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ function TableSchema({
setReferencedColumnDetails={setReferencedColumnDetails}
scrollEventForColumnValus={true}
cellColumnName={columnDetails[index].column_name}
isEditTable={isEditMode}
isCreateTable={!isEditMode}
/>
) : (
<ToolTip
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/TooljetDatabase/Forms/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@
.foreignKeyAcces-container-drawer {
border-radius: 5px;
height: 100% !important;
max-width: 494px;

button {
height: 35px !important;
Expand All @@ -700,6 +701,8 @@

.text-truncate {
font-size: 14px !important;
width: 85%;
text-align: left;
}

.dd-select-control-chevron {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/TooljetDatabase/Menu/CellEditMenu/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export const CellEditMenu = ({
onClick={isForeignKeyInEditCell ? closeFKMenu : closePopover}
variant="tertiary"
size="sm"
className="fs-12"
className="fs-12 p-2"
>
Cancel
</ButtonSolid>
Expand All @@ -249,7 +249,7 @@ export const CellEditMenu = ({
disabled={cellValue == previousCellValue ? true : false}
variant="primary"
size="sm"
className="fs-12"
className="fs-12 p-2"
>
Save
</ButtonSolid>
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/TooljetDatabase/Menu/CellEditMenu/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,20 @@
text-align: center;
}
}
}

.tjdb-foreignKeyAccess-container {
border-radius: 4px;

button {
border-radius: 4px !important;

.text-truncate {
width: 90% !important;
text-align: left !important;
}

}


}
1 change: 1 addition & 0 deletions frontend/src/TooljetDatabase/Table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ const Table = ({ collapseSidebar }) => {
cell.column.dataType !== 'boolean' &&
cell.value !== ''
}
tooltipClassName="tooltip-table-dashboard"
>
<div
className={`${
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/TooljetDatabase/Table/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,19 @@

.tjdb-selected-cell {
border: 1.5px solid var(--Indigo-09, #3E63DD) !important;

.tjdb-td-wrapper {
div {
padding-bottom: 0px !important;

span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 85%;
}
}
}
}

.card-table tr td:last-child {
Expand Down Expand Up @@ -468,4 +481,12 @@
}

}
}

.tooltip-table-dashboard {
max-width: 500px !important;

.tooltip-inner {
max-width: 100% !important;
}
}
8 changes: 8 additions & 0 deletions frontend/src/_styles/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13128,6 +13128,14 @@ tbody {
}
}

.tjdb-cell-tooltip {
max-width: 420px !important;

.tooltip-inner {
max-width: 100% !important;
}
}

div.ds-svg-container svg {
padding: 2px;
}
Loading