/** @jsx h */
import { Component, h } from 'preact';
import SystemComponentView from './SystemComponentView.jsx';
import './SystemComponentsView.css';
class SystemComponentsView extends Component {
render() {
if (this.props.collapsed) {
return this.renderCollapsed();
} else {
return this.renderExpanded();
}
}
renderCollapsed() {
return (
...
);
}
renderExpanded() {
return (
{this.props.spec.short_program_name}
{' '}
application server
{this.buildDivider()}
Preparation work
{' '}
before executing the app
{this.buildDivider()}
Web
{' '}
application
);
}
/**
* Returns the general system status. Only two results are possible:
* 'preparation-error': preparation error, app not reached
* 'app-error': preparation done, app error
*/
getGeneralSystemStatus() {
const journey = this.props.spec.journey;
if (journey.steps.SUBPROCESS_APP_LOAD_OR_EXEC
&& journey.steps.SUBPROCESS_APP_LOAD_OR_EXEC.state === 'STEP_ERRORED')
{
return 'app-error';
}
if (journey.steps.SUBPROCESS_LISTEN
&& journey.steps.SUBPROCESS_LISTEN.state === 'STEP_ERRORED')
{
return 'app-error';
}
return 'preparation-error';
}
getPreparationWorkStatus() {
if (this.getGeneralSystemStatus() === 'app-error') {
return 'DONE';
} else {
return 'ERROR';
}
}
getWebAppStatus() {
if (this.getGeneralSystemStatus() === 'app-error') {
return 'ERROR';
} else {
return 'NOT_REACHED';
}
}
buildDivider() {
return (
)
}
}
export default SystemComponentsView;