public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Sterz <s.sterz@proxmox.com>
To: pbs-devel@lists.proxmox.com, pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-backup v4 3/4] fix #3067: ui: add a separate notes view for longer markdown notes
Date: Fri,  1 Apr 2022 12:19:07 +0200	[thread overview]
Message-ID: <20220401101908.1154385-4-s.sterz@proxmox.com> (raw)
In-Reply-To: <20220401101908.1154385-1-s.sterz@proxmox.com>

since markdown notes might be rather long, this commit adds a tab
similar to pve's datacenter or node notes. requires a bump of the
widget toolkit in order to use the `pmxNotesView`.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
the maxLength of a note in pbs is chosen to be 1022*64 because the
server allows at most 1024*64 bytes of form data per request, which
are distributed as follows:

equal signs:             2
the word "digest":       7
digest:                  64
the word "description":  12
description:             65451

so by setting the limit to 1024*64 some users might encounter an
error telling them that the message body was too large even though the
front-end said the description was fine. i wanted to approximate
the 1024*64 limit here as close as possible so i chose:
65451 / 64 ~ 1022.

note that afaict due to the way maxLength is implemented the limit
will still sometimes not be correct. this is due to character
encodings and how javascript's string length property works.

 www/Makefile          |  1 +
 www/NavigationTree.js |  6 ++++++
 www/NodeNotes.js      | 23 +++++++++++++++++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 www/NodeNotes.js

diff --git a/www/Makefile b/www/Makefile
index 455fbeec..922d8de9 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -98,6 +98,7 @@ JSSRC=							\
 	datastore/DataStoreList.js			\
 	ServerStatus.js					\
 	ServerAdministration.js				\
+	NodeNotes.js				        \
 	Dashboard.js					\
 	${TAPE_UI_FILES}				\
 	NavigationTree.js				\
diff --git a/www/NavigationTree.js b/www/NavigationTree.js
index 576d05ab..916582ef 100644
--- a/www/NavigationTree.js
+++ b/www/NavigationTree.js
@@ -32,6 +32,12 @@ Ext.define('PBS.store.NavigationStore', {
 		path: 'pbsDashboard',
 		leaf: true,
 	    },
+	    {
+		text: gettext('Notes'),
+		iconCls: 'fa fa-sticky-note-o',
+		path: 'pbsNodeNotes',
+		leaf: true,
+	    },
 	    {
 		text: gettext('Configuration'),
 		iconCls: 'fa fa-gears',
diff --git a/www/NodeNotes.js b/www/NodeNotes.js
new file mode 100644
index 00000000..f8b253c4
--- /dev/null
+++ b/www/NodeNotes.js
@@ -0,0 +1,23 @@
+// Needs to be its own xtype for `path` to work in `NavigationTree`
+Ext.define('PBS.NodeNotes', {
+    extend: 'Ext.panel.Panel',
+    xtype: 'pbsNodeNotes',
+
+    scrollable: true,
+    layout: 'fit',
+
+    items: [
+	{
+	    xtype: 'container',
+	    layout: 'fit',
+	    items: [{
+		xtype: 'pmxNotesView',
+		tools: false,
+		border: false,
+		node: 'localhost',
+		enableTBar: true,
+		maxLength: 1022*64,
+	    }],
+	},
+    ],
+});
-- 
2.30.2





  parent reply	other threads:[~2022-04-01 10:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 10:19 [pve-devel] [PATCH SERIES v4 0/4] add notes to functionality to pbs webui Stefan Sterz
2022-04-01 10:19 ` [pve-devel] [PATCH proxmox-backup v4 1/4] fix #3067: docs: add markdown primer from pve to pbs Stefan Sterz
2022-04-01 10:19 ` [pve-devel] [PATCH widget-toolkit v4 2/4] toolkit: add markdown based NotesView and NotesEdit Stefan Sterz
2022-04-06  8:26   ` Stefan Sterz
2022-04-06 11:39     ` [pve-devel] [pbs-devel] " Thomas Lamprecht
2022-04-01 10:19 ` Stefan Sterz [this message]
2022-04-01 10:19 ` [pve-devel] [PATCH manager v4 4/4] ui: move NotesView panel and NotesEdit window to widget kit Stefan Sterz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220401101908.1154385-4-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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