The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
fix: disable row edit button when rows are selected (#63290)
Konstantin Darutkin71f02e8684ad
diff --git a/e2e/test/scenarios/table-editing/table-editing.cy.spec.ts b/e2e/test/scenarios/table-editing/table-editing.cy.spec.tsindex 8fea17333ee..851c72522a1 100644--- a/e2e/test/scenarios/table-editing/table-editing.cy.spec.ts+++ b/e2e/test/scenarios/table-editing/table-editing.cy.spec.ts@@ -452,6 +452,10 @@ describe("scenarios > table-editing", () => {cy.findAllByTestId("row-select-checkbox").eq(15).click();cy.findAllByTestId("row-select-checkbox").eq(16).click();+ cy.log("should not show edit icon when rows are selected");+ cy.findByTestId("row-edit-icon").should("not.exist");++ cy.log("should bulk delete rows");cy.findByTestId("toast-card").findByText("Delete").click();H.modal().within(() => {@@ -467,6 +471,9 @@ describe("scenarios > table-editing", () => {cy.findByTestId("toast-card").should("not.exist");H.undoToast().findByText("Successfully deleted").should("be.visible");++ cy.log("should show edit icon when no rows are selected");+ cy.findAllByTestId("row-edit-icon").should("exist");});});});diff --git a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/data-grid/use-table-column-row-select.tsx b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/data-grid/use-table-column-row-select.tsxindex 06671aa1a3c..909f5b731ff 100644--- a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/data-grid/use-table-column-row-select.tsx+++ b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/data-grid/use-table-column-row-select.tsx@@ -52,14 +52,19 @@ export function getRowSelectColumn({/></Flex>),- cell: ({ row }: { row: Row<RowValues> }) => (+ cell: ({+ row,+ table,+ }: {+ row: Row<RowValues>;+ table: Table<RowValues>;+ }) => (<BaseCell className={CellS.cell}><Group align="center" justify="flex-start" h="100%"><Checkboxsize={rem(16)}checked={row.getIsSelected()}disabled={!row.getCanSelect()}- indeterminate={row.getIsSomeSelected()}onChange={row.getToggleSelectedHandler()}data-testid="row-select-checkbox"styles={{@@ -69,14 +74,17 @@ export function getRowSelectColumn({}}/>- <Tooltip label="Edit record">- <Icon- name="pencil"- data-testid="row-edit-icon"- className={S.pencilIcon}- onClick={() => onRowEditClick(row.index)}- />- </Tooltip>+ {/* Only show the edit icon when no rows are selected */}+ {!table.getIsSomeRowsSelected() && !table.getIsAllRowsSelected() && (+ <Tooltip label="Edit record">+ <Icon+ name="pencil"+ data-testid="row-edit-icon"+ className={S.pencilIcon}+ onClick={() => onRowEditClick(row.index)}+ />+ </Tooltip>+ )}</Group></BaseCell>),