Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #1375 - Error view instead of blank page in UI #1726

Merged
merged 3 commits into from
Jun 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions ui/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,23 @@ requests.onError.subscribe(async (err) => {
}
});

export class App extends React.Component<{}, { popupProps: PopupProps }> {
export class App extends React.Component<{}, { popupProps: PopupProps, error: Error }> {
public static childContextTypes = {
history: PropTypes.object,
apis: PropTypes.object,
};

public static getDerivedStateFromError(error: Error) {
return { error };
}

private popupManager: PopupManager;
private notificationsManager: NotificationsManager;
private navigationManager: NavigationManager;

constructor(props: {}) {
super(props);
this.state = { popupProps: null };
this.state = { popupProps: null, error: null };
this.popupManager = new PopupManager();
this.notificationsManager = new NotificationsManager();
this.navigationManager = new NavigationManager(history);
Expand All @@ -97,6 +101,20 @@ export class App extends React.Component<{}, { popupProps: PopupProps }> {
}

public render() {
if (this.state.error != null) {
const stack = this.state.error.stack;
const url = 'https://github.com/argoproj/argo-cd/issues/new?labels=bug&template=bug_report.md';

return (
<React.Fragment>
AdityaGupta1 marked this conversation as resolved.
Show resolved Hide resolved
<p>Something went wrong!</p>
<p>Consider submitting an issue <a href={url}>here</a>.</p><br />
<p>Stacktrace:</p>
<pre>{stack}</pre>
</React.Fragment>
);
}

return (
<React.Fragment>
<Helmet>
Expand Down