Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize UI #364

Merged
merged 9 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
buildPlugin(configurations: [
[platform: 'linux', jdk: '8'],
[platform: 'linux', jdk: '11'],
[platform: 'windows', jdk: '11'],
])
[platform: 'linux', jdk: '11'],
[platform: 'windows', jdk: '11'],
])
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<jenkins.version>2.340</jenkins.version>
<jenkins.version>2.361</jenkins.version>
timja marked this conversation as resolved.
Show resolved Hide resolved
<java.level>8</java.level>
<antlr4.version>4.9.3</antlr4.version>
</properties>
Expand All @@ -89,8 +89,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.332.x</artifactId>
<version>1246.va_b_50630c1d19</version>
<artifactId>bom-2.361.x</artifactId>
<version>1607.va_c1576527071</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ public String getRelativeLinkToContext() {
return null;
}
if (context instanceof Jenkins) {
return URI.create(request.getContextPath() + "/").normalize().toString();
String suffix = Jenkins.get().hasPermission(Jenkins.ADMINISTER) ? "/manage/" : "/";
return URI.create(request.getContextPath() + suffix).normalize().toString();
}
if (context instanceof User) {
return URI.create(request.getContextPath() + "/" + ((User) context).getUrl()+"/")
Expand Down Expand Up @@ -537,6 +538,22 @@ public final String getContextDisplayName() {
}
}

/**
* Resolves a display name from the Store
* @return the display name
*/
public String getDisplayName() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved code from CredentialsStoreAction

Class<?> c = this.getClass();
while (c.getEnclosingClass() != null) {
c = c.getEnclosingClass();
}
String name = c.getSimpleName().replaceAll("(?i)(Impl|Credentials|Provider|Store)+", "");
if (StringUtils.isBlank(name)) {
name = c.getSimpleName();
}
return StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(name), ' ');
}

/**
* Return the {@link CredentialsStoreAction} for this store. The action will be displayed as a sub-item of the
* {@link ViewCredentialsAction}. Return {@code null} if this store will take control of displaying its action
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
import net.sf.json.JSONObject;
import org.acegisecurity.AccessDeniedException;
import org.apache.commons.lang.StringUtils;
import org.jenkins.ui.icon.IconSet;
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand Down Expand Up @@ -240,15 +239,7 @@ public String getIconFileName() {
public String getDisplayName() {
CredentialsStore store = getStore();
if (this == store.getStoreAction()) {
Class<?> c = store.getClass();
while (c.getEnclosingClass() != null) {
c = c.getEnclosingClass();
}
String name = c.getSimpleName().replaceAll("(?i)(Impl|Credentials|Provider|Store)+", "");
if (StringUtils.isBlank(name)) {
name = c.getSimpleName();
}
return StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(name), ' ');
return store.getDisplayName();
} else {
return Messages.CredentialsStoreAction_DisplayName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"
xmlns:f="/lib/form" xmlns:c="/lib/credentials" xmlns:t="/lib/hudson">
<l:layout title="${it.fullDisplayName}" norefresh="true" permission="${it.domain.parent.VIEW}">
<l:layout title="${it.fullDisplayName}" permission="${it.domain.parent.VIEW}">
<st:include page="sidepanel.jelly"/>
<l:main-panel>
<h1>${%Concurrent Modification}</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:layout title="${%Delete credentials}" norefresh="true" permission="${it.domain.parent.DELETE}">
<l:layout title="${%Delete credentials}" permission="${it.domain.parent.DELETE}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1>${%Delete credentials}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:t="/lib/hudson">
<l:layout title="${it.fullDisplayName}" norefresh="true" permission="${it.domain.parent.VIEW}">
<l:layout title="${it.fullDisplayName}" permission="${it.domain.parent.VIEW}">
<st:include page="sidepanel.jelly"/>
<l:main-panel>
<h1>${it.displayName}</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:layout title="${%Move credentials}" norefresh="true" permission="${it.domain.parent.DELETE}">
<l:layout title="${%Move credentials}" permission="${it.domain.parent.DELETE}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1>${%Move credentials}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<l:side-panel>
<l:tasks>
<j:set var="url" value="${h.getNearestAncestorUrl(request,it)}"/>
<l:task icon="icon-up icon-md" href="../.." title="${%backto(it.domain.displayName)}" contextMenu="false"/>
<l:task icon="icon-setting icon-md" href="${url}/update" title="${%Update}" permission="${it.domain.parent.UPDATE}"/>
<l:task icon="icon-edit-delete icon-md" href="${url}/delete" title="${%Delete}" permission="${it.domain.parent.DELETE}"/>
<l:task icon="symbol-swap" href="${url}/move" title="${%Move}" permission="${it.domain.parent.DELETE}"/>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
backto=Zur\u00FCck zu {0}
Update=Bearbeiten
Delete=L\u00F6schen
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

backto=Revenir \u00e0 {0}
Update=Mettre \u00e0 jour
Delete=Supprimer
Move=D\u00e9placer
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

backto=Torna a {0}
Delete=Elimina
Move=Sposta
Update=Aggiorna
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
backto={0}\u3078\u623b\u308b
Update=\u66f4\u65b0
Delete=\u524a\u9664
Move=\u79fb\u52d5
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"
xmlns:f="/lib/form" xmlns:c="/lib/credentials" xmlns:t="/lib/hudson">
<l:layout title="${%Update credentials}" norefresh="true" permission="${it.domain.parent.UPDATE}">
<l:layout title="${%Update credentials}" permission="${it.domain.parent.UPDATE}">
<st:include page="sidepanel.jelly"/>
<l:main-panel>
<h1>${%Update credentials}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"
xmlns:f="/lib/form" xmlns:c="/lib/credentials" xmlns:t="/lib/hudson">
<l:layout title="${%Update domain}" norefresh="true" permission="${it.parent.MANAGE_DOMAINS}">
<l:layout title="${%Update domain}" permission="${it.parent.MANAGE_DOMAINS}">
<st:include page="sidepanel.jelly"/>
<l:main-panel>
<h1>${%Update domain}</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:layout title="${%Delete domain}" norefresh="true" permission="${it.parent.MANAGE_DOMAINS}">
<l:layout title="${%Delete domain}" permission="${it.parent.MANAGE_DOMAINS}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1>${%Delete domain}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,28 @@
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"
xmlns:f="/lib/form" xmlns:c="/lib/credentials" xmlns:t="/lib/hudson">
<l:layout title="${it.fullDisplayName}" norefresh="true" permission="${it.parent.VIEW}">
<l:layout title="${it.fullDisplayName}" permission="${it.parent.VIEW}" type="one-column">
<st:include page="sidepanel.jelly"/>
<l:app-bar title="${it.displayName}" />
<l:app-bar title="${it.displayName}">
<l:hasPermission permission="${it.parent.CREATE}">
<a href="newCredentials" class="jenkins-button jenkins-button--primary">
<l:icon src="symbol-add" />
${%Add Credentials}
</a>
</l:hasPermission>
<j:if test="${!it.global and it.parent.domainsModifiable}">
<l:hasPermission permission="${it.parent.CREATE}">
<a href="configure" class="jenkins-button">
<l:icon class="icon-setting icon-md" />
${%Configure domain}
</a>
<a href="delete" class="jenkins-button jenkins-!-destructive-color">
<l:icon class="icon-edit-delete icon-md" />
${%Delete domain}
</a>
</l:hasPermission>
</j:if>
</l:app-bar>
<l:main-panel>
<div>
<j:out value="${it.description!=null ? app.markupFormatter.translate(it.description) : ''}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@
<l:side-panel>
<l:tasks>
<j:set var="url" value="${h.getNearestAncestorUrl(request,it)}"/>
<l:task icon="icon-up icon-md" href="../.." title="${%Back to credential domains}" contextMenu="false"/>
<l:task icon="symbol-add" href="newCredentials" title="${%Add Credentials}" permission="${it.parent.CREATE}" />
<j:if test="${!it.global and it.parent.domainsModifiable}">
<l:task icon="icon-setting icon-md" href="${url}/configure" title="${%Configure}" permission="${it.parent.MANAGE_DOMAINS}"/>
<l:task icon="symbol-add" href="newCredentials" title="${%Add Credentials}" permission="${it.parent.CREATE}" />
<j:if test="${!it.global and it.parent.domainsModifiable}">
<l:task icon="icon-setting icon-md" href="${url}/configure" title="${%Configure domain}" permission="${it.parent.MANAGE_DOMAINS}"/>
<l:task icon="icon-edit-delete icon-md" href="${url}/delete" title="${%Delete domain}" permission="${it.parent.MANAGE_DOMAINS}"/>
</j:if>
</j:if>
</l:tasks>
</l:side-panel>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,25 @@
xmlns:f="/lib/form" xmlns:c="/lib/credentials" xmlns:t="/lib/hudson">
<j:choose>
<j:when test="${it.hasPermission(it.VIEW) and !it.visible}">
<l:layout title="${it.fullDisplayName}" norefresh="true">
<l:layout title="${it.fullDisplayName}" type="one-column">
<l:main-panel>
<h1>Not found</h1>
</l:main-panel>
</l:layout>
</j:when>
<j:otherwise>
<l:layout title="${it.fullDisplayName}" norefresh="true" permission="${it.VIEW}">
<st:include it="${it.store.context}" page="sidepanel.jelly"/>
<l:app-bar title="${it.displayName}" />
<l:layout title="${it.fullDisplayName}" permission="${it.VIEW}" type="one-column">
<l:app-bar title="${it.displayName}">
<j:if test="${it.domainsModifiable}">
<l:hasPermission permission="${it.parent.CREATE}">
<a href="newDomain" class="jenkins-button jenkins-button--primary">
<l:icon src="symbol-add" />
${%Add domain}
</a>
</l:hasPermission>
</j:if>
</l:app-bar>

<l:main-panel>
<t:setIconSize/>
<table class="jenkins-table ${iconSize == '16x16' ? 'jenkins-table--small' : iconSize == '24x24' ? 'jenkins-table--medium' : ''} sortable">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"
xmlns:f="/lib/form" xmlns:c="/lib/credentials" xmlns:t="/lib/hudson">
<l:layout title="${%New domain}" norefresh="true" permission="${it.MANAGE_DOMAINS}">
<st:include it="${it.store.context}" page="sidepanel.jelly"/>
<l:layout title="${%New domain}" permission="${it.MANAGE_DOMAINS}" type="one-column">
<l:main-panel>
<h1>${%New domain}</h1>
<j:set var="descriptor" value="${it.domainDescriptor}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"
xmlns:f="/lib/form" xmlns:t="/lib/hudson">
<l:layout title="${it.displayName}" norefresh="true" permission="${app.ADMINISTER}">
<l:layout title="${it.displayName}" permission="${app.ADMINISTER}">
<st:include it="${app}" page="sidepanel"/>
<l:main-panel>
<h1>${it.displayName}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"
xmlns:t="/lib/hudson">
<l:layout title="${it.fullDisplayName}" norefresh="true" permission="${it.VIEW}">
<st:include it="${it.context}" page="sidepanel.jelly"/>
<l:layout title="${it.fullDisplayName}" permission="${it.VIEW}" type="one-column">
<l:app-bar title="${%Credentials}" />
<l:main-panel>
<style>
Expand Down Expand Up @@ -66,7 +65,7 @@
<td data="${stores.indexOf(d.store)}">
<a href="${storeAction==null?d.store.relativeLinkToAction:d.store.relativeLinkToContext+'credentials/store/'+storeAction.urlName}"
class='model-link inside jenkins-table__link'>
${d.store.contextDisplayName}
${d.store.context == app ? d.store.displayName : d.store.contextDisplayName}
</a>
</td>
<td>
Expand Down Expand Up @@ -121,7 +120,7 @@
<td data="${stores.indexOf(d.store)}">
<a href="${storeAction==null?store.relativeLinkToAction:store.relativeLinkToContext+'credentials/store/'+storeAction.urlName}"
class='model-link inside jenkins-table__link'>
${store.contextDisplayName}
${store.context == app ? store.displayName : store.contextDisplayName}
</a>
</td>
<td>
Expand Down Expand Up @@ -173,7 +172,7 @@
<td data="${stores.indexOf(store)}">
<a href="${storeAction==null?store.relativeLinkToAction:store.relativeLinkToContext+'credentials/store/'+storeAction.urlName}"
class='model-link inside jenkins-table__link'>
${store.contextDisplayName}
${store.context == app ? store.displayName : store.contextDisplayName}
</a>
</td>
<td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
global=(global)
storesScopedTo=Stores scoped to <a href=".." class='model-link inside'>{0}</a>
storesScopedTo=Stores scoped to {0}
daniel-beck marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
-->

<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" >
<l:layout norefresh="true">
<l:layout>
<l:main-panel>
View no longer required/supported due to the inlining of the file input.
If you came to this page due to another plugin, you will have to update that plugin to be compatible
Expand Down