Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add theme support #181

Merged
merged 1 commit into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.6</version>
<version>4.15</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
Expand All @@ -13,16 +13,13 @@
<packaging>hpi</packaging>
<properties>
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->
<jenkins.version>2.204.6</jenkins.version>
<jenkins.version>2.222.4</jenkins.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of the plugins in the bom didn't do that 😂 so the minimum is realistically the latest one

<java.level>8</java.level>
<!-- Other properties you may want to use:
~ jenkins-test-harness.version: Jenkins Test Harness version you use to test the plugin. For Jenkins version >= 1.580.1 use JTH 2.0 or higher.
~ hpi-plugin.version: The HPI Maven Plugin version used by the plugin..
~ stapler-plugin.version: The Stapler Maven plugin version required by the plugin.
-->

<!-- GitHub Checks plugin is still in beta version-->
<useBeta>true</useBeta>
</properties>
<name>Code Coverage API Plugin</name>
<description>Code Coverage API Plugin</description>
Expand All @@ -40,19 +37,15 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.204.x</artifactId>
<version>11</version>
<artifactId>bom-2.222.x</artifactId>
<version>21</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
Expand Down Expand Up @@ -110,22 +103,15 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>checks-api</artifactId>
<version>0.2.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>display-url-api</artifactId>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
62 changes: 49 additions & 13 deletions src/main/webapp/scripts/custom-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var CoverageChartGenerator = function () {
summaryChartDiv.style.height = metrics.length * 31 + 200 + "px";
var summaryChart = echarts.init(summaryChartDiv);

const textColor = getComputedStyle(document.body).getPropertyValue('--text-color') || '#333';

var stackedBarOption = {

Expand All @@ -62,7 +63,10 @@ var CoverageChartGenerator = function () {
// },

title: {
text: transformXML(name) + (isTitleHasLink?' (click to see more details)':'')
text: transformXML(name) + (isTitleHasLink?' (click to see more details)':''),
textStyle: {
color: textColor
}
},

toolbox: {
Expand Down Expand Up @@ -94,7 +98,10 @@ var CoverageChartGenerator = function () {
legend: {
data: ['Covered', 'Missed'],
right: 10,
top: 25
top: 25,
textStyle: {
color: textColor
}
},
grid: {
left: '3%',
Expand All @@ -103,8 +110,10 @@ var CoverageChartGenerator = function () {
containLabel: true
},
xAxis: {
type: 'value'

type: 'value',
axisLabel: {
color: textColor
}
},
yAxis: [{
type: 'category',
Expand All @@ -114,6 +123,9 @@ var CoverageChartGenerator = function () {
},
axisTick: {
show: false
},
axisLabel: {
color: textColor
}
}, {
type: 'category',
Expand All @@ -122,7 +134,8 @@ var CoverageChartGenerator = function () {
axisLabel: {
formatter: function (value, index) {
return coveredPercentage[index].toFixed(2) + "%";
}
},
color: textColor
},
axisLine: {
show: false
Expand Down Expand Up @@ -212,10 +225,15 @@ var CoverageChartGenerator = function () {
childSummaryChartDiv.style.height = height + "px";
var childSummaryChart = echarts.init(childSummaryChartDiv);

const textColor = getComputedStyle(document.body).getPropertyValue('--text-color') || '#333';

var childSummaryChartOption = {
title: {
text: 'Divided by ' + (metric ? metric + ' Name' : ''),
subtext: "click item name to see more details"
subtext: "click item name to see more details",
textStyle: {
color: textColor
}
},

tooltip: {
Expand Down Expand Up @@ -258,7 +276,8 @@ var CoverageChartGenerator = function () {
},
axisLabel: {
interval: 0,
fontWeight: 'bold'
fontWeight: 'bold',
color: textColor
}
},
yAxis: {
Expand All @@ -284,7 +303,8 @@ var CoverageChartGenerator = function () {
return value.substring(0, 70)+'...';
}
return value;
}
},
color: textColor
}
},
visualMap: {
Expand Down Expand Up @@ -395,10 +415,14 @@ var CoverageChartGenerator = function () {

});

const textColor = getComputedStyle(document.body).getPropertyValue('--text-color') || '#333';

var option = {
title: {
text: 'Trend'
text: 'Trend',
textStyle: {
color: textColor
}
},
tooltip: {
trigger: 'item',
Expand All @@ -407,7 +431,10 @@ var CoverageChartGenerator = function () {
}
},
legend: {
data: metrics
data: metrics,
textStyle: {
color: textColor
}
},
toolbox: {
feature: {
Expand All @@ -421,15 +448,24 @@ var CoverageChartGenerator = function () {
dataZoom: {
type: 'inside',
yAxisIndex: [0],
orient: 'vertical'
orient: 'vertical',
textStyle: {
color: textColor
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: builds
data: builds,
axisLabel: {
color: textColor
}
},
yAxis: {
type: 'value'
type: 'value',
axisLabel: {
color: textColor
}
},
series: series
};
Expand Down