From: Oguz Bektas <o.bektas@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v3 backup 2/2] ui: add textarea in remote -> add menu for pasting json blob
Date: Thu, 5 Nov 2020 18:48:18 +0100 [thread overview]
Message-ID: <20201105174818.1116016-2-o.bektas@proxmox.com> (raw)
In-Reply-To: <20201105174818.1116016-1-o.bektas@proxmox.com>
automatically fills the ip and fingerprint.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
www/window/RemoteEdit.js | 60 +++++++++++++++++++++++++++++++++++++---
1 file changed, 56 insertions(+), 4 deletions(-)
diff --git a/www/window/RemoteEdit.js b/www/window/RemoteEdit.js
index 56a248e0..757ea73e 100644
--- a/www/window/RemoteEdit.js
+++ b/www/window/RemoteEdit.js
@@ -5,6 +5,44 @@ Ext.define('PBS.window.RemoteEdit', {
onlineHelp: 'backup_remote',
+ 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);
+ console.log(jsons);
+ let joinInfo = Ext.JSON.decode(jsons, true);
+ console.log(joinInfo);
+
+ let info = {
+ ipAddress: joinInfo.ipAddress,
+ fingerprint: joinInfo.fingerprint,
+ datastore: joinInfo.datastore,
+ };
+ console.log(info);
+
+ vm.set('info', info);
+ console.log(vm);
+ },
+ },
+
+
userid: undefined,
isAdd: true,
@@ -28,7 +66,7 @@ Ext.define('PBS.window.RemoteEdit', {
};
},
- items: {
+ items: [{
xtype: 'inputpanel',
column1: [
{
@@ -49,6 +87,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;
@@ -88,7 +129,6 @@ Ext.define('PBS.window.RemoteEdit', {
name: 'port',
},
],
-
column2: [
{
xtype: 'proxmoxtextfield',
@@ -107,7 +147,6 @@ Ext.define('PBS.window.RemoteEdit', {
},
},
],
-
columnB: [
{
xtype: 'proxmoxtextfield',
@@ -116,6 +155,10 @@ Ext.define('PBS.window.RemoteEdit', {
deleteEmpty: '{!isCreate}',
},
fieldLabel: gettext('Fingerprint'),
+ bind: {
+ value: '{info.fingerprint}',
+ },
+
},
{
xtype: 'proxmoxtextfield',
@@ -126,7 +169,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:[~2020-11-05 17:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 17:48 [pbs-devel] [PATCH v2 backup 1/2] ui: add 'join info' copy/paste button on datastore summary Oguz Bektas
2020-11-05 17:48 ` Oguz Bektas [this message]
2020-11-05 17:49 ` [pbs-devel] [PATCH v3 backup 2/2] ui: add textarea in remote -> add menu for pasting json blob Oguz Bektas
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=20201105174818.1116016-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox