+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-// @flow
-import React from 'react';
-import Modal from 'react-modal';
-import { getTask } from '../../../api/ce';
-import { translate } from '../../../helpers/l10n';
-
-/*::
-type Props = {
- onClose: () => void,
- task: { componentName: string, id: string, type: string }
-};
-*/
-
-/*::
-type State = {
- scannerContext: ?string
-};
-*/
-
-export default class ScannerContext extends React.PureComponent {
- /*:: mounted: boolean; */
- /*:: props: Props; */
- state /*: State */ = {
- scannerContext: null
- };
-
- componentDidMount() {
- this.mounted = true;
- this.loadScannerContext();
- }
-
- componentWillUnmount() {
- this.mounted = false;
- }
-
- loadScannerContext() {
- getTask(this.props.task.id, ['scannerContext']).then(task => {
- if (this.mounted) {
- this.setState({ scannerContext: task.scannerContext });
- }
- });
- }
-
- handleCloseClick = (event /*: Event */) => {
- event.preventDefault();
- this.props.onClose();
- };
-
- render() {
- const { task } = this.props;
- const { scannerContext } = this.state;
-
- return (
- <Modal
- isOpen={true}
- contentLabel="scanner context"
- className="modal modal-large"
- overlayClassName="modal-overlay"
- onRequestClose={this.props.onClose}>
- <div className="modal-head">
- <h2>
- {translate('background_tasks.scanner_context')}
- {': '}
- {task.componentName}
- {' ['}
- {translate('background_task.type', task.type)}
- {']'}
- </h2>
- </div>
-
- <div className="modal-body modal-container">
- {scannerContext != null
- ? <pre className="js-task-scanner-context">
- {scannerContext}
- </pre>
- : <i className="spinner" />}
- </div>
-
- <div className="modal-foot">
- <a href="#" className="js-modal-close" onClick={this.handleCloseClick}>
- {translate('close')}
- </a>
- </div>
- </Modal>
- );
- }
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import Modal from 'react-modal';
+import { getTask } from '../../../api/ce';
+import { translate } from '../../../helpers/l10n';
+import { Task } from '../types';
+
+interface Props {
+ onClose: () => void;
+ task: Task;
+}
+
+interface State {
+ scannerContext?: string;
+}
+
+export default class ScannerContext extends React.PureComponent<Props, State> {
+ mounted: boolean;
+ state: State = {};
+
+ componentDidMount() {
+ this.mounted = true;
+ this.loadScannerContext();
+ }
+
+ componentWillUnmount() {
+ this.mounted = false;
+ }
+
+ loadScannerContext() {
+ getTask(this.props.task.id, ['scannerContext']).then(task => {
+ if (this.mounted) {
+ this.setState({ scannerContext: task.scannerContext });
+ }
+ });
+ }
+
+ handleCloseClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
+ event.preventDefault();
+ this.props.onClose();
+ };
+
+ render() {
+ const { task } = this.props;
+ const { scannerContext } = this.state;
+
+ return (
+ <Modal
+ isOpen={true}
+ contentLabel="scanner context"
+ className="modal modal-large"
+ overlayClassName="modal-overlay"
+ onRequestClose={this.props.onClose}>
+ <div className="modal-head">
+ <h2>
+ {translate('background_tasks.scanner_context')}
+ {': '}
+ {task.componentName}
+ {' ['}
+ {translate('background_task.type', task.type)}
+ {']'}
+ </h2>
+ </div>
+
+ <div className="modal-body modal-container">
+ {scannerContext != null
+ ? <pre className="js-task-scanner-context">
+ {scannerContext}
+ </pre>
+ : <i className="spinner" />}
+ </div>
+
+ <div className="modal-foot">
+ <a href="#" className="js-modal-close" onClick={this.handleCloseClick}>
+ {translate('close')}
+ </a>
+ </div>
+ </Modal>
+ );
+ }
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-// @flow
-import React from 'react';
-import Modal from 'react-modal';
-import { getTask } from '../../../api/ce';
-import { translate } from '../../../helpers/l10n';
-
-/*::
-type Props = {
- onClose: () => void,
- task: { componentName: string, errorMessage: string, id: string, type: string }
-};
-*/
-
-/*::
-type State = {
- loading: boolean,
- stacktrace: ?string
-};
-*/
-
-export default class Stacktrace extends React.PureComponent {
- /*:: mounted: boolean; */
- /*:: props: Props; */
- state /*: State */ = {
- loading: true,
- stacktrace: null
- };
-
- componentDidMount() {
- this.mounted = true;
- this.loadStacktrace();
- }
-
- componentWillUnmount() {
- this.mounted = false;
- }
-
- loadStacktrace() {
- getTask(this.props.task.id, ['stacktrace']).then(task => {
- if (this.mounted) {
- this.setState({ loading: false, stacktrace: task.errorStacktrace });
- }
- });
- }
-
- handleCloseClick = (event /*: Event */) => {
- event.preventDefault();
- this.props.onClose();
- };
-
- render() {
- const { task } = this.props;
- const { loading, stacktrace } = this.state;
-
- return (
- <Modal
- isOpen={true}
- contentLabel="stacktrace"
- className="modal modal-large"
- overlayClassName="modal-overlay"
- onRequestClose={this.props.onClose}>
- <div className="modal-head">
- <h2>
- {translate('background_tasks.error_stacktrace')}
- {': '}
- {task.componentName}
- {' ['}
- {translate('background_task.type', task.type)}
- {']'}
- </h2>
- </div>
-
- <div className="modal-body modal-container">
- {loading
- ? <i className="spinner" />
- : stacktrace
- ? <div>
- <h4 className="spacer-bottom">
- {translate('background_tasks.error_stacktrace')}
- </h4>
- <pre className="js-task-stacktrace">
- {stacktrace}
- </pre>
- </div>
- : <div>
- <h4 className="spacer-bottom">
- {translate('background_tasks.error_message')}
- </h4>
- <pre className="js-task-error-message">
- {task.errorMessage}
- </pre>
- </div>}
- </div>
-
- <div className="modal-foot">
- <a href="#" className="js-modal-close" onClick={this.handleCloseClick}>
- {translate('close')}
- </a>
- </div>
- </Modal>
- );
- }
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import Modal from 'react-modal';
+import { getTask } from '../../../api/ce';
+import { translate } from '../../../helpers/l10n';
+import { Task } from '../types';
+
+interface Props {
+ onClose: () => void;
+ task: Task;
+}
+
+interface State {
+ loading: boolean;
+ stacktrace?: string;
+}
+
+export default class Stacktrace extends React.PureComponent<Props, State> {
+ mounted: boolean;
+ state: State = { loading: true };
+
+ componentDidMount() {
+ this.mounted = true;
+ this.loadStacktrace();
+ }
+
+ componentWillUnmount() {
+ this.mounted = false;
+ }
+
+ loadStacktrace() {
+ getTask(this.props.task.id, ['stacktrace']).then(task => {
+ if (this.mounted) {
+ this.setState({ loading: false, stacktrace: task.errorStacktrace });
+ }
+ });
+ }
+
+ handleCloseClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
+ event.preventDefault();
+ this.props.onClose();
+ };
+
+ render() {
+ const { task } = this.props;
+ const { loading, stacktrace } = this.state;
+
+ return (
+ <Modal
+ isOpen={true}
+ contentLabel="stacktrace"
+ className="modal modal-large"
+ overlayClassName="modal-overlay"
+ onRequestClose={this.props.onClose}>
+ <div className="modal-head">
+ <h2>
+ {translate('background_tasks.error_stacktrace')}
+ {': '}
+ {task.componentName}
+ {' ['}
+ {translate('background_task.type', task.type)}
+ {']'}
+ </h2>
+ </div>
+
+ <div className="modal-body modal-container">
+ {loading
+ ? <i className="spinner" />
+ : stacktrace
+ ? <div>
+ <h4 className="spacer-bottom">
+ {translate('background_tasks.error_stacktrace')}
+ </h4>
+ <pre className="js-task-stacktrace">
+ {stacktrace}
+ </pre>
+ </div>
+ : <div>
+ <h4 className="spacer-bottom">
+ {translate('background_tasks.error_message')}
+ </h4>
+ <pre className="js-task-error-message">
+ {task.errorMessage}
+ </pre>
+ </div>}
+ </div>
+
+ <div className="modal-foot">
+ <a href="#" className="js-modal-close" onClick={this.handleCloseClick}>
+ {translate('close')}
+ </a>
+ </div>
+ </Modal>
+ );
+ }
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import React from 'react';
-import PropTypes from 'prop-types';
-import TaskStatus from './TaskStatus';
-import TaskComponent from './TaskComponent';
-import TaskId from './TaskId';
-import TaskDay from './TaskDay';
-import TaskDate from './TaskDate';
-import TaskExecutionTime from './TaskExecutionTime';
-import TaskActions from './TaskActions';
-
-export default class Task extends React.PureComponent {
- static propTypes = {
- task: PropTypes.object.isRequired,
- index: PropTypes.number.isRequired,
- tasks: PropTypes.array.isRequired,
- component: PropTypes.object,
- onCancelTask: PropTypes.func.isRequired,
- onFilterTask: PropTypes.func.isRequired
- };
-
- render() {
- const { task, index, tasks, component, onCancelTask, onFilterTask } = this.props;
-
- const prevTask = index > 0 ? tasks[index - 1] : null;
-
- return (
- <tr>
- <TaskStatus task={task} />
- <TaskComponent task={task} />
- <TaskId task={task} />
- <TaskDay task={task} prevTask={prevTask} />
- <TaskDate date={task.submittedAt} baseDate={task.submittedAt} />
- <TaskDate date={task.startedAt} baseDate={task.submittedAt} />
- <TaskDate date={task.executedAt} baseDate={task.submittedAt} />
- <TaskExecutionTime task={task} />
- <TaskActions
- component={component}
- task={task}
- onFilterTask={onFilterTask}
- onCancelTask={onCancelTask}
- />
- </tr>
- );
- }
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import TaskStatus from './TaskStatus';
+import TaskComponent from './TaskComponent';
+import TaskId from './TaskId';
+import TaskDay from './TaskDay';
+import TaskDate from './TaskDate';
+import TaskExecutionTime from './TaskExecutionTime';
+import TaskActions from './TaskActions';
+import { Task as ITask } from '../types';
+
+interface Props {
+ component?: {};
+ onCancelTask: (task: ITask) => void;
+ onFilterTask: (task: ITask) => void;
+ task: ITask;
+ previousTask?: ITask;
+}
+
+export default function Task(props: Props) {
+ const { task, component, onCancelTask, onFilterTask, previousTask } = props;
+
+ return (
+ <tr>
+ <TaskStatus status={task.status} />
+ <TaskComponent task={task} />
+ <TaskId id={task.id} />
+ <TaskDay
+ submittedAt={task.submittedAt}
+ prevSubmittedAt={previousTask && previousTask.submittedAt}
+ />
+ <TaskDate date={task.submittedAt} />
+ <TaskDate date={task.startedAt} baseDate={task.submittedAt} />
+ <TaskDate date={task.executedAt} baseDate={task.submittedAt} />
+ <TaskExecutionTime ms={task.executionTimeMs} />
+ <TaskActions
+ component={component}
+ task={task}
+ onFilterTask={onFilterTask}
+ onCancelTask={onCancelTask}
+ />
+ </tr>
+ );
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import React from 'react';
-import ScannerContext from './ScannerContext';
-import Stacktrace from './Stacktrace';
-import { STATUSES } from './../constants';
-import { translate, translateWithParameters } from '../../../helpers/l10n';
-
-export default class TaskActions extends React.PureComponent {
- state = {
- scannerContextOpen: false,
- stacktraceOpen: false
- };
-
- handleFilterClick(e) {
- e.preventDefault();
- this.props.onFilterTask(this.props.task);
- }
-
- handleCancelClick(e) {
- e.preventDefault();
- this.props.onCancelTask(this.props.task);
- }
-
- handleShowScannerContextClick(e) {
- e.preventDefault();
- this.setState({ scannerContextOpen: true });
- }
-
- closeScannerContext = () => this.setState({ scannerContextOpen: false });
-
- handleShowStacktraceClick(e) {
- e.preventDefault();
- this.setState({ stacktraceOpen: true });
- }
-
- closeStacktrace = () => this.setState({ stacktraceOpen: false });
-
- render() {
- const { component, task } = this.props;
-
- const canFilter = component == null;
- const canCancel = task.status === STATUSES.PENDING;
- const canShowStacktrace = task.errorMessage != null;
- const hasActions = canFilter || canCancel || task.hasScannerContext || canShowStacktrace;
-
- if (!hasActions) {
- return <td> </td>;
- }
-
- return (
- <td className="thin nowrap">
- <div className="dropdown js-task-action">
- <button className="dropdown-toggle" data-toggle="dropdown">
- <i className="icon-dropdown" />
- </button>
- <ul className="dropdown-menu dropdown-menu-right">
- {canFilter &&
- <li>
- <a className="js-task-filter" href="#" onClick={this.handleFilterClick.bind(this)}>
- <i className="spacer-right icon-filter icon-gray" />
- {translateWithParameters(
- 'background_tasks.filter_by_component_x',
- task.componentName
- )}
- </a>
- </li>}
- {canCancel &&
- <li>
- <a className="js-task-cancel" href="#" onClick={this.handleCancelClick.bind(this)}>
- <i className="spacer-right icon-delete" />
- {translate('background_tasks.cancel_task')}
- </a>
- </li>}
- {task.hasScannerContext &&
- <li>
- <a
- className="js-task-show-scanner-context"
- href="#"
- onClick={this.handleShowScannerContextClick.bind(this)}>
- <i className="spacer-right icon-list icon-gray" />
- {translate('background_tasks.show_scanner_context')}
- </a>
- </li>}
- {canShowStacktrace &&
- <li>
- <a
- className="js-task-show-stacktrace"
- href="#"
- onClick={this.handleShowStacktraceClick.bind(this)}>
- <i className="spacer-right icon-list icon-red" />
- {translate('background_tasks.show_stacktrace')}
- </a>
- </li>}
- </ul>
- </div>
-
- {this.state.scannerContextOpen &&
- <ScannerContext onClose={this.closeScannerContext} task={task} />}
-
- {this.state.stacktraceOpen && <Stacktrace onClose={this.closeStacktrace} task={task} />}
- </td>
- );
- }
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import ScannerContext from './ScannerContext';
+import Stacktrace from './Stacktrace';
+import { STATUSES } from './../constants';
+import { translate, translateWithParameters } from '../../../helpers/l10n';
+import { Task } from '../types';
+
+interface Props {
+ component?: {};
+ onCancelTask: (task: Task) => void;
+ onFilterTask: (task: Task) => void;
+ task: Task;
+}
+
+interface State {
+ scannerContextOpen: boolean;
+ stacktraceOpen: boolean;
+}
+
+export default class TaskActions extends React.PureComponent<Props, State> {
+ state: State = {
+ scannerContextOpen: false,
+ stacktraceOpen: false
+ };
+
+ handleFilterClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
+ event.preventDefault();
+ this.props.onFilterTask(this.props.task);
+ };
+
+ handleCancelClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
+ event.preventDefault();
+ this.props.onCancelTask(this.props.task);
+ };
+
+ handleShowScannerContextClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
+ event.preventDefault();
+ this.setState({ scannerContextOpen: true });
+ };
+
+ closeScannerContext = () => this.setState({ scannerContextOpen: false });
+
+ handleShowStacktraceClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
+ event.preventDefault();
+ this.setState({ stacktraceOpen: true });
+ };
+
+ closeStacktrace = () => this.setState({ stacktraceOpen: false });
+
+ render() {
+ const { component, task } = this.props;
+
+ const canFilter = component == undefined;
+ const canCancel = task.status === STATUSES.PENDING;
+ const canShowStacktrace = task.errorMessage != undefined;
+ const hasActions = canFilter || canCancel || task.hasScannerContext || canShowStacktrace;
+
+ if (!hasActions) {
+ return <td> </td>;
+ }
+
+ return (
+ <td className="thin nowrap">
+ <div className="dropdown js-task-action">
+ <button className="dropdown-toggle" data-toggle="dropdown">
+ <i className="icon-dropdown" />
+ </button>
+ <ul className="dropdown-menu dropdown-menu-right">
+ {canFilter &&
+ task.componentName &&
+ <li>
+ <a className="js-task-filter" href="#" onClick={this.handleFilterClick}>
+ <i className="spacer-right icon-filter icon-gray" />
+ {translateWithParameters(
+ 'background_tasks.filter_by_component_x',
+ task.componentName
+ )}
+ </a>
+ </li>}
+ {canCancel &&
+ <li>
+ <a className="js-task-cancel" href="#" onClick={this.handleCancelClick}>
+ <i className="spacer-right icon-delete" />
+ {translate('background_tasks.cancel_task')}
+ </a>
+ </li>}
+ {task.hasScannerContext &&
+ <li>
+ <a
+ className="js-task-show-scanner-context"
+ href="#"
+ onClick={this.handleShowScannerContextClick}>
+ <i className="spacer-right icon-list icon-gray" />
+ {translate('background_tasks.show_scanner_context')}
+ </a>
+ </li>}
+ {canShowStacktrace &&
+ <li>
+ <a
+ className="js-task-show-stacktrace"
+ href="#"
+ onClick={this.handleShowStacktraceClick}>
+ <i className="spacer-right icon-list icon-red" />
+ {translate('background_tasks.show_stacktrace')}
+ </a>
+ </li>}
+ </ul>
+ </div>
+
+ {this.state.scannerContextOpen &&
+ <ScannerContext onClose={this.closeScannerContext} task={task} />}
+
+ {this.state.stacktraceOpen && <Stacktrace onClose={this.closeStacktrace} task={task} />}
+ </td>
+ );
+ }
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* @flow */
-import React from 'react';
-import { Link } from 'react-router';
-import TaskType from './TaskType';
-import QualifierIcon from '../../../components/shared/QualifierIcon';
-import Organization from '../../../components/shared/Organization';
-/*:: import type { Task } from '../types'; */
-
-/*::
-type Props = {
- task: Task
-};
-*/
-
-export default function TaskComponent(props /*: Props */) {
- const { task } = props;
-
- if (!task.componentKey) {
- return (
- <td>
- <span className="note">
- {task.id}
- </span>
- <TaskType task={task} />
- </td>
- );
- }
-
- return (
- <td>
- <span className="little-spacer-right">
- <QualifierIcon qualifier={task.componentQualifier} />
- </span>
-
- {task.organization != null && <Organization organizationKey={task.organization} />}
-
- <Link to={{ pathname: '/dashboard', query: { id: task.componentKey } }}>
- {task.componentName}
- </Link>
-
- <TaskType task={task} />
- </td>
- );
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { Link } from 'react-router';
+import TaskType from './TaskType';
+import QualifierIcon from '../../../components/shared/QualifierIcon';
+import Organization from '../../../components/shared/Organization';
+import { Task } from '../types';
+
+interface Props {
+ task: Task;
+}
+
+export default function TaskComponent({ task }: Props) {
+ if (!task.componentKey) {
+ return (
+ <td>
+ <span className="note">
+ {task.id}
+ </span>
+ <TaskType incremental={task.incremental} type={task.type} />
+ </td>
+ );
+ }
+
+ return (
+ <td>
+ {task.componentQualifier &&
+ <span className="little-spacer-right">
+ <QualifierIcon qualifier={task.componentQualifier} />
+ </span>}
+
+ {task.organization && <Organization organizationKey={task.organization} />}
+
+ {task.componentName &&
+ <Link to={{ pathname: '/dashboard', query: { id: task.componentKey } }}>
+ {task.componentName}
+ </Link>}
+
+ <TaskType incremental={task.incremental} type={task.type} />
+ </td>
+ );
+}
import { differenceInDays, isValidDate, parseDate } from '../../../helpers/dates';
interface Props {
- date: string;
- baseDate: string;
+ date?: string;
+ baseDate?: string;
}
export default function TaskDate({ date, baseDate }: Props) {
- const parsedDate = parseDate(date);
- const parsedBaseDate = parseDate(baseDate);
+ const parsedDate = date && parseDate(date);
+ const parsedBaseDate = baseDate && parseDate(baseDate);
const diff =
- date && baseDate && isValidDate(parsedDate) && isValidDate(parsedBaseDate)
+ parsedDate && parsedBaseDate && isValidDate(parsedDate) && isValidDate(parsedBaseDate)
? differenceInDays(parsedDate, parsedBaseDate)
: 0;
<td className="thin nowrap text-right">
{diff > 0 && <span className="text-warning little-spacer-right">{`(+${diff}d)`}</span>}
- {date && isValidDate(parsedDate) ? <TimeFormatter date={parsedDate} long={true} /> : ''}
+ {parsedDate && isValidDate(parsedDate) ? <TimeFormatter date={parsedDate} long={true} /> : ''}
</td>
);
}
import * as React from 'react';
import DateFormatter from '../../../components/intl/DateFormatter';
import { isSameDay, parseDate } from '../../../helpers/dates';
-import { ITask } from '../types';
interface Props {
- task: ITask;
- prevTask?: ITask;
+ submittedAt: string;
+ prevSubmittedAt?: string;
}
-export default function TaskDay({ task, prevTask }: Props) {
+export default function TaskDay({ submittedAt, prevSubmittedAt }: Props) {
const shouldDisplay =
- !prevTask || !isSameDay(parseDate(task.submittedAt), parseDate(prevTask.submittedAt));
+ !prevSubmittedAt || !isSameDay(parseDate(submittedAt), parseDate(prevSubmittedAt));
return (
<td className="thin nowrap text-right">
- {shouldDisplay ? <DateFormatter date={task.submittedAt} long={true} /> : ''}
+ {shouldDisplay ? <DateFormatter date={submittedAt} long={true} /> : ''}
</td>
);
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* @flow */
-import React from 'react';
-import { formatDuration } from '../utils';
-/*:: import type { Task } from '../types'; */
-
-const TaskExecutionTime = ({ task } /*: { task: Task } */) => {
- return (
- <td className="thin nowrap text-right">
- {formatDuration(task.executionTimeMs)}
- </td>
- );
-};
-
-export default TaskExecutionTime;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { formatDuration } from '../utils';
+
+interface Props {
+ ms?: number;
+}
+
+export default function TaskExecutionTime({ ms }: Props) {
+ return (
+ <td className="thin nowrap text-right">
+ {ms && formatDuration(ms)}
+ </td>
+ );
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import React from 'react';
-
-const TaskId = ({ task }) => {
- return (
- <td className="thin nowrap">
- <div className="note">
- {task.id}
- </div>
- </td>
- );
-};
-
-export default TaskId;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+
+interface Props {
+ id: string;
+}
+
+export default function TaskId({ id }: Props) {
+ return (
+ <td className="thin nowrap">
+ <div className="note">
+ {id}
+ </div>
+ </td>
+ );
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* @flow */
-import React from 'react';
-import { STATUSES } from './../constants';
-import PendingIcon from '../../../components/icons-components/PendingIcon';
-import { translate } from '../../../helpers/l10n';
-/*:: import type { Task } from '../types'; */
-
-const TaskStatus = ({ task } /*: { task: Task } */) => {
- let inner;
-
- switch (task.status) {
- case STATUSES.PENDING:
- inner = <PendingIcon />;
- break;
- case STATUSES.IN_PROGRESS:
- inner = <i className="spinner" />;
- break;
- case STATUSES.SUCCESS:
- inner = (
- <span className="badge badge-success">
- {translate('background_task.status.SUCCESS')}
- </span>
- );
- break;
- case STATUSES.FAILED:
- inner = (
- <span className="badge badge-danger">
- {translate('background_task.status.FAILED')}
- </span>
- );
- break;
- case STATUSES.CANCELED:
- inner = (
- <span className="badge badge-muted">
- {translate('background_task.status.CANCELED')}
- </span>
- );
- break;
- default:
- inner = '';
- }
-
- return (
- <td className="thin spacer-right">
- {inner}
- </td>
- );
-};
-
-export default TaskStatus;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { STATUSES } from './../constants';
+import PendingIcon from '../../../components/icons-components/PendingIcon';
+import { translate } from '../../../helpers/l10n';
+
+interface Props {
+ status: string;
+}
+
+export default function TaskStatus({ status }: Props) {
+ let inner;
+
+ switch (status) {
+ case STATUSES.PENDING:
+ inner = <PendingIcon />;
+ break;
+ case STATUSES.IN_PROGRESS:
+ inner = <i className="spinner" />;
+ break;
+ case STATUSES.SUCCESS:
+ inner = (
+ <span className="badge badge-success">
+ {translate('background_task.status.SUCCESS')}
+ </span>
+ );
+ break;
+ case STATUSES.FAILED:
+ inner = (
+ <span className="badge badge-danger">
+ {translate('background_task.status.FAILED')}
+ </span>
+ );
+ break;
+ case STATUSES.CANCELED:
+ inner = (
+ <span className="badge badge-muted">
+ {translate('background_task.status.CANCELED')}
+ </span>
+ );
+ break;
+ default:
+ inner = '';
+ }
+
+ return (
+ <td className="thin spacer-right">
+ {inner}
+ </td>
+ );
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* @flow */
-import React from 'react';
-/*:: import type { Task } from '../types'; */
-import { translate } from '../../../helpers/l10n';
-
-const TaskType = ({ task } /*: { task: Task } */) => {
- return (
- <span className="note nowrap spacer-left">
- {'['}
- {translate('background_task.type', task.type)}
- {task.incremental && ` - ${translate('incremental')}`}
- {']'}
- </span>
- );
-};
-
-export default TaskType;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { translate } from '../../../helpers/l10n';
+
+interface Props {
+ incremental?: boolean;
+ type: string;
+}
+
+export default function TaskType({ incremental, type }: Props) {
+ return (
+ <span className="note nowrap spacer-left">
+ {'['}
+ {translate('background_task.type', type)}
+ {incremental && ` - ${translate('incremental')}`}
+ {']'}
+ </span>
+ );
+}
<Task
key={task.id}
task={task}
- index={index}
tasks={tasks}
component={component}
onCancelTask={onCancelTask}
onFilterTask={onFilterTask}
+ previousTask={index > 0 ? tasks[index - 1] : undefined}
/>
)}
</tbody>
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+jest.mock('../../../../api/ce', () => ({
+ getTask: jest.fn()
+}));
+
+import * as React from 'react';
+import { mount, shallow } from 'enzyme';
+import ScannerContext from '../ScannerContext';
+import { click, doAsync } from '../../../../helpers/testUtils';
+
+const getTask = require('../../../../api/ce').getTask as jest.Mock<any>;
+
+const task = {
+ componentName: 'foo',
+ status: 'PENDING',
+ id: '123',
+ submittedAt: '2017-01-01',
+ type: 'REPORT'
+};
+
+it('renders', () => {
+ const wrapper = shallow(<ScannerContext onClose={jest.fn()} task={task} />);
+ wrapper.setState({ scannerContext: 'context' });
+ expect(wrapper).toMatchSnapshot();
+});
+
+it('closes', () => {
+ const onClose = jest.fn();
+ const wrapper = shallow(<ScannerContext onClose={onClose} task={task} />);
+ click(wrapper.find('.js-modal-close'));
+ expect(onClose).toBeCalled();
+});
+
+it('fetches scanner context on mount', () => {
+ getTask.mockImplementation(() => Promise.resolve({ scannerContext: 'context' }));
+ const wrapper = mount(<ScannerContext onClose={jest.fn()} task={task} />);
+ expect(wrapper.state()).toEqual({});
+ expect(getTask).toBeCalledWith('123', ['scannerContext']);
+ return doAsync().then(() => {
+ expect(wrapper.state()).toEqual({ scannerContext: 'context' });
+ });
+});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+jest.mock('../../../../api/ce', () => ({
+ getTask: jest.fn()
+}));
+
+import * as React from 'react';
+import { mount, shallow } from 'enzyme';
+import Stacktrace from '../Stacktrace';
+import { click, doAsync } from '../../../../helpers/testUtils';
+
+const getTask = require('../../../../api/ce').getTask as jest.Mock<any>;
+
+const task = {
+ componentName: 'foo',
+ status: 'PENDING',
+ id: '123',
+ submittedAt: '2017-01-01',
+ type: 'REPORT'
+};
+
+it('renders', () => {
+ const wrapper = shallow(<Stacktrace onClose={jest.fn()} task={task} />);
+ wrapper.setState({ loading: false, stacktrace: 'stacktrace' });
+ expect(wrapper).toMatchSnapshot();
+});
+
+it('closes', () => {
+ const onClose = jest.fn();
+ const wrapper = shallow(<Stacktrace onClose={onClose} task={task} />);
+ click(wrapper.find('.js-modal-close'));
+ expect(onClose).toBeCalled();
+});
+
+it('fetches scanner context on mount', () => {
+ getTask.mockImplementation(() => Promise.resolve({ errorStacktrace: 'stacktrace' }));
+ const wrapper = mount(<Stacktrace onClose={jest.fn()} task={task} />);
+ expect(wrapper.state()).toEqual({ loading: true });
+ expect(getTask).toBeCalledWith('123', ['stacktrace']);
+ return doAsync().then(() => {
+ expect(wrapper.state()).toEqual({ loading: false, stacktrace: 'stacktrace' });
+ });
+});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import Task from '../Task';
+
+it('renders', () => {
+ expect(
+ shallow(
+ <Task
+ onCancelTask={jest.fn()}
+ onFilterTask={jest.fn()}
+ task={{
+ componentName: 'foo',
+ status: 'PENDING',
+ id: '123',
+ submittedAt: '2017-01-01',
+ type: 'REPORT'
+ }}
+ />
+ )
+ ).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import TaskActions from '../TaskActions';
+import { click } from '../../../../helpers/testUtils';
+
+it('renders', () => {
+ expect(shallowRender()).toMatchSnapshot();
+ expect(shallowRender({ status: 'SUCCESS' })).toMatchSnapshot();
+ expect(shallowRender({ hasScannerContext: true })).toMatchSnapshot();
+ expect(shallowRender({ errorMessage: 'error!' })).toMatchSnapshot();
+ expect(shallowRender({}, { component: { key: 'foo' } })).toMatchSnapshot();
+});
+
+it('shows stack trace', () => {
+ const wrapper = shallowRender({ errorMessage: 'error!' });
+ click(wrapper.find('.js-task-show-stacktrace'));
+ expect(wrapper.find('Stacktrace')).toMatchSnapshot();
+ wrapper.find('Stacktrace').prop<Function>('onClose')();
+ expect(wrapper.find('Stacktrace')).toMatchSnapshot();
+});
+
+it('shows scanner context', () => {
+ const wrapper = shallowRender({ hasScannerContext: true });
+ click(wrapper.find('.js-task-show-scanner-context'));
+ expect(wrapper.find('ScannerContext')).toMatchSnapshot();
+ wrapper.find('ScannerContext').prop<Function>('onClose')();
+ expect(wrapper.find('ScannerContext')).toMatchSnapshot();
+});
+
+function shallowRender(fields?: any, props?: any) {
+ return shallow(
+ <TaskActions
+ onCancelTask={jest.fn()}
+ onFilterTask={jest.fn()}
+ task={{
+ componentName: 'foo',
+ status: 'PENDING',
+ id: '123',
+ submittedAt: '2017-01-01',
+ type: 'REPORT',
+ ...fields
+ }}
+ {...props}
+ />
+ );
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* @flow */
-import React from 'react';
-import { shallow } from 'enzyme';
-import TaskComponent from '../TaskComponent';
-
-it('renders', () => {
- const task = {
- componentKey: 'foo',
- componentName: 'foo',
- componentQualifier: 'TRK',
- id: 'bar',
- organization: 'org',
- type: 'REPORT'
- };
- expect(shallow(<TaskComponent task={task} />)).toMatchSnapshot();
- expect(shallow(<TaskComponent task={{ ...task, componentKey: undefined }} />)).toMatchSnapshot();
-});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import TaskComponent from '../TaskComponent';
+
+it('renders', () => {
+ const task = {
+ componentKey: 'foo',
+ componentName: 'foo',
+ componentQualifier: 'TRK',
+ id: 'bar',
+ organization: 'org',
+ status: 'PENDING',
+ submittedAt: '2017-01-01',
+ type: 'REPORT'
+ };
+ expect(shallow(<TaskComponent task={task} />)).toMatchSnapshot();
+ expect(shallow(<TaskComponent task={{ ...task, componentKey: undefined }} />)).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import TaskDate from '../TaskDate';
+
+it('renders', () => {
+ expect(shallow(<TaskDate />)).toMatchSnapshot();
+ expect(shallow(<TaskDate date="2017-01-01" />)).toMatchSnapshot();
+ expect(shallow(<TaskDate date="2017-01-01" baseDate="2017-01-01" />)).toMatchSnapshot();
+ expect(shallow(<TaskDate date="2017-01-05" baseDate="2017-01-01" />)).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import TaskDay from '../TaskDay';
+
+it('renders', () => {
+ expect(
+ shallow(<TaskDay submittedAt="2017-01-02" prevSubmittedAt="2017-01-01" />)
+ ).toMatchSnapshot();
+
+ expect(
+ shallow(<TaskDay submittedAt="2017-01-01" prevSubmittedAt="2017-01-01" />)
+ ).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import TaskExecutionTime from '../TaskExecutionTime';
+
+it('renders', () => {
+ expect(shallow(<TaskExecutionTime />)).toMatchSnapshot();
+ expect(shallow(<TaskExecutionTime ms={12345} />)).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import TaskId from '../TaskId';
+
+it('renders', () => {
+ expect(shallow(<TaskId id="173" />)).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import TaskStatus from '../TaskStatus';
+
+it('renders', () => {
+ expect.assertions(5);
+ const statuses = ['PENDING', 'IN_PROGRESS', 'SUCCESS', 'FAILED', 'CANCELED'];
+ statuses.forEach(status => {
+ expect(shallow(<TaskStatus status={status} />)).toMatchSnapshot();
+ });
+});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* @flow */
-import React from 'react';
-import { shallow } from 'enzyme';
-import TaskType from '../TaskType';
-
-it('renders', () => {
- expect(shallow(<TaskType task={{ id: 'foo' }} />)).toMatchSnapshot();
- expect(shallow(<TaskType task={{ incremental: true, id: 'foo' }} />)).toMatchSnapshot();
-});
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import TaskType from '../TaskType';
+
+it('renders', () => {
+ expect(shallow(<TaskType type="REPORT" />)).toMatchSnapshot();
+ expect(shallow(<TaskType incremental={true} type="REPORT" />)).toMatchSnapshot();
+});
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<Modal
+ ariaHideApp={true}
+ bodyOpenClassName="ReactModal__Body--open"
+ className="modal modal-large"
+ closeTimeoutMS={0}
+ contentLabel="scanner context"
+ isOpen={true}
+ onRequestClose={[Function]}
+ overlayClassName="modal-overlay"
+ parentSelector={[Function]}
+ portalClassName="ReactModalPortal"
+ shouldCloseOnOverlayClick={true}
+>
+ <div
+ className="modal-head"
+ >
+ <h2>
+ background_tasks.scanner_context
+ :
+ foo
+ [
+ background_task.type.REPORT
+ ]
+ </h2>
+ </div>
+ <div
+ className="modal-body modal-container"
+ >
+ <pre
+ className="js-task-scanner-context"
+ >
+ context
+ </pre>
+ </div>
+ <div
+ className="modal-foot"
+ >
+ <a
+ className="js-modal-close"
+ href="#"
+ onClick={[Function]}
+ >
+ close
+ </a>
+ </div>
+</Modal>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<Modal
+ ariaHideApp={true}
+ bodyOpenClassName="ReactModal__Body--open"
+ className="modal modal-large"
+ closeTimeoutMS={0}
+ contentLabel="stacktrace"
+ isOpen={true}
+ onRequestClose={[Function]}
+ overlayClassName="modal-overlay"
+ parentSelector={[Function]}
+ portalClassName="ReactModalPortal"
+ shouldCloseOnOverlayClick={true}
+>
+ <div
+ className="modal-head"
+ >
+ <h2>
+ background_tasks.error_stacktrace
+ :
+ foo
+ [
+ background_task.type.REPORT
+ ]
+ </h2>
+ </div>
+ <div
+ className="modal-body modal-container"
+ >
+ <div>
+ <h4
+ className="spacer-bottom"
+ >
+ background_tasks.error_stacktrace
+ </h4>
+ <pre
+ className="js-task-stacktrace"
+ >
+ stacktrace
+ </pre>
+ </div>
+ </div>
+ <div
+ className="modal-foot"
+ >
+ <a
+ className="js-modal-close"
+ href="#"
+ onClick={[Function]}
+ >
+ close
+ </a>
+ </div>
+</Modal>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<tr>
+ <TaskStatus
+ status="PENDING"
+ />
+ <TaskComponent
+ task={
+ Object {
+ "componentName": "foo",
+ "id": "123",
+ "status": "PENDING",
+ "submittedAt": "2017-01-01",
+ "type": "REPORT",
+ }
+ }
+ />
+ <TaskId
+ id="123"
+ />
+ <TaskDay
+ submittedAt="2017-01-01"
+ />
+ <TaskDate
+ date="2017-01-01"
+ />
+ <TaskDate
+ baseDate="2017-01-01"
+ />
+ <TaskDate
+ baseDate="2017-01-01"
+ />
+ <TaskExecutionTime />
+ <TaskActions
+ onCancelTask={[Function]}
+ onFilterTask={[Function]}
+ task={
+ Object {
+ "componentName": "foo",
+ "id": "123",
+ "status": "PENDING",
+ "submittedAt": "2017-01-01",
+ "type": "REPORT",
+ }
+ }
+ />
+</tr>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<td
+ className="thin nowrap"
+>
+ <div
+ className="dropdown js-task-action"
+ >
+ <button
+ className="dropdown-toggle"
+ data-toggle="dropdown"
+ >
+ <i
+ className="icon-dropdown"
+ />
+ </button>
+ <ul
+ className="dropdown-menu dropdown-menu-right"
+ >
+ <li>
+ <a
+ className="js-task-filter"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-filter icon-gray"
+ />
+ background_tasks.filter_by_component_x.foo
+ </a>
+ </li>
+ <li>
+ <a
+ className="js-task-cancel"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-delete"
+ />
+ background_tasks.cancel_task
+ </a>
+ </li>
+ </ul>
+ </div>
+</td>
+`;
+
+exports[`renders 2`] = `
+<td
+ className="thin nowrap"
+>
+ <div
+ className="dropdown js-task-action"
+ >
+ <button
+ className="dropdown-toggle"
+ data-toggle="dropdown"
+ >
+ <i
+ className="icon-dropdown"
+ />
+ </button>
+ <ul
+ className="dropdown-menu dropdown-menu-right"
+ >
+ <li>
+ <a
+ className="js-task-filter"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-filter icon-gray"
+ />
+ background_tasks.filter_by_component_x.foo
+ </a>
+ </li>
+ </ul>
+ </div>
+</td>
+`;
+
+exports[`renders 3`] = `
+<td
+ className="thin nowrap"
+>
+ <div
+ className="dropdown js-task-action"
+ >
+ <button
+ className="dropdown-toggle"
+ data-toggle="dropdown"
+ >
+ <i
+ className="icon-dropdown"
+ />
+ </button>
+ <ul
+ className="dropdown-menu dropdown-menu-right"
+ >
+ <li>
+ <a
+ className="js-task-filter"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-filter icon-gray"
+ />
+ background_tasks.filter_by_component_x.foo
+ </a>
+ </li>
+ <li>
+ <a
+ className="js-task-cancel"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-delete"
+ />
+ background_tasks.cancel_task
+ </a>
+ </li>
+ <li>
+ <a
+ className="js-task-show-scanner-context"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-list icon-gray"
+ />
+ background_tasks.show_scanner_context
+ </a>
+ </li>
+ </ul>
+ </div>
+</td>
+`;
+
+exports[`renders 4`] = `
+<td
+ className="thin nowrap"
+>
+ <div
+ className="dropdown js-task-action"
+ >
+ <button
+ className="dropdown-toggle"
+ data-toggle="dropdown"
+ >
+ <i
+ className="icon-dropdown"
+ />
+ </button>
+ <ul
+ className="dropdown-menu dropdown-menu-right"
+ >
+ <li>
+ <a
+ className="js-task-filter"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-filter icon-gray"
+ />
+ background_tasks.filter_by_component_x.foo
+ </a>
+ </li>
+ <li>
+ <a
+ className="js-task-cancel"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-delete"
+ />
+ background_tasks.cancel_task
+ </a>
+ </li>
+ <li>
+ <a
+ className="js-task-show-stacktrace"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-list icon-red"
+ />
+ background_tasks.show_stacktrace
+ </a>
+ </li>
+ </ul>
+ </div>
+</td>
+`;
+
+exports[`renders 5`] = `
+<td
+ className="thin nowrap"
+>
+ <div
+ className="dropdown js-task-action"
+ >
+ <button
+ className="dropdown-toggle"
+ data-toggle="dropdown"
+ >
+ <i
+ className="icon-dropdown"
+ />
+ </button>
+ <ul
+ className="dropdown-menu dropdown-menu-right"
+ >
+ <li>
+ <a
+ className="js-task-cancel"
+ href="#"
+ onClick={[Function]}
+ >
+ <i
+ className="spacer-right icon-delete"
+ />
+ background_tasks.cancel_task
+ </a>
+ </li>
+ </ul>
+ </div>
+</td>
+`;
+
+exports[`shows scanner context 1`] = `
+<ScannerContext
+ onClose={[Function]}
+ task={
+ Object {
+ "componentName": "foo",
+ "hasScannerContext": true,
+ "id": "123",
+ "status": "PENDING",
+ "submittedAt": "2017-01-01",
+ "type": "REPORT",
+ }
+ }
+/>
+`;
+
+exports[`shows scanner context 2`] = `undefined`;
+
+exports[`shows stack trace 1`] = `
+<Stacktrace
+ onClose={[Function]}
+ task={
+ Object {
+ "componentName": "foo",
+ "errorMessage": "error!",
+ "id": "123",
+ "status": "PENDING",
+ "submittedAt": "2017-01-01",
+ "type": "REPORT",
+ }
+ }
+/>
+`;
+
+exports[`shows stack trace 2`] = `undefined`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders 1`] = `
-<td>
- <span
- className="little-spacer-right"
- >
- <QualifierIcon
- qualifier="TRK"
- />
- </span>
- <Connect(Organization)
- organizationKey="org"
- />
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to={
- Object {
- "pathname": "/dashboard",
- "query": Object {
- "id": "foo",
- },
- }
- }
- >
- foo
- </Link>
- <TaskType
- task={
- Object {
- "componentKey": "foo",
- "componentName": "foo",
- "componentQualifier": "TRK",
- "id": "bar",
- "organization": "org",
- "type": "REPORT",
- }
- }
- />
-</td>
-`;
-
-exports[`renders 2`] = `
-<td>
- <span
- className="note"
- >
- bar
- </span>
- <TaskType
- task={
- Object {
- "componentKey": undefined,
- "componentName": "foo",
- "componentQualifier": "TRK",
- "id": "bar",
- "organization": "org",
- "type": "REPORT",
- }
- }
- />
-</td>
-`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<td>
+ <span
+ className="little-spacer-right"
+ >
+ <QualifierIcon
+ qualifier="TRK"
+ />
+ </span>
+ <Connect(Organization)
+ organizationKey="org"
+ />
+ <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/dashboard",
+ "query": Object {
+ "id": "foo",
+ },
+ }
+ }
+ >
+ foo
+ </Link>
+ <TaskType
+ type="REPORT"
+ />
+</td>
+`;
+
+exports[`renders 2`] = `
+<td>
+ <span
+ className="note"
+ >
+ bar
+ </span>
+ <TaskType
+ type="REPORT"
+ />
+</td>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<td
+ className="thin nowrap text-right"
+/>
+`;
+
+exports[`renders 2`] = `
+<td
+ className="thin nowrap text-right"
+>
+ <TimeFormatter
+ date={2016-12-31T23:00:00.000Z}
+ long={true}
+ />
+</td>
+`;
+
+exports[`renders 3`] = `
+<td
+ className="thin nowrap text-right"
+>
+ <TimeFormatter
+ date={2016-12-31T23:00:00.000Z}
+ long={true}
+ />
+</td>
+`;
+
+exports[`renders 4`] = `
+<td
+ className="thin nowrap text-right"
+>
+ <span
+ className="text-warning little-spacer-right"
+ >
+ (+4d)
+ </span>
+ <TimeFormatter
+ date={2017-01-04T23:00:00.000Z}
+ long={true}
+ />
+</td>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<td
+ className="thin nowrap text-right"
+>
+ <DateFormatter
+ date="2017-01-02"
+ long={true}
+ />
+</td>
+`;
+
+exports[`renders 2`] = `
+<td
+ className="thin nowrap text-right"
+/>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<td
+ className="thin nowrap text-right"
+/>
+`;
+
+exports[`renders 2`] = `
+<td
+ className="thin nowrap text-right"
+>
+ 12s
+</td>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<td
+ className="thin nowrap"
+>
+ <div
+ className="note"
+ >
+ 173
+ </div>
+</td>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<td
+ className="thin spacer-right"
+>
+ <PendingIcon />
+</td>
+`;
+
+exports[`renders 2`] = `
+<td
+ className="thin spacer-right"
+>
+ <i
+ className="spinner"
+ />
+</td>
+`;
+
+exports[`renders 3`] = `
+<td
+ className="thin spacer-right"
+>
+ <span
+ className="badge badge-success"
+ >
+ background_task.status.SUCCESS
+ </span>
+</td>
+`;
+
+exports[`renders 4`] = `
+<td
+ className="thin spacer-right"
+>
+ <span
+ className="badge badge-danger"
+ >
+ background_task.status.FAILED
+ </span>
+</td>
+`;
+
+exports[`renders 5`] = `
+<td
+ className="thin spacer-right"
+>
+ <span
+ className="badge badge-muted"
+ >
+ background_task.status.CANCELED
+ </span>
+</td>
+`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders 1`] = `
-<span
- className="note nowrap spacer-left"
->
- [
- background_task.type.
- ]
-</span>
-`;
-
-exports[`renders 2`] = `
-<span
- className="note nowrap spacer-left"
->
- [
- background_task.type.
- - incremental
- ]
-</span>
-`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<span
+ className="note nowrap spacer-left"
+>
+ [
+ background_task.type.REPORT
+ ]
+</span>
+`;
+
+exports[`renders 2`] = `
+<span
+ className="note nowrap spacer-left"
+>
+ [
+ background_task.type.REPORT
+ - incremental
+ ]
+</span>
+`;
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-export interface ITask {
- incremental: boolean;
+export interface Task {
+ componentKey?: string;
+ componentName?: string;
+ componentQualifier?: string;
+ errorMessage?: string;
+ executedAt?: string;
+ executionTimeMs?: number;
+ hasScannerContext?: boolean;
+ incremental?: boolean;
id: string;
+ organization?: string;
+ startedAt?: string;
+ status: string;
submittedAt: string;
+ type: string;
}