From 5dcae0b48f8b16511f55ddebc461900a81c04261 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 6 Feb 2023 23:00:49 +0100 Subject: [PATCH] [JENKINS-60866] Un-inline setup wizard root URL js (#7619) * Un-inline setup wizard root URL * Fix linting --- .../setInitialRootUrlFieldValue.js | 22 +++++++++++++++++ .../setupWizardConfigureInstance.jelly | 24 ++----------------- 2 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 core/src/main/resources/jenkins/install/SetupWizard/setInitialRootUrlFieldValue.js diff --git a/core/src/main/resources/jenkins/install/SetupWizard/setInitialRootUrlFieldValue.js b/core/src/main/resources/jenkins/install/SetupWizard/setInitialRootUrlFieldValue.js new file mode 100644 index 0000000000..9faabe8281 --- /dev/null +++ b/core/src/main/resources/jenkins/install/SetupWizard/setInitialRootUrlFieldValue.js @@ -0,0 +1,22 @@ +var rootUrlField = $("root-url"); + +rootUrlField.focus(); +rootUrlField.onkeydown = function (event) { + if (event.keyCode == 13) { + event.preventDefault(); + } +}; + +(function setInitialRootUrlFieldValue() { + var iframeUrl = window.location.href; + // will let the trailing slash in the rootUrl + var iframeRelativeUrl = "setupWizard/setupWizardConfigureInstance"; + var rootUrl = iframeUrl.substr( + 0, + iframeUrl.length - iframeRelativeUrl.length + ); + // to keep only the root url + rootUrlField.value = rootUrl; + // to adjust the width of the input, + rootUrlField.size = Math.min(50, rootUrl.length); +})(); diff --git a/core/src/main/resources/jenkins/install/SetupWizard/setupWizardConfigureInstance.jelly b/core/src/main/resources/jenkins/install/SetupWizard/setupWizardConfigureInstance.jelly index 60bfd45246..3fd6c5df00 100644 --- a/core/src/main/resources/jenkins/install/SetupWizard/setupWizardConfigureInstance.jelly +++ b/core/src/main/resources/jenkins/install/SetupWizard/setupWizardConfigureInstance.jelly @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> - + @@ -45,27 +45,7 @@ THE SOFTWARE. - + -- GitLab