From 0afa15138ba1a04f26931ff151c6cdf16acfa6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CA=88=E1=B5=83=E1=B5=A2?= Date: Thu, 2 Jul 2020 10:00:37 -0700 Subject: [PATCH] fix(listview): use disableSortBy to disable sorting in table columns (#10223) --- superset-frontend/src/views/chartList/ChartList.tsx | 9 ++++----- .../src/views/dashboardList/DashboardList.tsx | 7 +++---- .../src/views/datasetList/DatasetList.tsx | 11 +++++++++-- superset-frontend/src/welcome/DashboardTable.jsx | 3 --- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/superset-frontend/src/views/chartList/ChartList.tsx b/superset-frontend/src/views/chartList/ChartList.tsx index 9dfaa3caf..57cfd829c 100644 --- a/superset-frontend/src/views/chartList/ChartList.tsx +++ b/superset-frontend/src/views/chartList/ChartList.tsx @@ -119,7 +119,6 @@ class ChartList extends React.PureComponent { }: any) => {sliceName}, Header: t('Chart'), accessor: 'slice_name', - canSort: true, }, { Cell: ({ @@ -129,7 +128,6 @@ class ChartList extends React.PureComponent { }: any) => vizType, Header: t('Visualization Type'), accessor: 'viz_type', - canSort: true, }, { Cell: ({ @@ -139,7 +137,6 @@ class ChartList extends React.PureComponent { }: any) => {dsNameTxt}, Header: t('Datasource'), accessor: 'datasource_name', - canSort: true, }, { Cell: ({ @@ -152,7 +149,6 @@ class ChartList extends React.PureComponent { }: any) => {changedByName}, Header: t('Creator'), accessor: 'changed_by_fk', - canSort: true, }, { Cell: ({ @@ -162,19 +158,21 @@ class ChartList extends React.PureComponent { }: any) => {moment(changedOn).fromNow()}, Header: t('Last Modified'), accessor: 'changed_on', - canSort: true, }, { accessor: 'description', hidden: true, + disableSortBy: true, }, { accessor: 'owners', hidden: true, + disableSortBy: true, }, { accessor: 'datasource', hidden: true, + disableSortBy: true, }, { Cell: ({ row: { state, original } }: any) => { @@ -226,6 +224,7 @@ class ChartList extends React.PureComponent { }, Header: t('Actions'), id: 'actions', + disableSortBy: true, }, ]; diff --git a/superset-frontend/src/views/dashboardList/DashboardList.tsx b/superset-frontend/src/views/dashboardList/DashboardList.tsx index ef0ede787..438c964ad 100644 --- a/superset-frontend/src/views/dashboardList/DashboardList.tsx +++ b/superset-frontend/src/views/dashboardList/DashboardList.tsx @@ -134,7 +134,6 @@ class DashboardList extends React.PureComponent { }: any) => {dashboardTitle}, Header: t('Title'), accessor: 'dashboard_title', - sortable: true, }, { Cell: ({ @@ -152,6 +151,7 @@ class DashboardList extends React.PureComponent { ), Header: t('Owners'), accessor: 'owners', + disableSortBy: true, }, { Cell: ({ @@ -164,7 +164,6 @@ class DashboardList extends React.PureComponent { }: any) => {changedByName}, Header: t('Creator'), accessor: 'changed_by_fk', - sortable: true, }, { Cell: ({ @@ -178,7 +177,6 @@ class DashboardList extends React.PureComponent { ), Header: t('Published'), accessor: 'published', - sortable: true, }, { Cell: ({ @@ -188,11 +186,11 @@ class DashboardList extends React.PureComponent { }: any) => {moment(changedOn).fromNow()}, Header: t('Modified'), accessor: 'changed_on', - sortable: true, }, { accessor: 'slug', hidden: true, + disableSortBy: true, }, { Cell: ({ row: { state, original } }: any) => { @@ -254,6 +252,7 @@ class DashboardList extends React.PureComponent { }, Header: t('Actions'), id: 'actions', + disableSortBy: true, }, ]; diff --git a/superset-frontend/src/views/datasetList/DatasetList.tsx b/superset-frontend/src/views/datasetList/DatasetList.tsx index a4ee407a9..0d0352765 100644 --- a/superset-frontend/src/views/datasetList/DatasetList.tsx +++ b/superset-frontend/src/views/datasetList/DatasetList.tsx @@ -176,6 +176,7 @@ class DatasetList extends React.PureComponent { ); }, accessor: 'kind_icon', + disableSortBy: true, size: 'xs', }, { @@ -186,7 +187,6 @@ class DatasetList extends React.PureComponent { }: any) => datasetTitle, Header: t('Name'), accessor: 'table_name', - sortable: true, }, { Cell: ({ @@ -196,16 +196,19 @@ class DatasetList extends React.PureComponent { }: any) => kind[0]?.toUpperCase() + kind.slice(1), Header: t('Type'), accessor: 'kind', + disableSortBy: true, size: 'md', }, { Header: t('Source'), accessor: 'database_name', + disableSortBy: true, size: 'lg', }, { Header: t('Schema'), accessor: 'schema', + disableSortBy: true, size: 'lg', }, { @@ -229,7 +232,6 @@ class DatasetList extends React.PureComponent { }, Header: t('Last Modified'), accessor: 'changed_on', - sortable: true, size: 'xl', }, { @@ -240,10 +242,12 @@ class DatasetList extends React.PureComponent { }: any) => changedByName, Header: t('Modified By'), accessor: 'changed_by_fk', + disableSortBy: true, size: 'xl', }, { accessor: 'database', + disableSortBy: true, hidden: true, }, { @@ -271,11 +275,13 @@ class DatasetList extends React.PureComponent { }, Header: t('Owners'), id: 'owners', + disableSortBy: true, size: 'lg', }, { accessor: 'is_sqllab_view', hidden: true, + disableSortBy: true, }, { Cell: ({ row: { state, original } }: any) => { @@ -352,6 +358,7 @@ class DatasetList extends React.PureComponent { }, Header: t('Actions'), id: 'actions', + disableSortBy: true, }, ]; diff --git a/superset-frontend/src/welcome/DashboardTable.jsx b/superset-frontend/src/welcome/DashboardTable.jsx index c05d24e82..6399064b5 100644 --- a/superset-frontend/src/welcome/DashboardTable.jsx +++ b/superset-frontend/src/welcome/DashboardTable.jsx @@ -54,7 +54,6 @@ class DashboardTable extends React.PureComponent { { accessor: 'dashboard_title', Header: 'Dashboard', - canSort: true, Cell: ({ row: { original: { url, dashboard_title: dashboardTitle }, @@ -64,7 +63,6 @@ class DashboardTable extends React.PureComponent { { accessor: 'changed_by_fk', Header: 'Creator', - canSort: true, Cell: ({ row: { original: { changed_by_name: changedByName, changedByUrl }, @@ -74,7 +72,6 @@ class DashboardTable extends React.PureComponent { { accessor: 'changed_on', Header: 'Modified', - canSort: true, Cell: ({ row: { original: { changed_on: changedOn },