Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Implement no-data state
Browse files Browse the repository at this point in the history
  • Loading branch information
dok committed Sep 28, 2018
1 parent db8cc6a commit 7b1de2a
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions packages/api-logs/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,23 @@ class Logs extends React.Component {
}

renderTable() {
const { loading } = this.state;
const { loading, logs } = this.state;
if (loading) {
return (
<div className="loading-container">
{React.createElement(LoadingSvg, { className: 'normal' })}
</div>
);
}

if (!logs.length) {
return (
<div className="logs-empty">
<p>No Logs</p>
</div>
);
}

return (
<table className="table">
<thead>
Expand All @@ -184,14 +193,24 @@ class Logs extends React.Component {

render() {
const { group } = this.state;

const { oas, operation, baseUrl } = this.props;
if (!group) return null;

const find = {
url: `${oas.servers[0].url}${operation.path}`,
};
const url = `${baseUrl}logs?${querystring.stringify(find)}`;

return (
<div className="logs">
<div className="log-header">
<h3>Logs</h3>
<div className="select-container">{this.renderSelect()}</div>
<div className="select-container">
<div>
<a href={url}>View More</a>
{this.renderSelect()}
</div>
</div>
</div>
<div className="logs-list">{this.renderTable()}</div>
</div>
Expand Down

0 comments on commit 7b1de2a

Please sign in to comment.