This commit is contained in:
Jan Faracik committed 2025-01-30 18:36:28 +00:00
1 parent 3397f3978a
commit 79c1280d51
15 files changed
+31 -546

No files matched your search

@@ -27,11 +27,17 @@ package jenkins.model.navigation;
import static hudson.Functions.getAvatar;
import hudson.Extension;
import hudson.model.Action;
import hudson.model.RootAction;
import hudson.model.User;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* TODO
*/
@@ -69,4 +75,18 @@ public class UserAction implements RootAction {
public User getUser() {
return User.current();
}
@Restricted(NoExternalUse.class)
public List<Action> getActions() {
User current = User.current();
if (User.current() == null) {
return null;
}
List<Action> actions = new ArrayList<>();
actions.addAll(current.getPropertyActions());
actions.addAll(current.getTransientActions());
return Collections.unmodifiableList(actions);
}
}
@@ -1,71 +0,0 @@
<!--
The MIT License
Copyright (c) 2016, Daniel Beck, Keith Zantow, CloudBees, 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.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
<!-- <j:set var="activeMonitors" value="${it.getMonitorsToDisplay()}"/>-->
<!-- <j:if test="${activeMonitors != null and activeMonitors.size() > 0}">-->
<!-- <st:adjunct includes="jenkins.management.AdministrativeMonitorsDecorator.resources"/>-->
<!-- <j:set var="activeNonSecurityAM" value="${it.filterNonSecurityAdministrativeMonitors(activeMonitors)}" />-->
<!-- <j:set var="activeNonSecurityAMCount" value="${activeNonSecurityAM.size()}" />-->
<!-- <j:set var="activeSecurityAM" value="${it.filterSecurityAdministrativeMonitors(activeMonitors)}" />-->
<!-- <j:set var="activeSecurityAMCount" value="${activeSecurityAM.size()}" />-->
<!-- <div id="visible-am-container" class="am-container">-->
<!-- <j:if test="${activeNonSecurityAMCount > 0}">-->
<!-- <a id="visible-am-button"-->
<!-- class="am-button"-->
<!-- href="#"-->
<!-- data-href="${rootURL}/administrativeMonitorsApi/nonSecurityPopupContent"-->
<!-- title="${%tooltip(activeNonSecurityAMCount)}">-->
<!-- <l:icon src="symbol-notifications" class="icon-md"/>-->
<!-- <div class="am-monitor__indicator-mobile"/>-->
<!-- <span class="am-monitor__count">-->
<!-- ${activeNonSecurityAMCount}-->
<!-- </span>-->
<!-- </a>-->
<!-- <div id="visible-am-list" class="am-list">-->
<!-- </div>-->
<!-- </j:if>-->
<!-- </div>-->
<!-- <div id="visible-sec-am-container" class="am-container">-->
<!-- <j:if test="${activeSecurityAMCount > 0}">-->
<!-- <a id="visible-sec-am-button"-->
<!-- class="am-button security-am"-->
<!-- href="#"-->
<!-- data-href="${rootURL}/administrativeMonitorsApi/securityPopupContent"-->
<!-- title="${%tooltipSec(activeSecurityAMCount)}">-->
<!-- <l:icon src="symbol-shield-warning" class="icon-md"/>-->
<!-- <div class="am-monitor__indicator-mobile"/>-->
<!-- <span class="am-monitor__count">-->
<!-- ${activeSecurityAMCount}-->
<!-- </span>-->
<!-- </a>-->
<!-- <div id="visible-sec-am-list" class="am-list">-->
<!-- </div>-->
<!-- </j:if>-->
<!-- </div>-->
<!-- </j:if>-->
</j:jelly>
@@ -1,2 +0,0 @@
tooltip=There are {0} active administrative monitors.
tooltipSec=There are {0} active security administrative monitors.
@@ -1,27 +0,0 @@
# The MIT License
#
# Bulgarian translation: Copyright (c) 2017, Alexander Shopov <ash@kambanaria.org>
#
# 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.
# There are {0} active administrative monitors.
tooltip=\
В момента има {0} предупреждения.
Manage\ Jenkins=\
Управление на Jenkins
@@ -1,24 +0,0 @@
# The MIT License
#
# Copyright (c) 2017 Daniel Beck and a number of other of contributors
#
# 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.
Manage\ Jenkins=Jenkins verwalten
tooltip={0,choice,0#Keine Administrator-Warnungen sind|1#{0} Administrator-Warnung ist|1<{0} Administrator-Warnungen sind} aktiv.
@@ -1,2 +0,0 @@
tooltip=Il existe {0} moniteurs d''administration activés.
tooltipSec=Il existe {0} moniteurs d''administration de sécurité activés.
@@ -1,25 +0,0 @@
# The MIT License
#
# Italian localization plugin for Jenkins
# Copyright © 2020 Alessandro Menti
#
# 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.
Manage\ Jenkins=Gestisci Jenkins
tooltip=Ci sono {0} monitor amministrativi attivi.
@@ -1,24 +0,0 @@
# The MIT License
#
# Copyright (c) 2016-2017, Damian Szczepanik
#
# 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.
# There are {0} active administrative monitors.
tooltip=Znaleziono {0} aktywnych powiadomień dla administratorów
Manage\ Jenkins=Zarządzaj Jenkinsem
@@ -1,24 +0,0 @@
# The MIT License
#
# Copyright (c) 2004-, Kohsuke Kawaguchi, Sun Microsystems, Inc., and a number of other of contributors
#
# 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.
tooltip=Existem {0} monitores administrativos ativos.
tooltipSec=Existem {0} monitores administrativos de segurança ativos.
@@ -1,2 +0,0 @@
tooltip=Det finns {0} aktiva administrativa övervakningar.
tooltipSec=Det finns {0} aktiva säkerhetsadministrativa övervakningar.
@@ -1,25 +0,0 @@
# The MIT License
#
# Copyright (c) 2021, Mustafa Ulu
#
# 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.
Manage\ Jenkins=Jenkins''i Yönet
tooltip={0} adet aktif yönetimsel gösterge var.
tooltipSec={0} adet aktif yönetimsel güvenlik göstergesi var.
@@ -1,2 +0,0 @@
tooltip=有 {0} 個啟用中的管理監視器。
tooltipSec=有 {0} 個啟用中的安全性管理監視器。
@@ -1,184 +0,0 @@
.am-container {
display: contents;
}
.am-button {
position: relative;
}
.am-button .am-monitor__indicator-mobile {
display: none;
position: absolute;
top: 0.25rem;
right: 0.25rem;
border-radius: 50%;
width: 0.65rem;
height: 0.65rem;
background-color: var(--warning-color);
}
.security-am .am-monitor__indicator-mobile {
background-color: var(--error-color);
}
.am-button .am-monitor__count {
display: inline-flex;
justify-content: center;
align-items: center;
height: 18px;
min-width: 18px;
color: #fff;
background-color: var(--warning-color);
font-weight: var(--font-bold-weight);
font-size: var(--font-size-xs);
border-radius: 16px;
}
.am-button.security-am .am-monitor__count {
color: #fff;
background-color: var(--error-color);
}
.am-container div.am-list {
position: absolute;
top: 48px;
right: 2%;
height: auto;
padding: var(--section-padding);
text-align: left;
display: block;
background-color: var(--background);
box-shadow: var(--dropdown-box-shadow);
border-radius: 15px;
opacity: 0;
z-index: 0;
transform: scale(0);
}
.am-container.am-hidden div.am-list {
animation: hide-am-list 300ms ease-in 1 normal;
}
.am-container.visible div.am-list {
opacity: 1;
animation: show-am-list 300ms ease-in 1 normal forwards;
z-index: 1000;
}
@keyframes show-am-list {
from {
opacity: 0;
visibility: hidden;
transform: translateY(-10px) scale(0.975);
}
to {
opacity: 1;
visibility: visible;
transform: scale(1);
}
}
@keyframes hide-am-list {
from {
opacity: 1;
visibility: visible;
transform: scale(1);
z-index: 1000;
}
to {
opacity: 0;
visibility: hidden;
transform: translateY(-10px) scale(0.975);
z-index: 1000;
}
}
.am-container .am-message {
display: block;
line-height: 1.4em;
margin-bottom: 1.4em;
}
.am-container.visible .am-button:after {
background: var(--button-background--hover);
}
.am-message-list {
padding: 0;
margin: 0;
}
.am-container .am-message .alert form,
.am-container .am-message .jenkins-alert form {
position: relative;
float: right;
margin: -6px 0 0 0 !important;
gap: 0.5rem;
display: flex;
padding-left: 0.5rem;
}
.am-container .am-message .alert form span,
.am-container .am-message .jenkins-alert form span {
margin: 0 0 0 4px !important;
}
.am-container .am-message .alert,
.am-container .am-message .jenkins-alert {
margin-bottom: 0 !important;
}
.am-container .am-message dl dt::after {
content: ": ";
}
/* Restore hyperlink style overriden by the page header */
.am-container .am-list a:link {
display: inline-block;
color: var(--link-color);
text-decoration: underline;
margin-right: 0;
padding: 0;
font-weight: var(--link-font-weight);
}
.am-container .am-list a:visited {
color: var(--link-color);
}
.am-container .am-list a:hover,
.am-container .am-list a:focus,
.am-container .am-list a:active {
color: var(--link-color);
background-color: transparent;
text-decoration: underline;
text-decoration: var(--link-text-decoration--hover);
}
.am-container .am-list .jenkins-alert-success a {
color: var(--alert-success-text-color);
}
.am-container .am-list .jenkins-alert-info a {
color: var(--alert-info-text-color);
}
.am-container .am-list .jenkins-alert-warning a {
color: var(--alert-warning-text-color);
}
.am-container .am-list .jenkins-alert-danger a {
color: var(--alert-danger-text-color);
}
@media screen and (max-width: 576px) {
/* Hide non-security monitors on mobile view to avoid messing up the heading */
#visible-am-container {
display: none;
}
}
@media screen and (max-width: 768px) {
.am-button .am-monitor__indicator-mobile {
display: block;
}
.am-button .am-monitor__count {
display: none;
}
}
@@ -1,128 +0,0 @@
(function () {
function initializeAmMonitor(amMonitorRoot, options) {
var button = amMonitorRoot.querySelector(".am-button");
var amList = amMonitorRoot.querySelector(".am-list");
if (button === null || amList === null) {
return null;
}
var url = button.getAttribute("data-href");
function onClose(e) {
var list = amList;
var el = e.target;
while (el) {
if (el === list) {
return; // clicked in the list
}
el = el.parentElement;
}
close();
}
function onEscClose(e) {
var escapeKeyCode = 27;
if (e.keyCode === escapeKeyCode) {
close();
}
}
function show() {
if (options.closeAll) {
options.closeAll();
}
fetch(url).then((rsp) => {
if (rsp.ok) {
rsp.text().then((responseText) => {
var popupContent = responseText;
amList.innerHTML = popupContent;
amMonitorRoot.classList.add("visible");
amMonitorRoot.classList.remove("am-hidden");
document.addEventListener("click", onClose);
document.addEventListener("keydown", onEscClose);
// Applies all initialization code to the elements within the popup
// Among other things, this sets the CSRF crumb to the forms within
Behaviour.applySubtree(amList);
});
}
});
}
function close() {
if (amMonitorRoot.classList.contains("visible")) {
amMonitorRoot.classList.add("am-hidden");
}
amMonitorRoot.classList.remove("visible");
document.removeEventListener("click", onClose);
document.removeEventListener("keydown", onEscClose);
}
function toggle(e) {
if (amMonitorRoot.classList.contains("visible")) {
close();
} else {
show();
}
e.preventDefault();
}
function startListeners() {
button.addEventListener("click", toggle);
}
return {
close: close,
startListeners: startListeners,
};
}
document.addEventListener("DOMContentLoaded", function () {
var monitorWidgets;
function closeAll() {
monitorWidgets.forEach(function (widget) {
widget.close();
});
}
var normalMonitors = initializeAmMonitor(
document.getElementById("visible-am-container"),
{
closeAll: closeAll,
},
);
var securityMonitors = initializeAmMonitor(
document.getElementById("visible-sec-am-container"),
{
closeAll: closeAll,
},
);
monitorWidgets = [normalMonitors, securityMonitors].filter(
function (widget) {
return widget !== null;
},
);
monitorWidgets.forEach(function (widget) {
widget.startListeners();
});
});
})();
document.addEventListener("DOMContentLoaded", function () {
var amContainer = document.getElementById("visible-am-container");
var amInsertion = document.getElementById("visible-am-insertion");
if (amInsertion) {
amInsertion.appendChild(amContainer);
}
var secAmContainer = document.getElementById("visible-sec-am-container");
var secAmInsertion = document.getElementById("visible-sec-am-insertion");
if (secAmInsertion) {
secAmInsertion.appendChild(secAmContainer);
}
});
@@ -7,12 +7,17 @@
</div>
${it.user.fullName}
</a>
<a class="jenkins-dropdown__item" href="${rootURL}/${it.user.url}/account">
<div class="jenkins-dropdown__item__icon">
<l:icon src="symbol-settings" />
</div>
${%Configure}
</a>
<div class="jenkins-dropdown__separator" />
<j:forEach var="action" items="${it.actions}">
<a class="jenkins-dropdown__item" href="${rootURL}/${it.user.url}/${action.urlName}">
<div class="jenkins-dropdown__item__icon">
<l:icon src="${action.iconFileName}" />
</div>
${action.displayName}
</a>
</j:forEach>
<div class="jenkins-dropdown__separator" />
<a class="jenkins-dropdown__item" href="${rootURL}/logout">
<div class="jenkins-dropdown__item__icon">