You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/10/01 16:28:26 UTC

[GitHub] [incubator-superset] kgabryje commented on a change in pull request #10999: refactor: Remove usages of reactable from TableLoader

kgabryje commented on a change in pull request #10999:
URL: https://github.com/apache/incubator-superset/pull/10999#discussion_r498372653



##########
File path: superset-frontend/src/components/TableLoader.jsx
##########
@@ -71,40 +99,26 @@ class TableLoader extends React.PureComponent {
       ...tableProps
     } = this.props;
 
-    let { columns } = this.props;
-    if (!columns && this.state.data.length > 0) {
+    let { columns = [] } = this.props;
+    if (columns.length === 0 && this.state.data.length > 0) {
       columns = Object.keys(this.state.data[0]).filter(col => col[0] !== '_');
     }
     delete tableProps.dataEndpoint;
     delete tableProps.mutator;
     delete tableProps.columns;
 
     return (
-      <Table
-        {...tableProps}
-        className="table"
-        itemsPerPage={50}
-        style={{ textTransform: 'capitalize' }}
-      >
-        {this.state.data.map((row, i) => (
-          <Tr key={i}>
-            {columns.map(col => {
-              if (row.hasOwnProperty(`_${col}`)) {
-                return (
-                  <Td key={col} column={col} value={row[`_${col}`]}>
-                    {row[col]}
-                  </Td>
-                );
-              }
-              return (
-                <Td key={col} column={col}>
-                  {row[col]}
-                </Td>
-              );
-            })}
-          </Tr>
-        ))}
-      </Table>
+      <ListView
+        columns={columns.map(column => ({
+          accessor: column,
+          Header: column,
+        }))}
+        data={this.state.data}
+        count={this.state.data.length}

Review comment:
       This component is used with endpoints `/superset/recent_activity/{userId}`, `/superset/fave_dashboards/{userId}`, `/superset/fave_slices/{userId}`, `/superset/created_dashboards/{userId}` and `/superset/created_slices/{userId}` and they don't use server side pagination (and don't return total count explicitly as it's equal to length of data array).




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org