mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1) Port the file/storage manager to React. Fixes #7313
2) Allow users to delete files/folders from the storage manager. Fixes #4607 3) Allow users to search within the file/storage manager. Fixes #7389 4) Fixed an issue where new folders cannot be created in the save dialog. Fixes #7524
This commit is contained in:
committed by
Akshay Joshi
parent
4585597388
commit
4808df5e95
@@ -23,6 +23,7 @@ from pgadmin.utils.menu import MenuItem
|
||||
|
||||
from pgadmin.model import db, Setting
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
from .utils import get_dialog_type, get_file_type_setting
|
||||
|
||||
MODULE_NAME = 'settings'
|
||||
|
||||
@@ -223,38 +224,20 @@ def get_browser_tree_state():
|
||||
mimetype="application/json")
|
||||
|
||||
|
||||
def _get_dialog_type(file_type):
|
||||
"""
|
||||
This function return dialog type
|
||||
:param file_type:
|
||||
:return: dialog type.
|
||||
"""
|
||||
if 'pgerd' in file_type:
|
||||
return 'erd_file_type'
|
||||
elif 'backup' in file_type:
|
||||
return 'backup_file_type'
|
||||
elif 'csv' in file_type and 'txt' in file_type:
|
||||
return 'import_export_file_type'
|
||||
elif 'csv' in file_type and 'txt' not in file_type:
|
||||
return 'storage_manager_file_type'
|
||||
else:
|
||||
return 'sqleditor_file_format'
|
||||
|
||||
|
||||
@blueprint.route("/save_file_format_setting/",
|
||||
endpoint="save_file_format_setting",
|
||||
methods=['POST'])
|
||||
@login_required
|
||||
def save_file_format_setting():
|
||||
"""
|
||||
This function save the selected file format.
|
||||
This function save the selected file format.save_file_format_setting
|
||||
:return: save file format response
|
||||
"""
|
||||
data = request.form if request.form else json.loads(
|
||||
request.data.decode('utf-8'))
|
||||
file_type = _get_dialog_type(data['allowed_file_types'])
|
||||
file_type = get_dialog_type(data['allowed_file_types'])
|
||||
|
||||
store_setting(file_type, data['selectedFormat'])
|
||||
store_setting(file_type, data['last_selected_format'])
|
||||
return make_json_response(success=True,
|
||||
info=data,
|
||||
result=request.form)
|
||||
@@ -276,11 +259,5 @@ def get_file_format_setting():
|
||||
except (ValueError, TypeError, KeyError):
|
||||
data[k] = v
|
||||
|
||||
file_type = _get_dialog_type(list(data.values()))
|
||||
|
||||
data = Setting.query.filter_by(
|
||||
user_id=current_user.id, setting=file_type).first()
|
||||
if data is None:
|
||||
return make_json_response(success=True, info='*')
|
||||
else:
|
||||
return make_json_response(success=True, info=data.value)
|
||||
return make_json_response(success=True,
|
||||
info=get_file_type_setting(list(data.values())))
|
||||
|
||||
Reference in New Issue
Block a user