Skip to content

Commit

Permalink
[JENKINS-42877] Remove unnecessary class and reference Jelly files th…
Browse files Browse the repository at this point in the history
…rough absolute paths.
  • Loading branch information
Evaristo Gutiérrez committed Apr 25, 2017
1 parent 5f2811c commit f99b89c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 37 deletions.
Expand Up @@ -94,14 +94,6 @@ public String getIconUrl(String rootUrl) {
return rootUrl + ICON_PATH;
}

/**
* used by configfiles.jelly to gather the class to be referenced when loading jelly files
*/
@Restricted(NoExternalUse.class)
public Class getJellyFilesClass() {
return ConfigFilesUI.class;
}

/**
* @see hudson.model.ManagementLink#getUrlName()
*/
Expand Down Expand Up @@ -156,7 +148,7 @@ public void doShow(StaplerRequest req, StaplerResponse rsp, @QueryParameter("id"
Config config = store.getById(confgiId);
req.setAttribute("contentType", config.getProvider().getContentType());
req.setAttribute("config", config);
req.getView(ConfigFilesUI.class, "show.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "show.jelly").forward(req, rsp);

}

Expand All @@ -179,7 +171,7 @@ public void doEditConfig(StaplerRequest req, StaplerResponse rsp, @QueryParamete
req.setAttribute("contentType", config.getProvider().getContentType());
req.setAttribute("config", config);
req.setAttribute("provider", config.getProvider());
req.getView(ConfigFilesUI.class, "edit.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "edit.jelly").forward(req, rsp);
}

/**
Expand Down Expand Up @@ -209,7 +201,7 @@ public void doAddConfig(StaplerRequest req, StaplerResponse rsp, @QueryParameter
checkPermission(Hudson.ADMINISTER);
req.setAttribute("providers", ConfigProvider.all());
req.setAttribute("configId", configId);
req.getView(ConfigFilesUI.class, "selectprovider.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "selectprovider.jelly").forward(req, rsp);
return;
}

Expand All @@ -229,14 +221,14 @@ public void doAddConfig(StaplerRequest req, StaplerResponse rsp, @QueryParameter
config.setProviderId(provider.getProviderId());
req.setAttribute("config", config);

req.getView(ConfigFilesUI.class, "edit.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "edit.jelly").forward(req, rsp);
}

public void doSelectProvider(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
checkPermission(Hudson.ADMINISTER);
req.setAttribute("providers", ConfigProvider.all());
req.setAttribute("configId", UUID.randomUUID().toString());
req.getView(ConfigFilesUI.class, "selectprovider.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "selectprovider.jelly").forward(req, rsp);
}

private void checkPermission(Permission permission) {
Expand Down

This file was deleted.

Expand Up @@ -41,6 +41,8 @@ of this software and associated documentation files (the "Software"), to deal
*/
public interface ConfigFilesUIContract {

public static final String JELLY_RESOURCES_PATH = "/org/jenkinsci/plugins/configfiles/ConfigFilesUI/";

public static final String ICON_PATH = "/plugin/config-file-provider/images/cfg_logo.png";


Expand Down
Expand Up @@ -16,7 +16,6 @@
import org.jenkinsci.plugins.configfiles.ConfigFilesManagement;
import org.jenkinsci.plugins.configfiles.ConfigFilesUIContract;
import org.jenkinsci.plugins.configfiles.Messages;
import org.jenkinsci.plugins.configfiles.ConfigFilesUI;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.*;
Expand Down Expand Up @@ -53,14 +52,6 @@ public String getIconUrl(String rootUrl) {
return rootUrl + ConfigFilesManagement.ICON_PATH;
}

/**
* used by configfiles.jelly to gather the class to be referenced when loading jelly files
*/
@Restricted(NoExternalUse.class)
public Class getJellyFilesClass() {
return ConfigFilesUI.class;
}

@Override
public String getDisplayName() {
return "Config Files";
Expand Down Expand Up @@ -136,7 +127,7 @@ public void doShow(StaplerRequest req, StaplerResponse rsp, @QueryParameter("id"
Config config = getStore().getById(confgiId);
req.setAttribute("contentType", config.getProvider().getContentType());
req.setAttribute("config", config);
req.getView(ConfigFilesUI.class, "show.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "show.jelly").forward(req, rsp);
}

@Override
Expand All @@ -146,7 +137,7 @@ public void doEditConfig(StaplerRequest req, StaplerResponse rsp, @QueryParamete
req.setAttribute("contentType", config.getProvider().getContentType());
req.setAttribute("config", config);
req.setAttribute("provider", config.getProvider());
req.getView(ConfigFilesUI.class, "edit.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "edit.jelly").forward(req, rsp);
}


Expand All @@ -166,7 +157,7 @@ public void doAddConfig(StaplerRequest req, StaplerResponse rsp, @QueryParameter
checkPermission(Job.CONFIGURE);
req.setAttribute("providers", getProviders());
req.setAttribute("configId", configId);
req.getView(ConfigFilesUI.class, "selectprovider.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "selectprovider.jelly").forward(req, rsp);
return;
}

Expand All @@ -186,15 +177,15 @@ public void doAddConfig(StaplerRequest req, StaplerResponse rsp, @QueryParameter
config.setProviderId(provider.getProviderId());
req.setAttribute("config", config);

req.getView(ConfigFilesUI.class, "edit.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "edit.jelly").forward(req, rsp);
}

@Override
public void doSelectProvider(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {;
checkPermission(Job.CONFIGURE);
req.setAttribute("providers", getProviders());
req.setAttribute("configId", UUID.randomUUID().toString());
req.getView(ConfigFilesUI.class, "selectprovider.jelly").forward(req, rsp);
req.getView(this, JELLY_RESOURCES_PATH + "selectprovider.jelly").forward(req, rsp);
}

@Override
Expand Down
Expand Up @@ -26,6 +26,6 @@ THE SOFTWARE.
<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:cf="/lib/configfiles">
<l:layout permission="${app.ADMINISTER}" norefresh="true">
<st:include page="configfiles.jelly" class="${it.getJellyFilesClass()}" />
<st:include page="/org/jenkinsci/plugins/configfiles/ConfigFilesUI/configfiles.jelly" />
</l:layout>
</j:jelly>
Expand Up @@ -26,6 +26,6 @@ THE SOFTWARE.
<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:cf="/lib/configfiles">
<l:layout permission="${it.CONFIGURE}" norefresh="true">
<st:include page="configfiles.jelly" class="${it.getJellyFilesClass()}" />
<st:include page="/org/jenkinsci/plugins/configfiles/ConfigFilesUI/configfiles.jelly" />
</l:layout>
</j:jelly>

0 comments on commit f99b89c

Please sign in to comment.