Skip to content

Commit

Permalink
feat(ui): format offset lag numbers with toLocaleString (#1050)
Browse files Browse the repository at this point in the history
Closes #911
  • Loading branch information
timonback authored Apr 20, 2022
1 parent b665127 commit 9e5e775
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ConsumerGroupTopics extends Root {
}

handleOptional(optional) {
if (optional !== undefined && optional !== '') {
if (optional !== undefined && optional !== '' && optional !== 'NaN') {
return <label>{optional}</label>;
} else {
return <label>-</label>;
Expand Down Expand Up @@ -115,7 +115,7 @@ class ConsumerGroupTopics extends Root {
colName: 'Lag',
type: 'text',
cell: obj => {
return this.handleOptional(obj.lag);
return this.handleOptional(Number(obj.lag).toLocaleString());
}
}
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ConsumerGroupList extends Root {
>
{topicId + ' '}

<div className="badge badge-secondary">Lag: {offsetLag}</div>
<div className="badge badge-secondary">Lag: {Number(offsetLag).toLocaleString()}</div>
</Link>
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class NodeLogs extends Root {
topic: log.topic,
partition: log.partition,
size: showBytes(log.size),
offsetLag: log.offsetLag
offsetLag: Number(log.offsetLag).toLocaleString()
};
});
this.setState({ data: tableNodes, loading: false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TopicGroups extends Root {
onClick={noPropagation}
>
{topic}
<div className="badge badge-secondary">Lag: {topics[topic]}</div>
<div className="badge badge-secondary">Lag: {Number(topics[topic]).toLocaleString()}</div>
</Link>
);
});
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/Topic/Topic/TopicLogs/TopicLogs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TopicLogs extends Root {
topic: log.topic,
partition: log.partition,
size: log.size,
offsetLag: log.offsetLag
offsetLag: Number(log.offsetLag).toLocaleString()
};
});
this.setState({ data: tableLogs, loading: false });
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/Topic/TopicList/TopicList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class TopicList extends Root {
className={className}
onClick={noPropagation}
>
{consumerGroup.id} <div className="badge badge-secondary"> Lag: {offsetLag}</div>
{consumerGroup.id} <div className="badge badge-secondary"> Lag: {Number(offsetLag).toLocaleString()}</div>
</Link>
);
});
Expand Down

0 comments on commit 9e5e775

Please sign in to comment.