|
|
|
|
@ -11,6 +11,8 @@ import Layout from 'antd/lib/layout';
|
|
|
|
|
import Modal from 'antd/lib/modal';
|
|
|
|
|
import notification from 'antd/lib/notification';
|
|
|
|
|
import Spin from 'antd/lib/spin';
|
|
|
|
|
import { DisconnectOutlined } from '@ant-design/icons';
|
|
|
|
|
import Space from 'antd/lib/space';
|
|
|
|
|
import Text from 'antd/lib/typography/Text';
|
|
|
|
|
import 'antd/dist/antd.css';
|
|
|
|
|
|
|
|
|
|
@ -64,6 +66,7 @@ import showPlatformNotification, {
|
|
|
|
|
showUnsupportedNotification,
|
|
|
|
|
} from 'utils/platform-checker';
|
|
|
|
|
import '../styles.scss';
|
|
|
|
|
import consts from 'consts';
|
|
|
|
|
import EmailConfirmationPage from './email-confirmation-pages/email-confirmed';
|
|
|
|
|
import EmailVerificationSentPage from './email-confirmation-pages/email-verification-sent';
|
|
|
|
|
import IncorrectEmailConfirmationPage from './email-confirmation-pages/incorrect-email-confirmation';
|
|
|
|
|
@ -103,10 +106,23 @@ interface CVATAppProps {
|
|
|
|
|
isModelPluginActive: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentProps> {
|
|
|
|
|
interface CVATAppState {
|
|
|
|
|
healthIinitialized: boolean;
|
|
|
|
|
backendIsHealthy: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentProps, CVATAppState> {
|
|
|
|
|
constructor(props: CVATAppProps & RouteComponentProps) {
|
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
|
healthIinitialized: false,
|
|
|
|
|
backendIsHealthy: false,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
public componentDidMount(): void {
|
|
|
|
|
const core = getCore();
|
|
|
|
|
const { verifyAuthorized, history, location } = this.props;
|
|
|
|
|
const { history, location } = this.props;
|
|
|
|
|
// configure({ ignoreRepeatedEventsWhenKeyHeldDown: false });
|
|
|
|
|
|
|
|
|
|
// Logger configuration
|
|
|
|
|
@ -121,7 +137,46 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
|
|
|
|
|
customWaViewHit(_location.pathname, _location.search, _location.hash);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
verifyAuthorized();
|
|
|
|
|
const {
|
|
|
|
|
HEALH_CHECK_RETRIES, HEALTH_CHECK_PERIOD, HEALTH_CHECK_REQUEST_TIMEOUT, UPGRADE_GUIDE_URL,
|
|
|
|
|
} = consts;
|
|
|
|
|
core.server.healthCheck(
|
|
|
|
|
HEALH_CHECK_RETRIES,
|
|
|
|
|
HEALTH_CHECK_PERIOD,
|
|
|
|
|
HEALTH_CHECK_REQUEST_TIMEOUT,
|
|
|
|
|
).then(() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
healthIinitialized: true,
|
|
|
|
|
backendIsHealthy: true,
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
healthIinitialized: true,
|
|
|
|
|
backendIsHealthy: false,
|
|
|
|
|
});
|
|
|
|
|
Modal.error({
|
|
|
|
|
title: 'Cannot connect to the server',
|
|
|
|
|
className: 'cvat-modal-cannot-connect-server',
|
|
|
|
|
closable: false,
|
|
|
|
|
content: (
|
|
|
|
|
<Text>
|
|
|
|
|
Make sure the CVAT backend and all necessary services
|
|
|
|
|
(Database, Redis and Open Policy Agent) are running and avaliable.
|
|
|
|
|
If you upgraded from version 2.2.0 or earlier, manual actions may be needed, see the
|
|
|
|
|
|
|
|
|
|
<a
|
|
|
|
|
target='_blank'
|
|
|
|
|
rel='noopener noreferrer'
|
|
|
|
|
href={UPGRADE_GUIDE_URL}
|
|
|
|
|
>
|
|
|
|
|
Upgrade Guide
|
|
|
|
|
</a>
|
|
|
|
|
.
|
|
|
|
|
</Text>
|
|
|
|
|
),
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
name, version, engine, os,
|
|
|
|
|
@ -198,6 +253,12 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
|
|
|
|
|
isModelPluginActive,
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
const { backendIsHealthy } = this.state;
|
|
|
|
|
|
|
|
|
|
if (!backendIsHealthy) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.showErrors();
|
|
|
|
|
this.showMessages();
|
|
|
|
|
|
|
|
|
|
@ -332,6 +393,8 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
|
|
|
|
|
isModelPluginActive,
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
const { healthIinitialized, backendIsHealthy } = this.state;
|
|
|
|
|
|
|
|
|
|
const notRegisteredUserInitialized = (userInitialized && (user == null || !user.isVerified));
|
|
|
|
|
let readyForRender = userAgreementsInitialized && authActionsInitialized;
|
|
|
|
|
readyForRender = readyForRender && (notRegisteredUserInitialized ||
|
|
|
|
|
@ -456,7 +519,15 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <Spin size='large' className='cvat-spinner' />;
|
|
|
|
|
if (healthIinitialized && !backendIsHealthy) {
|
|
|
|
|
return (
|
|
|
|
|
<Space align='center' direction='vertical' className='cvat-spinner'>
|
|
|
|
|
<DisconnectOutlined className='cvat-disconnected' />
|
|
|
|
|
Cannot connect to the server.
|
|
|
|
|
</Space>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return <Spin size='large' className='cvat-spinner' tip='Connecting...' />;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|