diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2018-02-06 16:11:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-06 16:11:41 +0100 |
commit | cf9eb2f6a2bc594e3007eff1494817a42a6f2d35 (patch) | |
tree | 177cb35f5bc07f3811462a95c4137fc243c7ba48 /server/sonar-web/src/main/js/api | |
parent | 3c42d5d2e6b362d389c0058e069897bf26ef65f7 (diff) | |
download | sonarqube-cf9eb2f6a2bc594e3007eff1494817a42a6f2d35.tar.gz sonarqube-cf9eb2f6a2bc594e3007eff1494817a42a6f2d35.zip |
rewrite groups app with react (#3017)
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r-- | server/sonar-web/src/main/js/api/user_groups.ts | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/api/user_groups.ts b/server/sonar-web/src/main/js/api/user_groups.ts index 7fbddde3133..2e1b85c5cdf 100644 --- a/server/sonar-web/src/main/js/api/user_groups.ts +++ b/server/sonar-web/src/main/js/api/user_groups.ts @@ -17,7 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { getJSON, post } from '../helpers/request'; +import { getJSON, post, postJSON } from '../helpers/request'; +import { Paging, Group } from '../app/types'; +import throwGlobalError from '../app/utils/throwGlobalError'; export function searchUsersGroups(data: { f?: string; @@ -25,7 +27,7 @@ export function searchUsersGroups(data: { p?: number; ps?: number; q?: string; -}) { +}): Promise<{ groups: Group[]; paging: Paging }> { return getJSON('/api/user_groups/search', data); } @@ -46,3 +48,19 @@ export function removeUserFromGroup(data: { }) { return post('/api/user_groups/remove_user', data); } + +export function createGroup(data: { + description?: string; + organization: string | undefined; + name: string; +}): Promise<Group> { + return postJSON('/api/user_groups/create', data).then(r => r.group, throwGlobalError); +} + +export function updateGroup(data: { description?: string; id: number; name?: string }) { + return post('/api/user_groups/update', data).catch(throwGlobalError); +} + +export function deleteGroup(data: { name: string; organization: string | undefined }) { + return post('/api/user_groups/delete', data).catch(throwGlobalError); +} |