Fixed the UI related issues reported during testing for Shared Storage in Server Mode. #5014

This commit is contained in:
Nikhil Mohite
2023-03-24 11:08:27 +05:30
committed by GitHub
parent 8b815d4aac
commit e4eeba2aa7
10 changed files with 53 additions and 23 deletions

View File

@@ -17,7 +17,7 @@ from threading import Lock
import json
from config import PG_DEFAULT_DRIVER, ON_DEMAND_RECORD_COUNT,\
ALLOW_SAVE_PASSWORD
ALLOW_SAVE_PASSWORD, SHARED_STORAGE
from werkzeug.user_agent import UserAgent
from flask import Response, url_for, render_template, session, current_app
from flask import request
@@ -52,7 +52,7 @@ from pgadmin.tools.sqleditor.utils.macros import get_macros,\
get_user_macros, set_macros
from pgadmin.utils.constants import MIMETYPE_APP_JS, \
SERVER_CONNECTION_CLOSED, ERROR_MSG_TRANS_ID_NOT_FOUND, \
ERROR_FETCHING_DATA, MY_STORAGE
ERROR_FETCHING_DATA, MY_STORAGE, ACCESS_DENIED_MESSAGE
from pgadmin.model import Server, ServerGroup
from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
from pgadmin.settings import get_setting
@@ -1856,6 +1856,18 @@ def save_file():
last_storage = Preferences.module('file_manager').preference(
'last_storage').get()
if last_storage != MY_STORAGE:
selectedDirList = [sdir for sdir in SHARED_STORAGE if
sdir['name'] == last_storage]
selectedDir = selectedDirList[0] if len(
selectedDirList) == 1 else None
if selectedDir:
if selectedDir['restricted_access'] and \
not current_user.has_role("Administrator"):
return make_json_response(success=0,
errormsg=ACCESS_DENIED_MESSAGE,
info='ACCESS_DENIED',
status=403)
storage_manager_path = get_storage_directory(
shared_storage=last_storage)
else:

View File

@@ -422,7 +422,9 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
}).catch((err)=>{
eventBus.fireEvent(QUERY_TOOL_EVENTS.HANDLE_API_ERROR, err);
});
} else {
} else if(error.response?.status == 403 && error.response?.data.info == 'ACCESS_DENIED') {
Notifier.error(error.response.data.errormsg);
}else {
let msg = parseApiError(error);
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, msg, true);
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.FOCUS_PANEL, PANELS.MESSAGES);