mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added search object functionality. Fixes #2172
This commit is contained in:
committed by
Akshay Joshi
parent
f77aa3284f
commit
e1f990190e
@@ -24,7 +24,7 @@ define('pgadmin.node.extension', [
|
||||
pgAdmin.Browser.Nodes['coll-extension'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
node: 'extension',
|
||||
label: gettext('Extension'),
|
||||
label: gettext('Extensions'),
|
||||
type: 'coll-extension',
|
||||
columns: ['name', 'owner', 'comment'],
|
||||
});
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
SELECT
|
||||
nsp.oid, nspname AS name
|
||||
FROM
|
||||
pg_namespace nsp
|
||||
WHERE nspparent = {{scid}}::oid
|
||||
{% if pkgid %}
|
||||
AND nsp.oid = {{pkgid}}::oid
|
||||
{% endif %}
|
||||
AND nspobjecttype = 0
|
||||
AND nspcompoundtrigger = false
|
||||
ORDER BY nspname;
|
||||
@@ -54,8 +54,8 @@ class IndexConstraintModule(ConstraintTypeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'Index constraint'
|
||||
COLLECTION_LABEL = _('index_constraint')
|
||||
NODE_TYPE = 'index_constraint'
|
||||
COLLECTION_LABEL = _('Index constraint')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -29,8 +29,11 @@ from pgadmin.tools.schema_diff.compare import SchemaDiffObjectCompare
|
||||
|
||||
|
||||
def backend_supported(module, manager, **kwargs):
|
||||
if 'tid' in kwargs and CollectionNodeModule.BackendSupported(
|
||||
module, manager, **kwargs):
|
||||
|
||||
if CollectionNodeModule.BackendSupported(module, manager, **kwargs):
|
||||
if 'tid' not in kwargs:
|
||||
return True
|
||||
|
||||
conn = manager.connection(did=kwargs['did'])
|
||||
|
||||
template_path = 'partitions/sql/{0}/#{0}#{1}#'.format(
|
||||
|
||||
@@ -21,19 +21,19 @@ else:
|
||||
|
||||
class TestBackendSupport(BaseTestGenerator):
|
||||
scenarios = [
|
||||
('when tid is not present in arguments, should return None and no '
|
||||
'query should be done',
|
||||
('when tid is not present in arguments, but server version'
|
||||
'is supported then return True',
|
||||
dict(
|
||||
manager=dict(
|
||||
server_type="",
|
||||
version=""
|
||||
server_type="pg",
|
||||
version="100000"
|
||||
),
|
||||
input_arguments=dict(did=432),
|
||||
|
||||
collection_node_active=True,
|
||||
connection_execution_return_value=[],
|
||||
|
||||
expected_return_value=None,
|
||||
expected_return_value=True,
|
||||
expect_error_response=False,
|
||||
expected_number_calls_on_render_template=0
|
||||
)),
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
(SELECT 1 FROM pg_class WHERE relname = 'tables' AND
|
||||
relnamespace = {{ tbl }}.oid LIMIT 1))
|
||||
{%- endmacro %}
|
||||
{% macro IS_CATALOG_SCHEMA(schema_col_name) -%}
|
||||
{{ schema_col_name }} IN ('pg_catalog', 'pgagent', 'information_schema')
|
||||
{%- endmacro %}
|
||||
{% macro LABELS(tbl, _) -%}
|
||||
CASE {{ tbl }}.nspname
|
||||
WHEN 'pg_catalog' THEN '{{ _( 'PostgreSQL Catalog' ) }} (pg_catalog)'
|
||||
@@ -17,9 +20,24 @@
|
||||
ELSE {{ tbl }}.nspname
|
||||
END AS name
|
||||
{%- endmacro %}
|
||||
{% macro LABELS_SCHEMACOL(schema_col_name, _) -%}
|
||||
CASE {{ schema_col_name }}
|
||||
WHEN 'pg_catalog' THEN '{{ _( 'PostgreSQL Catalog' ) }} (pg_catalog)'
|
||||
WHEN 'pgagent' THEN '{{ _( 'pgAgent Job Scheduler' ) }} (pgagent)'
|
||||
WHEN 'information_schema' THEN '{{ _( 'ANSI' ) }} (information_schema)'
|
||||
ELSE {{ schema_col_name }}
|
||||
END
|
||||
{%- endmacro %}
|
||||
{% macro DB_SUPPORT(tbl) -%}
|
||||
CASE
|
||||
WHEN {{ tbl }}.nspname = ANY('{information_schema}')
|
||||
THEN false
|
||||
ELSE true END
|
||||
{%- endmacro %}
|
||||
{% macro DB_SUPPORT_SCHEMACOL(schema_col_name) -%}
|
||||
CASE
|
||||
WHEN {{ schema_col_name }} = ANY('{information_schema}')
|
||||
THEN false
|
||||
ELSE true END
|
||||
{%- endmacro %}
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
(SELECT 1 FROM pg_proc
|
||||
WHERE pronamespace = {{ tbl }}.oid and proname = 'run_job' LIMIT 1))
|
||||
{%- endmacro %}
|
||||
{% macro IS_CATALOG_SCHEMA(schema_col_name) -%}
|
||||
{{ schema_col_name }} IN ('pg_catalog', 'pgagent', 'information_schema', 'dbo', 'sys', 'dbms_job_procedure')
|
||||
{%- endmacro %}
|
||||
{% macro LABELS(tbl, _) -%}
|
||||
CASE {{ tbl }}.nspname
|
||||
WHEN 'pg_catalog' THEN '{{ _( 'PostgreSQL Catalog' ) }} (pg_catalog)'
|
||||
@@ -23,9 +26,25 @@
|
||||
ELSE {{ tbl }}.nspname
|
||||
END AS name
|
||||
{%- endmacro %}
|
||||
{% macro DB_SUPPORT(tbl) -%}
|
||||
{% macro LABELS_SCHEMACOL(schema_col_name, _) -%}
|
||||
CASE {{ schema_col_name }}
|
||||
WHEN 'pg_catalog' THEN '{{ _( 'PostgreSQL Catalog' ) }} (pg_catalog)'
|
||||
WHEN 'pgagent' THEN '{{ _( 'pgAgent Job Scheduler' ) }} (pgagent)'
|
||||
WHEN 'information_schema' THEN '{{ _( 'ANSI' ) }} (information_schema)'
|
||||
WHEN 'dbo' THEN 'Redmond (dbo)'
|
||||
WHEN 'sys' THEN 'Redwood (sys)'
|
||||
ELSE {{ schema_col_name }}
|
||||
END
|
||||
{%- endmacro %}
|
||||
{% macro DB_SUPPORT(tbl, schema_col_name) -%}
|
||||
CASE
|
||||
WHEN {{ tbl }}.nspname = ANY('{information_schema,sys,dbo}')
|
||||
THEN false
|
||||
ELSE true END
|
||||
{%- endmacro %}
|
||||
{% macro DB_SUPPORT_SCHEMACOL(schema_col_name) -%}
|
||||
CASE
|
||||
WHEN {{ schema_col_name }} = ANY('{information_schema,sys,dbo}')
|
||||
THEN false
|
||||
ELSE true END
|
||||
{%- endmacro %}
|
||||
|
||||
@@ -18,6 +18,7 @@ define('pgadmin.node.role', [
|
||||
pgAdmin.Browser.Nodes['coll-role'] =
|
||||
pgAdmin.Browser.Collection.extend({
|
||||
node: 'role',
|
||||
label: gettext('Login/Group Roles'),
|
||||
type: 'coll-role',
|
||||
columns: [
|
||||
'rolname', 'rolvaliduntil', 'rolconnlimit', 'rolcanlogin',
|
||||
|
||||
Reference in New Issue
Block a user