public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>,
	Gabriel Goller <g.goller@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 2/2] fix #5188: gui: add copy to clipboard on snapshots
Date: Thu, 14 Mar 2024 09:01:23 +0100	[thread overview]
Message-ID: <f463e77b-2285-4037-8567-efac001b33e7@proxmox.com> (raw)
In-Reply-To: <20240313161801.132483-2-g.goller@proxmox.com>

same comment as the previous patch, some note about why async is
ok would be nice

one high level comment:

i'd probably rename the button from 'copy' to something like 'copy name to clipboard'

otherwise it can be confusing as to what the button does, since 'copy' could
also mean duplicate the snapshot ;)

rest of the patch LGTM

On 3/13/24 17:17, Gabriel Goller wrote:
> When navigating to Datastores -> Content, it is now possible to
> right-click on a snapshot/group and copy the name to the clipboard.
> This makes the proxmox-backup-client much easier to use, especially when
> restoring archives.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>   www/datastore/Content.js | 25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
> 
> diff --git a/www/datastore/Content.js b/www/datastore/Content.js
> index fa0b7d2c..b2d6a053 100644
> --- a/www/datastore/Content.js
> +++ b/www/datastore/Content.js
> @@ -546,6 +546,10 @@ Ext.define('PBS.DataStoreContent', {
>   	    });
>   	},
>   
> +	onCopy: async function(view, rI, cI, item, e, { data }) {
> +	    await navigator.clipboard.writeText(data.text);
> +	},
> +
>   	onNotesEdit: function(view, data) {
>   	    let me = this;
>   
> @@ -884,6 +888,7 @@ Ext.define('PBS.DataStoreContent', {
>   	    if (record.data.ty === 'group') {
>   		menu = Ext.create('PBS.datastore.GroupCmdMenu', {
>   		    title: gettext('Group'),
> +		    onCopy: createControllerCallback('onCopy'),
>   		    onVerify: createControllerCallback('onVerify'),
>   		    onChangeOwner: createControllerCallback('onChangeOwner'),
>   		    onPrune: createControllerCallback('onPrune'),
> @@ -892,6 +897,7 @@ Ext.define('PBS.DataStoreContent', {
>   	    } else if (record.data.ty === 'dir') {
>   		menu = Ext.create('PBS.datastore.SnapshotCmdMenu', {
>   		    title: gettext('Snapshot'),
> +		    onCopy: createControllerCallback('onCopy'),
>   		    onVerify: createControllerCallback('onVerify'),
>   		    onProtectionChange: createControllerCallback('onProtectionChange'),
>   		    onForget: createControllerCallback('onForget'),
> @@ -1284,12 +1290,21 @@ Ext.define('PBS.datastore.GroupCmdMenu', {
>       extend: 'Ext.menu.Menu',
>       mixins: ['Proxmox.Mixin.CBind'],
>   
> +    onCopy: undefined,
>       onVerify: undefined,
>       onChangeOwner: undefined,
>       onPrune: undefined,
>       onForget: undefined,
>   
>       items: [
> +	{
> +	    text: gettext('Copy'),
> +	    iconCls: 'fa fa-clipboard',
> +	    handler: function() { this.up('menu').onCopy(); },
> +	    cbind: {
> +		hidden: '{!onCopy}',
> +	    },
> +	},
>   	{
>   	    text: gettext('Verify'),
>   	    iconCls: 'pve-icon-verify-lettering',
> @@ -1330,11 +1345,21 @@ Ext.define('PBS.datastore.SnapshotCmdMenu', {
>       extend: 'Ext.menu.Menu',
>       mixins: ['Proxmox.Mixin.CBind'],
>   
> +    onCopy: undefined,
>       onVerify: undefined,
>       onProtectionChange: undefined,
>       onForget: undefined,
>   
>       items: [
> +	{
> +	    text: gettext('Copy'),
> +	    iconCls: 'fa fa-clipboard',
> +	    handler: function() { this.up('menu').onCopy(); },
> +	    cbind: {
> +		hidden: '{!onCopy}',
> +		disabled: '{!onCopy}',
> +	    },
> +	},
>   	{
>   	    text: gettext('Verify'),
>   	    iconCls: 'pve-icon-verify-lettering',





  reply	other threads:[~2024-03-14  8:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 16:17 [pbs-devel] [PATCH proxmox-backup 1/2] gui: remove document.execCommand calls Gabriel Goller
2024-03-13 16:17 ` [pbs-devel] [PATCH proxmox-backup 2/2] fix #5188: gui: add copy to clipboard on snapshots Gabriel Goller
2024-03-14  8:01   ` Dominik Csapak [this message]
2024-03-14  9:10     ` Gabriel Goller
2024-03-14  7:59 ` [pbs-devel] [PATCH proxmox-backup 1/2] gui: remove document.execCommand calls Dominik Csapak
2024-03-14  9:08   ` Gabriel Goller
2024-03-14  9:13     ` Dominik Csapak
2024-03-14  9:21       ` Gabriel Goller

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=f463e77b-2285-4037-8567-efac001b33e7@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=g.goller@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal