[pbs-devel] [PATCH v3 backup 2/2] ui: add textarea in remote -> add menu for pasting json blob
Oguz Bektas
o.bektas at proxmox.com
Thu Nov 5 18:48:18 CET 2020
automatically fills the ip and fingerprint.
Signed-off-by: Oguz Bektas <o.bektas at 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
More information about the pbs-devel
mailing list