]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9702 rewrite some background tasks components
authorStas Vilchik <stas.vilchik@sonarsource.com>
Fri, 1 Sep 2017 09:18:10 +0000 (11:18 +0200)
committerJanos Gyerik <janos.gyerik@sonarsource.com>
Tue, 12 Sep 2017 09:34:56 +0000 (11:34 +0200)
48 files changed:
server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/Task.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskDate.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/TaskDay.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Task-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskExecutionTime-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskId-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskStatus-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/ScannerContext-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Stacktrace-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Task-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskActions-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDate-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskExecutionTime-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskId-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskStatus-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.js.snap [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/types.ts

diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.js b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.js
deleted file mode 100644 (file)
index f5286bc..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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>
-    );
-  }
-}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx
new file mode 100644 (file)
index 0000000..c15d38e
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * 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>
+    );
+  }
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.js
deleted file mode 100644 (file)
index 9f00597..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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>
-    );
-  }
-}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx
new file mode 100644 (file)
index 0000000..1397e58
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * 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>
+    );
+  }
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Task.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Task.js
deleted file mode 100644 (file)
index 3c93857..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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>
-    );
-  }
-}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx
new file mode 100644 (file)
index 0000000..701fffd
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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>
+  );
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.js
deleted file mode 100644 (file)
index 03b8be8..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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>&nbsp;</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>
-    );
-  }
-}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
new file mode 100644 (file)
index 0000000..e75801a
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * 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>&nbsp;</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>
+    );
+  }
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js
deleted file mode 100644 (file)
index 1123a8d..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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>
-  );
-}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
new file mode 100644 (file)
index 0000000..07bb92d
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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>
+  );
+}
index 525d8bbc4204ea529b610a95c7d814bc23b09419..6cebb2f9af64efc033ead3f232979418c7919d85 100644 (file)
@@ -22,15 +22,15 @@ import TimeFormatter from '../../../components/intl/TimeFormatter';
 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;
 
@@ -38,7 +38,7 @@ export default function TaskDate({ date, baseDate }: Props) {
     <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>
   );
 }
index c2d8911358b59af98d39a520f8f127eb266f3a23..46bb3879a6a7e3914f1389ff75ab91a660614f82 100644 (file)
 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>
   );
 }
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.js
deleted file mode 100644 (file)
index ee2eedb..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskExecutionTime.tsx
new file mode 100644 (file)
index 0000000..55baca3
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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>
+  );
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.js
deleted file mode 100644 (file)
index b4e705d..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskId.tsx
new file mode 100644 (file)
index 0000000..cd2215d
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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>
+  );
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.js
deleted file mode 100644 (file)
index b2ef518..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskStatus.tsx
new file mode 100644 (file)
index 0000000..87b2a7d
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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>
+  );
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.js
deleted file mode 100644 (file)
index da9f6c3..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx
new file mode 100644 (file)
index 0000000..5769bdb
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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>
+  );
+}
index fef3f83eea7888b76cd96261327ea765d9abbaa5..ebbfb3f253e1e908388f92d560a0b060439019d9 100644 (file)
@@ -82,11 +82,11 @@ export default class Tasks extends React.PureComponent {
             <Task
               key={task.id}
               task={task}
-              index={index}
               tasks={tasks}
               component={component}
               onCancelTask={onCancelTask}
               onFilterTask={onFilterTask}
+              previousTask={index > 0 ? tasks[index - 1] : undefined}
             />
           )}
         </tbody>
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx
new file mode 100644 (file)
index 0000000..af71941
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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' });
+  });
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx
new file mode 100644 (file)
index 0000000..979af8d
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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' });
+  });
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Task-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Task-test.tsx
new file mode 100644 (file)
index 0000000..a928e53
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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();
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskActions-test.tsx
new file mode 100644 (file)
index 0000000..940fe33
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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}
+    />
+  );
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js
deleted file mode 100644 (file)
index b1c54c7..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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();
-});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.tsx
new file mode 100644 (file)
index 0000000..5f12acf
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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();
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx
new file mode 100644 (file)
index 0000000..7e37c8d
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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();
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx
new file mode 100644 (file)
index 0000000..2413a56
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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();
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskExecutionTime-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskExecutionTime-test.tsx
new file mode 100644 (file)
index 0000000..77bd3e7
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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();
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskId-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskId-test.tsx
new file mode 100644 (file)
index 0000000..63cca20
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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();
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskStatus-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskStatus-test.tsx
new file mode 100644 (file)
index 0000000..e404108
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * 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();
+  });
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.js b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.js
deleted file mode 100644 (file)
index ed32df3..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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();
-});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.tsx
new file mode 100644 (file)
index 0000000..1c0e961
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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();
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/ScannerContext-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/ScannerContext-test.tsx.snap
new file mode 100644 (file)
index 0000000..8b3ce1e
--- /dev/null
@@ -0,0 +1,50 @@
+// 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>
+`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Stacktrace-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Stacktrace-test.tsx.snap
new file mode 100644 (file)
index 0000000..d1fad07
--- /dev/null
@@ -0,0 +1,57 @@
+// 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>
+`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Task-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Task-test.tsx.snap
new file mode 100644 (file)
index 0000000..0fab9af
--- /dev/null
@@ -0,0 +1,49 @@
+// 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>
+`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskActions-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskActions-test.tsx.snap
new file mode 100644 (file)
index 0000000..9de3ec8
--- /dev/null
@@ -0,0 +1,272 @@
+// 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`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap
deleted file mode 100644 (file)
index 703c9f2..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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>
-`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap
new file mode 100644 (file)
index 0000000..b8fec51
--- /dev/null
@@ -0,0 +1,46 @@
+// 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>
+`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDate-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDate-test.tsx.snap
new file mode 100644 (file)
index 0000000..2222e54
--- /dev/null
@@ -0,0 +1,45 @@
+// 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>
+`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap
new file mode 100644 (file)
index 0000000..7fccb03
--- /dev/null
@@ -0,0 +1,18 @@
+// 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"
+/>
+`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskExecutionTime-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskExecutionTime-test.tsx.snap
new file mode 100644 (file)
index 0000000..536d0bf
--- /dev/null
@@ -0,0 +1,15 @@
+// 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>
+`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskId-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskId-test.tsx.snap
new file mode 100644 (file)
index 0000000..0fe2275
--- /dev/null
@@ -0,0 +1,13 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<td
+  className="thin nowrap"
+>
+  <div
+    className="note"
+  >
+    173
+  </div>
+</td>
+`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskStatus-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskStatus-test.tsx.snap
new file mode 100644 (file)
index 0000000..02e803c
--- /dev/null
@@ -0,0 +1,55 @@
+// 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>
+`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.js.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.js.snap
deleted file mode 100644 (file)
index 92b09f7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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>
-`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap
new file mode 100644 (file)
index 0000000..649856a
--- /dev/null
@@ -0,0 +1,22 @@
+// 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>
+`;
index c517f20139929a161ed9b33567fe2cd2632df25c..b0e1003be0340297daff1b520b4f965a4837df5c 100644 (file)
  * 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;
 }