public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText
Date: Tue, 26 Nov 2024 16:12:58 +0100	[thread overview]
Message-ID: <20241126151300.71000-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20241126151300.71000-1-f.ebner@proxmox.com>

First user is intended to be the path field for datastores in PBS
where the emptyText should dynamically be for a relative or absolute
path.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/form/DisplayEdit.js | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/form/DisplayEdit.js b/src/form/DisplayEdit.js
index fe1b83b..3f6a9bb 100644
--- a/src/form/DisplayEdit.js
+++ b/src/form/DisplayEdit.js
@@ -7,6 +7,7 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
 	data: {
 	    editable: false,
 	    value: undefined,
+	    emptyText: undefined,
 	},
     },
 
@@ -41,6 +42,19 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
 	vm.get('value');
     },
 
+    setEmptyText: function(emptyText) {
+	let me = this;
+	let vm = me.getViewModel();
+
+	me.emptyText = emptyText;
+	vm.set('emptyText', emptyText);
+    },
+    getEmptyText: function() {
+	let me = this;
+	let vm = me.getViewModel();
+	return vm.get('emptyText');
+    },
+
     layout: 'fit',
     defaults: {
 	hideLabel: true,
@@ -77,11 +91,13 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
 	    hidden: '{editable}',
 	    disabled: '{editable}',
 	    value: '{value}',
+	    // doesn't have a setEmptyText() method, so don't bind that
 	});
 	Ext.applyIf(editConfig.bind, {
 	    hidden: '{!editable}',
 	    disabled: '{!editable}',
 	    value: '{value}',
+	    emptyText: '{emptyText}',
 	});
 
 	// avoid glitch, start off correct even before viewmodel fixes it
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  reply	other threads:[~2024-11-26 15:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 15:12 [pbs-devel] [PATCH proxmox-widget-toolkit/proxmox-backup 0/3] ui: slightly improve removable datastore dialog Fiona Ebner
2024-11-26 15:12 ` Fiona Ebner [this message]
2024-11-26 15:28   ` [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText Thomas Lamprecht
2024-11-26 16:23     ` Fiona Ebner
2024-11-26 15:12 ` [pbs-devel] [PATCH proxmox-backup 2/3] ui: datastore edit: improve field label name Fiona Ebner
2024-11-26 15:44   ` [pbs-devel] applied: " Thomas Lamprecht
2024-11-26 15:13 ` [pbs-devel] [PATCH proxmox-backup 3/3] ui: datastore edit: fix emptytext for path field Fiona Ebner

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=20241126151300.71000-2-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pbs-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