Skip to content

Commit

Permalink
CSP support for DockerManagementServer (#1107)
Browse files Browse the repository at this point in the history
* CSP support for `DockerManagementServer`

* Spotless
  • Loading branch information
basil authored Oct 14, 2024
1 parent 94b7439 commit 5007d28
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.nirima.jenkins.plugins.docker;

import com.github.dockerjava.api.DockerClient;
import com.nirima.jenkins.plugins.docker.utils.Consts;
import com.nirima.jenkins.plugins.docker.utils.JenkinsUtils;
import hudson.Extension;
import hudson.model.Describable;
Expand Down Expand Up @@ -72,10 +71,6 @@ public String asTime(Long time) {
return dt.toString();
}

public String getJsUrl(String jsName) {
return Consts.PLUGIN_JS_URL + jsName;
}

@SuppressWarnings("unused")
@RequirePOST
public void doControlSubmit(@QueryParameter("stopId") String stopId, StaplerRequest req, StaplerResponse rsp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ public final class Consts {
* The base URL of the plugin images.
*/
public static final String PLUGIN_IMAGES_URL = PLUGIN_URL + "images/";

/**
* The base URL of the plugin javascripts.
*/
public static final String PLUGIN_JS_URL = PLUGIN_URL + "js/";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function stop(theId) {
var input = document.getElementById('stopId');
if (input != null) {
input.value = theId;
}

var form = document.getElementById('control');
form.submit();
}

document.addEventListener('DOMContentLoaded', () => {
const stopContainerButtons = document.querySelectorAll('#control .stop-container');
stopContainerButtons.forEach((button) =>
button.addEventListener('click', () => {
stop(button.dataset.id);
}),
);
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:f="/lib/form"
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:f="/lib/form"
>
<l:layout title="${%Docker hosts}" norefresh="true" permission="${it.requiredPermission}">
<l:header>
<script src="${rootURL}${it.getJsUrl('docker-manage.js')}" type="text/javascript"></script>
<st:adjunct includes="com.nirima.jenkins.plugins.docker.DockerManagementServer.docker-manage"/>
<style type="text/css">
tr.disablehover:hover {
background-color: white;
Expand Down Expand Up @@ -52,7 +52,7 @@
</j:forEach>
</td>
<td>
<input type="button" value="stop" onclick="stop('${res.id}')"></input>
<input type="button" class="stop-container" value="stop" data-id="${res.id}"></input>
</td>
</tr>
</j:forEach>
Expand Down
10 changes: 0 additions & 10 deletions src/main/webapp/js/docker-manage.js

This file was deleted.

0 comments on commit 5007d28

Please sign in to comment.