-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #301 from jenkinsci/build-button-updates
Adapt build buttons to core changes
- Loading branch information
Showing
7 changed files
with
92 additions
and
93 deletions.
There are no files selected for viewing
50 changes: 27 additions & 23 deletions
50
src/main/resources/hudson/plugins/view/dashboard/core/JobsPortlet/portlet.jelly
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 |
---|---|---|
@@ -1,35 +1,39 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: © 2009 Peter Hayes | ||
SPDX-FileCopyrightText: © 2010 Marco Ambu | ||
SPDX-FileCopyrightText: © 2023 TobiX <[email protected]> | ||
SPDX-License-Identifier: MIT | ||
--> | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" | ||
xmlns:dp="/hudson/plugins/view/dashboard"> | ||
<dp:decorate portlet="${it}" width="${w}"> | ||
<j:forEach var="row" items="${it.jobs}"> | ||
<tr> | ||
<j:forEach var="job" items="${row}"> | ||
<td style="border: 1px solid #bbb;"> | ||
<j:if test="${job.buildable and job.hasPermission(job.BUILD)}"> | ||
<j:set var="id" value="${h.generateId()}"/> | ||
<a href="${job.shortUrl}build?delay=0sec"> | ||
<j:choose> | ||
<j:when test="${job.parameterized}"> | ||
<j:set var="onclick" value="${null}"/> | ||
</j:when> | ||
<j:otherwise> | ||
<j:set var="onclick" | ||
value="return build_${id}(this)"/> | ||
</j:otherwise> | ||
</j:choose> | ||
<l:icon class="icon-clock icon-sm" | ||
title="${%Schedule a build}" alt="${%Schedule a build}" | ||
onclick="${onclick}" | ||
style="float: right; clear: none;"/> | ||
<j:choose> | ||
<j:when test="${job.parameterized}"> | ||
<j:set var="title" value="${%Schedule_a_task_with_parameters(h.getRelativeDisplayNameFrom(job, itemGroup),job.taskNoun)}"/> | ||
<j:set var="buildNotification" value=""/> | ||
<j:set var="behaviourClass" value=""/> | ||
</j:when> | ||
<j:otherwise> | ||
<j:set var="title" value="${%Schedule_a_task(h.getRelativeDisplayNameFrom(job, itemGroup),job.taskNoun)}"/> | ||
<j:set var="buildNotification" value="${%Task_scheduled(job.taskNoun)}"/> | ||
<j:set var="behaviourClass" value="dashboard-view-job-portlet-build-button"/> | ||
<st:adjunct includes="hudson.plugins.view.dashboard.core.buildbutton"/> | ||
</j:otherwise> | ||
</j:choose> | ||
<j:set var="isQueued" value="${app.queue.contains(job)}"/> | ||
<a tooltip="${title}" class="${behaviourClass} jenkins-!-build-color" | ||
data-notification="${buildNotification}" | ||
href="${jobBaseUrl}${job.shortUrl}build?delay=0sec"> | ||
<span class="${isQueued ? 'pulse-animation': ''}"> | ||
<l:icon src="symbol-play" class="icon-sm"/> | ||
</span> | ||
</a> | ||
<script> | ||
function build_${id}(img) { | ||
new Ajax.Request(img.parentNode.href); | ||
hoverNotification('${%Build scheduled}', img, -100); | ||
return false; | ||
} | ||
</script> | ||
</j:if> | ||
<t:jobLink job="${job}"/> | ||
</td> | ||
|
5 changes: 5 additions & 0 deletions
5
src/main/resources/hudson/plugins/view/dashboard/core/JobsPortlet/portlet.properties
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,5 @@ | ||
# SPDX-FileCopyrightText: \u00A9 2023 TobiX <[email protected]> | ||
# SPDX-License-Identifier: MIT | ||
Task_scheduled={0} scheduled | ||
Schedule_a_task=Schedule a {1} for {0} | ||
Schedule_a_task_with_parameters=Schedule a {1} with parameters for {0} |
26 changes: 3 additions & 23 deletions
26
src/main/resources/hudson/plugins/view/dashboard/core/JobsPortlet/portlet_ja.properties
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 |
---|---|---|
@@ -1,23 +1,3 @@ | ||
# The MIT License | ||
# | ||
# Copyright (c) 2012, Seiji Sogabe | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
|
||
Schedule\ a\ build=\u30d3\u30eb\u30c9\u5b9f\u884c | ||
# SPDX-FileCopyrightText: \u00A9 2012 Seiji Sogabe | ||
# SPDX-License-Identifier: MIT | ||
Schedule_a_task=\u30D3\u30EB\u30C9\u5B9F\u884C |
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: © 2009 Peter Hayes | ||
SPDX-FileCopyrightText: © 2010 Marco Ambu | ||
SPDX-FileCopyrightText: © 2023 TobiX <[email protected]> | ||
SPDX-License-Identifier: MIT | ||
--> | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" | ||
xmlns:dp="/hudson/plugins/view/dashboard"> | ||
<dp:decorate portlet="${it}" width="4"> | ||
<j:set var="columnExtensions" value="${it.columns}"/> | ||
|
@@ -17,29 +23,27 @@ | |
<tr> | ||
<td style="${indenter.getCss(j)}; border: 1px solid #BBBBBB"> | ||
<j:if test="${job.buildable and job.hasPermission(job.BUILD)}"> | ||
<j:set var="id" value="${h.generateId()}"/> | ||
<a href="${job.shortUrl}build?delay=0sec"> | ||
<j:choose> | ||
<j:when test="${job.parameterized}"> | ||
<j:set var="onclick" value="${null}"/> | ||
</j:when> | ||
<j:otherwise> | ||
<j:set var="onclick" | ||
value="return build_${id}(this)"/> | ||
</j:otherwise> | ||
</j:choose> | ||
<l:icon class="icon-clock icon-sm" | ||
title="${%Schedule a build}" alt="${%Schedule a build}" | ||
onclick="${onclick}" | ||
style="float: right; clear: none;"/> | ||
<j:choose> | ||
<j:when test="${job.parameterized}"> | ||
<j:set var="title" value="${%Schedule_a_task_with_parameters(h.getRelativeDisplayNameFrom(job, itemGroup),job.taskNoun)}"/> | ||
<j:set var="buildNotification" value=""/> | ||
<j:set var="behaviourClass" value=""/> | ||
</j:when> | ||
<j:otherwise> | ||
<j:set var="title" value="${%Schedule_a_task(h.getRelativeDisplayNameFrom(job, itemGroup),job.taskNoun)}"/> | ||
<j:set var="buildNotification" value="${%Task_scheduled(job.taskNoun)}"/> | ||
<j:set var="behaviourClass" value="dashboard-view-job-portlet-build-button"/> | ||
<st:adjunct includes="hudson.plugins.view.dashboard.core.buildbutton"/> | ||
</j:otherwise> | ||
</j:choose> | ||
<j:set var="isQueued" value="${app.queue.contains(job)}"/> | ||
<a tooltip="${title}" class="${behaviourClass} jenkins-!-build-color" | ||
data-notification="${buildNotification}" | ||
href="${jobBaseUrl}${job.shortUrl}build?delay=0sec"> | ||
<span class="${isQueued ? 'pulse-animation': ''}"> | ||
<l:icon src="symbol-play" class="icon-sm"/> | ||
</span> | ||
</a> | ||
<script> | ||
function build_${id}(img) { | ||
new Ajax.Request(img.parentNode.href); | ||
hoverNotification('${%Build scheduled}', img, -100); | ||
return false; | ||
} | ||
</script> | ||
</j:if> | ||
<t:jobLink job="${job}"/> | ||
</td> | ||
|
5 changes: 5 additions & 0 deletions
5
src/main/resources/hudson/plugins/view/dashboard/core/UnstableJobsPortlet/portlet.properties
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,5 @@ | ||
# SPDX-FileCopyrightText: \u00A9 2023 TobiX <[email protected]> | ||
# SPDX-License-Identifier: MIT | ||
Task_scheduled={0} scheduled | ||
Schedule_a_task=Schedule a {1} for {0} | ||
Schedule_a_task_with_parameters=Schedule a {1} with parameters for {0} |
28 changes: 4 additions & 24 deletions
28
...in/resources/hudson/plugins/view/dashboard/core/UnstableJobsPortlet/portlet_ja.properties
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 |
---|---|---|
@@ -1,24 +1,4 @@ | ||
# The MIT License | ||
# | ||
# Copyright (c) 2004-2010, Sun Microsystems, Inc. | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
|
||
No\ unstable\ jobs=\u4e0d\u5b89\u5b9a\u30d3\u30eb\u30c9\u306a\u3057 | ||
Schedule\ a\ build=\u30d3\u30eb\u30c9\u5b9f\u884c | ||
# SPDX-FileCopyrightText: \u00A9 2012 Seiji Sogabe | ||
# SPDX-License-Identifier: MIT | ||
No\ unstable\ jobs=\u4E0D\u5B89\u5B9A\u30D3\u30EB\u30C9\u306A\u3057 | ||
Schedule_a_task=\u30D3\u30EB\u30C9\u5B9F\u884C |
21 changes: 21 additions & 0 deletions
21
src/main/resources/hudson/plugins/view/dashboard/core/buildbutton.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,21 @@ | ||
// SPDX-FileCopyrightText: © 2023 TobiX <[email protected]> | ||
// SPDX-License-Identifier: MIT | ||
|
||
Behaviour.specify( | ||
".dashboard-view-job-portlet-build-button", | ||
"build-button", | ||
0, | ||
function (e) { | ||
var url = e.getAttribute("href"); | ||
var message = e.getAttribute("data-notification"); | ||
|
||
e.onclick = function () { | ||
fetch(url, { | ||
method: "post", | ||
headers: crumb.wrap({}), | ||
}); | ||
hoverNotification(message, this, -100); | ||
return false; | ||
}; | ||
} | ||
); |