Skip to content

Commit

Permalink
Simplify JSON usages (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Oct 2, 2024
1 parent 2de3c84 commit b5deb9c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
19 changes: 5 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@
<properties>
<revision>2.35</revision>
<gitHubRepo>jenkinsci/pipeline-stage-view-plugin</gitHubRepo>
<bom>2.361.x</bom>
<jenkins.version>2.361.4</jenkins.version>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.426</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
<changelist>-SNAPSHOT</changelist>
<node.version>18.7.0</node.version>
<npm.version>8.15.0</npm.version>
Expand Down Expand Up @@ -98,21 +99,11 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${bom}</artifactId>
<version>2102.v854b_fec19c92</version>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3208.vb_21177d4b_cd9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20230618</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.33</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
3 changes: 1 addition & 2 deletions ui/src/main/js/util/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ exports.jenkinsAjaxPOST = function () {
var data = arguments[1];
var success = arguments[2];
if (typeof data !== 'string') {
// TODO simplify when Prototype.js is removed
data = Object.toJSON ? Object.toJSON(data) : JSON.stringify(data);
data = JSON.stringify(data);
}
fetch(path, {
method: 'post',
Expand Down
3 changes: 1 addition & 2 deletions ui/src/main/js/view/run-input-required.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ exports.render = function (inputRequiredModel, onElement) {

// Perform the POST. Needs to be encoded into a "json" parameter with an
// array object named "parameter" :)
// TODO simplify when Prototype.js is removed
var parameters = {
json: Object.toJSON ? Object.toJSON({ parameter: inputNVPs }) : JSON.stringify({ parameter: inputNVPs })
json: JSON.stringify({ parameter: inputNVPs })
};
ajax.jenkinsAjaxPOSTURLEncoded(proceedUrl, parameters, function() {
popover.hide();
Expand Down
4 changes: 0 additions & 4 deletions ui/src/test/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ var log = require('fancy-log');
var fs = require('fs');
var requireUncached = require("require-uncached");

Object.toJSON = function(object) {
return JSON.stringify(object);
}

/**
* require one of the pipeline source modules.
* <p/>
Expand Down

0 comments on commit b5deb9c

Please sign in to comment.