Skip to content

Commit 3e50e6e

Browse files
authored
Modernise UI (#2717)
1 parent 9d0cb94 commit 3e50e6e

File tree

10 files changed

+59
-103
lines changed

10 files changed

+59
-103
lines changed

docs/features/configExport.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,41 @@
33
The plugin supports exporting existing configurations as YAML.
44
This can be achieved with the following options:
55

6-
* Accessing the `http://[your_jenkins_url]/configuration-as-code/` URL as a Jenkins administrators and pressing `Download Configuration`
6+
* Accessing the `http://[your_jenkins_url]/configuration-as-code/` URL as a Jenkins administrator, and clicking `Export configuration`
77
* Running the following in a Groovy script (not recommended, uses internal APIs):
88

99
import io.jenkins.plugins.casc.ConfigurationAsCode
1010
def stream = new ByteArrayOutputStream()
1111
ConfigurationAsCode.get().export(stream)
1212
println stream.toString()
1313

14-
Export feature is **NOT** intended to offer a directly usable jenkins.yaml configuration.
15-
It can be used for inspiration writing your own production-ready YAML, but be aware that export can be partial,
16-
or fail for some components.
14+
Export may not offer a directly usable jenkins.yaml configuration.
15+
It is normally better when you copy the relevant sections you need instead of the entire file.
1716

1817
## Security notice
1918

2019
Jenkins configuration may include various sensitive information,
2120
including, but not limited to, credentials, secrets, administrative information about the instance and user personal data.
2221
The Configuration-as-Code plugin tracks secrets and represents them safely in the exported YAMLs,
2322
but it cannot prevent secrets from being exported in all cases.
24-
Ultimately, it is a responsibility of Jenkins administrators to ensure that the generated YAML files
23+
Ultimately, it is the responsibility of Jenkins administrators to ensure that the generated YAML files
2524
do not include sensitive information.
2625

2726
See more information about the masking logic below.
2827

2928
## Data to be exported
3029

31-
Currently the plugin does not have a way to define which data should be exported.
30+
The plugin does not have a way to define which data should be exported.
3231
The following data is exported:
3332

3433
* System configuration under the _Manage Jenkins_ link
3534
(global configurations, descriptor configurations, etc.)
3635
* Agent configurations
3736
* Views
3837
* Credentials
38+
* Users - Only if using the security realm "Jenkins’ own user database"
3939

40-
Jobs and users are NOT exported by the plugin.
40+
The plugin does NOT export Jobs.
4141

4242
## Secret masking
4343

plugin/src/main/resources/io/jenkins/plugins/casc/ConfigurationAsCode/index.jelly

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@
22
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:st="jelly:stapler">
33
<l:layout type="one-column" title="${%Configuration as Code}" permissions="${app.MANAGE_AND_SYSTEM_READ}">
44
<l:main-panel>
5-
<st:adjunct includes="io.jenkins.plugins.casc.assets.index"/>
6-
<h1>${%Configuration as Code}</h1>
5+
<l:app-bar title="${%Configuration as Code}">
6+
7+
<f:form method="post" action="reload" name="reload">
8+
<l:hasAdministerOrManage>
9+
<f:submit icon="symbol-refresh" primary="false" name="reload"
10+
value="${%Reload existing configuration}"/>
11+
</l:hasAdministerOrManage>
12+
</f:form>
13+
<f:form method="post" action="viewExport" name="viewExport">
14+
<l:hasPermission permission="${app.SYSTEM_READ}">
15+
<f:submit primary="false" name="viewExport" value="${%Export configuration}"/>
16+
</l:hasPermission>
17+
</f:form>
18+
</l:app-bar>
719

820
<j:choose>
921
<j:when test="${empty it.sources}">
@@ -17,41 +29,24 @@
1729
</j:forEach>
1830
</ul>
1931

20-
<p>${%Last time applied :} <i:formatDate value="${it.lastTimeLoaded}" type="both" dateStyle="medium" timeStyle="long"/></p>
32+
<p>${%Last time applied:} <i:formatDate value="${it.lastTimeLoaded}" type="both" dateStyle="medium" timeStyle="long"/></p>
2133

2234
</j:otherwise>
2335
</j:choose>
2436

2537
<l:isAdmin>
2638
<f:form method="post" action="replace" name="replace">
2739
<h2>${%Replace configuration source with:}</h2>
28-
<f:entry title="${%Path or URL}" field="newSource" >
40+
<f:entry title="${%Path or URL}" field="newSource" class="jenkins-form-item--small" >
2941
<f:textbox checkUrl="checkNewSource" checkDependsOn="newSource"/>
3042
</f:entry>
3143
<f:block>
3244
<f:submit name="replace" value="${%Apply new configuration}"/>
3345
</f:block>
3446
</f:form>
3547
</l:isAdmin>
36-
<h2>${%Actions}</h2>
3748

38-
<l:hasAdministerOrManage>
39-
<f:form method="post" action="reload" name="reload">
40-
<f:submit name="reload" value="${%Reload existing configuration}"/>
41-
</f:form>
42-
</l:hasAdministerOrManage>
4349
<l:hasPermission permission="${app.SYSTEM_READ}">
44-
<f:form method="post" action="export" name="export">
45-
<f:submit name="export" value="${%Download Configuration}"/>
46-
</f:form>
47-
<f:form method="post" action="viewExport" name="viewExport">
48-
<f:submit name="viewExport" value="${%View Configuration}"/>
49-
</f:form>
50-
<div class="alert alert-warning clear-action-forms">
51-
<l:icon class="icon-warning icon-sm"/>
52-
${%exportWarning}
53-
</div>
54-
5550
<h2>${%Reference}</h2>
5651
<dt>
5752
<dl><a href="reference">${%Documentation}</a></dl>

plugin/src/main/resources/io/jenkins/plugins/casc/ConfigurationAsCode/index.properties

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,17 @@
11
<?jelly escape-by-default='true'?>
2-
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler">
3-
<st:contentType value="text/html;charset=UTF-8"/>
4-
<j:new var="h" className="hudson.Functions"/>
5-
<j:invoke on="${h}" method="initPageVariables">
6-
<j:arg value="${context}"/>
7-
</j:invoke>
8-
<html><head>
9-
<link href='https://jenkins.io/assets/bower/bootstrap/css/bootstrap.min.css' media='screen' rel='stylesheet'/>
10-
<link href='https://jenkins.io/assets/bower/tether/css/tether.min.css' media='screen' rel='stylesheet'/>
11-
<link href='https://jenkins.io/css/font-icons.css' media='screen' rel='stylesheet'/>
12-
<link href='https://jenkins.io/css/jenkins.css' media='screen' rel='stylesheet'/>
13-
<link href='https://jenkins.io/assets/bower/ionicons/css/ionicons.min.css' media='screen' rel='stylesheet'/>
14-
<link href='https://jenkins.io/css/footer.css' media='screen' rel='stylesheet'/>
15-
<link href='https://jenkins.io/css/font-awesome.min.css' media='screen' rel='stylesheet'/>
16-
<link href='${rootURL}/plugin/configuration-as-code/css/reference.css' rel='stylesheet'/>
17-
</head>
18-
19-
<body class='syntax'>
20-
<div class='container'>
21-
<div class='row body'>
22-
<div class='section'>
23-
<h2>${%Jenkins Configuration as Code Reference}</h2>
24-
25-
<div class='sect3'>
26-
<j:set var="casc" value="${it}"/>
27-
<j:forEach items="${it.configurators}" var="c">
28-
<st:include page="documentation.jelly" it="${c}" optional="true"/>
29-
</j:forEach>
30-
</div>
31-
</div>
32-
</div>
33-
</div>
34-
</body>
35-
</html>
2+
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:st="jelly:stapler">
3+
<l:layout type="one-column" title="${%Reference}" permissions="${app.MANAGE_AND_SYSTEM_READ}">
4+
<l:breadcrumb title="${%Reference}"/>
5+
<l:main-panel>
6+
<link href='${rootURL}/plugin/configuration-as-code/css/reference.css' rel='stylesheet'/>
7+
<l:app-bar title="${%Reference}"/>
8+
<div class='sect3'>
9+
<j:set var="casc" value="${it}"/>
10+
<j:forEach items="${it.configurators}" var="c">
11+
<st:include page="documentation.jelly" it="${c}" optional="true"/>
12+
</j:forEach>
13+
</div>
14+
</l:main-panel>
15+
</l:layout>
3616

3717
</j:jelly>

plugin/src/main/resources/io/jenkins/plugins/casc/ConfigurationAsCode/viewExport.jelly

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
<?jelly escape-by-default='true'?>
2-
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:st="jelly:stapler" xmlns:p="/prism">
3-
<l:layout type="one-column" title="${%Configuration as Code}">
4-
<l:breadcrumb title="${%View}" />
2+
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:st="jelly:stapler" xmlns:p="/prism"
3+
xmlns:f="/lib/form">
4+
<l:layout type="one-column" title="${%Exported configuration}">
5+
<l:breadcrumb title="${%Exported configuration}" />
56
<l:main-panel>
67
<st:adjunct includes="io.jenkins.plugins.casc.assets.viewExport" />
78

9+
<l:app-bar title="${%Exported configuration}">
10+
<f:form method="post" action="export" name="export">
11+
<f:submit icon="symbol-download" primary="false" name="export" value="${%Download}"/>
12+
</f:form>
13+
</l:app-bar>
14+
15+
16+
<div class="jenkins-alert jenkins-alert-info">
17+
${%exportWarning}
18+
</div>
19+
820
<p:prism configuration="${it.prismConfiguration}" />
921
<pre>
1022
<code class="language-yaml">${export}</code>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
exportWarning=Export may not offer a directly usable jenkins.yaml configuration. \
2+
It is normally better when you copy the relevant sections you need instead of the entire file.

plugin/src/main/resources/io/jenkins/plugins/casc/assets/index.css

Lines changed: 0 additions & 26 deletions
This file was deleted.

plugin/src/main/webapp/css/reference.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
.configurator-pointer {
1010
font-size: 0.5em;
11-
color: #454545;
11+
color: var(--text-color-secondary);
1212
font-weight: 100;
1313
}
1414

1515
.root-configurator-pointer {
1616
font-size: 0.5em;
17-
color: #7f5200;
17+
color: var(--orange);
1818
font-weight: 100;
1919
}
2020

@@ -27,7 +27,7 @@
2727
display: flex;
2828
flex-grow: 1;
2929
margin-left: 25px;
30-
border-left: 1px solid #ccc;
30+
border-left: var(--jenkins-border);
3131
line-height: 24px;
3232
}
3333

@@ -70,7 +70,7 @@
7070
}
7171

7272
.attribute-type {
73-
color: #454545;
73+
color: var(--text-color-secondary);
7474
}
7575

7676
.attribute-type__list {

plugin/src/test/java/io/jenkins/plugins/casc/permissions/Action.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package io.jenkins.plugins.casc.permissions;
22

33
public enum Action {
4-
VIEW_CONFIGURATION("View Configuration"),
5-
DOWNLOAD_CONFIGURATION("Download Configuration"),
4+
VIEW_CONFIGURATION("Export configuration"),
65
APPLY_NEW_CONFIGURATION("Apply new configuration"),
76
RELOAD_EXISTING_CONFIGURATION("Reload existing configuration"),
87
;

plugin/src/test/java/io/jenkins/plugins/casc/permissions/PermissionsTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.jenkins.plugins.casc.permissions;
22

33
import static io.jenkins.plugins.casc.permissions.Action.APPLY_NEW_CONFIGURATION;
4-
import static io.jenkins.plugins.casc.permissions.Action.DOWNLOAD_CONFIGURATION;
54
import static io.jenkins.plugins.casc.permissions.Action.RELOAD_EXISTING_CONFIGURATION;
65
import static io.jenkins.plugins.casc.permissions.Action.VIEW_CONFIGURATION;
76
import static java.lang.String.format;
@@ -62,7 +61,6 @@ void checkPermissionsForSystemReader(JenkinsRule j) throws Exception {
6261
SYSTEM_READER,
6362
ImmutableMap.<Action, Boolean>builder()
6463
.put(VIEW_CONFIGURATION, true)
65-
.put(DOWNLOAD_CONFIGURATION, true)
6664
.put(APPLY_NEW_CONFIGURATION, false)
6765
.put(RELOAD_EXISTING_CONFIGURATION, false)
6866
.build());
@@ -106,7 +104,6 @@ void checkPermissionsForAdmin(JenkinsRule j) throws Exception {
106104
ADMIN,
107105
ImmutableMap.<Action, Boolean>builder()
108106
.put(VIEW_CONFIGURATION, true)
109-
.put(DOWNLOAD_CONFIGURATION, true)
110107
.put(APPLY_NEW_CONFIGURATION, true)
111108
.put(RELOAD_EXISTING_CONFIGURATION, true)
112109
.build());

0 commit comments

Comments
 (0)