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 v3 widget-toolkit] form: display-edit: support emptyText
Date: Tue, 26 Nov 2024 17:29:15 +0100	[thread overview]
Message-ID: <20241126162916.87958-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20241126162916.87958-1-f.ebner@proxmox.com>

To access the edit field, its xtype is now tracked.

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

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Changes in v3:
* fix typo in variable name

Changes in v2:
* avoid tracking emptyText state twice, pass directly to edit field.

 src/form/DisplayEdit.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/form/DisplayEdit.js b/src/form/DisplayEdit.js
index fe1b83b..01d6a05 100644
--- a/src/form/DisplayEdit.js
+++ b/src/form/DisplayEdit.js
@@ -12,6 +12,9 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
 
     displayType: 'displayfield',
 
+    // internal only, use editConfig to set the xtype
+    _editType: 'textfield',
+
     editConfig: {},
     editable: false,
     setEditable: function(editable) {
@@ -41,6 +44,15 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
 	vm.get('value');
     },
 
+    setEmptyText: function(emptyText) {
+	let me = this;
+	me.down(me._editType).setEmptyText(emptyText);
+    },
+    getEmptyText: function() {
+	let me = this;
+	return me.down(me._editType).getEmptyText();
+    },
+
     layout: 'fit',
     defaults: {
 	hideLabel: true,
@@ -64,6 +76,8 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
 	});
 	Ext.applyIf(editConfig, displayConfig);
 
+	me._editType = editConfig.xtype;
+
 	if (me.initialConfig && me.initialConfig.displayConfig) {
 	    Ext.applyIf(displayConfig, me.initialConfig.displayConfig);
 	    delete displayConfig.displayConfig;
-- 
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 16:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 16:29 [pbs-devel] [PATCH v3 proxmox-widget-toolkit/proxmox-backup 0/2] ui: slightly improve removable datastore dialog Fiona Ebner
2024-11-26 16:29 ` Fiona Ebner [this message]
2024-11-26 16:29 ` [pbs-devel] [PATCH v3 proxmox-backup 2/2] ui: datastore edit: fix emptytext for path field Fiona Ebner
2024-11-27 11:34 ` [pbs-devel] applied: [PATCH v3 proxmox-widget-toolkit/proxmox-backup 0/2] ui: slightly improve removable datastore dialog Thomas Lamprecht

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=20241126162916.87958-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