From d816fc84bb5f2d44403ecf2203c492826ae6a4bc Mon Sep 17 00:00:00 2001 From: Jan Hill Date: Mon, 1 Aug 2022 19:40:33 +0200 Subject: [PATCH] improve branch and pullrequest handling --- src/main/web/dashboard.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/web/dashboard.js b/src/main/web/dashboard.js index af028185..b1ae4764 100644 --- a/src/main/web/dashboard.js +++ b/src/main/web/dashboard.js @@ -16,8 +16,19 @@ window.registerExtension('licensecheck/dashboard', function (options) { } }, created() { + let uri = window.location.search.substring(1); + let params = new URLSearchParams(uri); + let request = request = { + component : options.component.key, + metricKeys : "licensecheck.license,licensecheck.dependency" + }; + if (params.has("branch")){ + request.branch = params.get("branch"); + } else if (params.has("pullRequest")) { + request.pullRequest = params.get("pullRequest"); + } window.SonarRequest - .getJSON(`/api/measures/component?component=${this.component.key}&branch=${options.branchLike.name}&metricKeys=licensecheck.license,licensecheck.dependency`) + .getJSON("/api/measures/component", request) .then(response => { response.component.measures.forEach(measure => { if (measure.metric === 'licensecheck.license') {