JobMonitor is now embedded.
| | |
| | | import {PageHeader} from '../../general/BootstrapComponents'; |
| | | import {getRestServiceUrl, humanFileSize, humanSeconds} from '../../../utilities/global'; |
| | | import ErrorAlert from '../../general/ErrorAlert'; |
| | | import {IconRefresh} from "../../general/IconComponents"; |
| | | import classNames from "classnames"; |
| | | import FileListPanel from "./FileListPanel"; |
| | | import {IconRefresh} from '../../general/IconComponents'; |
| | | import classNames from 'classnames'; |
| | | import FileListPanel from './FileListPanel'; |
| | | import JobMonitorPanel from '../jobs/JobMonitorPanel'; |
| | | |
| | | class ArchiveView extends React.Component { |
| | | |
| | |
| | | let pageHeader = ''; |
| | | |
| | | if (this.state.isFetching) { |
| | | content = <i>Loading...</i>; |
| | | content = <JobMonitorPanel/>; |
| | | } else if (this.state.failed) { |
| | | content = <ErrorAlert |
| | | title={'Cannot load Repositories'} |
| | |
| | | import React from 'react'; |
| | | import {Redirect} from 'react-router-dom'; |
| | | import {Button, Card, CardBody, Collapse, Progress} from 'reactstrap'; |
| | | import {IconCancel} from '../../general/IconComponents' |
| | | import {getRestServiceUrl} from "../../../utilities/global"; |
| | | import PropTypes from "prop-types"; |
| | | |
| | | class Job extends React.Component { |
| | | constructor(props) { |
| | | super(props); |
| | | this.toggle = this.toggle.bind(this); |
| | | this.cacnelJob = this.cancelJob.bind(this); |
| | | this.state = {collapse: false}; |
| | | this.state = { |
| | | collapse: false, |
| | | redirect: false |
| | | }; |
| | | } |
| | | |
| | | cancelJob = (jobId) => { |
| | | fetch(getRestServiceUrl('jobs/cancel', { |
| | | uniqueJobNumber: jobId |
| | | })); |
| | | this.setState({ |
| | | redirect: true |
| | | }) |
| | | }; |
| | | |
| | | toggle() { |
| | | this.setState({collapse: !this.state.collapse}); |
| | | } |
| | | |
| | | renderRedirect = () => { |
| | | if (this.props.embedded && this.state.redirect) { |
| | | return <Redirect to='/jobmonitor'/> |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | let content = undefined; |
| | | let job = this.props.job; |
| | |
| | | } |
| | | return ( |
| | | <div> |
| | | {this.renderRedirect()} |
| | | <Button color="link" onClick={this.toggle}>{job.description}</Button> |
| | | <div>{content} |
| | | <Button color={'danger'} onClick={() => this.cancelJob(job.uniqueJobNumber)} |
| | |
| | | } |
| | | } |
| | | |
| | | Job.propTypes = { |
| | | embedded: PropTypes.bool |
| | | }; |
| | | |
| | | export default Job; |
| | |
| | | import {getRestServiceUrl, isDevelopmentMode} from "../../../utilities/global"; |
| | | import JobQueue from "./JobQueue"; |
| | | import ErrorAlert from "../archives/ArchiveView"; |
| | | import PropTypes from "prop-types"; |
| | | |
| | | class JobMonitorPanel extends React.Component { |
| | | state = { |
| | |
| | | content = <React.Fragment> |
| | | {this.state.queues |
| | | .map((queue) => <JobQueue |
| | | embedded={this.props.embedded} |
| | | queue={queue} |
| | | key={queue.repo} |
| | | />)} |
| | | </React.Fragment>; |
| | | } else if (isDevelopmentMode()) { |
| | | } else if (isDevelopmentMode() && !this.props.embedded) { |
| | | content = <React.Fragment>No jobs are running or queued.<br/><br/> |
| | | <Button color="primary" onClick={this.toggleTestMode}>Test mode</Button> |
| | | </React.Fragment> |
| | |
| | | content = <React.Fragment>No jobs are running or queued.</React.Fragment> |
| | | } |
| | | } |
| | | if (isDevelopmentMode()) { |
| | | if (isDevelopmentMode() && !this.props.embedded) { |
| | | todo = <React.Fragment><br/> |
| | | <code> |
| | | <h2>To-do</h2> |
| | |
| | | } |
| | | } |
| | | |
| | | JobMonitorPanel.propTypes = { |
| | | embedded: PropTypes.bool |
| | | }; |
| | | |
| | | JobMonitorPanel.defaultProps = { |
| | | embedded: true |
| | | }; |
| | | |
| | | |
| | | export default JobMonitorPanel; |
| | |
| | | <PageHeader> |
| | | Job monitor |
| | | </PageHeader> |
| | | <JobMonitorPanel/> |
| | | <JobMonitorPanel embedded={false}/> |
| | | </React.Fragment>; |
| | | }; |
| | | } |
| | |
| | | import React from 'react'; |
| | | import {Button, Card, CardBody, Collapse} from 'reactstrap'; |
| | | import Job from "./Job"; |
| | | import PropTypes from "prop-types"; |
| | | |
| | | class JobQueue extends React.Component { |
| | | constructor(props) { |
| | |
| | | <CardBody> |
| | | {this.props.queue.jobs |
| | | .map((job, index) => <Job |
| | | embedded={this.props.embedded} |
| | | job={job} |
| | | key={job.commandLineAsString} |
| | | />)} |
| | |
| | | } |
| | | } |
| | | |
| | | JobQueue.propTypes = { |
| | | embedded: PropTypes.bool |
| | | }; |
| | | |
| | | export default JobQueue; |
| | |
| | | import {PageHeader} from '../../general/BootstrapComponents'; |
| | | import {getRestServiceUrl, humanFileSize} from '../../../utilities/global'; |
| | | import ErrorAlert from '../../general/ErrorAlert'; |
| | | import {IconCheck, IconRefresh} from "../../general/IconComponents"; |
| | | import {IconCheck, IconRefresh} from '../../general/IconComponents'; |
| | | import JobMonitorPanel from '../jobs/JobMonitorPanel'; |
| | | |
| | | class RepoArchiveListView extends React.Component { |
| | | |
| | |
| | | let pageHeader = ''; |
| | | |
| | | if (this.state.isFetching) { |
| | | content = <i>Loading...</i>; |
| | | content = <JobMonitorPanel />; |
| | | } else if (this.state.failed) { |
| | | content = <ErrorAlert |
| | | title={'Cannot load Repositories'} |