Skip to content

Commit

Permalink
Add sidebar to plugin manager, increase search bar size (#6783)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
Co-authored-by: Basil Crow <me@basilcrow.com>
Co-authored-by: Alexander Brandes <mc.cache@web.de>
  • Loading branch information
5 people committed Sep 6, 2022
1 parent dd7f793 commit 6db88c3
Show file tree
Hide file tree
Showing 66 changed files with 325 additions and 1,322 deletions.
28 changes: 25 additions & 3 deletions core/src/main/java/hudson/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerFallback;
import org.kohsuke.stapler.StaplerOverridable;
import org.kohsuke.stapler.StaplerProxy;
import org.kohsuke.stapler.StaplerRequest;
Expand Down Expand Up @@ -1386,6 +1387,27 @@ public static boolean isNonMetaLabel(String label) {
return !("adopt-this-plugin".equals(label) || "deprecated".equals(label));
}

/**
* This allows "Update Center" to live at the URL
* {@code /pluginManager/updates/} in addition to its {@code /updateCenter/}
* URL which is provided by {@link jenkins.model.Jenkins#getUpdateCenter()}.
* For purposes of Stapler, this object is the current item serving the
* view, and since this is not a {@link hudson.model.ModelObject}, it does
* not appear as an additional breadcrumb and only the "Plugin Manager"
* breadcrumb is shown.
*/
@Restricted(NoExternalUse.class)
public static class UpdateCenterProxy implements StaplerFallback {
@Override
public Object getStaplerFallback() {
return Jenkins.get().getUpdateCenter();
}
}

public UpdateCenterProxy getUpdates() {
return new UpdateCenterProxy();
}

@Restricted(NoExternalUse.class)
public HttpResponse doPluginsSearch(@QueryParameter String query, @QueryParameter Integer limit) {
List<JSONObject> plugins = new ArrayList<>();
Expand Down Expand Up @@ -1593,7 +1615,7 @@ public void doInstall(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
boolean dynamicLoad = req.getParameter("dynamicLoad") != null;
install(plugins, dynamicLoad);

rsp.sendRedirect("../updateCenter/");
rsp.sendRedirect("updates/");
}

/**
Expand Down Expand Up @@ -1898,7 +1920,7 @@ public HttpResponse doUploadPlugin(StaplerRequest req) throws IOException, Servl
element("url", t.toURI().toString()).
element("dependencies", dependencies);
new UpdateSite(UpdateCenter.ID_UPLOAD, null).new Plugin(UpdateCenter.ID_UPLOAD, cfg).deploy(true);
return new HttpRedirect("../updateCenter");
return new HttpRedirect("updates/");
} catch (FileUploadException e) {
throw new ServletException(e);
}
Expand Down Expand Up @@ -2124,7 +2146,7 @@ public JSONArray doPrevalidateConfig(StaplerRequest req) throws IOException {
@RequirePOST
public HttpResponse doInstallNecessaryPlugins(StaplerRequest req) throws IOException {
prevalidateConfig(req.getInputStream());
return HttpResponses.redirectViaContextPath("updateCenter");
return HttpResponses.redirectViaContextPath("updates/");
}

/**
Expand Down
7 changes: 3 additions & 4 deletions core/src/main/resources/hudson/PluginManager/advanced.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ THE SOFTWARE.
<?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">
<l:layout title="${%Advanced Settings} - ${%Plugin Manager}" permission="${app.SYSTEM_READ}">
<l:layout title="${%Advanced settings} - ${%Plugin Manager}" permission="${app.SYSTEM_READ}">
<j:set var="readOnlyMode" value="${!app.hasPermission(app.ADMINISTER)}"/>

<l:app-bar title="${%Plugin Manager}"/>
<l:app-bar title="${%Advanced settings}"/>

<st:include page="sidepanel.jelly"/>
<st:include page="sidepanel.jelly"/>

<l:main-panel>
<local:tabBar page="advanced" xmlns:local="/hudson/PluginManager"/>
<div class="jenkins-form">
<section class="jenkins-section jenkins-!-margin-bottom-5">
<h2 class="jenkins-section__title">${%HTTP Proxy Configuration}</h2>
Expand Down
33 changes: 16 additions & 17 deletions core/src/main/resources/hudson/PluginManager/available.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,30 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:f="/lib/form">
<l:layout title="${%Available Plugins} - ${%Plugin Manager}" permission="${app.SYSTEM_READ}">
<j:set var="page" value="available"/>
<l:layout title="${%Available plugins} - ${%Plugin Manager}" permission="${app.SYSTEM_READ}">

<l:app-bar title="${%Plugin Manager}" />
<l:app-bar title="${%Plugins}" />

<st:include page="sidepanel.jelly"/>

<l:main-panel>
<script src="${resURL}/jsbundles/plugin-manager-ui.js" type="text/javascript"/>

<form method="post" action="install">
<local:tabBar page="${page}" xmlns:local="/hudson/PluginManager"/>

<div class="jenkins-form-item jenkins-search">
<input
class="jenkins-search__input"
type="search"
id="filter-box"
value="${request.getParameter('filter')}"
placeholder="${%Search}"/>
<div class="jenkins-search__icon">
<l:icon src="symbol-search"/>
<div class="jenkins-app-bar jenkins-app-bar--sticky">
<div class="jenkins-app-bar__content">
<div class="app-plugin-manager__search">
<span class="app-plugin-manager__search__icon">
<l:icon src="symbol-search"/>
</span>
<input type="search"
placeholder="Search available plugins"
id="filter-box"
value="${request.getParameter('filter')}" />
</div>
</div>
</div>

<script src="${resURL}/jsbundles/plugin-manager-ui.js" type="text/javascript"/>

<form method="post" action="install">
<table id="plugins" class="jenkins-table sortable"
data-hasAdmin="${h.hasPermission(app.ADMINISTER)}">
<thead>
Expand Down
32 changes: 16 additions & 16 deletions core/src/main/resources/hudson/PluginManager/installed.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,28 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:s="/lib/form">
<l:layout title="${%Installed Plugins} - ${%Plugin Manager}" permission="${app.SYSTEM_READ}">
<l:layout title="${%Installed plugins} - ${%Plugin Manager}" permission="${app.SYSTEM_READ}">
<j:set var="readOnlyMode" value="${!app.hasPermission(app.ADMINISTER)}"/>

<l:app-bar title="${%Plugin Manager}" />
<l:app-bar title="${%Plugins}" />

<st:include page="sidepanel.jelly"/>

<l:main-panel>
<div class="jenkins-app-bar jenkins-app-bar--sticky">
<div class="jenkins-app-bar__content">
<div class="app-plugin-manager__search">
<span class="app-plugin-manager__search__icon">
<l:icon src="symbol-search"/>
</span>
<input type="search"
placeholder="Search installed plugins"
id="filter-box"
value="${request.getParameter('filter')}" />
</div>
</div>
</div>

<st:adjunct includes="hudson.PluginManager._table"/>

<j:if test="${app.updateCenter.isRestartRequiredForCompletion()}">
Expand All @@ -53,20 +67,6 @@ THE SOFTWARE.
data-detached-possible-dependents="${%detached-possible-dependents}"
/>

<local:tabBar page="installed" xmlns:local="/hudson/PluginManager" />

<div class="jenkins-form-item jenkins-search">
<input
class="jenkins-search__input"
type="search"
id="filter-box"
value="${request.getParameter('filter')}"
placeholder="${filtered == 'true' ? '%Search' : '%Filter'}"/>
<div class="jenkins-search__icon">
<l:icon src="symbol-search"/>
</div>
</div>

<table id="plugins" class="jenkins-table sortable">
<j:choose>
<j:when test="${empty(app.pluginManager.plugins) and empty(app.pluginManager.failedPlugins)}">
Expand Down
35 changes: 0 additions & 35 deletions core/src/main/resources/hudson/PluginManager/sidepanel.groovy

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
The MIT License
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
Copyright (c) 2022, Jenkins 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
Expand All @@ -23,17 +23,19 @@ THE SOFTWARE.
-->

<!--
List of available new plugins
Sidepanel component for Plugins Manager
-->
<?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">
<st:documentation>
<st:attribute name="page"/>
</st:documentation>
<l:tabBar>
<l:tab name="${%Updates}" active="${page=='updates'}" href="." />
<l:tab name="${%Available}" active="${page=='available'}" href="./available" />
<l:tab name="${%Installed}" active="${page=='installed'}" href="./installed" />
<l:tab name="${%Advanced}" active="${page=='advanced'}" href="./advanced" />
</l:tabBar>
<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:side-panel>
<l:tasks>
<l:task href="${rootURL}/manage/pluginManager/" icon="symbol-download" title="${%Updates}"/>
<l:task href="${rootURL}/manage/pluginManager/available" icon="symbol-shopping-bag" title="${%Available plugins}"/>
<l:task href="${rootURL}/manage/pluginManager/installed" icon="symbol-plugins" title="${%Installed plugins}"/>
<l:task href="${rootURL}/manage/pluginManager/advanced" icon="symbol-settings" title="${%Advanced settings}"/>
<j:if test="${!app.updateCenter.jobs.isEmpty()}">
<l:task href="${rootURL}/manage/pluginManager/updates/" icon="symbol-list" title="${%Download progress}"/>
</j:if>
</l:tasks>
</l:side-panel>
</j:jelly>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6db88c3

Please sign in to comment.