]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13999 Drop orgs from Components
authorJeremy Davis <jeremy.davis@sonarsource.com>
Wed, 16 Dec 2020 16:00:29 +0000 (17:00 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 22 Dec 2020 20:09:37 +0000 (20:09 +0000)
server/sonar-web/src/main/js/app/components/AdminContainer.tsx
server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx
server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/AdminContainer-test.tsx.snap
server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx
server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx

index 232a9fa97222eecd4fd7d28c2485afe305d8b30c..29a6a0ceb6708116674cc2bc8b9876af8c19f4ff 100644 (file)
@@ -32,7 +32,7 @@ import AdminContext, { defaultPendingPlugins, defaultSystemStatus } from './Admi
 import SettingsNav from './nav/settings/SettingsNav';
 
 interface Props {
-  appState: Pick<T.AppState, 'adminPages' | 'canAdmin' | 'organizationsEnabled'>;
+  appState: Pick<T.AppState, 'adminPages' | 'canAdmin'>;
   location: {};
   setAdminPages: (adminPages: T.Extension[]) => void;
 }
@@ -109,7 +109,7 @@ export class AdminContainer extends React.PureComponent<Props, State> {
   };
 
   render() {
-    const { adminPages, organizationsEnabled } = this.props.appState;
+    const { adminPages } = this.props.appState;
 
     // Check that the adminPages are loaded
     if (!adminPages) {
@@ -127,7 +127,6 @@ export class AdminContainer extends React.PureComponent<Props, State> {
           fetchPendingPlugins={this.fetchPendingPlugins}
           fetchSystemStatus={this.fetchSystemStatus}
           location={this.props.location}
-          organizationsEnabled={organizationsEnabled}
           pendingPlugins={pendingPlugins}
           systemStatus={systemStatus}
         />
index 02ac49bfea04bf0c89d96cb5def00d1d89e506ed..e32bd7bf28af25ed74f4bdc3a3be752d6eb55445 100644 (file)
@@ -32,11 +32,7 @@ import {
   isPullRequest
 } from '../../helpers/branch-like';
 import { getPortfolioUrl } from '../../helpers/urls';
-import {
-  fetchOrganization,
-  registerBranchStatus,
-  requireAuthorization
-} from '../../store/rootActions';
+import { registerBranchStatus, requireAuthorization } from '../../store/rootActions';
 import { BranchLike } from '../../types/branch-like';
 import { isPortfolioLike } from '../../types/component';
 import { Task, TaskStatuses, TaskWarning } from '../../types/tasks';
@@ -47,7 +43,6 @@ import ComponentNav from './nav/component/ComponentNav';
 
 interface Props {
   children: React.ReactElement;
-  fetchOrganization: (organization: string) => void;
   location: Pick<Location, 'query' | 'pathname'>;
   registerBranchStatus: (branchLike: BranchLike, component: string, status: T.Status) => void;
   requireAuthorization: (router: Pick<Router, 'replace'>) => void;
@@ -379,6 +374,6 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
   }
 }
 
-const mapDispatchToProps = { fetchOrganization, registerBranchStatus, requireAuthorization };
+const mapDispatchToProps = { registerBranchStatus, requireAuthorization };
 
 export default withRouter(connect(null, mapDispatchToProps)(ComponentContainer));
index 803e3a4d186dc7f73b078c116f80d24f3e97f082..47d8301038e3823f29561cdb2cc52ea87e736f72 100644 (file)
@@ -32,8 +32,7 @@ function shallowRender(props: Partial<AdminContainer['props']> = {}) {
     <AdminContainer
       appState={{
         adminPages: [{ key: 'foo', name: 'Foo' }],
-        canAdmin: true,
-        organizationsEnabled: false
+        canAdmin: true
       }}
       location={mockLocation()}
       setAdminPages={jest.fn()}
index 36bebb2c835109b5cc1ff6dbd3d8ad21fc296fac..a06fc57eee2fe1a9b8df8578946d88b2215a5c61 100644 (file)
@@ -121,7 +121,7 @@ it('updates branches on change', async () => {
 
 it('fetches status', async () => {
   (getComponentData as jest.Mock<any>).mockResolvedValueOnce({
-    component: { organization: 'org' }
+    component: {}
   });
 
   shallowRender();
@@ -293,7 +293,6 @@ it('should correctly reload last task warnings if anything got dismissed', async
 function shallowRender(props: Partial<ComponentContainer['props']> = {}) {
   return shallow<ComponentContainer>(
     <ComponentContainer
-      fetchOrganization={jest.fn()}
       location={mockLocation({ query: { id: 'foo' } })}
       registerBranchStatus={jest.fn()}
       requireAuthorization={jest.fn()}
index c7a5276bf4519730b119ed47ea567b21031b7e38..e4af05833b4aedbee344da043d97e1edd540b0b1 100644 (file)
@@ -30,7 +30,6 @@ exports[`should render correctly 1`] = `
         "state": Object {},
       }
     }
-    organizationsEnabled={false}
     pendingPlugins={
       Object {
         "installing": Array [],
index 5bbda188e0ed110588f5ff8f84edb1549a85f0f3..b6b5912db04c0f28103b8cb1494961c4fa35d076 100644 (file)
@@ -36,7 +36,6 @@ interface Props {
   fetchPendingPlugins: () => void;
   fetchSystemStatus: () => void;
   location: {};
-  organizationsEnabled?: boolean;
   pendingPlugins: PendingPluginResult;
   systemStatus: T.SysStatus;
 }
@@ -87,7 +86,6 @@ export default class SettingsNav extends React.PureComponent<Props> {
   };
 
   renderConfigurationTab() {
-    const { organizationsEnabled } = this.props;
     const extensionsWithoutSupport = this.props.extensions.filter(
       extension => extension.key !== 'license/support'
     );
@@ -110,13 +108,11 @@ export default class SettingsNav extends React.PureComponent<Props> {
                 {translate('custom_metrics.page')}
               </IndexLink>
             </li>
-            {!organizationsEnabled && (
-              <li>
-                <IndexLink activeClassName="active" to="/admin/webhooks">
-                  {translate('webhooks.page')}
-                </IndexLink>
-              </li>
-            )}
+            <li>
+              <IndexLink activeClassName="active" to="/admin/webhooks">
+                {translate('webhooks.page')}
+              </IndexLink>
+            </li>
             {extensionsWithoutSupport.map(this.renderExtension)}
           </ul>
         }
@@ -146,18 +142,15 @@ export default class SettingsNav extends React.PureComponent<Props> {
   }
 
   renderProjectsTab() {
-    const { organizationsEnabled } = this.props;
     return (
       <Dropdown
         overlay={
           <ul className="menu">
-            {!organizationsEnabled && (
-              <li>
-                <IndexLink activeClassName="active" to="/admin/projects_management">
-                  {translate('management')}
-                </IndexLink>
-              </li>
-            )}
+            <li>
+              <IndexLink activeClassName="active" to="/admin/projects_management">
+                {translate('management')}
+              </IndexLink>
+            </li>
             <li>
               <IndexLink activeClassName="active" to="/admin/background_tasks">
                 {translate('background_tasks.page')}
@@ -182,7 +175,6 @@ export default class SettingsNav extends React.PureComponent<Props> {
   }
 
   renderSecurityTab() {
-    const { organizationsEnabled } = this.props;
     return (
       <Dropdown
         overlay={
@@ -192,27 +184,21 @@ export default class SettingsNav extends React.PureComponent<Props> {
                 {translate('users.page')}
               </IndexLink>
             </li>
-            {!organizationsEnabled && (
-              <li>
-                <IndexLink activeClassName="active" to="/admin/groups">
-                  {translate('user_groups.page')}
-                </IndexLink>
-              </li>
-            )}
-            {!organizationsEnabled && (
-              <li>
-                <IndexLink activeClassName="active" to="/admin/permissions">
-                  {translate('global_permissions.page')}
-                </IndexLink>
-              </li>
-            )}
-            {!organizationsEnabled && (
-              <li>
-                <IndexLink activeClassName="active" to="/admin/permission_templates">
-                  {translate('permission_templates')}
-                </IndexLink>
-              </li>
-            )}
+            <li>
+              <IndexLink activeClassName="active" to="/admin/groups">
+                {translate('user_groups.page')}
+              </IndexLink>
+            </li>
+            <li>
+              <IndexLink activeClassName="active" to="/admin/permissions">
+                {translate('global_permissions.page')}
+              </IndexLink>
+            </li>
+            <li>
+              <IndexLink activeClassName="active" to="/admin/permission_templates">
+                {translate('permission_templates')}
+              </IndexLink>
+            </li>
           </ul>
         }
         tagName="li">
index ae23f2088ace91f50105fbf28d698b99793b81b0..49fc38aa2057c91b0f05a6205075d945f340d688 100644 (file)
@@ -29,7 +29,6 @@ it('should work with extensions', () => {
 
 it('should display a pending plugin notif', () => {
   const wrapper = shallowRender({
-    organizationsEnabled: false,
     pendingPlugins: {
       installing: [
         {
@@ -58,7 +57,6 @@ function shallowRender(props: Partial<SettingsNav['props']> = {}) {
       fetchPendingPlugins={jest.fn()}
       fetchSystemStatus={jest.fn()}
       location={{}}
-      organizationsEnabled={false}
       pendingPlugins={{ installing: [], removing: [], updating: [] }}
       systemStatus="UP"
       {...props}
index 9951d9473f2307018a1f0f4ced18581c79547571..c1c069d13fe0443139cd5e6f0f4c448ed5cd8de1 100644 (file)
@@ -30,7 +30,6 @@ const component = {
   analysisDate: '2016-01-01',
   breadcrumbs: [],
   name: 'Foo',
-  organization: 'org',
   qualifier: 'TRK',
   version: '0.0.1'
 };
index c87551e1ca3e05d8204530e511ca8272aca4cc4d..76d80bb245080a42c8a024cacab0aad6aade642f 100644 (file)
@@ -21,7 +21,6 @@ import { shallow } from 'enzyme';
 import * as React from 'react';
 import Projects from '../Projects';
 
-const organization = { key: 'org', name: 'org', projectVisibility: 'public' };
 const projects = [
   { key: 'a', name: 'A', qualifier: 'TRK', visibility: 'public' },
   { key: 'b', name: 'B', qualifier: 'TRK', visibility: 'public' }
@@ -56,7 +55,6 @@ function shallowRender(props?: any) {
       currentUser={{ login: 'foo' }}
       onProjectDeselected={jest.fn()}
       onProjectSelected={jest.fn()}
-      organization={organization}
       selection={[]}
       {...props}
     />