]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13999 Drop orgs from CE
authorJeremy Davis <jeremy.davis@sonarsource.com>
Tue, 8 Dec 2020 15:39:23 +0000 (16:39 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 22 Dec 2020 20:09:35 +0000 (20:09 +0000)
13 files changed:
server/sonar-web/src/main/js/api/ce.ts
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNav-test.tsx.snap
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap
server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/BackgroundTasksApp-test.tsx.snap
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/Task-test.tsx.snap
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskActions-test.tsx.snap
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap
server/sonar-web/src/main/js/helpers/mocks/tasks.ts
server/sonar-web/src/main/js/store/rootActions.ts
server/sonar-web/src/main/js/types/tasks.ts

index 35f43ef9e1de1b9fe1d6216fbc185556ca152993..19d47824bf5de16a4108d52109629db215d74f2d 100644 (file)
@@ -31,7 +31,6 @@ export function getAnalysisStatus(data: {
     branch?: string;
     key: string;
     name: string;
-    organization?: string;
     pullRequest?: string;
     warnings: TaskWarning[];
   };
index bf8b1225b71d02c6f4c0efc6a9a2c245a8ef80c8..569321c8f392604a22ea38d7a554c36a0a05dd41 100644 (file)
@@ -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",
index dad46cb8300a351b2223da9205748e30b730d289..b3626bf8088ea9ace006d7b2b1108b0f5eb9ee03 100644 (file)
@@ -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",
index ade7100f7c997902934aa176cad7c6b2411edf6e..1ab4f80fb4a50d64bb80457cb0db67f6d3ebf4b5 100644 (file)
  * 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);
index dde40b7a8b05e5438b13d68976ecf2b8d5d2981a..925147aa7ee642e990878b3dcaa22de74cd2d4dc 100644 (file)
@@ -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}
index 8ddcc2e8f648c3439b64f946c8bf3e966d097029..ffa2c1a2f734e137a0f5edbb164ae766d42d8605 100644 (file)
@@ -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}
index 4bc07059a03d0c3d789c414f1ed1ebbfc5a9c2cb..8812b1f2b3a9e1486a776154abf8c5d171d9c5e5 100644 (file)
@@ -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",
index 54747921035389c3ee1eecdb39fff799b970d01e..3dde355f5a6989afc81331f52b633cfc0a45075b 100644 (file)
@@ -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",
index c47e02b4755dd410736b5c0a60174171a22d61a6..ee8b692277e9ded18d4448c451edc1366e547d8f 100644 (file)
@@ -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",
index 271ad4cfde2404dea09f1f1efb2a335db2112df8..3dadcaf9fbff41e8c93d18eb4c89020439ff11b1 100644 (file)
@@ -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}
index f751e198d9cee230dcf528bb9f92e568c1da9673..2e3942c1ac62d4653fa244948335cf1376b3d0e5 100644 (file)
@@ -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,
index e76e803ef3043d7c1bb1e63be4d5895ebfac751f..c6471073c652e43538e8ebf7560bc52d7f94da34 100644 (file)
@@ -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]) => {
index 4eab7ff6357cf1ecf18e12b237cdfac1728b01ac..b1fb46ac92e4cbf6c563bb273e532f0eb54c4eaf 100644 (file)
@@ -46,7 +46,6 @@ export interface Task {
   hasScannerContext?: boolean;
   id: string;
   logs?: boolean;
-  organization: string;
   pullRequest?: string;
   pullRequestTitle?: string;
   scannerContext?: string;