aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-07-20 16:57:23 +0200
committerSonarTech <sonartech@sonarsource.com>2018-08-10 20:21:28 +0200
commitb08814f7807c1443592af65cd68c2a51dfd4ee37 (patch)
treed7bbaf30c5c0633cd212a30e52db073945ba61ea /server/sonar-web/src/main/js/api
parent3a39b4fa08b15912c928af35fb7b77cd4b85ab64 (diff)
downloadsonarqube-b08814f7807c1443592af65cd68c2a51dfd4ee37.tar.gz
sonarqube-b08814f7807c1443592af65cd68c2a51dfd4ee37.zip
SONAR-11036 Install integration with GitHub or BitBucket Cloud
* SONAR-11040 Update tutorial choices modal * SONAR-11041 Migrate manual installation tab * SONAR-11041 Rename button to start new project tutorial * SONAR-11041 Rework sonarcloud tabbed page styling * SONAR-11042 Add alm app install buttons in create project page * Make start script compatible with ALM integration
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r--server/sonar-web/src/main/js/api/alm-integration.ts30
-rw-r--r--server/sonar-web/src/main/js/api/components.ts29
2 files changed, 45 insertions, 14 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
new file mode 100644
index 00000000000..0232632ccc2
--- /dev/null
+++ b/server/sonar-web/src/main/js/api/alm-integration.ts
@@ -0,0 +1,30 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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 } from '../helpers/request';
+import throwGlobalError from '../app/utils/throwGlobalError';
+
+export function getRepositories(): Promise<{
+ installation: {
+ installationUrl: string;
+ enabled: boolean;
+ };
+}> {
+ return getJSON('/api/alm_integration/list_repositories').catch(throwGlobalError);
+}
diff --git a/server/sonar-web/src/main/js/api/components.ts b/server/sonar-web/src/main/js/api/components.ts
index a069c38b17e..c917f8a4460 100644
--- a/server/sonar-web/src/main/js/api/components.ts
+++ b/server/sonar-web/src/main/js/api/components.ts
@@ -17,8 +17,8 @@
* 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, postJSON, post, RequestData } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
+import { getJSON, postJSON, post, RequestData } from '../helpers/request';
import { Paging, Visibility, BranchParameters, MyProject } from '../app/types';
export interface BaseSearchProjectsParameters {
@@ -31,29 +31,30 @@ export interface BaseSearchProjectsParameters {
visibility?: Visibility;
}
-export interface SearchProjectsParameters extends BaseSearchProjectsParameters {
- p?: number;
- ps?: number;
+export interface ProjectBase {
+ key: string;
+ name: string;
+ qualifier: string;
+ visibility: Visibility;
}
-export interface SearchProjectsResponseComponent {
+export interface Project extends ProjectBase {
id: string;
- key: string;
lastAnalysisDate?: string;
- name: string;
organization: string;
- qualifier: string;
- visibility: Visibility;
}
-export interface SearchProjectsResponse {
- components: SearchProjectsResponseComponent[];
- paging: Paging;
+export interface SearchProjectsParameters extends BaseSearchProjectsParameters {
+ p?: number;
+ ps?: number;
}
export function getComponents(
parameters: SearchProjectsParameters
-): Promise<SearchProjectsResponse> {
+): Promise<{
+ components: Project[];
+ paging: Paging;
+}> {
return getJSON('/api/projects/search', parameters);
}
@@ -75,7 +76,7 @@ export function createProject(data: {
name: string;
project: string;
organization?: string;
-}): Promise<any> {
+}): Promise<{ project: ProjectBase }> {
return postJSON('/api/projects/create', data).catch(throwGlobalError);
}