diff --git a/lattice/src/App/MoleculaTables/MoleculaTable/MoleculaTable.tsx b/lattice/src/App/MoleculaTables/MoleculaTable/MoleculaTable.tsx index 0946b3d0e..c8071c2f4 100644 --- a/lattice/src/App/MoleculaTables/MoleculaTable/MoleculaTable.tsx +++ b/lattice/src/App/MoleculaTables/MoleculaTable/MoleculaTable.tsx @@ -4,6 +4,7 @@ import Breadcrumbs from '@material-ui/core/Breadcrumbs'; import classNames from 'classnames'; import Fuse from 'fuse.js'; import Highlighter from 'react-highlight-words'; +import isEmpty from 'lodash/isEmpty'; import Link from '@material-ui/core/Link'; import map from 'lodash/map'; import OrderBy from 'lodash/orderBy'; @@ -40,7 +41,7 @@ export const MoleculaTable: FC = ({ const [sortDir, setSortDir] = useState<'asc' | 'desc'>('desc'); useEffect(() => { - if (dataDistribution) { + if (dataDistribution && !dataDistribution.uncached) { const aggregatedFieldsData = Reduce( dataDistribution.fields, (result, value) => { @@ -77,7 +78,7 @@ export const MoleculaTable: FC = ({ threshold: 0 }); const result = fuse.search(searchText); - + let resultsArray: any[] = []; result.forEach((r: any) => { resultsArray.push({ ...r?.item, ...fieldsData[r?.item.name] }); @@ -251,7 +252,15 @@ export const MoleculaTable: FC = ({ = ({
{ .then((res) => setTables(res.data.indexes)) .catch((err) => console.log(err)) ); - + pilosa.get.usage().then((res) => { const nodes = Object.keys(res.data); let data = {}; @@ -83,7 +83,11 @@ export const MoleculaTablesContainer = () => { ) : ( diff --git a/lattice/src/App/MoleculaTables/UsageBreakdown/UsageBreakdown.tsx b/lattice/src/App/MoleculaTables/UsageBreakdown/UsageBreakdown.tsx index 562069458..78cc13c3d 100644 --- a/lattice/src/App/MoleculaTables/UsageBreakdown/UsageBreakdown.tsx +++ b/lattice/src/App/MoleculaTables/UsageBreakdown/UsageBreakdown.tsx @@ -18,7 +18,15 @@ export const UsageBreakdown: FC = ({ showLabel = true, usageValueSize = 'medium' }) => { - const { total, fieldKeysTotal, indexKeys, fragments, metadata, keys } = data; + const { + total, + fieldKeysTotal, + indexKeys, + fragments, + metadata, + keys, + uncached + } = data; const fieldKeysPercentage = fieldKeysTotal && total ? (fieldKeysTotal / total) * 100 : 0; const indexKeysPercentage = indexKeys ? (indexKeys / total) * 100 : 0; @@ -160,6 +168,10 @@ export const UsageBreakdown: FC = ({ ) : null}
+ ) : uncached ? ( + + Waiting... + ) : ( Calculating...