mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Add support for selecting a schema in the backup database dialog with no tables, mviews, views or foreign tables. #7053
Fixed a UI border issue on the dependencies tab for columns with icon. #7055
This commit is contained in:
parent
701085adaf
commit
ad0567bd85
@ -198,7 +198,7 @@ function CollectionArrow({ node, tree, selectedNodeIds }) {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<span onClick={toggleNode} >
|
<span onClick={toggleNode} >
|
||||||
{node.isInternal ? <ToggleArrowIcon node={node} /> : null}
|
{node.isInternal && node?.children.length > 0 ? <ToggleArrowIcon node={node} /> : null}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
cellIcon: {
|
cellIcon: {
|
||||||
paddingLeft: '1.8em',
|
paddingLeft: '1.8em',
|
||||||
paddingTop: '0.35em',
|
paddingTop: '0.35em',
|
||||||
height: 35,
|
borderRadius: 0,
|
||||||
backgroundPosition: '1%',
|
backgroundPosition: '1%',
|
||||||
},
|
},
|
||||||
emptyPanel: {
|
emptyPanel: {
|
||||||
|
@ -580,8 +580,9 @@ def objects(sid, did, scid=None):
|
|||||||
server_info['template_path'] = 'grant_wizard/ppas/#{0}#'.format(
|
server_info['template_path'] = 'grant_wizard/ppas/#{0}#'.format(
|
||||||
server_info['version'])
|
server_info['version'])
|
||||||
|
|
||||||
res, msg = get_data(sid, did, scid, 'schema' if scid else 'database',
|
res, msg, empty_schema_list = get_data(sid, did, scid,
|
||||||
server_info)
|
'schema' if scid else 'database',
|
||||||
|
server_info, True)
|
||||||
|
|
||||||
tree_data = {
|
tree_data = {
|
||||||
'table': [],
|
'table': [],
|
||||||
@ -643,6 +644,14 @@ def objects(sid, did, scid=None):
|
|||||||
|
|
||||||
ch['children'] = children
|
ch['children'] = children
|
||||||
|
|
||||||
|
for empty_schema in empty_schema_list:
|
||||||
|
schema_group.append({
|
||||||
|
'id': empty_schema,
|
||||||
|
'name': empty_schema,
|
||||||
|
'icon': 'icon-schema',
|
||||||
|
'children': [],
|
||||||
|
'is_schema': True,
|
||||||
|
})
|
||||||
return make_json_response(
|
return make_json_response(
|
||||||
data=schema_group,
|
data=schema_group,
|
||||||
success=200
|
success=200
|
||||||
|
@ -274,7 +274,8 @@ def properties(sid, did, node_id, node_type):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_data(sid, did, node_id, node_type, server_data):
|
def get_data(sid, did, node_id, node_type, server_data,
|
||||||
|
return_emtpy_schema=False):
|
||||||
get_schema_sql_url = '/sql/get_schemas.sql'
|
get_schema_sql_url = '/sql/get_schemas.sql'
|
||||||
|
|
||||||
# unquote encoded url parameter
|
# unquote encoded url parameter
|
||||||
@ -306,46 +307,80 @@ def get_data(sid, did, node_id, node_type, server_data):
|
|||||||
if len(res) > 0:
|
if len(res) > 0:
|
||||||
res_data.extend(res['rows'])
|
res_data.extend(res['rows'])
|
||||||
|
|
||||||
|
empty_schema_list = []
|
||||||
for row in node_types:
|
for row in node_types:
|
||||||
|
is_empty_schema = True
|
||||||
if 'oid' in row:
|
if 'oid' in row:
|
||||||
node_id = row['oid']
|
node_id = row['oid']
|
||||||
|
|
||||||
if ntype == 'schema':
|
if ntype == 'schema':
|
||||||
status, res = _get_rows_for_type(
|
status, res = _get_rows_for_type(
|
||||||
conn, 'function', server_prop, node_id)
|
conn, 'function', server_prop, node_id)
|
||||||
|
|
||||||
_append_rows(status, res, 'function')
|
_append_rows(status, res, 'function')
|
||||||
|
|
||||||
status, res = _get_rows_for_type(
|
status, res = _get_rows_for_type(
|
||||||
conn, 'procedure', server_prop, node_id)
|
conn, 'procedure', server_prop, node_id)
|
||||||
|
|
||||||
_append_rows(status, res, 'procedure')
|
_append_rows(status, res, 'procedure')
|
||||||
|
|
||||||
status, res = _get_rows_for_type(
|
status, res = _get_rows_for_type(
|
||||||
conn, 'trigger_function', server_prop, node_id)
|
conn, 'trigger_function', server_prop, node_id)
|
||||||
|
|
||||||
_append_rows(status, res, 'trigger function')
|
_append_rows(status, res, 'trigger function')
|
||||||
|
|
||||||
status, res = _get_rows_for_type(
|
status, res = _get_rows_for_type(
|
||||||
conn, 'sequence', server_prop, node_id)
|
conn, 'sequence', server_prop, node_id)
|
||||||
|
|
||||||
|
if len(res['rows']):
|
||||||
|
is_empty_schema = False
|
||||||
|
|
||||||
_append_rows(status, res, 'sequence')
|
_append_rows(status, res, 'sequence')
|
||||||
|
|
||||||
status, res = _get_rows_for_type(
|
status, res = _get_rows_for_type(
|
||||||
conn, 'table', server_prop, node_id)
|
conn, 'table', server_prop, node_id)
|
||||||
|
|
||||||
|
if len(res['rows']):
|
||||||
|
is_empty_schema = False
|
||||||
|
|
||||||
_append_rows(status, res, 'table')
|
_append_rows(status, res, 'table')
|
||||||
|
|
||||||
status, res = _get_rows_for_type(
|
status, res = _get_rows_for_type(
|
||||||
conn, 'view', server_prop, node_id)
|
conn, 'view', server_prop, node_id)
|
||||||
|
|
||||||
|
if len(res['rows']):
|
||||||
|
is_empty_schema = False
|
||||||
|
|
||||||
_append_rows(status, res, 'view')
|
_append_rows(status, res, 'view')
|
||||||
|
|
||||||
status, res = _get_rows_for_type(
|
status, res = _get_rows_for_type(
|
||||||
conn, 'mview', server_prop, node_id)
|
conn, 'mview', server_prop, node_id)
|
||||||
|
|
||||||
|
if len(res['rows']):
|
||||||
|
is_empty_schema = False
|
||||||
|
|
||||||
_append_rows(status, res, 'materialized view')
|
_append_rows(status, res, 'materialized view')
|
||||||
|
|
||||||
status, res = _get_rows_for_type(
|
status, res = _get_rows_for_type(
|
||||||
conn, 'foreign_table', server_prop, node_id)
|
conn, 'foreign_table', server_prop, node_id)
|
||||||
|
|
||||||
|
if len(res['rows']):
|
||||||
|
is_empty_schema = False
|
||||||
|
|
||||||
_append_rows(status, res, 'foreign table')
|
_append_rows(status, res, 'foreign table')
|
||||||
|
|
||||||
status, res = _get_rows_for_type(
|
status, res = _get_rows_for_type(
|
||||||
conn, 'package', server_prop, node_id)
|
conn, 'package', server_prop, node_id)
|
||||||
|
|
||||||
|
if (type(res) is list and len(res) > 0) or (
|
||||||
|
'rows' in res and len(res['rows']) > 0):
|
||||||
|
is_empty_schema = False
|
||||||
|
|
||||||
_append_rows(status, res, 'package')
|
_append_rows(status, res, 'package')
|
||||||
|
|
||||||
|
if is_empty_schema and row['name'] not in empty_schema_list:
|
||||||
|
empty_schema_list.append(row['name'])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
status, res = _get_rows_for_type(conn, ntype, server_prop, node_id)
|
status, res = _get_rows_for_type(conn, ntype, server_prop, node_id)
|
||||||
_append_rows(status, res, 'function')
|
_append_rows(status, res, 'function')
|
||||||
@ -355,6 +390,9 @@ def get_data(sid, did, node_id, node_type, server_data):
|
|||||||
msg = gettext('Unable to fetch the {} objects'.format(
|
msg = gettext('Unable to fetch the {} objects'.format(
|
||||||
", ".join(failed_objects))
|
", ".join(failed_objects))
|
||||||
)
|
)
|
||||||
|
if return_emtpy_schema:
|
||||||
|
return res_data, msg, empty_schema_list
|
||||||
|
|
||||||
return res_data, msg
|
return res_data, msg
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user