public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v3 0/2] pve fix help buttons by accounting for keys in widget toolkit
@ 2022-11-14 11:38 Stefan Sterz
  2022-11-14 11:38 ` [pve-devel] [PATCH docs v3 1/2] asciidoc-pve: disallow certain characters in onlineHelp keys Stefan Sterz
  2022-11-14 11:38 ` [pve-devel] [PATCH manager v3 2/2] fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js Stefan Sterz
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Sterz @ 2022-11-14 11:38 UTC (permalink / raw)
  To: pve-devel

this patch series fixes an issue where `onlineHelp` keys, that were
only used by components in the widget toolkit, were not properly
mapped to the corresponding anchors in the docs. this lead to
affected help buttons only showing an error message.

this series first fixes `pve-docs` by making `asciidoc-pve`
a bit less aggressiv in order to avoid keys that are set by cbind.
then it adds the toolkit as a build dependency to `pve-manager` and
scans the toolkit for keys there when building the front-end.


changes from v2, thanks @ Thomas Lamprecht:

* rebase to current master
* move to greedy regex

changes from v1, thanks @ Thomas Lamprecht:

* scan the widget toolkit too and not just components in
  `pve-manager`

Stefan Sterz (1):
  asciidoc-pve: disallow certain characters in onlineHelp keys

 asciidoc-pve.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Stefan Sterz (1):
  fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js

 debian/control        | 1 +
 www/manager6/Makefile | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH docs v3 1/2] asciidoc-pve: disallow certain characters in onlineHelp keys
  2022-11-14 11:38 [pve-devel] [PATCH manager v3 0/2] pve fix help buttons by accounting for keys in widget toolkit Stefan Sterz
@ 2022-11-14 11:38 ` Stefan Sterz
  2022-11-14 18:50   ` [pve-devel] applied: " Thomas Lamprecht
  2022-11-14 11:38 ` [pve-devel] [PATCH manager v3 2/2] fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js Stefan Sterz
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Sterz @ 2022-11-14 11:38 UTC (permalink / raw)
  To: pve-devel

this removes the lazily evaluated part of the regex used to detect
`onlineHelp` keys in order to match them with asciidoc anchors in the
documentation. it uses a pattern that excludes curly braces, brackets
and quotations instead. this allows for greedy matching and also
removes an issue where keys that are set via CBind were included
incorrectly. the script would try to find an anchor name that was
equivalent to the CBind placeholder, which would fail.

since brackets, curly braces and quotation marks aren't allowed in
asciidoc anchors anyway, excluding them like this should be safe.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
 asciidoc-pve.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/asciidoc-pve.in b/asciidoc-pve.in
index d638a38..49e54bd 100644
--- a/asciidoc-pve.in
+++ b/asciidoc-pve.in
@@ -465,7 +465,7 @@ sub scan_extjs_file {
     debug("scan-extjs $filename");
 
     while(defined(my $line = <$fh>)) {
-	if ($line =~ m/\s+onlineHelp:\s*[\'\"](.*?)[\'\"]/) {
+	if ($line =~ m/\s+onlineHelp:\s*[\'\"]([^{}\[\]\'\"]+)[\'\"]/) {
 	    my $blockid = $1;
 	    my $link = $fileinfo->{blockid_target}->{default}->{$blockid};
 	    die "undefined blockid '$blockid' ($filename, line $.)\n"
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH manager v3 2/2] fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js
  2022-11-14 11:38 [pve-devel] [PATCH manager v3 0/2] pve fix help buttons by accounting for keys in widget toolkit Stefan Sterz
  2022-11-14 11:38 ` [pve-devel] [PATCH docs v3 1/2] asciidoc-pve: disallow certain characters in onlineHelp keys Stefan Sterz
@ 2022-11-14 11:38 ` Stefan Sterz
  2022-11-14 19:48   ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Sterz @ 2022-11-14 11:38 UTC (permalink / raw)
  To: pve-devel

previously the widget toolkit was not scanned when creating the
mapping between `onlineHelp` keys and pve-doc anchors. this could
lead to cases where help buttons didn't work because the necessary
mapping wasn't present in `OnlineHelpInfo.js`.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
 debian/control        | 1 +
 www/manager6/Makefile | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index 35c9eee3..712d65e8 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,7 @@ Build-Depends: debhelper (>= 12~),
                libtemplate-perl,
                libtest-mockmodule-perl,
                lintian,
+               proxmox-widget-toolkit (>= 3.4-9),
                pve-cluster,
                pve-container,
                pve-doc-generator (>= 7.0-4),
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 5938c7f5..2802cbac 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -288,6 +288,8 @@ JSSRC= 							\
 	Workspace.js					\
 # end of JSSRC list
 
+WIDGETKIT=/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
+
 all:
 
 .lint-incremental: ${JSSRC}
@@ -304,8 +306,8 @@ pvemanagerlib.js: .lint-incremental OnlineHelpInfo.js ${JSSRC}
 	cat OnlineHelpInfo.js ${JSSRC} >$@.tmp
 	mv $@.tmp $@
 
-OnlineHelpInfo.js: /usr/bin/asciidoc-pve ${JSSRC}
-	/usr/bin/asciidoc-pve scan-extjs ${JSSRC} >$@.tmp
+OnlineHelpInfo.js: ${JSSRC} ${WIDGETKIT}
+	/usr/bin/asciidoc-pve scan-extjs $^ >$@.tmp
 	mv $@.tmp $@
 
 .PHONY: install
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH docs v3 1/2] asciidoc-pve: disallow certain characters in onlineHelp keys
  2022-11-14 11:38 ` [pve-devel] [PATCH docs v3 1/2] asciidoc-pve: disallow certain characters in onlineHelp keys Stefan Sterz
@ 2022-11-14 18:50   ` Thomas Lamprecht
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2022-11-14 18:50 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Sterz

Am 14/11/2022 um 12:38 schrieb Stefan Sterz:
> this removes the lazily evaluated part of the regex used to detect
> `onlineHelp` keys in order to match them with asciidoc anchors in the
> documentation. it uses a pattern that excludes curly braces, brackets
> and quotations instead. this allows for greedy matching and also
> removes an issue where keys that are set via CBind were included
> incorrectly. the script would try to find an anchor name that was
> equivalent to the CBind placeholder, which would fail.
> 
> since brackets, curly braces and quotation marks aren't allowed in
> asciidoc anchors anyway, excluding them like this should be safe.
> 
> Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
> ---
>  asciidoc-pve.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH manager v3 2/2] fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js
  2022-11-14 11:38 ` [pve-devel] [PATCH manager v3 2/2] fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js Stefan Sterz
@ 2022-11-14 19:48   ` Thomas Lamprecht
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2022-11-14 19:48 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Sterz

Am 14/11/2022 um 12:38 schrieb Stefan Sterz:
> previously the widget toolkit was not scanned when creating the
> mapping between `onlineHelp` keys and pve-doc anchors. this could
> lead to cases where help buttons didn't work because the necessary
> mapping wasn't present in `OnlineHelpInfo.js`.
> 
> Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
> ---
>  debian/control        | 1 +
>  www/manager6/Makefile | 6 ++++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
>

applied, thanks! Also bumped the versioned build-dependency to pve-doc-generator




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-14 19:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 11:38 [pve-devel] [PATCH manager v3 0/2] pve fix help buttons by accounting for keys in widget toolkit Stefan Sterz
2022-11-14 11:38 ` [pve-devel] [PATCH docs v3 1/2] asciidoc-pve: disallow certain characters in onlineHelp keys Stefan Sterz
2022-11-14 18:50   ` [pve-devel] applied: " Thomas Lamprecht
2022-11-14 11:38 ` [pve-devel] [PATCH manager v3 2/2] fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js Stefan Sterz
2022-11-14 19:48   ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal