Skip to content

Commit

Permalink
fix : Foreign key dropdown width oversize issue in create and edit row (
Browse files Browse the repository at this point in the history
#9799)

* fix : foreign key dropdown width oversize issue in create and edit row

* fix : unable to read the menu text in fkr dropdown

* css classaname prefix changes

* fix : added tooltips for create and edit row in large fk values

* fix : Added max-width property for tooltip on create and edit row for foreign key fields

* fix :added tooltips for fkr dropdown in create and edit column

* fix : added tooltips for fkr dropdowns in create and edit table
  • Loading branch information
S-Abdul-Rahman committed Jun 4, 2024
1 parent 35efc02 commit 6ea2a47
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 13 deletions.
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;
}

0 comments on commit 6ea2a47

Please sign in to comment.