-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-74110][JENKINS-74109] Extract inline JavaScript (#335)
* [JENKINS-74109] Extract inline JavaScript from `AbstractClaimBuildAction/summary.jelly` * [JENKINS-74109] Extract JavaScript from `AbstractClaimBuildAction/tablerow.jelly`
- Loading branch information
1 parent
6217bea
commit 619f52a
Showing
4 changed files
with
109 additions
and
59 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/main/resources/hudson/plugins/claim/AbstractClaimBuildAction/resource.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
function showPopup() { | ||
var hp = document.getElementById("claimHoverPopup"); | ||
hp.style.display = "block"; | ||
} | ||
|
||
function hidePopup() { | ||
var hp = document.getElementById("claimHoverPopup"); | ||
hp.style.display = "none"; | ||
} | ||
|
||
function display(error) { | ||
var reasonText = document.getElementById("errordesc"); | ||
claimBuildAction.getReason(error, function(content) { | ||
reasonText.textContent = content.responseObject(); | ||
}); | ||
} | ||
|
||
Behaviour.specify("A#claim", "AbstractClaimBuildAction_claim", 0, function (element) { | ||
element.addEventListener("click", (event) => { | ||
event.preventDefault(); | ||
showPopup(); | ||
}); | ||
}); | ||
|
||
Behaviour.specify("A#reassign", "AbstractClaimBuildAction_reassign", 0, function (element) { | ||
element.addEventListener("click", (event) => { | ||
event.preventDefault(); | ||
showPopup(); | ||
}); | ||
}); | ||
|
||
Behaviour.specify(".claim-hide-popup", "AbstractClaimBuildAction_hide-popup", 0, function (element) { | ||
element.addEventListener("click", (event) => { | ||
hidePopup(); | ||
}); | ||
}); | ||
|
||
Behaviour.specify(".claim-bfa-display-error", "AbstractClaimBuildAction_display-bfa-error", 0, function (element) { | ||
element.addEventListener("change", (event) => { | ||
display(event.target.value); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/resources/hudson/plugins/claim/AbstractClaimBuildAction/tablerow-resource.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
function showPopup(hoveritem) { | ||
var row = hoveritem.closest('tr'); | ||
var hp = row.querySelector(".claimHoverPopup"); | ||
if (hp) { | ||
hp.style.display = "block"; | ||
} else { | ||
console.error("Claim popup not found in the same row."); | ||
} | ||
} | ||
|
||
function hidePopup(hoveritem) { | ||
var row = hoveritem.closest('tr'); | ||
var hp = row.querySelector(".claimHoverPopup"); | ||
if (hp) { | ||
hp.style.display = "none"; | ||
} else { | ||
console.error("Claim popup not found in the same row."); | ||
} | ||
} | ||
|
||
function display(hoveritem, error) { | ||
var row = hoveritem.closest('tr'); | ||
var reasonText = row.querySelector('#errordesc'); | ||
claimBuildAction.getReason(error, function(content) { | ||
reasonText.textContent = content.responseObject(); | ||
}); | ||
} | ||
|
||
Behaviour.specify("A#claim", "AbstractClaimBuildAction_claim", 0, function (element) { | ||
element.addEventListener("click", (event) => { | ||
event.preventDefault(); | ||
showPopup(event.target.closest("a#claim")); | ||
}); | ||
}); | ||
|
||
Behaviour.specify("A#reassign", "AbstractClaimBuildAction_reassign", 0, function (element) { | ||
element.addEventListener("click", (event) => { | ||
event.preventDefault(); | ||
showPopup(event.target.closest("a#reassign")); | ||
}); | ||
}); | ||
|
||
Behaviour.specify(".claim-hide-popup", "AbstractClaimBuildAction_hide-popup", 0, function (element) { | ||
element.addEventListener("click", (event) => { | ||
hidePopup(event.target); | ||
}); | ||
}); | ||
|
||
Behaviour.specify(".claim-bfa-display-error", "AbstractClaimBuildAction_display-bfa-error", 0, function (element) { | ||
element.addEventListener("change", (event) => { | ||
display(event.target, event.target.value); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters