Skip to content

Commit

Permalink
feat(playground): Make dashboard loading errors permanent
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Oct 2, 2019
1 parent c8c8230 commit 155380d
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions packages/cubejs-playground/src/DashboardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,27 @@ class DashboardPage extends Component {
appCode: null,
loadError: null
});
await this.dashboardSource.load(createApp, { chartLibrary });
this.setState({
dashboardStarting: false,
appCode: !this.dashboardSource.loadError && this.dashboardSource.dashboardAppCode(),
loadError: this.dashboardSource.loadError
});
const dashboardStatus = await (await fetch('/playground/dashboard-app-status')).json();
this.setState({
dashboardRunning: dashboardStatus.running,
dashboardPort: dashboardStatus.dashboardPort,
dashboardAppPath: dashboardStatus.dashboardAppPath
});
if (createApp) {
await this.startDashboardApp();
try {
await this.dashboardSource.load(createApp, { chartLibrary });
this.setState({
dashboardStarting: false,
appCode: !this.dashboardSource.loadError && this.dashboardSource.dashboardAppCode(),
loadError: this.dashboardSource.loadError
});
const dashboardStatus = await (await fetch('/playground/dashboard-app-status')).json();
this.setState({
dashboardRunning: dashboardStatus.running,
dashboardPort: dashboardStatus.dashboardPort,
dashboardAppPath: dashboardStatus.dashboardAppPath
});
if (createApp) {
await this.startDashboardApp();
}
} catch (e) {
this.setState({
dashboardStarting: false,
loadError: <pre>{e.toString()}</pre>
});
}
}

Expand Down

0 comments on commit 155380d

Please sign in to comment.