Skip to content

Commit 7fa9fae

Browse files
committed
defect #1962496: change $ to jQuery (fix for not loading the plugin on jira server >= 9.x)
1 parent a8b21a7 commit 7fa9fae

File tree

3 files changed

+35
-33
lines changed

3 files changed

+35
-33
lines changed

pom.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
<!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
2525
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
2626

27-
<jira.version>8.20.7</jira.version>
28-
<jira.software.application.version>8.20.7</jira.software.application.version>
29-
<amps.version>8.0.2</amps.version>
27+
<jira.version>9.3.0</jira.version>
28+
<jira.software.application.version>9.3.0</jira.software.application.version>
29+
<amps.version>8.6.0</amps.version>
3030

3131
<plugin.testrunner.version>2.0.1</plugin.testrunner.version>
3232
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
@@ -175,7 +175,7 @@
175175
<dependency>
176176
<groupId>com.google.code.gson</groupId>
177177
<artifactId>gson</artifactId>
178-
<version>2.2.2-atlassian-1</version>
178+
<version>2.8.9</version>
179179
</dependency>
180180
<dependency>
181181
<groupId>com.atlassian.util.concurrent</groupId>
@@ -203,7 +203,8 @@
203203
<configuration>
204204
<productVersion>${jira.version}</productVersion>
205205
<productDataVersion>${jira.version}</productDataVersion>
206-
<jvmArgs>-Xms1g -Xmx1g -XX:+ExplicitGCInvokesConcurrent</jvmArgs>
206+
<jvmArgs>-Xms512m -Xmx4096m -XX:+ExplicitGCInvokesConcurrent</jvmArgs>
207+
<extractDependencies>false</extractDependencies>
207208
<applications>
208209
<application>
209210
<applicationKey>jira-software</applicationKey>

src/main/resources/js/jira-octane-plugin-coverage-panel.js

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,65 @@
11
function loadOctaneCoverageWidget(projectKey, issueKey, issueId) {
22
var query = "&project-key=" + projectKey + "&issue-key=" + issueKey + "&issue-id=" + issueId;
33
var url = AJS.contextPath() + "/rest/octane-coverage/1.0/coverage?" + query;
4-
console.log("loadOctaneCoverageWidget :" + url);
4+
console.log("[coverage] loadOctaneCoverageWidget :" + url);
55

66
//do request
7-
$.ajax({url: url, type: "GET", dataType: "json", contentType: "application/json"
7+
jQuery.ajax({
8+
url: url, type: "GET", dataType: "json", contentType: "application/json"
89
}).done(function (data) {
9-
var panelEl = $("#octane-coverage-panel");
10+
var panelEl = jQuery("#octane-coverage-panel");
1011
var issueKeyFromHtml = panelEl.attr("issue-key");
1112
var issueKeyFromData = data.issueKey;
1213
if (issueKeyFromHtml !== issueKeyFromData) {
13-
console.log("issueKeyFromHtml(" + issueKeyFromHtml + ")!==issueKeyFromData(" + issueKeyFromData + ") => return");
14+
console.log("[coverage] issueKeyFromHtml(" + issueKeyFromHtml + ")!==issueKeyFromData(" + issueKeyFromData + ") => return");
1415
return;
1516
}
1617

17-
$("#octane-loading-section").addClass("hidden");
18+
jQuery("#octane-loading-section").addClass("hidden");
1819

1920
if (data.status === 'noData') {
20-
$("#octane-no-data-section").removeClass("hidden");
21+
jQuery("#octane-no-data-section").removeClass("hidden");
2122
} else if (data.status === 'noValidConfiguration') {
22-
$("#octane-no-valid-configuration-section").removeClass("hidden");
23+
jQuery("#octane-no-valid-configuration-section").removeClass("hidden");
2324
} else if (data.status === 'hasData') {
24-
$("#octane-entity-section").removeClass("hidden");
25+
jQuery("#octane-entity-section").removeClass("hidden");
2526

2627
//entity settings
2728
var octaneEntity = data.octaneEntity.fields;
28-
$("#octane-entity-icon-text").text(octaneEntity.typeAbbreviation);
29-
$("#octane-entity-icon").css("background-color", octaneEntity.typeColor);
30-
$("#octane-entity-url a").attr("href", octaneEntity.url);
31-
$("#octane-entity-url a").text(octaneEntity.id);
32-
$("#octane-entity-name").text(octaneEntity.name);
33-
$("#octane-entity-name").attr("title", octaneEntity.name);
29+
jQuery("#octane-entity-icon-text").text(octaneEntity.typeAbbreviation);
30+
jQuery("#octane-entity-icon").css("background-color", octaneEntity.typeColor);
31+
jQuery("#octane-entity-url a").attr("href", octaneEntity.url);
32+
jQuery("#octane-entity-url a").text(octaneEntity.id);
33+
jQuery("#octane-entity-name").text(octaneEntity.name);
34+
jQuery("#octane-entity-name").attr("title", octaneEntity.name);
3435

3536
//totals
3637
var totalRuns = data.totalExecutedTestsCount ? data.totalExecutedTestsCount + " last runs:" : "No last runs";
37-
$("#octane-total-runs").text(totalRuns);
38+
jQuery("#octane-total-runs").text(totalRuns);
3839
if (data.totalTestsCount) {
39-
$("#octane-total-tests").text(data.totalTestsCount);
40-
$("#view-tests-in-alm").attr("href", octaneEntity.testTabUrl);
40+
jQuery("#octane-total-tests").text(data.totalTestsCount);
41+
jQuery("#view-tests-in-alm").attr("href", octaneEntity.testTabUrl);
4142

4243
} else {
43-
$("#view-tests-in-alm").text("No linked tests in ALM Octane");
44-
$("#view-tests-in-alm").attr("style", "pointer-events: none; cursor: default; color: gray; font-weight: bold");
44+
jQuery("#view-tests-in-alm").text("No linked tests in ALM Octane");
45+
jQuery("#view-tests-in-alm").attr("style", "pointer-events: none; cursor: default; color: gray; font-weight: bold");
4546
}
4647

4748
//coverage groups
4849
data.coverageGroups.forEach(function (entry) {
4950
var idSelector = "#" + entry.fields.id;
5051
var countSelector = idSelector + " .octane-test-status-count";
5152
var percentageSelector = idSelector + " .octane-test-status-percentage";
52-
$(idSelector).removeClass("hidden");
53-
$(countSelector).text(entry.fields.countStr);
54-
$(percentageSelector).text(entry.fields.percentage);
53+
jQuery(idSelector).removeClass("hidden");
54+
jQuery(countSelector).text(entry.fields.countStr);
55+
jQuery(percentageSelector).text(entry.fields.percentage);
5556
});
5657
}
5758

5859
if (data.debug) {
59-
$("#octane-debug-section").removeClass("hidden");
60-
$.each(data.debug, function (key, val) {
61-
$("#octane-debug-section").append("<p>" + key + " : " + val + "</p>");
60+
jQuery("#octane-debug-section").removeClass("hidden");
61+
jQuery.each(data.debug, function (key, val) {
62+
jQuery("#octane-debug-section").append("<p>" + key + " : " + val + "</p>");
6263
});
6364
}
6465

src/main/resources/templates/test-coverage-web-panel.vm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script language="JavaScript" type="text/javascript">
2-
$(document).ready(function() {
2+
jQuery(document).ready(function() {
33
console.log("octane plugin : document ready");
44
load(1);
55
});
66

77
function load(counter) {
8-
var panelEl = $("#octane-coverage-panel:not(.resolved)");
8+
var panelEl = jQuery("#octane-coverage-panel:not(.resolved)");
99

1010
if (!panelEl.length) {
1111
if(counter < 30) {
@@ -18,7 +18,7 @@
1818
var projectKey = panelEl.attr("project-key");
1919
var issueKey = panelEl.attr("issue-key");
2020
var issueId = panelEl.attr("issue-id");
21-
$("#octane-coverage-panel").addClass("resolved");
21+
jQuery("#octane-coverage-panel").addClass("resolved");
2222
loadOctaneCoverageWidget(projectKey, issueKey, issueId);
2323
}
2424
};

0 commit comments

Comments
 (0)