aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api/components.js
diff options
context:
space:
mode:
authorGrégoire Aubert <gregaubert@users.noreply.github.com>2017-03-20 13:15:55 +0100
committerGitHub <noreply@github.com>2017-03-20 13:15:55 +0100
commitfff745c5b6f9e713a66dd9393ceafd9aad397f0d (patch)
tree837fc437a3781e7b1d0b31dffeec3add493083e4 /server/sonar-web/src/main/js/api/components.js
parentab8377a211348bc4ca17c731a71f6cd80f855eca (diff)
downloadsonarqube-fff745c5b6f9e713a66dd9393ceafd9aad397f0d.tar.gz
sonarqube-fff745c5b6f9e713a66dd9393ceafd9aad397f0d.zip
SONAR-8843 Add the tags on the projects page and project homepage (#1801)
Diffstat (limited to 'server/sonar-web/src/main/js/api/components.js')
-rw-r--r--server/sonar-web/src/main/js/api/components.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/api/components.js b/server/sonar-web/src/main/js/api/components.js
index c2ec0a454f5..75fa13cb001 100644
--- a/server/sonar-web/src/main/js/api/components.js
+++ b/server/sonar-web/src/main/js/api/components.js
@@ -107,20 +107,26 @@ export function getTree(component: string, options?: Object = {}) {
return getJSON(url, data);
}
-export function getParents({ id, key }: { id: string, key: string }) {
+export function getComponentShow(component: string) {
const url = '/api/components/show';
- const data = id ? { id } : { key };
- return getJSON(url, data).then(r => r.ancestors);
+ return getJSON(url, { component });
+}
+
+export function getParents(component: string) {
+ return getComponentShow(component).then(r => r.ancestors);
}
export function getBreadcrumbs(component: string) {
- const url = '/api/components/show';
- return getJSON(url, { component }).then(r => {
+ return getComponentShow(component).then(r => {
const reversedAncestors = [...r.ancestors].reverse();
return [...reversedAncestors, r.component];
});
}
+export function getComponentTags(component: string) {
+ return getComponentShow(component).then(r => r.component.tags || []);
+}
+
export function getMyProjects(data?: Object) {
const url = '/api/projects/search_my_projects';
return getJSON(url, data);