geido commented on a change in pull request #16939:
URL: https://github.com/apache/superset/pull/16939#discussion_r721177314
##########
File path: superset-frontend/src/SqlLab/components/ResultSet.tsx
##########
@@ -449,6 +455,7 @@ export default class ResultSet extends React.PureComponent<
({ data } = this.state);
}
const { columns } = this.props.query.results;
+ console.log('RESULT_COL:', columns)
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/FilterableTable.tsx
##########
@@ -544,54 +547,32 @@ export default class FilterableTable extends
PureComponent<
) as List<Datum>;
}
- let { height } = this.props;
- let totalTableHeight = height;
- if (
- this.container.current &&
- this.totalTableWidth > this.container.current.clientWidth
- ) {
- // exclude the height of the horizontal scroll bar from the height of
the table
- // and the height of the table container if the content overflows
- height -= SCROLL_BAR_HEIGHT;
- totalTableHeight -= SCROLL_BAR_HEIGHT;
- }
+ //let { height } = this.props;
+ //let totalTableHeight = height;
+ //if (
+ // this.container.current &&
+ // this.totalTableWidth > this.container.current.clientWidth
+ //) {
+ // // exclude the height of the horizontal scroll bar from the height of
the table
+ // // and the height of the table container if the content overflows
+ // height -= SCROLL_BAR_HEIGHT;
+ // totalTableHeight -= SCROLL_BAR_HEIGHT;
+ //}
+
+ //const rowGetter = ({ index }: { index: number }) =>
+ // this.getDatum(sortedAndFilteredList, index);
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
+import TableDisplay from './TableDisplay';
+import { SortByType } from './types';
+
+export enum EmptyWrapperType {
+ Default = 'Default',
+ Small = 'Small',
+}
+
+export interface ResizableTableProps {
+ columns: any[];
+ data: any[];
+ filterText?: string;
+ totalCount?: number;
+ initialSortBy?: SortByType;
+ loading?: boolean;
+ emptyWrapperType?: EmptyWrapperType;
+ noDataText?: string;
+ className?: string;
+ showRowCount?: boolean;
+ scrollTable?: boolean;
+ small?: boolean;
+}
+
+const EmptyWrapper = styled.div`
+ margin: ${({ theme }) => theme.gridUnit * 40}px 0;
+`;
+
+const ResizableTableStyles = styled.div<{
+ isPaginationSticky?: boolean;
+ scrollTable?: boolean;
+ small?: boolean;
+}>`
+ ${({ scrollTable, theme }) =>
+ scrollTable &&
+ `
+ flex: 1 1 auto;
+ margin-bottom: ${theme.gridUnit * 4}px;
+ overflow: auto;
+ `}
+ .table {
+ border: 1px solid black;
+ width: 100%;
+ }
+ .table-row {
+ }
+
+ .table-cell {
+ ${({ small }) =>
+ small &&
+ `
+ `}
+ }
+ }
+
+ th[role='columnheader'] {
+ z-index: 1;
+ border-bottom: 1px solid black;
+ {/*border-bottom: ${({ theme }) =>
+ `${theme.gridUnit - 2}px solid ${theme.colors.grayscale.light2}`};
+ ${({ small }) => small && `padding-bottom: 0;`}*/}
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/SqlLab/components/ResultSet.tsx
##########
@@ -36,6 +36,7 @@ import ExploreCtasResultsButton from
'./ExploreCtasResultsButton';
import ExploreResultsButton from './ExploreResultsButton';
import HighlightedSql from './HighlightedSql';
import FilterableTable from '../../components/FilterableTable/FilterableTable';
+//import GlobalFilter from '../../components/FilterableTable/GlobalFilter';
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/FilterableTable.tsx
##########
@@ -186,6 +186,17 @@ export default class FilterableTable extends PureComponent<
return list.get(index % list.size);
}
+ getColumnsWithAccessor(arr: string[]) {
+ let res = [];
+ res = arr.map(name => {
+ let colObj = {
+ Header: name,
+ accessor: name,
+ };
+ return colObj;
+ });
+ return res;
+ }
Review comment:
```suggestion
getColumnsWithAccessor(arr: string[]) {
const res = arr.map(name => (
{
Header: name,
accessor: name,
}
));
return res;
}
```
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
+import TableDisplay from './TableDisplay';
+import { SortByType } from './types';
+
+export enum EmptyWrapperType {
+ Default = 'Default',
+ Small = 'Small',
+}
+
+export interface ResizableTableProps {
+ columns: any[];
+ data: any[];
Review comment:
Same as `columns`, can we use a more specific type?
##########
File path: superset-frontend/src/SqlLab/components/ResultSet.tsx
##########
@@ -64,12 +65,17 @@ enum LIMITING_FACTOR {
const LOADING_STYLES: CSSProperties = { position: 'relative', minHeight: 100 };
+interface ReactTableColumns{
+ Header: string;
Review comment:
Is there a reason why this should be uppercase?
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
+import TableDisplay from './TableDisplay';
+import { SortByType } from './types';
+
+export enum EmptyWrapperType {
+ Default = 'Default',
+ Small = 'Small',
+}
+
+export interface ResizableTableProps {
+ columns: any[];
Review comment:
Can we use a more specific type?
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
+import TableDisplay from './TableDisplay';
+import { SortByType } from './types';
+
+export enum EmptyWrapperType {
+ Default = 'Default',
+ Small = 'Small',
+}
+
+export interface ResizableTableProps {
+ columns: any[];
+ data: any[];
+ filterText?: string;
+ totalCount?: number;
+ initialSortBy?: SortByType;
+ loading?: boolean;
+ emptyWrapperType?: EmptyWrapperType;
+ noDataText?: string;
+ className?: string;
+ showRowCount?: boolean;
+ scrollTable?: boolean;
+ small?: boolean;
+}
+
+const EmptyWrapper = styled.div`
+ margin: ${({ theme }) => theme.gridUnit * 40}px 0;
+`;
+
+const ResizableTableStyles = styled.div<{
+ isPaginationSticky?: boolean;
+ scrollTable?: boolean;
+ small?: boolean;
+}>`
+ ${({ scrollTable, theme }) =>
+ scrollTable &&
+ `
+ flex: 1 1 auto;
+ margin-bottom: ${theme.gridUnit * 4}px;
+ overflow: auto;
+ `}
+ .table {
+ border: 1px solid black;
+ width: 100%;
+ }
+ .table-row {
+ }
+
+ .table-cell {
+ ${({ small }) =>
+ small &&
+ `
+ `}
+ }
+ }
+
+ th[role='columnheader'] {
+ z-index: 1;
+ border-bottom: 1px solid black;
+ {/*border-bottom: ${({ theme }) =>
+ `${theme.gridUnit - 2}px solid ${theme.colors.grayscale.light2}`};
+ ${({ small }) => small && `padding-bottom: 0;`}*/}
+ border-right: 1px solid black;
+ text-overflow: elipsis;
+ overflow: hidden;
+ }
+
+ tr.table-row:nth-child(odd) {
+ background-color: ${({ theme }) => `${theme.colors.grayscale.light2}`};
+ }
+ tr,
+ td {
+ margin: 0;
+ border-bottom: 1px solid black;
+ border-right: 1px solid black;
+
+ .resizer {
+ display: inline-block;
+ width: 10px;
+ height: 100%;
+ position: absolute;
+ right: 0;
+ top: 0;
+ transform: translateX(50%);
+ z-index: 1;
+ ${'' /* prevents from scrolling while dragging on touch devices */}
+ touch-action:none;
Review comment:
```suggestion
touch-action: none;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]