-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#7635) * [JENKINS-60866] Un-inline 'Build Now' JS * Fix formatting * Use MorphTagLibrary to simplify API * Update docs for l:task attributes * This is a collosal waste of time Copied from 8aee10e, this is just stupid * Rename adjunct file, restructure to work around broken formatter * Exclude all documented attributes except data-* * Fix onclick behavior * Address review feedback --------- Co-authored-by: Daniel Beck <[email protected]>
- Loading branch information
1 parent
6fcfb18
commit 38d31c1
Showing
4 changed files
with
70 additions
and
28 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
core/src/main/resources/lib/hudson/project/configurable/configurable.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,17 @@ | ||
(function () { | ||
/* The JS formatting rules enforced in this repo can result in function declarations incompatible with HTMLUnit. | ||
As a workaround, split function definition and assignment. */ | ||
function foo(el, ev) { | ||
let parameterized = el.dataset.parameterized; | ||
let success = el.dataset.buildSuccess; | ||
if (parameterized === "false") { | ||
fetch(el.href, { | ||
method: "post", | ||
headers: crumb.wrap({}), | ||
}); | ||
hoverNotification(success, ev.target.parentNode); | ||
ev.preventDefault(); | ||
} | ||
} | ||
window.lib_hudson_project_configurable_build_now_callback = foo; | ||
})(); |
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
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,28 @@ | ||
Behaviour.specify("a.task-link-no-confirm", "task-link", 0, function (el) { | ||
if (el.onclick !== null) { | ||
return; | ||
} | ||
|
||
let post = el.dataset.taskPost; | ||
let callback = el.dataset.callback; | ||
let success = el.dataset.taskSuccess; | ||
let href = el.href; | ||
|
||
if (callback !== undefined) { | ||
el.onclick = function (ev) { | ||
window[callback](el, ev); | ||
}; | ||
return; | ||
} | ||
|
||
if (post === "true") { | ||
el.onclick = function (ev) { | ||
fetch(href, { | ||
method: "post", | ||
headers: crumb.wrap({}), | ||
}); | ||
hoverNotification(success, el.parentNode); | ||
ev.preventDefault(); | ||
}; | ||
} | ||
}); |