[pve-devel] applied: [PATCH v3 manager 3/3] Code cleanup in Backup

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Aug 14 14:07:50 CEST 2019


Am 8/12/19 um 2:50 PM schrieb Stefan Reiter:
> Whitespace removal and consolidating VZDump's job id format into a
> local variable.
> 
> Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
> ---
>  PVE/API2/Backup.pm        | 25 +++++++++----------------
>  www/manager6/dc/Backup.js | 10 +++++-----
>  2 files changed, 14 insertions(+), 21 deletions(-)
> 

applied, but please separate also cleanups. The backend and frontend
cleanup has nothing to do with each other (i.e., they do not cleanup
the same thing, one is code reduction by factoring out a common param
definition, the other is just indentation fixup). Also, while WebUI
and api are (for now still) in the same repo, they should be seen as
almost different "projects", this means that most of the time changes
on both should not be made in the same commit - there are naturally
exceptions.

> diff --git a/PVE/API2/Backup.pm b/PVE/API2/Backup.pm
> index ec6b4541..8bf3895f 100644
> --- a/PVE/API2/Backup.pm
> +++ b/PVE/API2/Backup.pm
> @@ -31,6 +31,11 @@ sub verify_day_of_week {
>      die "invalid day '$value'\n";
>  }
>  
> +my $vzdump_job_id_prop = {
> +    type => 'string',
> +    description => "The job ID.",
> +    maxLength => 50
> +};
>  
>  my $dowhash_to_dow = sub {
>      my ($d, $num) = @_;
> @@ -207,7 +212,7 @@ __PACKAGE__->register_method({
>  	items => {
>  	    type => "object",
>  	    properties => {
> -		id => { type => 'string' },
> +		id => $vzdump_job_id_prop
>  	    },
>  	},
>  	links => [ { rel => 'child', href => "{id}" } ],
> @@ -304,11 +309,7 @@ __PACKAGE__->register_method({
>      parameters => {
>      	additionalProperties => 0,
>  	properties => {
> -	    id => {
> -		type => 'string',
> -		description => "The job ID.",
> -		maxLength => 50,
> -	    }
> +	    id => $vzdump_job_id_prop
>  	},
>      },
>      returns => {
> @@ -344,11 +345,7 @@ __PACKAGE__->register_method({
>      parameters => {
>      	additionalProperties => 0,
>  	properties => {
> -	    id => {
> -		type => 'string',
> -		description => "The job ID.",
> -		maxLength => 50,
> -	    },
> +	    id => $vzdump_job_id_prop
>  	},
>      },
>      returns => { type => 'null' },
> @@ -397,11 +394,7 @@ __PACKAGE__->register_method({
>      parameters => {
>      	additionalProperties => 0,
>  	properties => PVE::VZDump::json_config_properties({
> -	    id => {
> -		type => 'string',
> -		description => "The job ID.",
> -		maxLength => 50,
> -	    },
> +	    id => $vzdump_job_id_prop,
>  	    starttime => {
>  		type => 'string',
>  		description => "Job Start time.",
> diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
> index f644e364..9da93d9c 100644
> --- a/www/manager6/dc/Backup.js
> +++ b/www/manager6/dc/Backup.js
> @@ -412,11 +412,11 @@ Ext.define('PVE.dc.BackupView', {
>  		return;
>  	    }
>  
> -            var win = Ext.create('PVE.dc.BackupEdit',{
> -                jobid: rec.data.id
> -            });
> -            win.on('destroy', reload);
> -            win.show();
> +	    var win = Ext.create('PVE.dc.BackupEdit', {
> +		jobid: rec.data.id
> +	    });
> +	    win.on('destroy', reload);
> +	    win.show();
>  	};
>  
>  	var run_backup_now = function(job) {
> 




More information about the pve-devel mailing list