aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api
diff options
context:
space:
mode:
authorPhilippe Perrin <philippe.perrin@sonarsource.com>2019-11-27 22:16:40 +0100
committerSonarTech <sonartech@sonarsource.com>2019-12-09 20:46:17 +0100
commit064e1d872f584f4568a12fa0f31e6a4f975a7437 (patch)
tree2dba1212e3aff2309b4d016c75ae5d9809bf423c /server/sonar-web/src/main/js/api
parent7197bceddc7c51d51cd46e22b68cdc71d277aa65 (diff)
downloadsonarqube-064e1d872f584f4568a12fa0f31e6a4f975a7437.tar.gz
sonarqube-064e1d872f584f4568a12fa0f31e6a4f975a7437.zip
SONAR-12679 Drop short & long living branch concept
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r--server/sonar-web/src/main/js/api/branches.ts5
-rw-r--r--server/sonar-web/src/main/js/api/components.ts21
-rw-r--r--server/sonar-web/src/main/js/api/measures.ts3
-rw-r--r--server/sonar-web/src/main/js/api/nav.ts3
-rw-r--r--server/sonar-web/src/main/js/api/projectActivity.ts3
-rw-r--r--server/sonar-web/src/main/js/api/quality-gates.ts3
-rw-r--r--server/sonar-web/src/main/js/api/settings.ts7
-rw-r--r--server/sonar-web/src/main/js/api/time-machine.ts5
8 files changed, 29 insertions, 21 deletions
diff --git a/server/sonar-web/src/main/js/api/branches.ts b/server/sonar-web/src/main/js/api/branches.ts
index 0bf62d734b6..d2c152405f0 100644
--- a/server/sonar-web/src/main/js/api/branches.ts
+++ b/server/sonar-web/src/main/js/api/branches.ts
@@ -19,12 +19,13 @@
*/
import { getJSON, post } from 'sonar-ui-common/helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
+import { Branch, PullRequest } from '../types/branch-like';
-export function getBranches(project: string): Promise<T.Branch[]> {
+export function getBranches(project: string): Promise<Branch[]> {
return getJSON('/api/project_branches/list', { project }).then(r => r.branches, throwGlobalError);
}
-export function getPullRequests(project: string): Promise<T.PullRequest[]> {
+export function getPullRequests(project: string): Promise<PullRequest[]> {
return getJSON('/api/project_pull_requests/list', { project }).then(
r => r.pullRequests,
throwGlobalError
diff --git a/server/sonar-web/src/main/js/api/components.ts b/server/sonar-web/src/main/js/api/components.ts
index 8b26dacc1bb..32b7933674e 100644
--- a/server/sonar-web/src/main/js/api/components.ts
+++ b/server/sonar-web/src/main/js/api/components.ts
@@ -19,6 +19,7 @@
*/
import { getJSON, post, postJSON, RequestData } from 'sonar-ui-common/helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
+import { BranchParameters } from '../types/branch-like';
export interface BaseSearchProjectsParameters {
analyzedBefore?: string;
@@ -121,7 +122,7 @@ export function getComponentLeaves(
}
export function getComponent(
- data: { component: string; metricKeys: string } & T.BranchParameters
+ data: { component: string; metricKeys: string } & BranchParameters
): Promise<{ component: T.ComponentMeasure }> {
return getJSON('/api/measures/component', data);
}
@@ -148,7 +149,7 @@ type GetTreeParams = {
q?: string;
s?: string;
strategy?: 'all' | 'leaves' | 'children';
-} & T.BranchParameters;
+} & BranchParameters;
export function getTree<T = TreeComponent>(
data: GetTreeParams & { qualifiers?: string }
@@ -164,17 +165,17 @@ export function getDirectories(data: GetTreeParams) {
return getTree<TreeComponentWithPath>({ ...data, qualifiers: 'DIR' });
}
-export function getComponentData(data: { component: string } & T.BranchParameters): Promise<any> {
+export function getComponentData(data: { component: string } & BranchParameters): Promise<any> {
return getJSON('/api/components/show', data);
}
export function doesComponentExists(
- data: { component: string } & T.BranchParameters
+ data: { component: string } & BranchParameters
): Promise<boolean> {
return getComponentData(data).then(({ component }) => component !== undefined, () => false);
}
-export function getComponentShow(data: { component: string } & T.BranchParameters): Promise<any> {
+export function getComponentShow(data: { component: string } & BranchParameters): Promise<any> {
return getComponentData(data).catch(throwGlobalError);
}
@@ -182,7 +183,7 @@ export function getParents(component: string): Promise<any> {
return getComponentShow({ component }).then(r => r.ancestors);
}
-export function getBreadcrumbs(data: { component: string } & T.BranchParameters): Promise<any> {
+export function getBreadcrumbs(data: { component: string } & BranchParameters): Promise<any> {
return getComponentShow(data).then(r => {
const reversedAncestors = [...r.ancestors].reverse();
return [...reversedAncestors, r.component];
@@ -275,25 +276,25 @@ export function getSuggestions(
}
export function getComponentForSourceViewer(
- data: { component: string } & T.BranchParameters
+ data: { component: string } & BranchParameters
): Promise<T.SourceViewerFile> {
return getJSON('/api/components/app', data);
}
export function getSources(
- data: { key: string; from?: number; to?: number } & T.BranchParameters
+ data: { key: string; from?: number; to?: number } & BranchParameters
): Promise<T.SourceLine[]> {
return getJSON('/api/sources/lines', data).then(r => r.sources);
}
export function getDuplications(
- data: { key: string } & T.BranchParameters
+ data: { key: string } & BranchParameters
): Promise<{ duplications: T.Duplication[]; files: T.Dict<T.DuplicatedFile> }> {
return getJSON('/api/duplications/show', data).catch(throwGlobalError);
}
export function getTests(
- data: { sourceFileKey: string; sourceFileLineNumber: number | string } & T.BranchParameters
+ data: { sourceFileKey: string; sourceFileLineNumber: number | string } & BranchParameters
): Promise<any> {
return getJSON('/api/tests/list', data).then(r => r.tests);
}
diff --git a/server/sonar-web/src/main/js/api/measures.ts b/server/sonar-web/src/main/js/api/measures.ts
index 455fa131a8e..6f62cab0561 100644
--- a/server/sonar-web/src/main/js/api/measures.ts
+++ b/server/sonar-web/src/main/js/api/measures.ts
@@ -19,9 +19,10 @@
*/
import { getJSON, post, postJSON, RequestData } from 'sonar-ui-common/helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
+import { BranchParameters } from '../types/branch-like';
export function getMeasures(
- data: { component: string; metricKeys: string } & T.BranchParameters
+ data: { component: string; metricKeys: string } & BranchParameters
): Promise<T.Measure[]> {
return getJSON('/api/measures/component', data).then(r => r.component.measures, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/nav.ts b/server/sonar-web/src/main/js/api/nav.ts
index 9d1fdcec5e6..c09a42be697 100644
--- a/server/sonar-web/src/main/js/api/nav.ts
+++ b/server/sonar-web/src/main/js/api/nav.ts
@@ -19,6 +19,7 @@
*/
import { getJSON } from 'sonar-ui-common/helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
+import { BranchParameters } from '../types/branch-like';
export function getGlobalNavigation(): Promise<T.AppState> {
return getJSON('/api/navigation/global');
@@ -27,7 +28,7 @@ export function getGlobalNavigation(): Promise<T.AppState> {
type NavComponent = T.Omit<T.Component, 'alm' | 'qualifier' | 'leakPeriodDate' | 'path' | 'tags'>;
export function getComponentNavigation(
- data: { component: string } & T.BranchParameters
+ data: { component: string } & BranchParameters
): Promise<NavComponent> {
return getJSON('/api/navigation/component', data).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/projectActivity.ts b/server/sonar-web/src/main/js/api/projectActivity.ts
index 20aa8e8e89b..7b639df7931 100644
--- a/server/sonar-web/src/main/js/api/projectActivity.ts
+++ b/server/sonar-web/src/main/js/api/projectActivity.ts
@@ -19,6 +19,7 @@
*/
import { getJSON, post, postJSON, RequestData } from 'sonar-ui-common/helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
+import { BranchParameters } from '../types/branch-like';
export function getProjectActivity(
data: {
@@ -27,7 +28,7 @@ export function getProjectActivity(
from?: string;
p?: number;
ps?: number;
- } & T.BranchParameters
+ } & BranchParameters
): Promise<{ analyses: T.Analysis[]; paging: T.Paging }> {
return getJSON('/api/project_analyses/search', data).catch(throwGlobalError);
}
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 b881adfefd6..fa63e0d1b20 100644
--- a/server/sonar-web/src/main/js/api/quality-gates.ts
+++ b/server/sonar-web/src/main/js/api/quality-gates.ts
@@ -19,6 +19,7 @@
*/
import { getJSON, post, postJSON } from 'sonar-ui-common/helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
+import { BranchParameters } from '../types/branch-like';
export function fetchQualityGates(data: {
organization?: string;
@@ -174,7 +175,7 @@ export function getQualityGateProjectStatus(
data: {
projectKey?: string;
projectId?: string;
- } & T.BranchParameters
+ } & BranchParameters
): Promise<T.QualityGateProjectStatus> {
return getJSON('/api/qualitygates/project_status', data)
.then(r => r.projectStatus)
diff --git a/server/sonar-web/src/main/js/api/settings.ts b/server/sonar-web/src/main/js/api/settings.ts
index f6426a81593..5b9798f52c2 100644
--- a/server/sonar-web/src/main/js/api/settings.ts
+++ b/server/sonar-web/src/main/js/api/settings.ts
@@ -21,6 +21,7 @@ import { omitBy } from 'lodash';
import { getJSON, post, postJSON, RequestData } from 'sonar-ui-common/helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
import { isCategoryDefinition } from '../apps/settings/utils';
+import { BranchParameters } from '../types/branch-like';
export function getDefinitions(component?: string): Promise<T.SettingCategoryDefinition[]> {
return getJSON('/api/settings/list_definitions', { component }).then(
@@ -30,7 +31,7 @@ export function getDefinitions(component?: string): Promise<T.SettingCategoryDef
}
export function getValues(
- data: { keys: string; component?: string } & T.BranchParameters
+ data: { keys: string; component?: string } & BranchParameters
): Promise<T.SettingValue[]> {
return getJSON('/api/settings/values', data).then(r => r.settings);
}
@@ -57,13 +58,13 @@ export function setSettingValue(
}
export function setSimpleSettingValue(
- data: { component?: string; value: string; key: string } & T.BranchParameters
+ data: { component?: string; value: string; key: string } & BranchParameters
): Promise<void | Response> {
return post('/api/settings/set', data).catch(throwGlobalError);
}
export function resetSettingValue(
- data: { keys: string; component?: string } & T.BranchParameters
+ data: { keys: string; component?: string } & BranchParameters
): Promise<void> {
return post('/api/settings/reset', data);
}
diff --git a/server/sonar-web/src/main/js/api/time-machine.ts b/server/sonar-web/src/main/js/api/time-machine.ts
index af307b524bc..43018b3b595 100644
--- a/server/sonar-web/src/main/js/api/time-machine.ts
+++ b/server/sonar-web/src/main/js/api/time-machine.ts
@@ -19,6 +19,7 @@
*/
import { getJSON } from 'sonar-ui-common/helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
+import { BranchParameters } from '../types/branch-like';
interface TimeMachineResponse {
measures: {
@@ -36,7 +37,7 @@ export function getTimeMachineData(
p?: number;
ps?: number;
to?: string;
- } & T.BranchParameters
+ } & BranchParameters
): Promise<TimeMachineResponse> {
return getJSON('/api/measures/search_history', data).catch(throwGlobalError);
}
@@ -48,7 +49,7 @@ export function getAllTimeMachineData(
from?: string;
p?: number;
to?: string;
- } & T.BranchParameters,
+ } & BranchParameters,
prev?: TimeMachineResponse
): Promise<TimeMachineResponse> {
return getTimeMachineData({ ...data, ps: 1000 }).then(r => {