diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx index 35c3f8221..9cfc4301d 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx @@ -1779,6 +1779,9 @@ export const DocumentsTabComponent: React.FunctionComponent {tableItems.length > 0 && ( { idHeader: ID_HEADER, partitionKeyHeaders: [PARTITION_KEY_HEADER], }, + isSelectionDisabled: false, }); it("should render documents and partition keys in header", () => { @@ -31,4 +32,11 @@ describe("DocumentsTableComponent", () => { const wrapper = mount(); expect(wrapper).toMatchSnapshot(); }); + + it("should not render selection column when isSelectionDisabled is true", () => { + const props: IDocumentsTableComponentProps = createMockProps(); + props.isSelectionDisabled = true; + const wrapper = mount(); + expect(wrapper).toMatchSnapshot(); + }); }); diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTableComponent.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTableComponent.tsx index 4089b12bd..d66568875 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTableComponent.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTableComponent.tsx @@ -41,6 +41,7 @@ export interface IDocumentsTableComponentProps { size: { height: number; width: number }; columnHeaders: ColumnHeaders; style?: React.CSSProperties; + isSelectionDisabled?: boolean; } interface TableRowData extends RowStateBase { @@ -61,6 +62,7 @@ export const DocumentsTableComponent: React.FC = style, size, columnHeaders, + isSelectionDisabled, }: IDocumentsTableComponentProps) => { const [activeItemIndex, setActiveItemIndex] = React.useState(undefined); @@ -127,12 +129,14 @@ export const DocumentsTableComponent: React.FC = const { item, selected, appearance, onClick, onKeyDown } = data[index]; return ( - + {!isSelectionDisabled && ( + + )} {columns.map((column) => ( = - + {!isSelectionDisabled && ( + + )} {columns.map((column /* index */) => ( diff --git a/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTabV2.test.tsx.snap b/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTabV2.test.tsx.snap index 0b4c7578e..52bc636a8 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTabV2.test.tsx.snap +++ b/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTabV2.test.tsx.snap @@ -532,6 +532,7 @@ exports[`Documents tab (noSql API) when rendered should render the page 1`] = ` "partitionKeyHeaders": Array [], } } + isSelectionDisabled={true} items={Array []} onItemClicked={[Function]} onSelectedRowsChange={[Function]} diff --git a/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTableComponent.test.tsx.snap b/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTableComponent.test.tsx.snap index 6e80eac9f..44eb5db8b 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTableComponent.test.tsx.snap +++ b/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTableComponent.test.tsx.snap @@ -1,5 +1,985 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`DocumentsTableComponent should not render selection column when isSelectionDisabled is true 1`] = ` + +
+
+ +
+ +
+ + + + + , + }, + } + } + > + + + } + className="documentsTableCell" + data-tabster="{\\"restorer\\":{\\"type\\":1}}" + id="menu17" + key="id" + onContextMenu={[Function]} + onMouseEnter={[Function]} + onMouseLeave={[Function]} + onMouseMove={[Function]} + style={ + Object { + "maxWidth": 50, + "minWidth": 50, + "width": 50, + } + } + > + + + + +
, + }, + } + } + > + + + + + + + +
+ +
+ + +
+ +
+
+ + +
+ +
+ +
+
+ + 1 + +
+
+
+
+
+ +
+ +
+
+ + pk1 + +
+
+
+
+
+
+
+
+ + +
+ +
+ +
+
+ + 2 + +
+
+
+
+
+ +
+ +
+
+ + pk2 + +
+
+
+
+
+
+
+
+ + +
+ +
+ +
+
+ + 3 + +
+
+
+
+
+ +
+ +
+
+ + pk3 + +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+`; + exports[`DocumentsTableComponent should render documents and partition keys in header 1`] = `