|
1 | 1 | function loadOctaneCoverageWidget(projectKey, issueKey, issueId) {
|
2 | 2 | var query = "&project-key=" + projectKey + "&issue-key=" + issueKey + "&issue-id=" + issueId;
|
3 | 3 | var url = AJS.contextPath() + "/rest/octane-coverage/1.0/coverage?" + query;
|
4 |
| - console.log("loadOctaneCoverageWidget :" + url); |
| 4 | + console.log("[coverage] loadOctaneCoverageWidget :" + url); |
5 | 5 |
|
6 | 6 | //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" |
8 | 9 | }).done(function (data) {
|
9 |
| - var panelEl = $("#octane-coverage-panel"); |
| 10 | + var panelEl = jQuery("#octane-coverage-panel"); |
10 | 11 | var issueKeyFromHtml = panelEl.attr("issue-key");
|
11 | 12 | var issueKeyFromData = data.issueKey;
|
12 | 13 | if (issueKeyFromHtml !== issueKeyFromData) {
|
13 |
| - console.log("issueKeyFromHtml(" + issueKeyFromHtml + ")!==issueKeyFromData(" + issueKeyFromData + ") => return"); |
| 14 | + console.log("[coverage] issueKeyFromHtml(" + issueKeyFromHtml + ")!==issueKeyFromData(" + issueKeyFromData + ") => return"); |
14 | 15 | return;
|
15 | 16 | }
|
16 | 17 |
|
17 |
| - $("#octane-loading-section").addClass("hidden"); |
| 18 | + jQuery("#octane-loading-section").addClass("hidden"); |
18 | 19 |
|
19 | 20 | if (data.status === 'noData') {
|
20 |
| - $("#octane-no-data-section").removeClass("hidden"); |
| 21 | + jQuery("#octane-no-data-section").removeClass("hidden"); |
21 | 22 | } else if (data.status === 'noValidConfiguration') {
|
22 |
| - $("#octane-no-valid-configuration-section").removeClass("hidden"); |
| 23 | + jQuery("#octane-no-valid-configuration-section").removeClass("hidden"); |
23 | 24 | } else if (data.status === 'hasData') {
|
24 |
| - $("#octane-entity-section").removeClass("hidden"); |
| 25 | + jQuery("#octane-entity-section").removeClass("hidden"); |
25 | 26 |
|
26 | 27 | //entity settings
|
27 | 28 | 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); |
34 | 35 |
|
35 | 36 | //totals
|
36 | 37 | var totalRuns = data.totalExecutedTestsCount ? data.totalExecutedTestsCount + " last runs:" : "No last runs";
|
37 |
| - $("#octane-total-runs").text(totalRuns); |
| 38 | + jQuery("#octane-total-runs").text(totalRuns); |
38 | 39 | 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); |
41 | 42 |
|
42 | 43 | } 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"); |
45 | 46 | }
|
46 | 47 |
|
47 | 48 | //coverage groups
|
48 | 49 | data.coverageGroups.forEach(function (entry) {
|
49 | 50 | var idSelector = "#" + entry.fields.id;
|
50 | 51 | var countSelector = idSelector + " .octane-test-status-count";
|
51 | 52 | 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); |
55 | 56 | });
|
56 | 57 | }
|
57 | 58 |
|
58 | 59 | 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>"); |
62 | 63 | });
|
63 | 64 | }
|
64 | 65 |
|
|
0 commit comments