diff options
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); } |