From bac628ea675741db47999d2da654970646dc6ea1 Mon Sep 17 00:00:00 2001 From: Toan Do Date: Fri, 11 Sep 2020 13:56:48 -0400 Subject: [PATCH 1/3] added renderDefaultTableCell function --- .../Network/containers/AccessPoints/index.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/containers/Network/containers/AccessPoints/index.js b/app/containers/Network/containers/AccessPoints/index.js index bb3a309..b2254e5 100644 --- a/app/containers/Network/containers/AccessPoints/index.js +++ b/app/containers/Network/containers/AccessPoints/index.js @@ -25,6 +25,24 @@ const renderTableCell = tabCell => { return tabCell; }; +const renderDefaultTableCell = tabCell => { + if (Array.isArray(tabCell)) { + return ( +
+ {tabCell.map((i, key) => ( + // eslint-disable-next-line react/no-array-index-key + {i} + ))} +
+ ); + } + return ( +
+ 0 +
+ ); +}; + const durationToString = duration => `${floor(duration.asDays())}d ${floor(duration.hours())}h ${padStart( duration.minutes(), @@ -96,7 +114,7 @@ const accessPointsTableColumns = [ { title: 'DEVICES', dataIndex: ['status', 'clientDetails', 'details', 'numClientsPerRadio'], - render: renderTableCell, + render: renderDefaultTableCell, }, ]; From afc6ddc30e4627c28e1f93824a41d9bee6d7d188 Mon Sep 17 00:00:00 2001 From: Toan Do Date: Fri, 11 Sep 2020 16:52:39 -0400 Subject: [PATCH 2/3] made default for AP table --- .../Network/containers/AccessPoints/index.js | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/app/containers/Network/containers/AccessPoints/index.js b/app/containers/Network/containers/AccessPoints/index.js index b2254e5..c71b538 100644 --- a/app/containers/Network/containers/AccessPoints/index.js +++ b/app/containers/Network/containers/AccessPoints/index.js @@ -11,36 +11,21 @@ import { FILTER_EQUIPMENT } from 'graphql/queries'; import styles from './index.module.scss'; -const renderTableCell = tabCell => { - if (Array.isArray(tabCell)) { +const renderTableCell = (text, _record, _index, defaultValue = 'N/A') => { + if (Array.isArray(text)) { + if (text.length < 1) { + return defaultValue; + } return (
- {tabCell.map((i, key) => ( + {text.map((i, key) => ( // eslint-disable-next-line react/no-array-index-key {i} ))}
); } - return tabCell; -}; - -const renderDefaultTableCell = tabCell => { - if (Array.isArray(tabCell)) { - return ( -
- {tabCell.map((i, key) => ( - // eslint-disable-next-line react/no-array-index-key - {i} - ))} -
- ); - } - return ( -
- 0 -
- ); + return text !== null ? text : defaultValue; }; const durationToString = duration => @@ -114,7 +99,7 @@ const accessPointsTableColumns = [ { title: 'DEVICES', dataIndex: ['status', 'clientDetails', 'details', 'numClientsPerRadio'], - render: renderDefaultTableCell, + render: (text, record, index) => renderTableCell(text, record, index, 0), }, ]; From be3582514c46c4cdc7ecd1d2e80c5e969b529981 Mon Sep 17 00:00:00 2001 From: Toan Do Date: Fri, 11 Sep 2020 16:52:59 -0400 Subject: [PATCH 3/3] removed padding --- app/containers/Network/containers/AccessPoints/index.module.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/app/containers/Network/containers/AccessPoints/index.module.scss b/app/containers/Network/containers/AccessPoints/index.module.scss index a95f62b..5564257 100644 --- a/app/containers/Network/containers/AccessPoints/index.module.scss +++ b/app/containers/Network/containers/AccessPoints/index.module.scss @@ -1,5 +1,4 @@ .tabColumn { display: flex; flex-direction: column; - padding: 0 30px; }