/** @jsx h */ import { Component, h } from 'preact'; import './SystemComponentView.css'; class SystemComponentView extends Component { render() { const labelAndClass = this.getStatusLabelAndClass(); const statusLabel = labelAndClass[0]; const statusClass = labelAndClass[1]; return (
{this.getIcon()}
{this.props.children}
{this.getStatusIcon()}
{statusLabel}
); } getIcon() { if (this.props.type == 'APP_SERVER') { return this.getCoreServerIcon(); } else if (this.props.type == 'PREPARATION_WORK') { return this.getPreparationWorkIcon(); } else if (this.props.type == 'APP') { return this.getAppIcon(); } else { return (); } } getStatusIcon() { if (this.props.status === 'WORKING' || this.props.status == 'DONE') { return (); } else if (this.props.status === 'ERROR') { return (); } else if (this.props.status === 'NOT_REACHED') { return (); } else { return (); } } getStatusLabelAndClass() { if (this.props.status === 'WORKING') { return ['Working', 'working']; } else if (this.props.status === 'DONE') { return ['Done', 'done']; } else if (this.props.status === 'ERROR') { return ['Error', 'error']; } else if (this.props.status === 'NOT_REACHED') { return ['Not reached', 'not_reached']; } else { return ['Unknown', 'unknown']; } } getCoreServerIcon() { return ( ); } getPreparationWorkIcon() { return ( ); } getAppIcon() { return ( ); } } export default SystemComponentView;