Skip to content

Commit

Permalink
Merge pull request #89 from jenkinsci/viewproxy-name
Browse files Browse the repository at this point in the history
Fix name of `proxy` variable
  • Loading branch information
uhafner authored Feb 24, 2024
2 parents 2848817 + 12dc038 commit d1d6e78
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<url>https://github.com/jenkinsci/coverage-plugin</url>

<properties>
<revision>1.12.0</revision>
<revision>1.11.1</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/coverage-plugin</gitHubRepo>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* global jQuery3, proxy, echartsJenkinsApi, bootstrap5 */

(function () {
proxy.getJenkinsColorIDs(function (colors) {
const jenkinsColors = getJenkinsColors(colors.responseObject());
const colorJson = JSON.stringify(Object.fromEntries(jenkinsColors));
proxy.setJenkinsColors(colorJson);
new CoverageChartGenerator(jQuery3).populateDetailsCharts(jenkinsColors);
new CoverageChartGenerator(jQuery3, proxy).populateDetailsCharts(jenkinsColors);
});
})();
16 changes: 8 additions & 8 deletions plugin/src/main/webapp/js/view-model.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global jQuery3, viewProxy, echartsJenkinsApi, bootstrap5 */
/* global jQuery3, proxy, echartsJenkinsApi, bootstrap5 */

getJenkinsColors = function (colors) {
// TODO: also handle HSL colors and parse them to hex in order to use dark mode colors
Expand All @@ -12,15 +12,15 @@ getJenkinsColors = function (colors) {
return colorHexMapping;
};

const CoverageChartGenerator = function ($) {
const CoverageChartGenerator = function ($, proxy) {
var selectedTreeNode;

function printPercentage(value, minimumFractionDigits = 2) {
return Number(value / 100.0).toLocaleString(undefined, {style: 'percent', minimumFractionDigits: minimumFractionDigits});
}

const openBuild = function (build) {
viewProxy.getUrlForBuild(build, window.location.href, function (buildUrl) {
proxy.getUrlForBuild(build, window.location.href, function (buildUrl) {
if (buildUrl.responseJSON.startsWith('http')) {
window.location.assign(buildUrl.responseJSON);
}
Expand Down Expand Up @@ -350,14 +350,14 @@ const CoverageChartGenerator = function ($) {
function initializeCharts() {
renderTrendChart();

viewProxy.getOverview(function (t) {
proxy.getOverview(function (t) {
createOverview(t.responseObject(), 'coverage-overview');
});

$('.tree-chart').each(function () {
const id = $(this).attr('id');
const name = $(this).attr('data-item-name');
viewProxy.getCoverageTree(id, function (t) {
proxy.getCoverageTree(id, function (t) {
createFilesTreeMap(t.responseObject(), id, name);
});
});
Expand All @@ -369,7 +369,7 @@ const CoverageChartGenerator = function ($) {

function renderTrendChart() {
const configuration = JSON.stringify(echartsJenkinsApi.readFromLocalStorage('jenkins-echarts-chart-configuration-coverage-history'));
viewProxy.getTrendChart(configuration, function (t) {
proxy.getTrendChart(configuration, function (t) {
echartsJenkinsApi.renderConfigurableZoomableTrendChart('coverage-trend', t.responseJSON, 'chart-configuration-coverage-history', openBuild);
resizeChartOf('#coverage-trend');
});
Expand Down Expand Up @@ -430,7 +430,7 @@ const CoverageChartGenerator = function ($) {
showSourceCode();
sourceView.html('Loading...');
const rowData = datatable.rows(indexes).data().toArray();
viewProxy.getSourceCode(rowData[0].fileHash, tableId + '-table', function (t) {
proxy.getSourceCode(rowData[0].fileHash, tableId + '-table', function (t) {
const sourceCode = t.responseObject();
if (sourceCode === "n/a") {
showNoSourceCode();
Expand Down Expand Up @@ -462,7 +462,7 @@ const CoverageChartGenerator = function ($) {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
redrawCharts();

viewProxy.getOverview(function (t) {
proxy.getOverview(function (t) {
createOverview(t.responseObject(), 'coverage-overview');
});
});
Expand Down

0 comments on commit d1d6e78

Please sign in to comment.