From b5deb9c1d6d9adf3a660dee823d3d22cf369cb14 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Tue, 1 Oct 2024 20:49:03 -0700 Subject: [PATCH] Simplify JSON usages (#352) --- pom.xml | 19 +++++-------------- ui/src/main/js/util/ajax.js | 3 +-- ui/src/main/js/view/run-input-required.js | 3 +-- ui/src/test/js/helper.js | 4 ---- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index 3feb5c0f..1a21ff4b 100644 --- a/pom.xml +++ b/pom.xml @@ -58,8 +58,9 @@ 2.35 jenkinsci/pipeline-stage-view-plugin - 2.361.x - 2.361.4 + + 2.426 + ${jenkins.baseline}.3 -SNAPSHOT 18.7.0 8.15.0 @@ -98,21 +99,11 @@ io.jenkins.tools.bom - bom-${bom} - 2102.v854b_fec19c92 + bom-${jenkins.baseline}.x + 3208.vb_21177d4b_cd9 pom import - - org.json - json - 20230618 - - - org.yaml - snakeyaml - 1.33 - diff --git a/ui/src/main/js/util/ajax.js b/ui/src/main/js/util/ajax.js index 6e961d50..20bd0383 100644 --- a/ui/src/main/js/util/ajax.js +++ b/ui/src/main/js/util/ajax.js @@ -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', diff --git a/ui/src/main/js/view/run-input-required.js b/ui/src/main/js/view/run-input-required.js index ff7c3393..28b29f98 100644 --- a/ui/src/main/js/view/run-input-required.js +++ b/ui/src/main/js/view/run-input-required.js @@ -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(); diff --git a/ui/src/test/js/helper.js b/ui/src/test/js/helper.js index 66a1a231..8190e5ac 100644 --- a/ui/src/test/js/helper.js +++ b/ui/src/test/js/helper.js @@ -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. *