Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
61dfeaf1
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
61dfeaf1
编写于
3月 05, 2020
作者:
D
Daniel Beck
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Manage Jenkins with flow layout and categories
Co-authored-by:
N
Félix Queiruga
<
fqueiruga@cloudbees.com
>
上级
1e5112a1
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
208 addition
and
7 deletion
+208
-7
core/src/main/java/hudson/AboutJenkins.java
core/src/main/java/hudson/AboutJenkins.java
+6
-0
core/src/main/java/hudson/diagnosis/OldDataMonitor.java
core/src/main/java/hudson/diagnosis/OldDataMonitor.java
+5
-0
core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java
.../src/main/java/hudson/lifecycle/WindowsInstallerLink.java
+8
-0
core/src/main/java/hudson/model/ManagementLink.java
core/src/main/java/hudson/model/ManagementLink.java
+35
-0
core/src/main/java/hudson/security/GlobalSecurityConfiguration.java
...ain/java/hudson/security/GlobalSecurityConfiguration.java
+6
-0
core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
...main/java/hudson/security/HudsonPrivateSecurityRealm.java
+6
-0
core/src/main/java/jenkins/management/CliLink.java
core/src/main/java/jenkins/management/CliLink.java
+6
-0
core/src/main/java/jenkins/management/ConfigureLink.java
core/src/main/java/jenkins/management/ConfigureLink.java
+6
-0
core/src/main/java/jenkins/management/ConsoleLink.java
core/src/main/java/jenkins/management/ConsoleLink.java
+8
-0
core/src/main/java/jenkins/management/NodesLink.java
core/src/main/java/jenkins/management/NodesLink.java
+6
-1
core/src/main/java/jenkins/management/PluginsLink.java
core/src/main/java/jenkins/management/PluginsLink.java
+8
-0
core/src/main/java/jenkins/management/ReloadLink.java
core/src/main/java/jenkins/management/ReloadLink.java
+8
-0
core/src/main/java/jenkins/management/ShutdownLink.java
core/src/main/java/jenkins/management/ShutdownLink.java
+8
-0
core/src/main/java/jenkins/management/StatisticsLink.java
core/src/main/java/jenkins/management/StatisticsLink.java
+6
-0
core/src/main/java/jenkins/management/SystemInfoLink.java
core/src/main/java/jenkins/management/SystemInfoLink.java
+6
-2
core/src/main/java/jenkins/management/SystemLogLink.java
core/src/main/java/jenkins/management/SystemLogLink.java
+8
-0
core/src/main/java/jenkins/model/Jenkins.java
core/src/main/java/jenkins/model/Jenkins.java
+23
-0
core/src/main/java/jenkins/tools/GlobalToolConfiguration.java
.../src/main/java/jenkins/tools/GlobalToolConfiguration.java
+7
-0
core/src/main/resources/hudson/model/Messages.properties
core/src/main/resources/hudson/model/Messages.properties
+8
-0
core/src/main/resources/jenkins/model/Jenkins/manage.jelly
core/src/main/resources/jenkins/model/Jenkins/manage.jelly
+7
-4
war/src/main/less/base-styles-v2.less
war/src/main/less/base-styles-v2.less
+2
-0
war/src/main/less/modules/manage-jenkins.less
war/src/main/less/modules/manage-jenkins.less
+25
-0
未找到文件。
core/src/main/java/hudson/AboutJenkins.java
浏览文件 @
61dfeaf1
...
...
@@ -46,4 +46,10 @@ public class AboutJenkins extends ManagementLink {
public
Permission
getRequiredPermission
()
{
return
Jenkins
.
SYSTEM_READ
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
STATUS
.
toString
();
}
}
core/src/main/java/hudson/diagnosis/OldDataMonitor.java
浏览文件 @
61dfeaf1
...
...
@@ -440,6 +440,11 @@ public class OldDataMonitor extends AdministrativeMonitor {
@Extension
@Symbol
(
"oldData"
)
public
static
class
ManagementLinkImpl
extends
ManagementLink
{
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
TROUBLESHOOTING
.
toString
();
}
@Override
public
String
getIconFileName
()
{
return
"document.png"
;
...
...
core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java
浏览文件 @
61dfeaf1
...
...
@@ -53,6 +53,7 @@ import org.apache.tools.ant.DefaultLogger;
import
org.apache.tools.ant.types.FileSet
;
import
org.kohsuke.stapler.interceptor.RequirePOST
;
import
javax.annotation.Nonnull
;
import
javax.servlet.ServletException
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -100,6 +101,13 @@ public class WindowsInstallerLink extends ManagementLink {
return
Messages
.
WindowsInstallerLink_Description
();
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
CONFIGURATION
.
toString
();
}
/**
* Is the installation successful?
*/
...
...
core/src/main/java/hudson/model/ManagementLink.java
浏览文件 @
61dfeaf1
...
...
@@ -30,7 +30,9 @@ import hudson.ExtensionList;
import
hudson.security.Permission
;
import
jenkins.model.Jenkins
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.List
;
import
org.kohsuke.stapler.interceptor.RequirePOST
;
import
javax.annotation.CheckForNull
;
...
...
@@ -131,4 +133,37 @@ public abstract class ManagementLink implements ExtensionPoint, Action {
public
boolean
getRequiresPOST
()
{
return
false
;
}
/**
* Category for management link, uses {@code String} so it can be done with core dependency pre-dating the version this feature was added.
*
* @return An enum value of {@link Category}.
* @since TODO
*/
public
@Nonnull
String
getCategory
()
{
return
Category
.
UNCATEGORIZED
.
toString
();
}
/**
* Categories supported by this version of core.
*
* @since TODO
*/
public
enum
Category
{
CONFIGURATION
,
SECURITY
,
STATUS
,
TROUBLESHOOTING
,
TOOLS
,
MISC
,
UNCATEGORIZED
;
public
@Nonnull
String
getLabel
()
{
try
{
return
Messages
.
class
.
getMethod
(
"ManagementLink_Category_"
+
this
.
toString
()).
invoke
(
null
).
toString
();
}
catch
(
IllegalAccessException
|
InvocationTargetException
|
NoSuchMethodException
e
)
{
return
Messages
.
ManagementLink_Category_UNCATEGORIZED
();
}
}
}
}
core/src/main/java/hudson/security/GlobalSecurityConfiguration.java
浏览文件 @
61dfeaf1
...
...
@@ -41,6 +41,7 @@ import java.util.function.Predicate;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.annotation.Nonnull
;
import
javax.servlet.ServletException
;
import
jenkins.model.GlobalConfigurationCategory
;
...
...
@@ -93,6 +94,11 @@ public class GlobalSecurityConfiguration extends ManagementLink implements Descr
return
Jenkins
.
get
().
isDisableRememberMe
();
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
SECURITY
.
toString
();
}
@POST
public
synchronized
void
doConfigure
(
StaplerRequest
req
,
StaplerResponse
rsp
)
throws
IOException
,
ServletException
,
FormException
{
// for compatibility reasons, the actual value is stored in Jenkins
...
...
core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
浏览文件 @
61dfeaf1
...
...
@@ -771,6 +771,12 @@ public class HudsonPrivateSecurityRealm extends AbstractPasswordBasedSecurityRea
public
String
getDescription
()
{
return
Messages
.
HudsonPrivateSecurityRealm_ManageUserLinks_Description
();
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
SECURITY
.
toString
();
}
}
/**
...
...
core/src/main/java/jenkins/management/CliLink.java
浏览文件 @
61dfeaf1
...
...
@@ -62,4 +62,10 @@ public class CliLink extends ManagementLink {
public
String
getUrlName
()
{
return
"cli"
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
TOOLS
.
toString
();
}
}
core/src/main/java/jenkins/management/ConfigureLink.java
浏览文件 @
61dfeaf1
...
...
@@ -62,4 +62,10 @@ public class ConfigureLink extends ManagementLink {
public
String
getUrlName
()
{
return
"configure"
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
CONFIGURATION
.
toString
();
}
}
core/src/main/java/jenkins/management/ConsoleLink.java
浏览文件 @
61dfeaf1
...
...
@@ -30,6 +30,8 @@ import hudson.security.Permission;
import
jenkins.model.Jenkins
;
import
org.jenkinsci.Symbol
;
import
javax.annotation.Nonnull
;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
*/
...
...
@@ -59,4 +61,10 @@ public class ConsoleLink extends ManagementLink {
public
Permission
getRequiredPermission
()
{
return
Jenkins
.
ADMINISTER
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
TOOLS
.
toString
();
}
}
core/src/main/java/jenkins/management/NodesLink.java
浏览文件 @
61dfeaf1
...
...
@@ -27,7 +27,6 @@ package jenkins.management;
import
hudson.Extension
;
import
hudson.model.ManagementLink
;
import
hudson.security.Permission
;
import
jenkins.management.Messages
;
import
jenkins.model.Jenkins
;
import
org.jenkinsci.Symbol
;
...
...
@@ -63,4 +62,10 @@ public class NodesLink extends ManagementLink {
public
String
getUrlName
()
{
return
"computer"
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
CONFIGURATION
.
toString
();
}
}
core/src/main/java/jenkins/management/PluginsLink.java
浏览文件 @
61dfeaf1
...
...
@@ -28,6 +28,8 @@ import hudson.Extension;
import
hudson.model.ManagementLink
;
import
org.jenkinsci.Symbol
;
import
javax.annotation.Nonnull
;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
*/
...
...
@@ -52,4 +54,10 @@ public class PluginsLink extends ManagementLink {
public
String
getUrlName
()
{
return
"pluginManager"
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
CONFIGURATION
.
toString
();
}
}
core/src/main/java/jenkins/management/ReloadLink.java
浏览文件 @
61dfeaf1
...
...
@@ -28,6 +28,8 @@ import hudson.Extension;
import
hudson.model.ManagementLink
;
import
org.jenkinsci.Symbol
;
import
javax.annotation.Nonnull
;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
*/
...
...
@@ -61,4 +63,10 @@ public class ReloadLink extends ManagementLink {
public
boolean
getRequiresPOST
()
{
return
true
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
TOOLS
.
toString
();
}
}
core/src/main/java/jenkins/management/ShutdownLink.java
浏览文件 @
61dfeaf1
...
...
@@ -29,6 +29,8 @@ import hudson.model.ManagementLink;
import
jenkins.model.Jenkins
;
import
org.jenkinsci.Symbol
;
import
javax.annotation.Nonnull
;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
*/
...
...
@@ -58,4 +60,10 @@ public class ShutdownLink extends ManagementLink {
public
boolean
getRequiresPOST
()
{
return
true
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
TOOLS
.
toString
();
}
}
core/src/main/java/jenkins/management/StatisticsLink.java
浏览文件 @
61dfeaf1
...
...
@@ -62,4 +62,10 @@ public class StatisticsLink extends ManagementLink {
public
String
getUrlName
()
{
return
"load-statistics"
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
STATUS
.
toString
();
}
}
core/src/main/java/jenkins/management/SystemInfoLink.java
浏览文件 @
61dfeaf1
...
...
@@ -31,8 +31,6 @@ import javax.annotation.Nonnull;
import
jenkins.model.Jenkins
;
import
org.jenkinsci.Symbol
;
import
javax.annotation.CheckForNull
;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
*/
...
...
@@ -63,4 +61,10 @@ public class SystemInfoLink extends ManagementLink {
public
String
getUrlName
()
{
return
"systemInfo"
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
STATUS
.
toString
();
}
}
core/src/main/java/jenkins/management/SystemLogLink.java
浏览文件 @
61dfeaf1
...
...
@@ -28,6 +28,8 @@ import hudson.Extension;
import
hudson.model.ManagementLink
;
import
org.jenkinsci.Symbol
;
import
javax.annotation.Nonnull
;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
*/
...
...
@@ -52,4 +54,10 @@ public class SystemLogLink extends ManagementLink {
public
String
getUrlName
()
{
return
"log"
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
STATUS
.
toString
();
}
}
core/src/main/java/jenkins/model/Jenkins.java
浏览文件 @
61dfeaf1
...
...
@@ -4705,6 +4705,29 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
public
List
<
ManagementLink
>
getManagementLinks
()
{
return
ManagementLink
.
all
();
}
// for Jelly
@Restricted
(
NoExternalUse
.
class
)
public
Map
<
ManagementLink
.
Category
,
List
<
ManagementLink
>>
getCategorizedManagementLinks
()
{
Map
<
ManagementLink
.
Category
,
List
<
ManagementLink
>>
byCategory
=
new
TreeMap
<>();
for
(
ManagementLink
link
:
ManagementLink
.
all
())
{
if
(
link
.
getIconFileName
()
==
null
)
{
continue
;
}
if
(!
Jenkins
.
get
().
hasPermission
(
link
.
getRequiredPermission
()))
{
continue
;
}
String
categoryName
=
link
.
getCategory
();
ManagementLink
.
Category
category
;
try
{
category
=
ManagementLink
.
Category
.
valueOf
(
categoryName
);
}
catch
(
IllegalArgumentException
ex
)
{
category
=
ManagementLink
.
Category
.
UNCATEGORIZED
;
}
byCategory
.
computeIfAbsent
(
category
,
c
->
new
ArrayList
<>()).
add
(
link
);
}
return
byCategory
;
}
/**
* If set, a currently active setup wizard - e.g. installation
...
...
core/src/main/java/jenkins/tools/GlobalToolConfiguration.java
浏览文件 @
61dfeaf1
...
...
@@ -39,6 +39,7 @@ import org.kohsuke.stapler.StaplerRequest;
import
org.kohsuke.stapler.StaplerResponse
;
import
org.kohsuke.stapler.verb.POST
;
import
javax.annotation.Nonnull
;
import
javax.servlet.ServletException
;
import
java.io.IOException
;
import
java.util.logging.Level
;
...
...
@@ -73,6 +74,12 @@ public class GlobalToolConfiguration extends ManagementLink {
return
Jenkins
.
ADMINISTER
;
}
@Nonnull
@Override
public
String
getCategory
()
{
return
Category
.
CONFIGURATION
.
toString
();
}
@POST
public
synchronized
void
doConfigure
(
StaplerRequest
req
,
StaplerResponse
rsp
)
throws
IOException
,
ServletException
,
Descriptor
.
FormException
{
boolean
result
=
configure
(
req
,
req
.
getSubmittedForm
());
...
...
core/src/main/resources/hudson/model/Messages.properties
浏览文件 @
61dfeaf1
...
...
@@ -404,3 +404,11 @@ User.IllegalFullname="{0}" is prohibited as a full name for security reasons.
TimeZoneProperty.DisplayName
=
User Defined Time Zone
TimeZoneProperty.DisplayDefaultTimeZone
=
Default
ManagementLink.Category.CONFIGURATION
=
System Configuration
ManagementLink.Category.SECURITY
=
Security
ManagementLink.Category.STATUS
=
Status Information
ManagementLink.Category.TROUBLESHOOTING
=
Troubleshooting
ManagementLink.Category.TOOLS
=
Tools and Actions
ManagementLink.Category.MISC
=
Other
ManagementLink.Category.UNCATEGORIZED
=
Uncategorized
core/src/main/resources/jenkins/model/Jenkins/manage.jelly
浏览文件 @
61dfeaf1
...
...
@@ -47,11 +47,13 @@ THE SOFTWARE.
<st:include page="downgrade.jelly" />
</div>
<j:forEach var="m" items="${it.managementLinks}">
<l:hasPermission permission="${m.requiredPermission}">
<j:forEach var="category" items="${it.categorizedManagementLinks.entrySet()}">
<h2>${category.key.label}</h2>
<div class="manage-page__row">
<j:forEach var="m" items="${category.value}">
<j:set var="icon" value="${m.iconClassName != null ? m.iconClassName : m.iconFileName}" />
<j:if test="${icon!=null}">
<div class="manage-option">
<div class="manage-option
manage-page__column
">
<j:set var="iconUrl" value="${icon.startsWith('/') ? resURL+icon : imagesURL + '/48x48/' + icon}" />
<j:set var="alt" value="${icon.replaceAll('\\d*\\.[^.]+$', '')}"/>
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(m.urlName, iconUrl, m.displayName, m.requiresPOST, m.requiresConfirmation) : null}
...
...
@@ -89,7 +91,8 @@ THE SOFTWARE.
</j:choose>
</div>
</j:if>
</l:hasPermission>
</j:forEach>
</div>
</j:forEach>
</l:main-panel>
...
...
war/src/main/less/base-styles-v2.less
浏览文件 @
61dfeaf1
...
...
@@ -15,3 +15,5 @@ html {
// Keep page header code in this bundle to avoid loading multiple files
// that are always needed
@import './modules/page-header.less';
@import './modules/manage-jenkins.less';
war/src/main/less/modules/manage-jenkins.less
0 → 100644
浏览文件 @
61dfeaf1
.manage-page__row {
display: block;
display: flex;
flex-wrap: wrap;
}
.manage-page__column {
width: 100%;
// TODO: set padding
// TODO: set margin bottom
}
@media screen and (min-width: 992px) {
.manage-page__column {
width: 50%;
}
}
@media screen and (min-width: 1200px) {
.manage-page__column {
width: 33.333%;
}
}
@media screen and (min-width: 1800px) {
.manage-page__column {
width: 25%;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录