aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api
diff options
context:
space:
mode:
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);
}