aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-02-16 09:12:23 +0100
committerGitHub <noreply@github.com>2018-02-16 09:12:23 +0100
commit6dabceb176660fbed4195214d39c8f348fbe2c32 (patch)
tree21f322f558b69319ab7c5b2d679dbddb8d32c3c2 /server/sonar-web/src/main/js/api
parent11bd2fcdf399d62b277e9a69b7a6bc4f3ad696a8 (diff)
downloadsonarqube-6dabceb176660fbed4195214d39c8f348fbe2c32.tar.gz
sonarqube-6dabceb176660fbed4195214d39c8f348fbe2c32.zip
rewrite parts of permission templates app in react (#3070)
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r--server/sonar-web/src/main/js/api/permissions.ts25
1 files changed, 6 insertions, 19 deletions
diff --git a/server/sonar-web/src/main/js/api/permissions.ts b/server/sonar-web/src/main/js/api/permissions.ts
index b87dbc9956d..465d4fedea3 100644
--- a/server/sonar-web/src/main/js/api/permissions.ts
+++ b/server/sonar-web/src/main/js/api/permissions.ts
@@ -18,6 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { BaseSearchProjectsParameters } from './components';
+import { PermissionTemplate } from '../app/types';
+import throwGlobalError from '../app/utils/throwGlobalError';
import { getJSON, post, postJSON, RequestData } from '../helpers/request';
const PAGE_SIZE = 100;
@@ -86,21 +88,6 @@ export function revokePermissionFromGroup(
return post('/api/permissions/remove_group', data);
}
-export interface PermissionTemplate {
- id: string;
- name: string;
- description?: string;
- projectKeyPattern?: string;
- createdAt: string;
- updatedAt?: string;
- permissions: Array<{
- key: string;
- usersCount: number;
- groupsCount: number;
- withProjectCreator?: boolean;
- }>;
-}
-
interface GetPermissionTemplatesResponse {
permissionTemplates: PermissionTemplate[];
defaultTemplates: Array<{ templateId: string; qualifier: string }>;
@@ -122,8 +109,8 @@ export function updatePermissionTemplate(data: RequestData): Promise<void> {
return post('/api/permissions/update_template', data);
}
-export function deletePermissionTemplate(data: RequestData): Promise<void> {
- return post('/api/permissions/delete_template', data);
+export function deletePermissionTemplate(data: RequestData) {
+ return post('/api/permissions/delete_template', data).catch(throwGlobalError);
}
/**
@@ -133,8 +120,8 @@ export function setDefaultPermissionTemplate(templateId: string, qualifier: stri
return post('/api/permissions/set_default_template', { templateId, qualifier });
}
-export function applyTemplateToProject(data: RequestData): Promise<void> {
- return post('/api/permissions/apply_template', data);
+export function applyTemplateToProject(data: RequestData) {
+ return post('/api/permissions/apply_template', data).catch(throwGlobalError);
}
export function bulkApplyTemplate(data: BaseSearchProjectsParameters): Promise<void> {