From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id DE599B3D0A for ; Wed, 29 Nov 2023 15:14:43 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BA31A8ADB for ; Wed, 29 Nov 2023 15:14:13 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 29 Nov 2023 15:14:13 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id BC39440C59 for ; Wed, 29 Nov 2023 15:14:12 +0100 (CET) Date: Wed, 29 Nov 2023 15:14:05 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20231129110309.2524356-1-d.csapak@proxmox.com> In-Reply-To: <20231129110309.2524356-1-d.csapak@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1701267042.b4cj1tj788.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.064 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/2] ui: add 'show repository Information' button for datastores X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2023 14:14:43 -0000 On November 29, 2023 12:03 pm, Dominik Csapak wrote: > this has a similar functionality as the 'show fingerprint' button, > but for repository strings that are needed e.g. for the cli >=20 > included with and without the current user for convenience >=20 > Signed-off-by: Dominik Csapak for both patches: Tested-by: Fabian Gr=C3=BCnbichler works as expected - I am not 100% sure whether the "Repository" naming is confusing or not for the intended audience, maybe at least the button could be titled "Show Client Information" or something in that direction? some other nits for follow-ups/folding in: - a short note in the relevant docs part "Backup Repository Locations" - a help button linking to that docs part ;) - a bit of space between the text field and copy button - "*W*ith current User" instead of "with current User" might look nicer > --- > www/Makefile | 1 + > www/Utils.js | 8 +++ > www/datastore/DataStoreListSummary.js | 15 +++++ > www/datastore/Panel.js | 17 ++++- > www/window/DatastoreRepoInfo.js | 97 +++++++++++++++++++++++++++ > 5 files changed, 137 insertions(+), 1 deletion(-) > create mode 100644 www/window/DatastoreRepoInfo.js >=20 > diff --git a/www/Makefile b/www/Makefile > index 04c12b31..be7e27ab 100644 > --- a/www/Makefile > +++ b/www/Makefile > @@ -86,6 +86,7 @@ JSSRC=3D \ > window/VerifyAll.js \ > window/ZFSCreate.js \ > window/InfluxDbEdit.js \ > + window/DatastoreRepoInfo.js \ > dashboard/DataStoreStatistics.js \ > dashboard/LongestTasks.js \ > dashboard/RunningTasks.js \ > diff --git a/www/Utils.js b/www/Utils.js > index 7592d1bd..439aadb1 100644 > --- a/www/Utils.js > +++ b/www/Utils.js > @@ -752,4 +752,12 @@ Ext.define('PBS.Utils', { > return options.join(', '); > }, > =20 > + copyInputContent: function(inputId) { > + let el =3D document.getElementById(inputId); > + if (!el) { > + return; > + } > + el.select(); > + document.execCommand("copy"); > + }, > }); > diff --git a/www/datastore/DataStoreListSummary.js b/www/datastore/DataSt= oreListSummary.js > index 968239b0..ae503496 100644 > --- a/www/datastore/DataStoreListSummary.js > +++ b/www/datastore/DataStoreListSummary.js > @@ -89,6 +89,21 @@ Ext.define('PBS.datastore.DataStoreListSummary', { > me.lookup('historychart').setData(data); > }, > =20 > + tools: [ > + { > + xtype: 'button', > + text: gettext('Show Repository Information'), > + handler: function() { > + let me =3D this; > + let datastore =3D me.up('panel').datastore; > + Ext.create('PBS.window.DatastoreRepoInfo', { > + datastore, > + autoShow: true, > + }); > + }, > + }, > + ], > + > items: [ > { > xtype: 'container', > diff --git a/www/datastore/Panel.js b/www/datastore/Panel.js > index fd1b4611..248460d8 100644 > --- a/www/datastore/Panel.js > +++ b/www/datastore/Panel.js > @@ -37,7 +37,22 @@ Ext.define('PBS.DataStorePanel', { > border: false, > }, > =20 > - tools: [PBS.Utils.get_help_tool("datastore_intro")], > + tools: [ > + PBS.Utils.get_help_tool("datastore_intro"), > + { > + xtype: 'button', > + margin: '0 0 0 10', > + text: gettext('Show Repository Information'), > + handler: function() { > + let me =3D this; > + let datastore =3D me.up('panel').datastore; > + Ext.create('PBS.window.DatastoreRepoInfo', { > + datastore, > + autoShow: true, > + }); > + }, > + }, > + ], > =20 > items: [ > { > diff --git a/www/window/DatastoreRepoInfo.js b/www/window/DatastoreRepoIn= fo.js > new file mode 100644 > index 00000000..9d2df9aa > --- /dev/null > +++ b/www/window/DatastoreRepoInfo.js > @@ -0,0 +1,97 @@ > +Ext.define('PBS.window.DatastoreRepoInfo', { > + extend: 'Ext.window.Window', > + alias: 'widget.pbsDatastoreRepoInfo', > + mixins: ['Proxmox.Mixin.CBind'], > + > + title: gettext('Repository Information'), > + > + modal: true, > + resizable: false, > + width: 600, > + layout: 'anchor', > + bodyPadding: 10, > + > + cbindData: function() { > + let me =3D this; > + let host =3D window.location.hostname; > + if (window.location.port.toString() !=3D=3D "8007") { > + host +=3D `:${window.location.port}`; > + } > + let datastore =3D me.datastore; > + let user =3D Proxmox.UserName; > + let repository =3D `${host}:${datastore}`; > + let repositoryWithUser =3D `${user}@${host}:${datastore}`; > + > + return { > + datastore, > + repository, > + repositoryWithUser, > + }; > + }, > + > + defaults: { > + xtype: 'fieldcontainer', > + layout: 'hbox', > + labelWidth: 120, > + }, > + > + items: [ > + { > + xtype: 'displayfield', > + fieldLabel: gettext('Datastore'), > + cbind: { > + value: '{datastore}', > + }, > + }, > + { > + fieldLabel: gettext('Repository'), > + cbind: {}, > + items: [ > + { > + xtype: 'textfield', > + inputId: 'repository', > + flex: 1, > + editable: false, > + cbind: { > + value: '{repository}', > + }, > + }, > + { > + xtype: 'button', > + iconCls: 'fa fa-clipboard', > + handler: () =3D> PBS.Utils.copyInputContent('repository'), > + text: gettext('Copy'), > + }, > + ], > + }, > + { > + fieldLabel: gettext('with current User'), > + cbind: {}, > + items: [ > + { > + xtype: 'textfield', > + inputId: 'repositoryWithUser', > + flex: 1, > + editable: false, > + cbind: { > + value: '{repositoryWithUser}', > + }, > + }, > + { > + xtype: 'button', > + iconCls: 'fa fa-clipboard', > + handler: () =3D> PBS.Utils.copyInputContent('repositoryWithUser'), > + text: gettext('Copy'), > + }, > + ], > + }, > + ], > + buttons: [ > + { > + text: gettext('Ok'), > + handler: function() { > + this.up('window').close(); > + }, > + }, > + ], > +}); > --=20 > 2.30.2 >=20 >=20 >=20 > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel >=20 >=20 >=20