diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2020-12-08 16:39:23 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-12-22 20:09:35 +0000 |
commit | 21bafe70615623b45a7e55097241f885c7519461 (patch) | |
tree | 8fee7c6508ca0b2ca099d298584cf69de3bc15c2 /server | |
parent | 7d7b487bfd61ae19be0bec6d9e68066d6b9b2eed (diff) | |
download | sonarqube-21bafe70615623b45a7e55097241f885c7519461.tar.gz sonarqube-21bafe70615623b45a7e55097241f885c7519461.zip |
SONAR-13999 Drop orgs from CE
Diffstat (limited to 'server')
13 files changed, 8 insertions, 61 deletions
diff --git a/server/sonar-web/src/main/js/api/ce.ts b/server/sonar-web/src/main/js/api/ce.ts index 35f43ef9e1d..19d47824bf5 100644 --- a/server/sonar-web/src/main/js/api/ce.ts +++ b/server/sonar-web/src/main/js/api/ce.ts @@ -31,7 +31,6 @@ export function getAnalysisStatus(data: { branch?: string; key: string; name: string; - organization?: string; pullRequest?: string; warnings: TaskWarning[]; }; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNav-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNav-test.tsx.snap index bf8b1225b71..569321c8f39 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNav-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNav-test.tsx.snap @@ -192,7 +192,6 @@ exports[`renders correctly: has failed notification 1`] = ` "componentName": "Foo", "componentQualifier": "TRK", "id": "AXR8jg_0mF2ZsYr8Wzs2", - "organization": "bar", "status": "FAILED", "submittedAt": "2020-09-11T11:45:35+0200", "type": "REPORT", diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap index dad46cb8300..b3626bf8088 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap @@ -68,7 +68,6 @@ exports[`renders correctly: license issue 1`] = ` "errorMessage": "Foo", "errorType": "LICENSING", "id": "AXR8jg_0mF2ZsYr8Wzs2", - "organization": "bar", "status": "FAILED", "submittedAt": "2020-09-11T11:45:35+0200", "type": "REPORT", diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx index ade7100f7c9..1ab4f80fb4a 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx @@ -17,10 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { debounce, uniq } from 'lodash'; +import { debounce } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import { connect } from 'react-redux'; import { toShortNotSoISOString } from 'sonar-ui-common/helpers/dates'; import { translate } from 'sonar-ui-common/helpers/l10n'; import { parseAsDate } from 'sonar-ui-common/helpers/query'; @@ -33,7 +32,6 @@ import { } from '../../../api/ce'; import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import { Location, Router } from '../../../components/hoc/withRouter'; -import { fetchOrganizations } from '../../../store/rootActions'; import { Task, TaskStatuses } from '../../../types/tasks'; import '../background-tasks.css'; import { CURRENTS, DEBOUNCE_DELAY, DEFAULT_FILTERS } from '../constants'; @@ -46,7 +44,6 @@ import Tasks from './Tasks'; interface Props { component?: Pick<T.Component, 'key'> & { id: string }; // id should be removed when api/ce/activity accept a component key instead of an id - fetchOrganizations: (keys: string[]) => void; location: Location; router: Pick<Router, 'push'>; } @@ -60,7 +57,7 @@ interface State { types?: string[]; } -export class BackgroundTasksApp extends React.PureComponent<Props, State> { +export default class BackgroundTasksApp extends React.PureComponent<Props, State> { loadTasksDebounced: () => void; mounted = false; @@ -122,9 +119,6 @@ export class BackgroundTasksApp extends React.PureComponent<Props, State> { Promise.all([getActivity(parameters), getStatus(parameters.componentId)]).then( ([{ tasks }, status]) => { if (this.mounted) { - const organizations = uniq(tasks.map(task => task.organization).filter(o => o)); - this.props.fetchOrganizations(organizations); - this.setState({ failingCount: status.failing, loading: false, @@ -258,7 +252,3 @@ export class BackgroundTasksApp extends React.PureComponent<Props, State> { ); } } - -const mapDispatchToProps = { fetchOrganizations }; - -export default connect(null, mapDispatchToProps)(BackgroundTasksApp); 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 dde40b7a8b0..925147aa7ee 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 @@ -22,7 +22,6 @@ import { Link } from 'react-router'; import BranchIcon from 'sonar-ui-common/components/icons/BranchIcon'; import PullRequestIcon from 'sonar-ui-common/components/icons/PullRequestIcon'; import QualifierIcon from 'sonar-ui-common/components/icons/QualifierIcon'; -import Organization from '../../../components/shared/Organization'; import { getBranchUrl, getPortfolioUrl, @@ -58,8 +57,6 @@ export default function TaskComponent({ task }: Props) { </span> )} - {task.organization && <Organization organizationKey={task.organization} />} - {task.componentName && ( <Link className="spacer-right" to={getTaskComponentUrl(task.componentKey, task)}> {task.componentName} diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx index 8ddcc2e8f64..ffa2c1a2f73 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx @@ -21,7 +21,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { waitAndUpdate } from 'sonar-ui-common/helpers/testUtils'; import { mockLocation, mockRouter } from '../../../../helpers/testMocks'; -import { BackgroundTasksApp } from '../BackgroundTasksApp'; +import BackgroundTasksApp from '../BackgroundTasksApp'; jest.mock('../../../../api/ce', () => ({ getTypes: jest.fn().mockResolvedValue({ @@ -45,7 +45,6 @@ jest.mock('../../../../api/ce', () => ({ errorMessage: 'Analyses suspended. Please set a valid license for the Edition you installed.', hasScannerContext: false, - organization: 'default-organization', errorType: 'LICENSING', warningCount: 0, warnings: [] @@ -64,7 +63,6 @@ jest.mock('../../../../api/ce', () => ({ executionTimeMs: 19, logs: false, hasScannerContext: false, - organization: 'default-organization', warningCount: 0, warnings: [] } @@ -81,17 +79,16 @@ beforeEach(() => { it('should render correctly', async () => { const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); + expect(wrapper).toMatchSnapshot('initial'); await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); + expect(wrapper).toMatchSnapshot('loaded'); }); function shallowRender(props: Partial<BackgroundTasksApp['props']> = {}) { return shallow( <BackgroundTasksApp component={{ key: 'foo', id: '564' }} - fetchOrganizations={jest.fn()} location={mockLocation()} router={mockRouter()} {...props} diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/BackgroundTasksApp-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/BackgroundTasksApp-test.tsx.snap index 4bc07059a03..8812b1f2b3a 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/BackgroundTasksApp-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/BackgroundTasksApp-test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`should render correctly 1`] = ` +exports[`should render correctly: initial 1`] = ` <div className="page page-limited" > @@ -10,7 +10,7 @@ exports[`should render correctly 1`] = ` </div> `; -exports[`should render correctly 2`] = ` +exports[`should render correctly: loaded 1`] = ` <div className="page page-limited" > @@ -91,7 +91,6 @@ exports[`should render correctly 2`] = ` "hasScannerContext": false, "id": "AWkGcOThOiAPiP5AE-kM", "logs": false, - "organization": "default-organization", "startedAt": "2019-02-19T16:47:36+0100", "status": "FAILED", "submittedAt": "2019-02-19T16:47:35+0100", @@ -109,7 +108,6 @@ exports[`should render correctly 2`] = ` "hasScannerContext": false, "id": "AWkGcOThOiAPiP5AE-kL", "logs": false, - "organization": "default-organization", "startedAt": "2019-02-19T16:47:36+0100", "status": "SUCCESS", "submittedAt": "2019-02-19T16:47:35+0100", @@ -135,7 +133,6 @@ exports[`should render correctly 2`] = ` "hasScannerContext": false, "id": "AWkGcOThOiAPiP5AE-kM", "logs": false, - "organization": "default-organization", "startedAt": "2019-02-19T16:47:36+0100", "status": "FAILED", "submittedAt": "2019-02-19T16:47:35+0100", @@ -153,7 +150,6 @@ exports[`should render correctly 2`] = ` "hasScannerContext": false, "id": "AWkGcOThOiAPiP5AE-kL", "logs": false, - "organization": "default-organization", "startedAt": "2019-02-19T16:47:36+0100", "status": "SUCCESS", "submittedAt": "2019-02-19T16:47:35+0100", 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 54747921035..3dde355f5a6 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 @@ -13,7 +13,6 @@ exports[`renders 1`] = ` "componentName": "Foo", "componentQualifier": "TRK", "id": "AXR8jg_0mF2ZsYr8Wzs2", - "organization": "bar", "status": "PENDING", "submittedAt": "2020-09-11T11:45:35+0200", "type": "REPORT", @@ -47,7 +46,6 @@ exports[`renders 1`] = ` "componentName": "Foo", "componentQualifier": "TRK", "id": "AXR8jg_0mF2ZsYr8Wzs2", - "organization": "bar", "status": "PENDING", "submittedAt": "2020-09-11T11:45:35+0200", "type": "REPORT", 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 index c47e02b4755..ee8b692277e 100644 --- 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 @@ -130,7 +130,6 @@ exports[`shows scanner context 1`] = ` "componentQualifier": "TRK", "hasScannerContext": true, "id": "AXR8jg_0mF2ZsYr8Wzs2", - "organization": "bar", "status": "PENDING", "submittedAt": "2020-09-11T11:45:35+0200", "type": "REPORT", @@ -150,7 +149,6 @@ exports[`shows stack trace 1`] = ` "componentQualifier": "TRK", "errorMessage": "error!", "id": "AXR8jg_0mF2ZsYr8Wzs2", - "organization": "bar", "status": "PENDING", "submittedAt": "2020-09-11T11:45:35+0200", "type": "REPORT", 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 index 271ad4cfde2..3dadcaf9fbf 100644 --- 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 @@ -9,9 +9,6 @@ exports[`renders correctly 1`] = ` qualifier="TRK" /> </span> - <Connect(Organization) - organizationKey="bar" - /> <Link className="spacer-right" onlyActiveOnIndex={false} @@ -39,9 +36,6 @@ exports[`renders correctly: branch 1`] = ` <BranchIcon className="little-spacer-right" /> - <Connect(Organization) - organizationKey="bar" - /> <Link className="spacer-right" onlyActiveOnIndex={false} @@ -85,9 +79,6 @@ exports[`renders correctly: branch 2`] = ` <BranchIcon className="little-spacer-right" /> - <Connect(Organization) - organizationKey="bar" - /> <Link className="spacer-right" onlyActiveOnIndex={false} @@ -135,9 +126,6 @@ exports[`renders correctly: portfolio 1`] = ` qualifier="VW" /> </span> - <Connect(Organization) - organizationKey="bar" - /> <Link className="spacer-right" onlyActiveOnIndex={false} @@ -164,9 +152,6 @@ exports[`renders correctly: pull request 1`] = ` <PullRequestIcon className="little-spacer-right" /> - <Connect(Organization) - organizationKey="bar" - /> <Link className="spacer-right" onlyActiveOnIndex={false} diff --git a/server/sonar-web/src/main/js/helpers/mocks/tasks.ts b/server/sonar-web/src/main/js/helpers/mocks/tasks.ts index f751e198d9c..2e3942c1ac6 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/tasks.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/tasks.ts @@ -27,7 +27,6 @@ export function mockTask(overrides: Partial<Task> = {}): Task { componentName: 'Foo', componentQualifier: ComponentQualifier.Project, id: 'AXR8jg_0mF2ZsYr8Wzs2', - organization: 'bar', status: TaskStatuses.Pending, submittedAt: '2020-09-11T11:45:35+0200', type: TaskTypes.Report, diff --git a/server/sonar-web/src/main/js/store/rootActions.ts b/server/sonar-web/src/main/js/store/rootActions.ts index e76e803ef30..c6471073c65 100644 --- a/server/sonar-web/src/main/js/store/rootActions.ts +++ b/server/sonar-web/src/main/js/store/rootActions.ts @@ -22,7 +22,7 @@ import { Dispatch } from 'redux'; import * as auth from '../api/auth'; import { getLanguages } from '../api/languages'; import { getAllMetrics } from '../api/metrics'; -import { getOrganization, getOrganizationNavigation, getOrganizations } from '../api/organizations'; +import { getOrganization, getOrganizationNavigation } from '../api/organizations'; import { getQualityGateProjectStatus } from '../api/quality-gates'; import { getBranchLikeQuery } from '../helpers/branch-like'; import { extractStatusConditionsFromProjectStatus } from '../helpers/qualityGates'; @@ -52,15 +52,6 @@ export function fetchMetrics() { }; } -export function fetchOrganizations(organizations: string[]) { - return (dispatch: Dispatch) => { - getOrganizations({ organizations: organizations && organizations.join() }).then( - r => dispatch(receiveOrganizations(r.organizations)), - () => {} - ); - }; -} - export const fetchOrganization = (key: string) => (dispatch: Dispatch) => { return Promise.all([getOrganization(key), getOrganizationNavigation(key)]).then( ([organization, navigation]) => { diff --git a/server/sonar-web/src/main/js/types/tasks.ts b/server/sonar-web/src/main/js/types/tasks.ts index 4eab7ff6357..b1fb46ac92e 100644 --- a/server/sonar-web/src/main/js/types/tasks.ts +++ b/server/sonar-web/src/main/js/types/tasks.ts @@ -46,7 +46,6 @@ export interface Task { hasScannerContext?: boolean; id: string; logs?: boolean; - organization: string; pullRequest?: string; pullRequestTitle?: string; scannerContext?: string; |