aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-08-30 11:54:03 +0200
committersonartech <sonartech@sonarsource.com>2018-10-10 09:23:03 +0200
commit6a08bacfe5b6d692e83e493246efad11f22ff70e (patch)
tree19275740024e3b5a334aa0a0829d739db9930a76 /server/sonar-web/src/main/js
parentf31eb69eb58e1be3005a93d432c9136e1eee289d (diff)
downloadsonarqube-6a08bacfe5b6d692e83e493246efad11f22ff70e.tar.gz
sonarqube-6a08bacfe5b6d692e83e493246efad11f22ff70e.zip
move Task type to app/types
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/api/ce.ts31
-rw-r--r--server/sonar-web/src/main/js/app/components/ComponentContainer.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/types.ts25
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js5
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Task.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Task-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Task-test.tsx.snap2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/types.ts39
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/utils.js4
22 files changed, 59 insertions, 107 deletions
diff --git a/server/sonar-web/src/main/js/api/ce.ts b/server/sonar-web/src/main/js/api/ce.ts
index 21eaff0990d..b72d148873e 100644
--- a/server/sonar-web/src/main/js/api/ce.ts
+++ b/server/sonar-web/src/main/js/api/ce.ts
@@ -19,34 +19,7 @@
*/
import { getJSON, post, RequestData } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-
-export interface PendingTask {
- branch?: string;
- branchType?: string;
- componentKey: string;
- componentName: string;
- componentQualifier: string;
- id: string;
- logs: boolean;
- organization: string;
- pullRequest?: string;
- pullRequestTitle?: string;
- status: string;
- submittedAt: Date;
- submitterLogin?: string;
- type: string;
-}
-
-export interface Task extends PendingTask {
- analysisId?: string;
- errorMessage?: string;
- errorType?: string;
- executionTimeMs: number;
- executedAt: Date;
- hasErrorStacktrace: boolean;
- hasScannerContext: boolean;
- startedAt: Date;
-}
+import { Task } from '../app/types';
export function getActivity(data: RequestData): Promise<any> {
return getJSON('/api/ce/activity', data);
@@ -74,7 +47,7 @@ export function cancelAllTasks(): Promise<any> {
export function getTasksForComponent(
componentKey: string
-): Promise<{ queue: PendingTask[]; current: Task }> {
+): Promise<{ queue: Task[]; current: Task }> {
return getJSON('/api/ce/component', { componentKey }).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
index 346a52d154d..cf3781a495a 100644
--- a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
@@ -23,10 +23,10 @@ import { connect } from 'react-redux';
import { differenceBy } from 'lodash';
import ComponentContainerNotFound from './ComponentContainerNotFound';
import ComponentNav from './nav/component/ComponentNav';
-import { Component, BranchLike, Measure } from '../types';
+import { Component, BranchLike, Measure, Task } from '../types';
import handleRequiredAuthorization from '../utils/handleRequiredAuthorization';
import { getBranches, getPullRequests } from '../../api/branches';
-import { Task, getTasksForComponent, PendingTask } from '../../api/ce';
+import { getTasksForComponent } from '../../api/ce';
import { getComponentData } from '../../api/components';
import { getMeasures } from '../../api/measures';
import { getComponentNavigation } from '../../api/nav';
@@ -57,7 +57,7 @@ interface State {
currentTask?: Task;
isPending: boolean;
loading: boolean;
- tasksInProgress?: PendingTask[];
+ tasksInProgress?: Task[];
}
const FETCH_STATUS_WAIT_TIME = 3000;
@@ -271,12 +271,12 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
: undefined;
};
- getPendingTasks = (pendingTasks: PendingTask[], branchLike?: BranchLike) => {
+ getPendingTasks = (pendingTasks: Task[], branchLike?: BranchLike) => {
return pendingTasks.filter(task => this.isSameBranch(task, branchLike));
};
isSameBranch = (
- task: Pick<PendingTask, 'branch' | 'branchType' | 'pullRequest'>,
+ task: Pick<Task, 'branch' | 'branchType' | 'pullRequest'>,
branchLike?: BranchLike
) => {
if (branchLike && !isMainBranch(branchLike)) {
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
index 18a71ecb3e8..7d5ca616c2f 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
@@ -21,7 +21,7 @@ import * as React from 'react';
import { shallow, mount } from 'enzyme';
import { ComponentContainer } from '../ComponentContainer';
import { getBranches, getPullRequests } from '../../../api/branches';
-import { getTasksForComponent, Task } from '../../../api/ce';
+import { getTasksForComponent } from '../../../api/ce';
import { getComponentData } from '../../../api/components';
import { getComponentNavigation } from '../../../api/nav';
import {
@@ -30,7 +30,8 @@ import {
LongLivingBranch,
PullRequest,
BranchType,
- Visibility
+ Visibility,
+ Task
} from '../../types';
import { STATUSES } from '../../../apps/background-tasks/constants';
import { waitAndUpdate } from '../../../helpers/testUtils';
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
index 7024131f79b..b99e3f10d61 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
@@ -24,9 +24,8 @@ import ComponentNavMenu from './ComponentNavMenu';
import ComponentNavBgTaskNotif from './ComponentNavBgTaskNotif';
import RecentHistory from '../../RecentHistory';
import * as theme from '../../../theme';
-import { BranchLike, Component, Measure } from '../../../types';
+import { BranchLike, Component, Measure, Task } from '../../../types';
import ContextNavBar from '../../../../components/nav/ContextNavBar';
-import { Task } from '../../../../api/ce';
import { STATUSES } from '../../../../apps/background-tasks/constants';
import './ComponentNav.css';
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx
index 3ec72350517..14d5573d875 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx
@@ -23,11 +23,10 @@ import { FormattedMessage } from 'react-intl';
import ComponentNavLicenseNotif from './ComponentNavLicenseNotif';
import NavBarNotif from '../../../../components/nav/NavBarNotif';
import PendingIcon from '../../../../components/icons-components/PendingIcon';
-import { Component } from '../../../types';
+import { Component, Task } from '../../../types';
import { STATUSES } from '../../../../apps/background-tasks/constants';
import { getComponentBackgroundTaskUrl } from '../../../../helpers/urls';
import { hasMessage, translate } from '../../../../helpers/l10n';
-import { Task } from '../../../../api/ce';
interface Props {
component: Component;
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx
index 9a251ce316d..112158e5b2f 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx
@@ -22,8 +22,8 @@ import { Link } from 'react-router';
import * as PropTypes from 'prop-types';
import NavBarNotif from '../../../../components/nav/NavBarNotif';
import { translate } from '../../../../helpers/l10n';
-import { Task } from '../../../../api/ce';
import { isValidLicense } from '../../../../api/marketplace';
+import { Task } from '../../../types';
interface Props {
currentTask?: Task;
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
index b027ea1fcb9..07fece7737d 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
@@ -27,7 +27,7 @@ jest.mock('../../../../../helpers/l10n', () => {
import * as React from 'react';
import { shallow } from 'enzyme';
import ComponentNavBgTaskNotif from '../ComponentNavBgTaskNotif';
-import { Task } from '../../../../../api/ce';
+import { Task } from '../../../../types';
const component = {
analysisDate: '2017-01-02T00:00:00.000Z',
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx
index 4fb9cb4214b..c2440b8e197 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx
@@ -20,9 +20,9 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import ComponentNavLicenseNotif from '../ComponentNavLicenseNotif';
-import { Task } from '../../../../../api/ce';
import { isValidLicense } from '../../../../../api/marketplace';
import { waitAndUpdate } from '../../../../../helpers/testUtils';
+import { Task } from '../../../../types';
jest.mock('../../../../../helpers/l10n', () => {
const l10n = require.requireActual('../../../../../helpers/l10n');
diff --git a/server/sonar-web/src/main/js/app/types.ts b/server/sonar-web/src/main/js/app/types.ts
index 435f7206b0f..6d6965e1fce 100644
--- a/server/sonar-web/src/main/js/app/types.ts
+++ b/server/sonar-web/src/main/js/app/types.ts
@@ -720,6 +720,31 @@ export interface SubscriptionPlan {
price: number;
}
+export interface Task {
+ analysisId?: string;
+ branch?: string;
+ branchType?: string;
+ componentKey?: string;
+ componentName?: string;
+ componentQualifier?: string;
+ errorMessage?: string;
+ errorType?: string;
+ executedAt?: string;
+ executionTimeMs?: number;
+ hasErrorStacktrace?: boolean;
+ hasScannerContext?: boolean;
+ id: string;
+ logs?: boolean;
+ organization: string;
+ pullRequest?: string;
+ pullRequestTitle?: string;
+ startedAt?: string;
+ status: string;
+ submittedAt: string;
+ submitterLogin?: string;
+ type: string;
+}
+
export interface TestCase {
coveredLines: number;
durationInMs: number;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js
index 20329eafbaf..50b47f89b62 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js
@@ -42,7 +42,6 @@ import { fetchOrganizations } from '../../../store/rootActions';
import { translate } from '../../../helpers/l10n';
import { parseAsDate } from '../../../helpers/query';
import { toShortNotSoISOString } from '../../../helpers/dates';
-/*:: import type { Task } from '../types'; */
import '../background-tasks.css';
/*::
@@ -174,7 +173,7 @@ class BackgroundTasksApp extends React.PureComponent {
});
}
- handleCancelTask(task /*: Task */) {
+ handleCancelTask(task) {
this.setState({ loading: true });
cancelTaskAPI(task.id).then(nextTask => {
@@ -185,7 +184,7 @@ class BackgroundTasksApp extends React.PureComponent {
});
}
- handleFilterTask(task /*: Task */) {
+ handleFilterTask(task) {
this.handleFilterUpdate({ query: task.componentKey });
}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx
index 3d7f0fc682d..4242bb2b3e3 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx
@@ -19,7 +19,7 @@
*/
import * as React from 'react';
import { translateWithParameters } from '../../../helpers/l10n';
-import { Task } from '../types';
+import { Task } from '../../../app/types';
const LIMIT = 1000;
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
index 7e66a3e007e..6fc2bb4e920 100644
--- 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
@@ -20,12 +20,12 @@
import * as React from 'react';
import { getTask } from '../../../api/ce';
import { translate } from '../../../helpers/l10n';
-import { Task } from '../types';
import Modal from '../../../components/controls/Modal';
+import { Task } from '../../../app/types';
interface Props {
onClose: () => void;
- task: Task;
+ task: Pick<Task, 'componentName' | 'id' | 'type'>;
}
interface State {
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
index 21cdf7ec937..51d2c99875b 100644
--- 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
@@ -21,11 +21,11 @@ import * as React from 'react';
import { getTask } from '../../../api/ce';
import { translate } from '../../../helpers/l10n';
import Modal from '../../../components/controls/Modal';
-import { Task } from '../types';
+import { Task } from '../../../app/types';
interface Props {
onClose: () => void;
- task: Task;
+ task: Pick<Task, 'componentName' | 'errorMessage' | 'id' | 'type'>;
}
interface State {
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
index aec46467931..c51a705688b 100644
--- 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
@@ -26,14 +26,14 @@ import TaskDate from './TaskDate';
import TaskId from './TaskId';
import TaskStatus from './TaskStatus';
import TaskSubmitter from './TaskSubmitter';
-import { Task as ITask } from '../types';
+import { Task as TaskType } from '../../../app/types';
interface Props {
component?: {};
- onCancelTask: (task: ITask) => void;
- onFilterTask: (task: ITask) => void;
- task: ITask;
- previousTask?: ITask;
+ onCancelTask: (task: TaskType) => void;
+ onFilterTask: (task: TaskType) => void;
+ task: TaskType;
+ previousTask?: TaskType;
}
export default function Task(props: Props) {
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
index 02b367047bf..68587cd0ad9 100644
--- 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
@@ -22,8 +22,8 @@ import ScannerContext from './ScannerContext';
import Stacktrace from './Stacktrace';
import { STATUSES } from '../constants';
import { translate, translateWithParameters } from '../../../helpers/l10n';
-import { Task } from '../types';
import ActionsDropdown, { ActionsDropdownItem } from '../../../components/controls/ActionsDropdown';
+import { Task } from '../../../app/types';
interface Props {
component?: {};
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
index c3afacc324a..363fb4eae7a 100644
--- 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
@@ -20,7 +20,6 @@
import * as React from 'react';
import { Link } from 'react-router';
import TaskType from './TaskType';
-import { Task } from '../types';
import QualifierIcon from '../../../components/icons-components/QualifierIcon';
import Organization from '../../../components/shared/Organization';
import {
@@ -32,6 +31,7 @@ import {
import ShortLivingBranchIcon from '../../../components/icons-components/ShortLivingBranchIcon';
import LongLivingBranchIcon from '../../../components/icons-components/LongLivingBranchIcon';
import PullRequestIcon from '../../../components/icons-components/PullRequestIcon';
+import { Task } from '../../../app/types';
interface Props {
task: Task;
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
index e2fb32157e2..6e6e8e6f53b 100644
--- 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
@@ -31,10 +31,7 @@ const getTask = require('../../../../api/ce').getTask as jest.Mock<any>;
const task = {
componentName: 'foo',
- status: 'PENDING',
id: '123',
- submittedAt: '2017-01-01',
- submitterLogin: 'yoda',
type: 'REPORT'
};
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
index 96ccc7077d0..d68d7afc07b 100644
--- 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
@@ -31,10 +31,7 @@ const getTask = require('../../../../api/ce').getTask as jest.Mock<any>;
const task = {
componentName: 'foo',
- status: 'PENDING',
id: '123',
- submittedAt: '2017-01-01',
- submitterLogin: 'yoda',
type: 'REPORT'
};
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
index 9ff179bbe17..5108d020db1 100644
--- 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
@@ -29,8 +29,9 @@ it('renders', () => {
onFilterTask={jest.fn()}
task={{
componentName: 'foo',
- status: 'PENDING',
id: '123',
+ organization: 'org',
+ status: 'PENDING',
submittedAt: '2017-01-01',
submitterLogin: 'yoda',
type: 'REPORT'
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
index 0fffe27edc9..fc95e82d35c 100644
--- 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
@@ -10,6 +10,7 @@ exports[`renders 1`] = `
Object {
"componentName": "foo",
"id": "123",
+ "organization": "org",
"status": "PENDING",
"submittedAt": "2017-01-01",
"submitterLogin": "yoda",
@@ -43,6 +44,7 @@ exports[`renders 1`] = `
Object {
"componentName": "foo",
"id": "123",
+ "organization": "org",
"status": "PENDING",
"submittedAt": "2017-01-01",
"submitterLogin": "yoda",
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/types.ts b/server/sonar-web/src/main/js/apps/background-tasks/types.ts
deleted file mode 100644
index 220240365e5..00000000000
--- a/server/sonar-web/src/main/js/apps/background-tasks/types.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2018 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.
- */
-export interface Task {
- branch?: string;
- branchType?: string;
- componentKey?: string;
- componentName?: string;
- componentQualifier?: string;
- errorMessage?: string;
- executedAt?: string;
- executionTimeMs?: number;
- hasScannerContext?: boolean;
- id: string;
- organization?: string;
- pullRequest?: string;
- pullRequestTitle?: string;
- startedAt?: string;
- status: string;
- submittedAt: string;
- submitterLogin?: string;
- type: string;
-}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/utils.js b/server/sonar-web/src/main/js/apps/background-tasks/utils.js
index 4f92fa752db..a023e7176e6 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/utils.js
+++ b/server/sonar-web/src/main/js/apps/background-tasks/utils.js
@@ -17,12 +17,10 @@
* 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 { STATUSES, ALL_TYPES, CURRENTS } from './constants';
import { toShortNotSoISOString } from '../../helpers/dates';
-/*:: import type { Task } from './types'; */
-export function updateTask(tasks /*: Task[] */, newTask /*: Task */) {
+export function updateTask(tasks, newTask) {
return tasks.map(task => (task.id === newTask.id ? newTask : task));
}