Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
6de7e5fc
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,发现更多精彩内容 >>
未验证
提交
6de7e5fc
编写于
3月 14, 2020
作者:
T
Tim Jacomb
提交者:
GitHub
3月 14, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4546 from daniel-beck/new-manage-layout
Manage Jenkins with flow layout and categories
上级
775cf1b6
d112c015
变更
23
显示空白变更内容
内联
并排
Showing
23 changed file
with
227 addition
and
8 deletion
+227
-8
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
+6
-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
+60
-0
core/src/main/java/hudson/security/GlobalSecurityConfiguration.java
...ain/java/hudson/security/GlobalSecurityConfiguration.java
+7
-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
+16
-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
test/src/test/java/hudson/model/ManagementLinkTest.java
test/src/test/java/hudson/model/ManagementLinkTest.java
+1
-1
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
+23
-0
未找到文件。
core/src/main/java/hudson/AboutJenkins.java
浏览文件 @
6de7e5fc
...
...
@@ -46,4 +46,10 @@ public class AboutJenkins extends ManagementLink {
public
Permission
getRequiredPermission
()
{
return
Jenkins
.
SYSTEM_READ
;
}
@Nonnull
@Override
public
Category
getCategory
()
{
return
Category
.
STATUS
;
}
}
core/src/main/java/hudson/diagnosis/OldDataMonitor.java
浏览文件 @
6de7e5fc
...
...
@@ -440,6 +440,12 @@ public class OldDataMonitor extends AdministrativeMonitor {
@Extension
@Symbol
(
"oldData"
)
public
static
class
ManagementLinkImpl
extends
ManagementLink
{
@Nonnull
@Override
public
Category
getCategory
()
{
return
Category
.
TROUBLESHOOTING
;
}
@Override
public
String
getIconFileName
()
{
return
"document.png"
;
...
...
core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java
浏览文件 @
6de7e5fc
...
...
@@ -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
Category
getCategory
()
{
return
Category
.
CONFIGURATION
;
}
/**
* Is the installation successful?
*/
...
...
core/src/main/java/hudson/model/ManagementLink.java
浏览文件 @
6de7e5fc
...
...
@@ -31,6 +31,12 @@ import hudson.security.Permission;
import
jenkins.model.Jenkins
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.jvnet.localizer.Localizable
;
import
org.kohsuke.accmod.Restricted
;
import
org.kohsuke.accmod.restrictions.NoExternalUse
;
import
org.kohsuke.stapler.interceptor.RequirePOST
;
import
javax.annotation.CheckForNull
;
...
...
@@ -131,4 +137,58 @@ public abstract class ManagementLink implements ExtensionPoint, Action {
public
boolean
getRequiresPOST
()
{
return
false
;
}
/**
* Name of the category for this management link. Exists so that plugins with core dependency pre-dating the version
* when this was introduced can define a category. Plugins with newer core dependency override {@link #getCategory()} instead.
*
* @return name of the desired category, one of the enum values of {@link Category}, e.g. {@code STATUS}.
* @since TODO
*/
@Restricted
(
NoExternalUse
.
class
)
// TODO I don't think this works
protected
@Nonnull
String
getCategoryName
()
{
return
"UNCATEGORIZED"
;
}
/**
* 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
Category
getCategory
()
{
try
{
return
Category
.
valueOf
(
getCategoryName
());
}
catch
(
RuntimeException
e
)
{
LOGGER
.
log
(
Level
.
WARNING
,
"invalid category {0} for class {1}"
,
new
Object
[]{
getCategoryName
()
,
this
.
getClass
().
getName
()});
return
Category
.
UNCATEGORIZED
;
}
}
/**
* Categories supported by this version of core.
*
* @since TODO
*/
public
enum
Category
{
CONFIGURATION
(
Messages
.
_ManagementLink_Category_CONFIGURATION
()),
SECURITY
(
Messages
.
_ManagementLink_Category_SECURITY
()),
STATUS
(
Messages
.
_ManagementLink_Category_STATUS
()),
TROUBLESHOOTING
(
Messages
.
_ManagementLink_Category_TROUBLESHOOTING
()),
TOOLS
(
Messages
.
_ManagementLink_Category_TOOLS
()),
MISC
(
Messages
.
_ManagementLink_Category_MISC
()),
UNCATEGORIZED
(
Messages
.
_ManagementLink_Category_UNCATEGORIZED
());
private
Localizable
label
;
Category
(
Localizable
label
)
{
this
.
label
=
label
;
}
public
@Nonnull
String
getLabel
()
{
return
label
.
toString
();
}
}
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
ManagementLink
.
class
.
getName
());
}
core/src/main/java/hudson/security/GlobalSecurityConfiguration.java
浏览文件 @
6de7e5fc
...
...
@@ -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,12 @@ public class GlobalSecurityConfiguration extends ManagementLink implements Descr
return
Jenkins
.
get
().
isDisableRememberMe
();
}
@Nonnull
@Override
public
Category
getCategory
()
{
return
Category
.
SECURITY
;
}
@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
浏览文件 @
6de7e5fc
...
...
@@ -771,6 +771,12 @@ public class HudsonPrivateSecurityRealm extends AbstractPasswordBasedSecurityRea
public
String
getDescription
()
{
return
Messages
.
HudsonPrivateSecurityRealm_ManageUserLinks_Description
();
}
@Nonnull
@Override
public
Category
getCategory
()
{
return
Category
.
SECURITY
;
}
}
/**
...
...
core/src/main/java/jenkins/management/CliLink.java
浏览文件 @
6de7e5fc
...
...
@@ -62,4 +62,10 @@ public class CliLink extends ManagementLink {
public
String
getUrlName
()
{
return
"cli"
;
}
@Nonnull
@Override
public
Category
getCategory
()
{
return
Category
.
TOOLS
;
}
}
core/src/main/java/jenkins/management/ConfigureLink.java
浏览文件 @
6de7e5fc
...
...
@@ -62,4 +62,10 @@ public class ConfigureLink extends ManagementLink {
public
String
getUrlName
()
{
return
"configure"
;
}
@Nonnull
@Override
public
Category
getCategory
()
{
return
Category
.
CONFIGURATION
;
}
}
core/src/main/java/jenkins/management/ConsoleLink.java
浏览文件 @
6de7e5fc
...
...
@@ -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
Category
getCategory
()
{
return
Category
.
TOOLS
;
}
}
core/src/main/java/jenkins/management/NodesLink.java
浏览文件 @
6de7e5fc
...
...
@@ -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
Category
getCategory
()
{
return
Category
.
CONFIGURATION
;
}
}
core/src/main/java/jenkins/management/PluginsLink.java
浏览文件 @
6de7e5fc
...
...
@@ -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
Category
getCategory
()
{
return
Category
.
CONFIGURATION
;
}
}
core/src/main/java/jenkins/management/ReloadLink.java
浏览文件 @
6de7e5fc
...
...
@@ -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
Category
getCategory
()
{
return
Category
.
TOOLS
;
}
}
core/src/main/java/jenkins/management/ShutdownLink.java
浏览文件 @
6de7e5fc
...
...
@@ -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
Category
getCategory
()
{
return
Category
.
TOOLS
;
}
}
core/src/main/java/jenkins/management/StatisticsLink.java
浏览文件 @
6de7e5fc
...
...
@@ -62,4 +62,10 @@ public class StatisticsLink extends ManagementLink {
public
String
getUrlName
()
{
return
"load-statistics"
;
}
@Nonnull
@Override
public
Category
getCategory
()
{
return
Category
.
STATUS
;
}
}
core/src/main/java/jenkins/management/SystemInfoLink.java
浏览文件 @
6de7e5fc
...
...
@@ -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
Category
getCategory
()
{
return
Category
.
STATUS
;
}
}
core/src/main/java/jenkins/management/SystemLogLink.java
浏览文件 @
6de7e5fc
...
...
@@ -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
Category
getCategory
()
{
return
Category
.
STATUS
;
}
}
core/src/main/java/jenkins/model/Jenkins.java
浏览文件 @
6de7e5fc
...
...
@@ -4738,6 +4738,22 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
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
;
}
byCategory
.
computeIfAbsent
(
link
.
getCategory
(),
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
浏览文件 @
6de7e5fc
...
...
@@ -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
Category
getCategory
()
{
return
Category
.
CONFIGURATION
;
}
@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
浏览文件 @
6de7e5fc
...
...
@@ -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
浏览文件 @
6de7e5fc
...
...
@@ -46,11 +46,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}
...
...
@@ -88,7 +90,8 @@ THE SOFTWARE.
</j:choose>
</div>
</j:if>
</l:hasPermission>
</j:forEach>
</div>
</j:forEach>
</l:main-panel>
...
...
test/src/test/java/hudson/model/ManagementLinkTest.java
浏览文件 @
6de7e5fc
...
...
@@ -55,7 +55,7 @@ public class ManagementLinkTest {
for
(
int
i
=
0
;
;
i
++)
{
HtmlPage
page
=
wc
.
goTo
(
"manage"
);
List
<?>
anchors
=
DomNodeUtil
.
selectNodes
(
page
,
"//div[
@class='manage-option'
]/a[not(@onclick)]"
);
List
<?>
anchors
=
DomNodeUtil
.
selectNodes
(
page
,
"//div[
contains(@class,'manage-option')
]/a[not(@onclick)]"
);
assertTrue
(
anchors
.
size
()>=
8
);
if
(
i
==
anchors
.
size
())
return
;
// done
...
...
war/src/main/less/base-styles-v2.less
浏览文件 @
6de7e5fc
...
...
@@ -24,3 +24,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
浏览文件 @
6de7e5fc
.manage-page__row {
display: block;
display: flex;
flex-wrap: wrap;
}
.manage-page__column {
width: 100%;
}
@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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录