From: Oguz Bektas <o.bektas@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v3 proxmox-backup 2/2] ui: add textarea in remote and menu for pasting json blob
Date: Tue, 10 Nov 2020 14:28:53 +0100 [thread overview]
Message-ID: <20201110132853.1269082-2-o.bektas@proxmox.com> (raw)
In-Reply-To: <20201110132853.1269082-1-o.bektas@proxmox.com>
fills ip and fingerprint automatically on paste.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
v2->v3:
* remove console.log calls
www/window/RemoteEdit.js | 55 +++++++++++++++++++++++++++++++++++++---
1 file changed, 51 insertions(+), 4 deletions(-)
diff --git a/www/window/RemoteEdit.js b/www/window/RemoteEdit.js
index 4a4d8114..92b3d929 100644
--- a/www/window/RemoteEdit.js
+++ b/www/window/RemoteEdit.js
@@ -11,6 +11,39 @@ Ext.define('PBS.window.RemoteEdit', {
fieldDefaults: { labelWidth: 120 },
+ viewModel: {
+ parent: null,
+ data: {
+ info: {
+ ipAddress: '',
+ fingerprint: '',
+ datastore: '',
+ },
+ },
+ },
+
+ controller: {
+ xclass: 'Ext.app.ViewController',
+ control: {
+ 'textarea[name=serializedinfo]': {
+ change: 'deserializeInfo',
+ },
+ },
+ deserializeInfo: function(field, value) {
+ let vm = this.getViewModel();
+ let jsons = Ext.util.Base64.decode(value);
+ let joinInfo = Ext.JSON.decode(jsons, true);
+
+ let info = {
+ ipAddress: joinInfo.ipAddress,
+ fingerprint: joinInfo.fingerprint,
+ datastore: joinInfo.datastore,
+ };
+
+ vm.set('info', info);
+ },
+ },
+
cbindData: function(initialConfig) {
let me = this;
@@ -26,7 +59,7 @@ Ext.define('PBS.window.RemoteEdit', {
};
},
- items: {
+ items: [{
xtype: 'inputpanel',
column1: [
{
@@ -47,6 +80,9 @@ Ext.define('PBS.window.RemoteEdit', {
submitValue: false,
vtype: 'HostPort',
fieldLabel: gettext('Host'),
+ bind: {
+ value: '{info.ipAddress}',
+ },
listeners: {
change: function(field, newvalue) {
let host = newvalue;
@@ -86,7 +122,6 @@ Ext.define('PBS.window.RemoteEdit', {
name: 'port',
},
],
-
column2: [
{
xtype: 'proxmoxtextfield',
@@ -105,7 +140,6 @@ Ext.define('PBS.window.RemoteEdit', {
},
},
],
-
columnB: [
{
xtype: 'proxmoxtextfield',
@@ -114,6 +148,10 @@ Ext.define('PBS.window.RemoteEdit', {
deleteEmpty: '{!isCreate}',
},
fieldLabel: gettext('Fingerprint'),
+ bind: {
+ value: '{info.fingerprint}',
+ },
+
},
{
xtype: 'proxmoxtextfield',
@@ -124,7 +162,16 @@ Ext.define('PBS.window.RemoteEdit', {
fieldLabel: gettext('Comment'),
},
],
- },
+ },
+ {
+ xtype: 'textarea',
+ name: 'serializedinfo',
+ fieldLabel: gettext('Remote Info Blob'),
+ submitValue: false,
+ emptyText: gettext('Paste encoded Remote Information here'),
+ value: '',
+ },
+ ],
setValues: function(values) {
let me = this;
--
2.20.1
prev parent reply other threads:[~2020-11-10 13:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 13:28 [pbs-devel] [PATCH v3 proxmox-backup 1/2] ui: add 'join info' copy/paste button on datastore summary Oguz Bektas
2020-11-10 13:28 ` Oguz Bektas [this message]
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=20201110132853.1269082-2-o.bektas@proxmox.com \
--to=o.bektas@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal