From: Oguz Bektas <o.bektas@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v4 backup 2/2] ui: add textarea in remote and menu for pasting json blob
Date: Wed, 31 Mar 2021 12:35:40 +0200 [thread overview]
Message-ID: <20210331103540.466071-2-o.bektas@proxmox.com> (raw)
In-Reply-To: <20210331103540.466071-1-o.bektas@proxmox.com>
automatically fill hostname and fingerprint when pasted
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
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
next prev parent reply other threads:[~2021-03-31 10:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-31 10:35 [pbs-devel] [PATCH v4 backup 1/2] ui: add 'join info' copy/paste button on datastore summary Oguz Bektas
2021-03-31 10:35 ` Oguz Bektas [this message]
2021-03-31 10:51 ` Dylan Whyte
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=20210331103540.466071-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.