Skip to content

Commit

Permalink
no description case fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanalvizo committed Dec 21, 2023
1 parent 67ded17 commit 1fce944
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/iris-grid/src/ColumnStatistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,14 @@ class ColumnStatistics extends Component<
statistics == null &&
model.isColumnStatisticsAvailable;
const statisticElements = [];
const columnType = column.type.substring(column.type.lastIndexOf('.') + 1);
const description =
column.description === null
? null
: column.description.substring(column.description.lastIndexOf(' ') + 1);
let columnType = column.type.substring(column.type.lastIndexOf('.') + 1);
let description;
if (column.description != null && column.description !== undefined) {
description = column.type.substring(column.type.lastIndexOf('.') + 1);
columnType = column.description.substring(
column.description.lastIndexOf('.') + 1
);
}
if (statistics != null) {
for (let i = 0; i < statistics.length; i += 1) {
const { operation, className, value, type } = statistics[i];
Expand Down Expand Up @@ -204,7 +207,7 @@ class ColumnStatistics extends Component<
<div className="column-statistics">
<div className="column-statistics-title">
{column.name}
<span className="column-statistics-type">&nbsp;({description})</span>
<span className="column-statistics-type">&nbsp;({columnType})</span>
<CopyButton
className="column-statistics-copy"
tooltip="Copy column name"
Expand All @@ -213,7 +216,7 @@ class ColumnStatistics extends Component<
</div>
{description != null && (
<div className="column-statistics-description">
Previewing as {columnType}
Previewing as {description}
</div>
)}
{columnIndex != null && !model.isColumnSortable(columnIndex) && (
Expand Down

0 comments on commit 1fce944

Please sign in to comment.