diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2018-10-15 11:55:35 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-11-16 20:21:03 +0100 |
commit | f61d654f7d74036f50f2a1ca6b380a437ec911a2 (patch) | |
tree | 9a89718368daa1b60d5547ef606fbd00ebca59fc /server/sonar-web/src/main/js/api | |
parent | f8694e7d8b50651cba439fb5847ffde2d3bd013c (diff) | |
download | sonarqube-f61d654f7d74036f50f2a1ca6b380a437ec911a2.tar.gz sonarqube-f61d654f7d74036f50f2a1ca6b380a437ec911a2.zip |
SONAR-11321 Create organization from GitHub organization or BitBucket team
* Create api/alm_integration/show_organization and handle only GitHub installation
* Add import from ALM tab in Create Org page
* Do not show error while validating detail input
* Add step to create organization from ALM
* Display a warning if the installation id was not found
* Add Alm link to remote organization in org context
* Create GET api/alm_integration/show_app_info
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r-- | server/sonar-web/src/main/js/api/alm-integration.ts | 16 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/api/organizations.ts | 6 |
2 files changed, 19 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/api/alm-integration.ts b/server/sonar-web/src/main/js/api/alm-integration.ts index d35ff9995e0..c3f560044f2 100644 --- a/server/sonar-web/src/main/js/api/alm-integration.ts +++ b/server/sonar-web/src/main/js/api/alm-integration.ts @@ -18,9 +18,23 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { getJSON, postJSON } from '../helpers/request'; -import { AlmRepository } from '../app/types'; +import { AlmRepository, AlmApplication, AlmOrganization } from '../app/types'; import throwGlobalError from '../app/utils/throwGlobalError'; +export function getAlmAppInfo(): Promise<{ application: AlmApplication }> { + return getJSON('/api/alm_integration/show_app_info').catch(throwGlobalError); +} + +export function getAlmOrganization(data: { installationId: string }): Promise<AlmOrganization> { + return getJSON('/api/alm_integration/show_organization', data).then( + ({ organization }) => ({ + ...organization, + name: organization.name || organization.key + }), + throwGlobalError + ); +} + export function getRepositories(): Promise<{ almIntegration: { installed: boolean; diff --git a/server/sonar-web/src/main/js/api/organizations.ts b/server/sonar-web/src/main/js/api/organizations.ts index 289d6ce99d5..1b72037ce83 100644 --- a/server/sonar-web/src/main/js/api/organizations.ts +++ b/server/sonar-web/src/main/js/api/organizations.ts @@ -39,12 +39,12 @@ export function getOrganization(key: string): Promise<Organization | undefined> } interface GetOrganizationNavigation { + adminPages: Array<{ key: string; name: string }>; canAdmin: boolean; canDelete: boolean; canProvisionProjects: boolean; isDefault: boolean; pages: Array<{ key: string; name: string }>; - adminPages: Array<{ key: string; name: string }>; } export function getOrganizationNavigation(key: string): Promise<GetOrganizationNavigation> { @@ -54,7 +54,9 @@ export function getOrganizationNavigation(key: string): Promise<GetOrganizationN ); } -export function createOrganization(data: OrganizationBase): Promise<Organization> { +export function createOrganization( + data: OrganizationBase & { installId?: string } +): Promise<Organization> { return postJSON('/api/organizations/create', data).then(r => r.organization, throwGlobalError); } |