[MM-41891] Improve error and reload states (#2019)
This commit is contained in:
@@ -13,6 +13,7 @@ type Props = {
|
||||
id?: string;
|
||||
active?: boolean;
|
||||
appName?: string;
|
||||
handleLink: () => void;
|
||||
};
|
||||
|
||||
export default function ErrorView(props: Props) {
|
||||
@@ -42,27 +43,26 @@ export default function ErrorView(props: Props) {
|
||||
>
|
||||
<h2>{`Cannot connect to ${props.appName}`}</h2>
|
||||
<hr/>
|
||||
<p>{`We're having trouble connecting to ${props.appName}. If refreshing this page (Ctrl+R or Command+R) does not work please verify that:`}</p>
|
||||
<br/>
|
||||
<p>
|
||||
{`We're having trouble connecting to ${props.appName}. We'll continue to try and establish a connection.`}
|
||||
<br/>
|
||||
{'If refreshing this page (Ctrl+R or Command+R) does not work please verify that:'}
|
||||
</p>
|
||||
<ul className='ErrorView-bullets' >
|
||||
<li>{'Your computer is connected to the internet.'}</li>
|
||||
<li>{`The ${props.appName} URL `}
|
||||
<a
|
||||
|
||||
//onClick={handleClick}
|
||||
href={props.url}
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
onClick={props.handleLink}
|
||||
href='#'
|
||||
>
|
||||
{props.url}
|
||||
</a>{' is correct.'}</li>
|
||||
<li>{'You can reach '}
|
||||
<a
|
||||
|
||||
// onClick={handleClick}
|
||||
href={props.url}
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
onClick={props.handleLink}
|
||||
href='#'
|
||||
>
|
||||
{props.url}
|
||||
</a>{' from a browser window.'}</li>
|
||||
|
@@ -44,6 +44,7 @@ import {
|
||||
START_UPGRADE,
|
||||
START_DOWNLOAD,
|
||||
CLOSE_TAB,
|
||||
RELOAD_CURRENT_VIEW,
|
||||
} from 'common/communication';
|
||||
|
||||
import restoreButton from '../../assets/titlebar/chrome-restore.svg';
|
||||
@@ -358,6 +359,10 @@ export default class MainPage extends React.PureComponent<Props, State> {
|
||||
this.handleCloseTeamsDropdown();
|
||||
}
|
||||
|
||||
reloadCurrentView = () => {
|
||||
window.ipcRenderer.send(RELOAD_CURRENT_VIEW);
|
||||
}
|
||||
|
||||
render() {
|
||||
const currentTabs = this.props.teams.find((team) => team.name === this.state.activeServerName)?.tabs || [];
|
||||
|
||||
@@ -528,16 +533,6 @@ export default class MainPage extends React.PureComponent<Props, State> {
|
||||
return null;
|
||||
}
|
||||
switch (tabStatus.status) {
|
||||
case Status.NOSERVERS: // TODO: substitute with https://mattermost.atlassian.net/browse/MM-25003
|
||||
component = (
|
||||
<ErrorView
|
||||
id={'NoServers'}
|
||||
errorInfo={'No Servers configured'}
|
||||
url={tabStatus.extra ? tabStatus.extra.url : ''}
|
||||
active={true}
|
||||
appName={this.props.appName}
|
||||
/>);
|
||||
break;
|
||||
case Status.FAILED:
|
||||
component = (
|
||||
<ErrorView
|
||||
@@ -546,6 +541,7 @@ export default class MainPage extends React.PureComponent<Props, State> {
|
||||
url={tabStatus.extra ? tabStatus.extra.url : ''}
|
||||
active={true}
|
||||
appName={this.props.appName}
|
||||
handleLink={this.reloadCurrentView}
|
||||
/>);
|
||||
break;
|
||||
case Status.LOADING:
|
||||
|
Reference in New Issue
Block a user