-
Notifications
You must be signed in to change notification settings - Fork 46
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
#2213 Table toolbar should not be shown for single select tables #2214
#2213 Table toolbar should not be shown for single select tables #2214
Conversation
Signed-off-by: Michael Pavlik <[email protected]>
…sion-builder-chars
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
…into expression-builder-chars
…an to single select Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
…as into no-tabletoolbar-singletable
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
…as into no-tabletoolbar-singletable
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
…as into no-tabletoolbar-singletable
@@ -39,6 +39,11 @@ $row-left-padding: $spacing-02; | |||
height: $spacing-07; | |||
} | |||
|
|||
.single-table { |
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.
This class isn't used anywhere other than this file
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 removed it on accident when merging. I used it to resolve the bug where the add value button would switch location depending on if the table was in focus
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.
Rename to single-row-selection-table
Signed-off-by: Michael Pavlik <[email protected]>
className="delete-button" | ||
hasIconOnly | ||
onClick={this.props.deleteRow} | ||
renderIcon={TrashCan} |
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.
Please add iconDescription
for delete button
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.
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.
@mikieyx You should add iconDescription
and modify test cases.
@@ -414,6 +415,18 @@ class VirtualizedTable extends React.Component { | |||
readOnly={this.props.readOnly} | |||
/> | |||
</div>); | |||
} else { | |||
trashOption = ( |
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.
Rename this to deleteOption
cy.toggleCommonPropertiesSidePanel(); | ||
cy.openPropertyDefinition("summaryPanel_paramDef.json"); | ||
}); | ||
// describe("Test if tips show up for the summary table values", function() { |
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.
Enable all commented tests in this file
@@ -1216,7 +1216,7 @@ | |||
}, | |||
{ | |||
"complex_type_ref": "inlineEditingTableError", | |||
"row_selection": "single", | |||
"row_selection": "multiple-edit", |
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.
This change is not needed. You can revert this to "single". Table looks odd because there is no header for column which has delete icons.
Take a look at how the header is added for subpanel column here - https://github.com/elyra-ai/canvas/blob/main/canvas_modules/common-canvas/src/common-properties/controls/abstract-table.jsx#L705
You should add a similar header for single select tables which will have a delete rows column.
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 switched from single to multi select because single tables no longer have the toolbar which means that single tables can no longer move rows. The table has moveable rows set to true. I discussed this with Matt and Jesus, and they mentioned to switch it to multi select to ensure test coverage.
@@ -1216,7 +1216,7 @@ | |||
}, | |||
{ | |||
"complex_type_ref": "inlineEditingTableError", | |||
"row_selection": "single", | |||
"row_selection": "multiple-edit", |
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.
This change is not needed. You can revert this to "single".
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 switched from single to multi select because single tables no longer have the toolbar which means that single tables can no longer move rows. The table has moveable rows set to true. I discussed this with Matt and Jesus, and they mentioned to switch it to multi select to ensure test coverage.
@@ -523,7 +523,8 @@ class FlexibleTable extends React.Component { | |||
|
|||
const containerClass = this.props.showHeader ? "properties-ft-container-absolute " : "properties-ft-container-absolute-noheader "; | |||
const messageClass = (!this.props.messageInfo) ? containerClass + STATES.INFO : containerClass; | |||
const ftHeaderClassname = "properties-ft-table-header"; | |||
const ftHeaderClassname = classNames("properties-ft-table-header", | |||
{ "single-table": this.props.rowSelection === ROW_SELECTION.SINGLE }); |
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.
Rename to single-row-selection-table
@@ -39,6 +39,11 @@ $row-left-padding: $spacing-02; | |||
height: $spacing-07; | |||
} | |||
|
|||
.single-table { |
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.
Rename to single-row-selection-table
When I click on Delete icon, row gets selected and it shows the inline editable fields briefly before deleting the row - Screen.Recording.2024-10-30.at.5.42.59.PM.movIs it possible to not select the row when delete icon is clicked? |
When you click on the delete icon, it selects the row and it triggers the |
Signed-off-by: Michael Pavlik <[email protected]>
…as into no-tabletoolbar-singletable
@@ -703,6 +706,8 @@ export default class AbstractTable extends React.Component { | |||
if (this.props.control.childItem && !this.isReadonlyTable()) { | |||
// set to specific size. Exclude this column from resizing. | |||
headers.push({ "key": "subpanel", "label": "", "width": TABLE_SUBPANEL_BUTTON_WIDTH, "staticWidth": true }); | |||
} else if (this.props.control.rowSelection === ROW_SELECTION.SINGLE) { |
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.
Remove else
and just add if
condition.
This code fails if the table has edit icon and delete icon both, there's only 1 table header.
To test this case, add "row_selection": "single",
here - https://github.com/elyra-ai/canvas/blob/main/canvas_modules/harness/test_resources/parameterDefs/structurelisteditor_paramDef.json#L973
Signed-off-by: Michael Pavlik <[email protected]>
…as into no-tabletoolbar-singletable
@mikieyx The problem is in the expression builder there should be no delete column. @nmgokhale do you remember how we controlled this with single select before? |
I can add a condition that only adds the delete icon if it's a read only table and then pass in the readOnly prop as true into the flexible table in |
createTable() in abstract-table adds a table toolbar on a table. For expression field and functions tables, it never called createTable() method. So there was no table toolbar for expression tables.
@mikieyx |
… for expression tables Signed-off-by: Michael Pavlik <[email protected]>
} else if (this.props.rowSelection === ROW_SELECTION.SINGLE && !(this.props.tableLabel === fieldsTableLabel || | ||
this.props.tableLabel === valuesTableLabel || this.props.tableLabel === functionsTableLabel | ||
)) { | ||
const toolTip = "Delete"; |
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.
This tooltip should be translated
className="delete-button" | ||
hasIconOnly | ||
onClick={this.props.deleteRow} | ||
renderIcon={TrashCan} |
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.
Add iconDescription
here
@@ -414,6 +418,29 @@ class VirtualizedTable extends React.Component { | |||
readOnly={this.props.readOnly} | |||
/> | |||
</div>); | |||
} else if (this.props.rowSelection === ROW_SELECTION.SINGLE && !(this.props.tableLabel === fieldsTableLabel || |
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.
Please add a comment here -
"Don't show delete icon for tables in expression builder"
@mikieyx I am seeing extra width for Delete column - Wondering if this is because |
@nmgokhale I dug into it, and it seems like the delete icons are not being connected to the right column. The headers are add in abstract table, while the delete icon is created in virtualized table. Abstract tables uses flexible table which uses virtualized table. |
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
…as into no-tabletoolbar-singletable
Signed-off-by: Michael Pavlik <[email protected]>
@@ -414,6 +413,7 @@ class VirtualizedTable extends React.Component { | |||
readOnly={this.props.readOnly} | |||
/> | |||
</div>); | |||
// Don't show delete icon for tables in expression builder |
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.
remove this comment. This is no longer applicable now after adding delete icon in abstract-table
@@ -112,5 +112,6 @@ | |||
"label.indicator.optional": "[Esperanto~(optional)~~~~~~eo]", | |||
"slider.numberInput.label": "[Esperanto~Slider number input~~~~~eo]", | |||
"editorForm.tabList.label": "[Esperanto~Primary Tabs~~~~eo]", | |||
"subTabs.tabList.label": "[Esperanto~Tab List~~~~eo]" | |||
"subTabs.tabList.label": "[Esperanto~Tab List~~~~eo]", | |||
"table.deleteiIcon.tooltip": "[Esperanto~Delete~~~~eo]" |
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.
Typo in deleteiIcon
let deleteButton = tableToolbar.find("button.properties-action-delete"); | ||
expect(deleteButton).to.have.length(1); | ||
deleteButton.simulate("click"); | ||
// let tableToolbar = tableWrapper.find("div.properties-table-toolbar"); |
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.
Remove this comment
@@ -543,6 +543,7 @@ VirtualizedTable.propTypes = { | |||
PropTypes.number.isRequired | |||
]), | |||
onRowDoubleClick: PropTypes.func, | |||
deleteRow: PropTypes.func, |
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.
This isn't used anywhere
Signed-off-by: Michael Pavlik <[email protected]>
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.
Looks good 👍
Fixes: #2213
Developer's Certificate of Origin 1.1