[pbs-devel] [PATCH proxmox-backup 1/2] close #4589: allow multi-line comments in datastore notes

Gabriel Goller g.goller at proxmox.com
Fri Sep 15 11:46:34 CEST 2023


Converting '\n' to '<br>' tags then store it in the config
(`datastore.cfg`) file.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 pbs-api-types/src/datastore.rs | 6 +++---
 www/datastore/Notes.js         | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
index 73c4890e..4e555d0c 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -11,8 +11,8 @@ use proxmox_schema::{
 
 use crate::{
     Authid, CryptMode, Fingerprint, MaintenanceMode, Userid, DATASTORE_NOTIFY_STRING_SCHEMA,
-    GC_SCHEDULE_SCHEMA, PROXMOX_SAFE_ID_FORMAT, PRUNE_SCHEDULE_SCHEMA, SHA256_HEX_REGEX,
-    SINGLE_LINE_COMMENT_SCHEMA, UPID,
+    GC_SCHEDULE_SCHEMA, MULTI_LINE_COMMENT_SCHEMA, PROXMOX_SAFE_ID_FORMAT, PRUNE_SCHEDULE_SCHEMA,
+    SHA256_HEX_REGEX, SINGLE_LINE_COMMENT_SCHEMA, UPID,
 };
 
 const_regex! {
@@ -241,7 +241,7 @@ pub const DATASTORE_TUNING_STRING_SCHEMA: Schema = StringSchema::new("Datastore
         },
         comment: {
             optional: true,
-            schema: SINGLE_LINE_COMMENT_SCHEMA,
+            schema: MULTI_LINE_COMMENT_SCHEMA,
         },
         "gc-schedule": {
             optional: true,
diff --git a/www/datastore/Notes.js b/www/datastore/Notes.js
index 2928b7ec..300603fc 100644
--- a/www/datastore/Notes.js
+++ b/www/datastore/Notes.js
@@ -21,10 +21,11 @@ Ext.define('PBS.DataStoreNotes', {
 	    title: gettext('Comment'),
 	    width: 600,
 	    resizable: true,
+	    convertNewlines: true,
 	    layout: 'fit',
 	    defaultButton: undefined,
 	    items: {
-		xtype: 'textfield',
+		xtype: 'textareafield',
 		name: 'comment',
 		value: '',
 		hideLabel: true,
@@ -42,7 +43,7 @@ Ext.define('PBS.DataStoreNotes', {
     setNotes: function(value) {
 	let me = this;
 	var data = value || '';
-	me.update(Ext.htmlEncode(data));
+	me.update(data);
 
 	if (me.collapsible && me.collapseMode === 'auto') {
 	    me.setCollapsed(data === '');
-- 
2.39.2






More information about the pbs-devel mailing list