aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/permissions/global
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2020-10-07 10:24:33 +0200
committersonartech <sonartech@sonarsource.com>2020-10-16 20:07:40 +0000
commit16df95a4fa061755d0129927e29a3e7dc4794e8d (patch)
tree6c631c5bc520a2f9222ba974184bd053508d1bfe /server/sonar-web/src/main/js/apps/permissions/global
parent4d8f0c4bf3214a0a36e15ada2a8b1090543eaf8e (diff)
downloadsonarqube-16df95a4fa061755d0129927e29a3e7dc4794e8d.tar.gz
sonarqube-16df95a4fa061755d0129927e29a3e7dc4794e8d.zip
SONAR-13936 Remove org on user and group API front-end.
Diffstat (limited to 'server/sonar-web/src/main/js/apps/permissions/global')
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/PageHeader.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/__snapshots__/App-test.tsx.snap12
4 files changed, 12 insertions, 45 deletions
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx
index b8bbb81ae98..fcb97f36395 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx
@@ -27,10 +27,6 @@ import '../../styles.css';
import AllHoldersList from './AllHoldersList';
import PageHeader from './PageHeader';
-interface Props {
- organization?: T.Organization;
-}
-
interface State {
filter: 'all' | 'groups' | 'users';
groups: T.PermissionGroup[];
@@ -41,10 +37,10 @@ interface State {
usersPaging?: T.Paging;
}
-export default class App extends React.PureComponent<Props, State> {
+export default class App extends React.PureComponent<{}, State> {
mounted = false;
- constructor(props: Props) {
+ constructor(props: {}) {
super(props);
this.state = {
filter: 'all',
@@ -65,14 +61,12 @@ export default class App extends React.PureComponent<Props, State> {
}
loadUsersAndGroups = (userPage?: number, groupsPage?: number) => {
- const { organization } = this.props;
const { filter, query } = this.state;
const getUsers: Promise<{ paging?: T.Paging; users: T.PermissionUser[] }> =
filter !== 'groups'
? api.getGlobalPermissionsUsers({
q: query || undefined,
- organization: organization && organization.key,
p: userPage
})
: Promise.resolve({ paging: undefined, users: [] });
@@ -81,7 +75,6 @@ export default class App extends React.PureComponent<Props, State> {
filter !== 'users'
? api.getGlobalPermissionsGroups({
q: query || undefined,
- organization: organization && organization.key,
p: groupsPage
})
: Promise.resolve({ paging: undefined, groups: [] });
@@ -171,8 +164,7 @@ export default class App extends React.PureComponent<Props, State> {
return api
.grantPermissionToGroup({
groupName: group,
- permission,
- organization: this.props.organization && this.props.organization.key
+ permission
})
.then(
() => {},
@@ -196,8 +188,7 @@ export default class App extends React.PureComponent<Props, State> {
return api
.grantPermissionToUser({
login: user,
- permission,
- organization: this.props.organization && this.props.organization.key
+ permission
})
.then(
() => {},
@@ -221,8 +212,7 @@ export default class App extends React.PureComponent<Props, State> {
return api
.revokePermissionFromGroup({
groupName: group,
- permission,
- organization: this.props.organization && this.props.organization.key
+ permission
})
.then(
() => {},
@@ -246,8 +236,7 @@ export default class App extends React.PureComponent<Props, State> {
return api
.revokePermissionFromUser({
login: user,
- permission,
- organization: this.props.organization && this.props.organization.key
+ permission
})
.then(
() => {},
@@ -274,7 +263,7 @@ export default class App extends React.PureComponent<Props, State> {
<div className="page page-limited">
<Suggestions suggestions="global_permissions" />
<Helmet defer={false} title={translate('global_permissions.permission')} />
- <PageHeader loading={this.state.loading} organization={this.props.organization} />
+ <PageHeader loading={this.state.loading} />
<AllHoldersList
filter={this.state.filter}
grantPermissionToGroup={this.grantPermissionToGroup}
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/PageHeader.tsx
index 4be462d184d..bd002dc9dc1 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/PageHeader.tsx
@@ -22,26 +22,17 @@ import { translate } from 'sonar-ui-common/helpers/l10n';
interface Props {
loading?: boolean;
- organization?: {};
}
export default class PageHeader extends React.PureComponent<Props> {
render() {
- const title = this.props.organization
- ? translate('permissions.page')
- : translate('global_permissions.page');
-
- const description = this.props.organization
- ? translate('organization_permissions.page.description')
- : translate('global_permissions.page.description');
-
return (
<header className="page-header">
- <h1 className="page-title">{title}</h1>
+ <h1 className="page-title">{translate('global_permissions.page')}</h1>
{this.props.loading && <i className="spinner" />}
- <div className="page-description">{description}</div>
+ <div className="page-description">{translate('global_permissions.page.description')}</div>
</header>
);
}
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx
index ddc6dd2037b..f666b0f80fe 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx
@@ -26,7 +26,6 @@ import {
revokePermissionFromGroup,
revokePermissionFromUser
} from '../../../../../api/permissions';
-import { mockOrganization } from '../../../../../helpers/testMocks';
import App from '../App';
jest.mock('../../../../../api/permissions', () => ({
@@ -85,7 +84,7 @@ describe('should manage state correctly', () => {
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
const instance = wrapper.instance();
- const apiPayload = { groupName: 'Anyone', permission: 'foo', organization: 'foo' };
+ const apiPayload = { groupName: 'Anyone', permission: 'foo' };
instance.grantPermissionToGroup('Anyone', 'foo');
const groupState = wrapper.state('groups');
@@ -114,7 +113,7 @@ describe('should manage state correctly', () => {
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
const instance = wrapper.instance();
- const apiPayload = { login: 'user1', permission: 'foo', organization: 'foo' };
+ const apiPayload = { login: 'user1', permission: 'foo' };
instance.grantPermissionToUser('user1', 'foo');
expect(wrapper.state('users')[1].permissions).toHaveLength(1);
@@ -130,5 +129,5 @@ describe('should manage state correctly', () => {
});
function shallowRender(props: Partial<App['props']> = {}) {
- return shallow<App>(<App organization={mockOrganization()} {...props} />);
+ return shallow<App>(<App {...props} />);
}
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/__snapshots__/App-test.tsx.snap
index a22f405ecc5..589e0cb9e83 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/__snapshots__/App-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/__snapshots__/App-test.tsx.snap
@@ -14,12 +14,6 @@ exports[`should render correctly 1`] = `
/>
<PageHeader
loading={true}
- organization={
- Object {
- "key": "foo",
- "name": "Foo",
- }
- }
/>
<Connect(AllHoldersList)
filter="all"
@@ -53,12 +47,6 @@ exports[`should render correctly 2`] = `
/>
<PageHeader
loading={false}
- organization={
- Object {
- "key": "foo",
- "name": "Foo",
- }
- }
/>
<Connect(AllHoldersList)
filter="all"