feat: display last error when definition/config load fails
Contains a breaking internal API change to `errActions.newThrownErr`, which will require a MINOR version bump. Swagger-Editor does not depend on the old usage style.
This commit is contained in:
committed by
kyle
parent
a8f204181e
commit
bd41b736a8
@@ -16,7 +16,7 @@ export default class StandaloneLayout extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
let { getComponent, specSelectors } = this.props
|
||||
let { getComponent, specSelectors, errSelectors } = this.props
|
||||
|
||||
let Container = getComponent("Container")
|
||||
let Row = getComponent("Row")
|
||||
@@ -27,6 +27,8 @@ export default class StandaloneLayout extends React.Component {
|
||||
const OnlineValidatorBadge = getComponent("onlineValidatorBadge", true)
|
||||
|
||||
const loadingStatus = specSelectors.loadingStatus()
|
||||
const lastErr = errSelectors.lastError()
|
||||
const lastErrMsg = lastErr ? lastErr.get("message") : ""
|
||||
|
||||
return (
|
||||
|
||||
@@ -43,12 +45,16 @@ export default class StandaloneLayout extends React.Component {
|
||||
<div className="info">
|
||||
<div className="loading-container">
|
||||
<h4 className="title">Failed to load API definition.</h4>
|
||||
</div>
|
||||
<p>{lastErrMsg}</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
{ loadingStatus === "failedConfig" &&
|
||||
<div className="info" style={{ maxWidth: "880px", marginLeft: "auto", marginRight: "auto", textAlign: "center" }}>
|
||||
<h4 className="title">Failed to load remote configuration.</h4>
|
||||
<div className="loading-container">
|
||||
<h4 className="title">Failed to load remote configuration.</h4>
|
||||
<p>{lastErrMsg}</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
{ !loadingStatus || loadingStatus === "success" && <BaseLayout /> }
|
||||
|
||||
Reference in New Issue
Block a user