* [pbs-devel] [PATCH v2 backup 1/2] ui: add 'join info' copy/paste button on datastore summary
@ 2020-11-05 17:48 Oguz Bektas
2020-11-05 17:48 ` [pbs-devel] [PATCH v3 backup 2/2] ui: add textarea in remote -> add menu for pasting json blob Oguz Bektas
0 siblings, 1 reply; 3+ messages in thread
From: Oguz Bektas @ 2020-11-05 17:48 UTC (permalink / raw)
To: pbs-devel
shows information about the datastore:
- datastore name
- hostname
- host x509 fingerprint
and creates the base64-encoded json blob to be pasted into PVE to add
as storage.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
www/DataStoreSummary.js | 35 ++++++++++++++-
www/Makefile | 1 +
www/window/DataStoreJoin.js | 88 +++++++++++++++++++++++++++++++++++++
3 files changed, 123 insertions(+), 1 deletion(-)
create mode 100644 www/window/DataStoreJoin.js
diff --git a/www/DataStoreSummary.js b/www/DataStoreSummary.js
index 4a89460c..53613b8b 100644
--- a/www/DataStoreSummary.js
+++ b/www/DataStoreSummary.js
@@ -211,7 +211,40 @@ Ext.define('PBS.DataStoreSummary', {
padding: 5,
},
- tbar: ['->', { xtype: 'proxmoxRRDTypeSelector' }],
+ tbar: [
+ {
+ xtype: 'button',
+ text: gettext('Show Datastore Information'),
+ handler: function() {
+ let me = this;
+ let panel = me.up('panel');
+ Proxmox.Utils.API2Request({
+ url: '/api2/extjs/nodes/localhost/status',
+ method: 'GET',
+ waitMsgTarget: panel,
+ failure: function(e) {
+ console.log(e);
+ },
+ success: function(response) {
+ let fingerprint = response.result.data.info.fingerprint;
+ let hostname = window.location.hostname;
+ let dsName = panel.datastore;
+ Ext.create('PBS.JoinInfoWindow', {
+ joinInfo: {
+ ipAddress: hostname,
+ fingerprint: fingerprint,
+ dsName: dsName,
+ },
+ }).show();
+ },
+ });
+ },
+ },
+ '->',
+ {
+ xtype: 'proxmoxRRDTypeSelector',
+ },
+ ],
items: [
{
diff --git a/www/Makefile b/www/Makefile
index dc23e602..d088c327 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -23,6 +23,7 @@ JSSRC= \
window/BackupFileDownloader.js \
window/CreateDirectory.js \
window/DataStoreEdit.js \
+ window/DataStoreJoin.js \
window/FileBrowser.js \
window/NotesEdit.js \
window/RemoteEdit.js \
diff --git a/www/window/DataStoreJoin.js b/www/window/DataStoreJoin.js
new file mode 100644
index 00000000..3a1dd87f
--- /dev/null
+++ b/www/window/DataStoreJoin.js
@@ -0,0 +1,88 @@
+Ext.define('PBS.JoinInfoWindow', {
+ extend: 'Ext.window.Window',
+ modal: true,
+ width: 600,
+ title: gettext('Datastore Join Information'),
+ mixins: ['Proxmox.Mixin.CBind'],
+ joinInfo: {
+ ipAddress: undefined,
+ fingerprint: undefined,
+ dsName: undefined,
+ },
+ layout: 'form',
+ bodyPadding: '10 0',
+ items: [
+ {
+ xtype: 'container',
+ layout: 'form',
+ border: false,
+ padding: '0 10 10 10',
+ items: [
+ {
+ xtype: 'textfield',
+ fieldLabel: gettext('x509 Fingerprint'),
+ inputId: 'fingerprintField',
+ cbind: {
+ value: '{joinInfo.fingerprint}',
+ },
+ editable: false,
+ },
+ {
+ xtype: 'textfield',
+ fieldLabel: gettext('Hostname'),
+ editable: true,
+ inputId: 'hostnameField',
+ cbind: {
+ value: '{joinInfo.ipAddress}',
+ },
+ },
+ {
+ xtype: 'textfield',
+ fieldLabel: gettext('Datastore Name'),
+ inputId: 'dsNameField',
+ cbind: {
+ value: '{joinInfo.dsName}',
+ },
+ editable: false,
+ },
+ {
+ xtype: 'textarea',
+ inputId: 'SerializedJoinInfo',
+ fieldLabel: gettext('Join Information'),
+ grow: true,
+ editable: false,
+ cbind: {
+ joinInfo: '{joinInfo}',
+ },
+ listeners: {
+ afterrender: function(field) {
+ var jsons = Ext.JSON.encode(field.joinInfo);
+ var base64s = Ext.util.Base64.encode(jsons);
+ field.setValue(base64s)
+ },
+ },
+ },
+ ],
+ },
+ ],
+ buttons: [
+ {
+ xtype: 'button',
+ iconCls: 'fa fa-clipboard',
+ handler: function(b) {
+ var el = document.getElementById('SerializedJoinInfo');
+ el.select();
+ document.execCommand("copy");
+ },
+ text: gettext('Copy'),
+ },
+ {
+ text: gettext('Ok'),
+ handler: function() {
+ this.up('window').close();
+ },
+ },
+ ],
+});
+
+
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pbs-devel] [PATCH v3 backup 2/2] ui: add textarea in remote -> add menu for pasting json blob
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
2020-11-05 17:49 ` Oguz Bektas
0 siblings, 1 reply; 3+ messages in thread
From: Oguz Bektas @ 2020-11-05 17:48 UTC (permalink / raw)
To: pbs-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pbs-devel] [PATCH v3 backup 2/2] ui: add textarea in remote -> add menu for pasting json blob
2020-11-05 17:48 ` [pbs-devel] [PATCH v3 backup 2/2] ui: add textarea in remote -> add menu for pasting json blob Oguz Bektas
@ 2020-11-05 17:49 ` Oguz Bektas
0 siblings, 0 replies; 3+ messages in thread
From: Oguz Bektas @ 2020-11-05 17:49 UTC (permalink / raw)
To: pbs-devel
is also a v2, not v3 as it says in the subject.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-05 17:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [pbs-devel] [PATCH v3 backup 2/2] ui: add textarea in remote -> add menu for pasting json blob Oguz Bektas
2020-11-05 17:49 ` Oguz Bektas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox