*/
import { getJSON, post, postJSON, RequestData } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
-import { Paging } from '../app/types';
+import { CurrentUser, Paging } from '../app/types';
export interface IdentityProvider {
backgroundColor: string;
avatar?: string;
}
-export function getCurrentUser(): Promise<any> {
+export function getCurrentUser(): Promise<CurrentUser> {
return getJSON('/api/users/current');
}
import * as React from 'react';
import { shallow } from 'enzyme';
import GlobalNavUser from '../GlobalNavUser';
+import { Visibility } from '../../../../types';
const currentUser = { avatar: 'abcd1234', isLoggedIn: true, name: 'foo', email: 'foo@bar.baz' };
const organizations = [
- { key: 'myorg', name: 'MyOrg', projectVisibility: 'public' },
- { key: 'foo', name: 'Foo', projectVisibility: 'public' },
- { key: 'bar', name: 'bar', projectVisibility: 'public' }
+ { key: 'myorg', name: 'MyOrg', projectVisibility: Visibility.Public },
+ { key: 'foo', name: 'Foo', projectVisibility: Visibility.Public },
+ { key: 'bar', name: 'bar', projectVisibility: Visibility.Public }
];
const appState = { organizationsEnabled: true };
+++ /dev/null
-/*
- * 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 { connect } from 'react-redux';
-import { getOrganizationByKey } from '../../../store/rootReducer';
-import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization';
-
-export class OrganizationAdmin extends React.PureComponent {
- /*:: props: {
- children?: React.Element<*>,
- organization: { canAdmin: boolean }
- };
- */
-
- componentDidMount() {
- this.checkPermissions();
- }
-
- componentDidUpdate() {
- this.checkPermissions();
- }
-
- isOrganizationAdmin() {
- return this.props.organization.canAdmin;
- }
-
- checkPermissions() {
- if (!this.isOrganizationAdmin()) {
- handleRequiredAuthorization();
- }
- }
-
- render() {
- if (!this.isOrganizationAdmin()) {
- return null;
- }
-
- return this.props.children;
- }
-}
-
-const mapStateToProps = (state, ownProps) => ({
- organization: getOrganizationByKey(state, ownProps.params.organizationKey)
-});
-
-export default connect(mapStateToProps)(OrganizationAdmin);
--- /dev/null
+/*
+ * 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 { connect } from 'react-redux';
+import { RouterState } from 'react-router';
+import { getOrganizationByKey } from '../../../store/rootReducer';
+import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization';
+import { Organization } from '../../../app/types';
+
+interface StateToProps {
+ organization?: Organization;
+}
+
+interface OwnProps extends RouterState {
+ children: JSX.Element;
+}
+
+interface Props extends StateToProps, Pick<OwnProps, 'children' | 'location'> {}
+
+export class OrganizationAdmin extends React.PureComponent<Props> {
+ componentDidMount() {
+ this.checkPermissions();
+ }
+
+ componentDidUpdate() {
+ this.checkPermissions();
+ }
+
+ isOrganizationAdmin = () => this.props.organization && this.props.organization.canAdmin;
+
+ checkPermissions = () => {
+ if (!this.isOrganizationAdmin()) {
+ handleRequiredAuthorization();
+ }
+ };
+
+ render() {
+ if (!this.isOrganizationAdmin()) {
+ return null;
+ }
+ return React.cloneElement(this.props.children, {
+ location: this.props.location,
+ organization: this.props.organization
+ });
+ }
+}
+
+const mapStateToProps = (state: any, ownProps: OwnProps) => ({
+ organization: getOrganizationByKey(state, ownProps.params.organizationKey)
+});
+
+export default connect<StateToProps, {}, OwnProps>(mapStateToProps)(OrganizationAdmin);
+++ /dev/null
-/*
- * 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 { connect } from 'react-redux';
-import { getCurrentUser, getOrganizationByKey } from '../../../store/rootReducer';
-
-class OrganizationContainer extends React.PureComponent {
- render() {
- return React.cloneElement(this.props.children, {
- currentUser: this.props.currentUser,
- organization: this.props.organization
- });
- }
-}
-
-const mapStateToProps = (state, ownProps) => ({
- organization: getOrganizationByKey(state, ownProps.params.organizationKey),
- currentUser: getCurrentUser(state)
-});
-
-export default connect(mapStateToProps)(OrganizationContainer);
--- /dev/null
+/*
+ * 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 { connect } from 'react-redux';
+import { RouterState } from 'react-router';
+import { getCurrentUser, getOrganizationByKey } from '../../../store/rootReducer';
+import { Organization, CurrentUser } from '../../../app/types';
+
+interface StateToProps {
+ organization?: Organization;
+ currentUser: CurrentUser;
+}
+
+interface OwnProps extends RouterState {
+ children: JSX.Element;
+}
+
+interface Props extends StateToProps, Pick<OwnProps, 'children' | 'location'> {}
+
+class OrganizationContainer extends React.PureComponent<Props> {
+ render() {
+ return React.cloneElement(this.props.children, {
+ location: this.props.location,
+ currentUser: this.props.currentUser,
+ organization: this.props.organization
+ });
+ }
+}
+
+const mapStateToProps = (state: any, ownProps: OwnProps) => ({
+ organization: getOrganizationByKey(state, ownProps.params.organizationKey),
+ currentUser: getCurrentUser(state)
+});
+
+export default connect<StateToProps, {}, OwnProps>(mapStateToProps)(OrganizationContainer);
}
}
-const mapStateToProps = (state, ownProps) => ({
- organization: getOrganizationByKey(state, ownProps.params.organizationKey)
-});
-
const mapDispatchToProps = { deleteOrganization };
-export default connect(mapStateToProps, mapDispatchToProps)(withRouter(OrganizationDelete));
+export default connect(null, mapDispatchToProps)(withRouter(OrganizationDelete));
export const UnconnectedOrganizationDelete = OrganizationDelete;
}
}
-const mapStateToProps = (state, ownProps) => ({
- organization: getOrganizationByKey(state, ownProps.params.organizationKey)
-});
-
const mapDispatchToProps = { updateOrganization };
-export default connect(mapStateToProps, mapDispatchToProps)(OrganizationEdit);
+export default connect(null, mapDispatchToProps)(OrganizationEdit);
export const UnconnectedOrganizationEdit = OrganizationEdit;
// @flow
import React from 'react';
import Helmet from 'react-helmet';
-import { connect } from 'react-redux';
import init from '../../groups/init';
-import { getOrganizationByKey } from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
/*:: import type { Organization } from '../../../store/organizations/duck'; */
-class OrganizationGroups extends React.PureComponent {
+export default class OrganizationGroups extends React.PureComponent {
/*:: props: {
organization: Organization
};
);
}
}
-
-const mapStateToProps = (state, ownProps) => ({
- organization: getOrganizationByKey(state, ownProps.params.organizationKey)
-});
-
-export default connect(mapStateToProps)(OrganizationGroups);
+++ /dev/null
-/*
- * 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 { connect } from 'react-redux';
-import AppContainer from '../../permission-templates/components/AppContainer';
-import { getOrganizationByKey } from '../../../store/rootReducer';
-/*:: import type { Organization } from '../../../store/organizations/duck'; */
-
-/*::
-type Props = {
- location: {},
- organization: Organization
-};
-*/
-
-function OrganizationPermissionTemplates(props /*: Props */) {
- return <AppContainer location={props.location} organization={props.organization} />;
-}
-
-const mapStateToProps = (state, ownProps) => ({
- organization: getOrganizationByKey(state, ownProps.params.organizationKey)
-});
-
-export default connect(mapStateToProps)(OrganizationPermissionTemplates);
+++ /dev/null
-/*
- * 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 { connect } from 'react-redux';
-import GlobalPermissionsApp from '../../permissions/global/components/App';
-import { getOrganizationByKey } from '../../../store/rootReducer';
-import { Organization } from '../../../app/types';
-
-interface Props {
- organization: Organization;
-}
-
-function OrganizationPermissions({ organization }: Props) {
- return <GlobalPermissionsApp organization={organization} />;
-}
-
-const mapStateToProps = (state: any, ownProps: any) => ({
- organization: getOrganizationByKey(state, ownProps.params.organizationKey)
-});
-
-export default connect(mapStateToProps)(OrganizationPermissions);
+++ /dev/null
-/*
- * 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 { connect } from 'react-redux';
-import AppContainer from '../../projectsManagement/AppContainer';
-import { getOrganizationByKey } from '../../../store/rootReducer';
-/*:: import type { Organization } from '../../../store/organizations/duck'; */
-
-/*::
-type Props = {
- organization: Organization
-};
-*/
-
-function OrganizationProjectsManagement(props /*: Props */) {
- return <AppContainer organization={props.organization} />;
-}
-
-const mapStateToProps = (state, ownProps) => ({
- organization: getOrganizationByKey(state, ownProps.params.organizationKey)
-});
-
-export default connect(mapStateToProps)(OrganizationProjectsManagement);
+++ /dev/null
-/*
- * 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 { shallow } from 'enzyme';
-import { OrganizationAdmin } from '../OrganizationAdmin';
-
-jest.mock('../../../../app/utils/handleRequiredAuthorization', () => jest.fn());
-
-it('should render children', () => {
- const organization = { canAdmin: true };
- expect(
- shallow(
- <OrganizationAdmin organization={organization}>
- <div>hello</div>
- </OrganizationAdmin>
- )
- ).toMatchSnapshot();
-});
-
-it('should not render anything', () => {
- const organization = { canAdmin: false };
- expect(
- shallow(
- <OrganizationAdmin organization={organization}>
- <div>hello</div>
- </OrganizationAdmin>
- ).type()
- ).toBeNull();
-});
--- /dev/null
+/*
+* 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 { Location } from 'history';
+import { OrganizationAdmin } from '../OrganizationAdminContainer';
+import { Visibility } from '../../../../app/types';
+
+jest.mock('../../../../app/utils/handleRequiredAuthorization', () => ({ default: jest.fn() }));
+
+const locationMock = {} as Location;
+
+it('should render children', () => {
+ const organization = {
+ canAdmin: true,
+ key: 'foo',
+ name: 'Foo',
+ projectVisibility: Visibility.Public
+ };
+ expect(
+ shallow(
+ <OrganizationAdmin organization={organization} location={locationMock}>
+ <div>hello</div>
+ </OrganizationAdmin>
+ )
+ ).toMatchSnapshot();
+});
+
+it('should not render anything', () => {
+ const organization = {
+ canAdmin: false,
+ key: 'foo',
+ name: 'Foo',
+ projectVisibility: Visibility.Public
+ };
+ expect(
+ shallow(
+ <OrganizationAdmin organization={organization} location={locationMock}>
+ <div>hello</div>
+ </OrganizationAdmin>
+ ).type()
+ ).toBeNull();
+});
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render children 1`] = `
-<div>
- hello
-</div>
-`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render children 1`] = `
+<div
+ location={Object {}}
+ organization={
+ Object {
+ "canAdmin": true,
+ "key": "foo",
+ "name": "Foo",
+ "projectVisibility": "public",
+ }
+ }
+>
+ hello
+</div>
+`;
"canDelete": true,
"key": "foo",
"name": "Foo",
+ "projectVisibility": "public",
}
}
/>
"canDelete": false,
"key": "foo",
"name": "Foo",
+ "projectVisibility": "public",
}
}
/>
"canDelete": false,
"key": "foo",
"name": "Foo",
+ "projectVisibility": "public",
}
}
/>
+++ /dev/null
-/*
- * 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 OrganizationPageContainer from './components/OrganizationPage';
-import OrganizationPageExtension from '../../app/components/extensions/OrganizationPageExtension';
-import OrganizationContainer from './components/OrganizationContainer';
-import OrganizationProjects from './components/OrganizationProjects';
-import OrganizationRules from './components/OrganizationRules';
-import OrganizationAdminContainer from './components/OrganizationAdmin';
-import OrganizationEdit from './components/OrganizationEdit';
-import OrganizationGroups from './components/OrganizationGroups';
-import OrganizationMembersContainer from './components/OrganizationMembersContainer';
-import OrganizationPermissions from './components/OrganizationPermissions';
-import OrganizationPermissionTemplates from './components/OrganizationPermissionTemplates';
-import OrganizationProjectsManagement from './components/OrganizationProjectsManagement';
-import OrganizationDelete from './components/OrganizationDelete';
-import qualityGatesRoutes from '../quality-gates/routes';
-import qualityProfilesRoutes from '../quality-profiles/routes';
-import Issues from '../issues/components/AppContainer';
-
-const routes = [
- {
- path: ':organizationKey',
- component: OrganizationPageContainer,
- childRoutes: [
- {
- indexRoute: {
- onEnter(nextState, replace) {
- const { params } = nextState;
- replace(`/organizations/${params.organizationKey}/projects`);
- }
- }
- },
- {
- path: 'projects',
- component: OrganizationContainer,
- childRoutes: [{ indexRoute: { component: OrganizationProjects } }]
- },
- {
- path: 'issues',
- component: OrganizationContainer,
- childRoutes: [{ indexRoute: { component: Issues } }]
- },
- {
- path: 'members',
- component: OrganizationMembersContainer
- },
- {
- path: 'rules',
- component: OrganizationRules
- },
- {
- path: 'quality_profiles',
- childRoutes: qualityProfilesRoutes
- },
- {
- path: 'quality_gates',
- component: OrganizationContainer,
- childRoutes: qualityGatesRoutes
- },
- {
- path: 'extension/:pluginKey/:extensionKey',
- component: OrganizationPageExtension
- },
- {
- component: OrganizationAdminContainer,
- childRoutes: [
- { path: 'delete', component: OrganizationDelete },
- { path: 'edit', component: OrganizationEdit },
- { path: 'groups', component: OrganizationGroups },
- { path: 'permissions', component: OrganizationPermissions },
- { path: 'permission_templates', component: OrganizationPermissionTemplates },
- { path: 'projects_management', component: OrganizationProjectsManagement }
- ]
- }
- ]
- }
-];
-
-export default routes;
--- /dev/null
+/*
+ * 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 { RouterState, RedirectFunction } from 'react-router';
+import GlobalPermissionsApp from '../permissions/global/components/App';
+import OrganizationPageContainer from './components/OrganizationPage';
+import OrganizationPageExtension from '../../app/components/extensions/OrganizationPageExtension';
+import OrganizationContainer from './components/OrganizationContainer';
+import OrganizationProjects from './components/OrganizationProjects';
+import OrganizationRules from './components/OrganizationRules';
+import OrganizationAdminContainer from './components/OrganizationAdminContainer';
+import OrganizationEdit from './components/OrganizationEdit';
+import OrganizationGroups from './components/OrganizationGroups';
+import OrganizationMembersContainer from './components/OrganizationMembersContainer';
+import OrganizationDelete from './components/OrganizationDelete';
+import PermissionTemplateApp from '../permission-templates/components/AppContainer';
+import ProjectManagementApp from '../projectsManagement/AppContainer';
+import qualityGatesRoutes from '../quality-gates/routes';
+import qualityProfilesRoutes from '../quality-profiles/routes';
+import Issues from '../issues/components/AppContainer';
+
+const routes = [
+ {
+ path: ':organizationKey',
+ component: OrganizationPageContainer,
+ childRoutes: [
+ {
+ indexRoute: {
+ onEnter(nextState: RouterState, replace: RedirectFunction) {
+ const { params } = nextState;
+ replace(`/organizations/${params.organizationKey}/projects`);
+ }
+ }
+ },
+ {
+ path: 'projects',
+ component: OrganizationContainer,
+ childRoutes: [{ indexRoute: { component: OrganizationProjects } }]
+ },
+ {
+ path: 'issues',
+ component: OrganizationContainer,
+ childRoutes: [{ indexRoute: { component: Issues } }]
+ },
+ {
+ path: 'members',
+ component: OrganizationMembersContainer
+ },
+ {
+ path: 'rules',
+ component: OrganizationRules
+ },
+ {
+ path: 'quality_profiles',
+ childRoutes: qualityProfilesRoutes
+ },
+ {
+ path: 'quality_gates',
+ component: OrganizationContainer,
+ childRoutes: qualityGatesRoutes
+ },
+ {
+ path: 'extension/:pluginKey/:extensionKey',
+ component: OrganizationPageExtension
+ },
+ {
+ component: OrganizationAdminContainer,
+ childRoutes: [
+ { path: 'delete', component: OrganizationDelete },
+ { path: 'edit', component: OrganizationEdit },
+ { path: 'groups', component: OrganizationGroups },
+ { path: 'permissions', component: GlobalPermissionsApp },
+ { path: 'permission_templates', component: PermissionTemplateApp },
+ { path: 'projects_management', component: ProjectManagementApp }
+ ]
+ }
+ ]
+ }
+];
+
+export default routes;
};
render() {
- const order = PERMISSIONS_ORDER;
const l10nPrefix = this.props.organization ? 'organizations_permissions' : 'global_permissions';
- const permissions = order.map(p => ({
+ const permissions = PERMISSIONS_ORDER.map(p => ({
key: p,
name: translate(l10nPrefix, p),
description: translate(l10nPrefix, p, 'desc')
}
export default class PermissionHeader extends React.PureComponent<Props> {
- static defaultProps = {
- showPublicProjectsWarning: false
- };
-
handlePermissionClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
event.preventDefault();
event.currentTarget.blur();