From 9ce1001a2b6eaecd600a0b225b5be0bf348a93f0 Mon Sep 17 00:00:00 2001 From: shlomomdahan <64103471+shlomomdahan@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:42:39 -0500 Subject: [PATCH] extract inline JS script in AbstractDependencyGraphAction/jsplumb.jelly --- .../AbstractDependencyGraphAction/jsplumb-config.js | 7 +++++++ .../AbstractDependencyGraphAction/jsplumb.jelly | 7 ++----- 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/hudson/plugins/depgraph_view/AbstractDependencyGraphAction/jsplumb-config.js diff --git a/src/main/resources/hudson/plugins/depgraph_view/AbstractDependencyGraphAction/jsplumb-config.js b/src/main/resources/hudson/plugins/depgraph_view/AbstractDependencyGraphAction/jsplumb-config.js new file mode 100644 index 0000000..bfc0b32 --- /dev/null +++ b/src/main/resources/hudson/plugins/depgraph_view/AbstractDependencyGraphAction/jsplumb-config.js @@ -0,0 +1,7 @@ +document.addEventListener('DOMContentLoaded', function() { + const config = document.querySelector(".jsplumb-config").dataset; + + window.depview.editEnabled = config.editEnabled === "true"; + window.depview.projectNameStripRegex = new RegExp(config.nameStripRegex, 'g'); + window.depview.projectNameStripRegexGroup = config.regexGroup; +}); diff --git a/src/main/resources/hudson/plugins/depgraph_view/AbstractDependencyGraphAction/jsplumb.jelly b/src/main/resources/hudson/plugins/depgraph_view/AbstractDependencyGraphAction/jsplumb.jelly index 6e60348..1d0c765 100644 --- a/src/main/resources/hudson/plugins/depgraph_view/AbstractDependencyGraphAction/jsplumb.jelly +++ b/src/main/resources/hudson/plugins/depgraph_view/AbstractDependencyGraphAction/jsplumb.jelly @@ -59,11 +59,8 @@ - + +