aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-09-01 16:33:48 +0200
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-09-12 11:34:58 +0200
commitc2954e35714c703c84b0e4c2af4e0249751516b6 (patch)
tree2b41a712c1f161815fc936eb520ee04da49b2a07 /server/sonar-web/src/main/js/api
parent081f3bce1dfa04d2445178045885bd8a50494f1f (diff)
downloadsonarqube-c2954e35714c703c84b0e4c2af4e0249751516b6.tar.gz
sonarqube-c2954e35714c703c84b0e4c2af4e0249751516b6.zip
SONAR-9736 fix access to project admin pages
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r--server/sonar-web/src/main/js/api/quality-gates.ts25
-rw-r--r--server/sonar-web/src/main/js/api/quality-profiles.ts21
2 files changed, 41 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/api/quality-gates.ts b/server/sonar-web/src/main/js/api/quality-gates.ts
index b07f1a89104..2839607c23c 100644
--- a/server/sonar-web/src/main/js/api/quality-gates.ts
+++ b/server/sonar-web/src/main/js/api/quality-gates.ts
@@ -24,11 +24,21 @@ export function fetchQualityGatesAppDetails(): Promise<any> {
return getJSON('/api/qualitygates/app').catch(throwGlobalError);
}
-export function fetchQualityGates(): Promise<any> {
+export interface QualityGate {
+ isDefault?: boolean;
+ id: string;
+ name: string;
+}
+
+export function fetchQualityGates(): Promise<QualityGate[]> {
return getJSON('/api/qualitygates/list').then(
r =>
r.qualitygates.map((qualityGate: any) => {
- return { ...qualityGate, isDefault: qualityGate.id === r.default };
+ return {
+ ...qualityGate,
+ id: String(qualityGate.id),
+ isDefault: qualityGate.id === r.default
+ };
}),
throwGlobalError
);
@@ -74,8 +84,15 @@ export function deleteCondition(id: string): Promise<void> {
return post('/api/qualitygates/delete_condition', { id });
}
-export function getGateForProject(projectKey: string): Promise<any> {
- return getJSON('/api/qualitygates/get_by_project', { projectKey }).then(r => r.qualityGate);
+export function getGateForProject(projectKey: string): Promise<QualityGate | undefined> {
+ return getJSON('/api/qualitygates/get_by_project', { projectKey }).then(
+ r =>
+ r.qualityGate && {
+ id: r.qualityGate.id,
+ isDefault: r.qualityGate.default,
+ name: r.qualityGate.name
+ }
+ );
}
export function associateGateWithProject(
diff --git a/server/sonar-web/src/main/js/api/quality-profiles.ts b/server/sonar-web/src/main/js/api/quality-profiles.ts
index 630effa1831..9ee43f3eabf 100644
--- a/server/sonar-web/src/main/js/api/quality-profiles.ts
+++ b/server/sonar-web/src/main/js/api/quality-profiles.ts
@@ -27,10 +27,29 @@ import {
RequestData
} from '../helpers/request';
+export interface Profile {
+ key: string;
+ name: string;
+ language: string;
+ languageName: string;
+ isInherited?: boolean;
+ parentKey?: string;
+ parentName?: string;
+ isDefault?: boolean;
+ activeRuleCount: number;
+ activeDeprecatedRuleCount: number;
+ rulesUpdatedAt?: string;
+ lastUsed?: string;
+ userUpdatedAt?: string;
+ organization: string;
+ isBuiltIn?: boolean;
+ projectCount?: number;
+}
+
export function searchQualityProfiles(data: {
organization?: string;
projectKey?: string;
-}): Promise<any> {
+}): Promise<Profile[]> {
return getJSON('/api/qualityprofiles/search', data).then(r => r.profiles);
}