mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Properly support backups in Directory format. Fixes #3309
This commit is contained in:
committed by
Dave Page
parent
c85ced4c6b
commit
fb1ef9ac0b
@@ -168,7 +168,7 @@ def filename_with_file_manager_path(_file):
|
||||
elif not os.path.isabs(_file):
|
||||
_file = os.path.join(document_dir(), _file)
|
||||
|
||||
if not os.path.isfile(_file):
|
||||
if not os.path.isfile(_file) and not os.path.exists(_file):
|
||||
return None
|
||||
|
||||
return fs_short_path(_file)
|
||||
|
||||
@@ -112,9 +112,23 @@ commonUtils, menuUtils, supportedNodes, restoreDialog
|
||||
label: gettext('Filename'),
|
||||
type: 'text',
|
||||
disabled: false,
|
||||
control: Backform.FileControl,
|
||||
control: Backform.FileControl.extend({
|
||||
render: function() {
|
||||
var attributes = this.model.toJSON();
|
||||
if (attributes.format == 'directory') {
|
||||
this.field.attributes.dialog_type = 'select_folder';
|
||||
}
|
||||
else {
|
||||
this.field.attributes.dialog_type = 'select_file';
|
||||
}
|
||||
|
||||
Backform.InputControl.prototype.render.apply(this, arguments);
|
||||
return this;
|
||||
},
|
||||
}),
|
||||
dialog_type: 'select_file',
|
||||
supp_types: ['*', 'backup', 'sql', 'patch'],
|
||||
deps: ['format'],
|
||||
}, {
|
||||
id: 'no_of_jobs',
|
||||
label: gettext('Number of jobs'),
|
||||
|
||||
@@ -51,6 +51,32 @@ class RestoreCreateJobTest(BaseTestGenerator):
|
||||
not_expected_cmd_opts=[],
|
||||
expected_exit_code=[0, None]
|
||||
)),
|
||||
('When restore object with format directory',
|
||||
dict(
|
||||
class_params=dict(
|
||||
sid=1,
|
||||
name='test_restore_server',
|
||||
port=5444,
|
||||
host='localhost',
|
||||
database='postgres',
|
||||
bfile='test_restore',
|
||||
username='postgres'
|
||||
),
|
||||
params=dict(
|
||||
file='test_restore_file',
|
||||
format='directory',
|
||||
custom=False,
|
||||
verbose=True,
|
||||
blobs=False,
|
||||
schemas=[],
|
||||
tables=[],
|
||||
database='postgres'
|
||||
),
|
||||
url='/restore/job/{0}',
|
||||
expected_cmd_opts=['--verbose', '--format=d'],
|
||||
not_expected_cmd_opts=[],
|
||||
expected_exit_code=[0, None]
|
||||
)),
|
||||
('When restore object with the sections options',
|
||||
dict(
|
||||
class_params=dict(
|
||||
|
||||
Reference in New Issue
Block a user