[pbs-devel] [pve-devel] [PATCH proxmox-backup 5/5] ui: added possiblity to remove directories/mount-units in the WebUI

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Aug 18 19:50:09 CEST 2020


Can I re-add the same one after wards?

On 18.08.20 10:40, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> ---
>  www/DirectoryList.js | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/www/DirectoryList.js b/www/DirectoryList.js
> index 00531fd0..b4313e49 100644
> --- a/www/DirectoryList.js
> +++ b/www/DirectoryList.js
> @@ -20,6 +20,21 @@ Ext.define('PBS.admin.Directorylist', {
>  		},
>  	    }).show();
>  	},
> +    removeDir: function () {
> +        let me = this;
> +        let view = me.getView();
> +        let rec = view.getSelection();

could do
let rec = me.getView().getSelection();
let id = rec[0].data.id;

to avoid a only once used variable (they often can be OK, but here it adds
no value when reading it) and instead avoid doing two 'rec[0].data.id' uses
below.

> +        Ext.create('Proxmox.window.SafeRemove', {
> +            url: `/nodes/localhost/disks/directory/${rec[0].data.id}`,
> +            item: {type: 'Dir', id: rec[0].data.id},

please try to have new additions eslint compatible, i.e., 

item: {
    type: 'Dir',
    id: id,
},

> +            note: gettext('Data and partitions on the disk will be left untouched.'),

did you checked available gettext translations for something which could be used
here, to avoid a new translation? I'm fine with new ones, but only if there's really
nothing which could be used.

> +            listeners: {
> +                destroy: function () {
> +                    me.reload();
> +                },

nit: could use arrow function:

destroy: () => me.reload(),

> +            },
> +        }).show();
> +    },
>  
>  	reload: function() {
>  	    let me = this;
> @@ -49,6 +64,13 @@ Ext.define('PBS.admin.Directorylist', {
>  	    text: gettext('Create') + ': Directory',
>  	    handler: 'createDirectory',
>  	},
> +	{
> +		xtype: 'proxmoxButton',
> +		text: gettext('Remove'),
> +		handler: 'removeDir',
> +		disabled: true,
> +		iconCls: 'fa fa-trash-o'
> +	}
>      ],
>  
>      columns: [
> 






More information about the pbs-devel mailing list