1) Make folder name pluralise inside 'templates' folder and fix naming inconsistency.

2) Remove unwanted functions "module_js()" from the code.
3) Change naming convention for 'Roles' module.
This commit is contained in:
Akshay Joshi 2019-05-15 15:09:08 +05:30
parent 3364350b01
commit b7121bb2d2
744 changed files with 113 additions and 1180 deletions

View File

@ -208,7 +208,7 @@ class CastView(PGChildNodeView):
).connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
# Set template path for the SQL scripts
self.template_path = 'cast/sql/#{0}#'.format(self.manager.version)
self.template_path = 'casts/sql/#{0}#'.format(self.manager.version)
return f(*args, **kwargs)

View File

@ -116,10 +116,6 @@ class ForeignServerView(PGChildNodeView):
* __init__(**kwargs)
- Method is used to initialize the ForeignServerView and it's base view.
* module_js()
- This property defines (if javascript) exists for this node.
Override this property for your own logic
* check_precondition()
- This function will behave as a decorator which will checks
database connection before running view, it will also attaches
@ -192,23 +188,9 @@ class ForeignServerView(PGChildNodeView):
'msql': [{'get': 'msql'}, {'get': 'msql'}],
'stats': [{'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}]
'dependent': [{'get': 'dependents'}]
})
def module_js(self):
"""
This property defines (if javascript) exists for this node.
Override this property for your own logic.
"""
return make_response(
render_template(
"foreign_servers/js/foreign_servers.js",
_=gettext
),
200, {'Content-Type': 'application/javascript'}
)
def check_precondition(f):
"""
This function will behave as a decorator which will checks

View File

@ -132,10 +132,6 @@ class UserMappingView(PGChildNodeView):
* __init__(**kwargs)
- Method is used to initialize the UserMappingView and it's base view.
* module_js()
- This property defines (if javascript) exists for this node.
Override this property for your own logic
* check_precondition()
- This function will behave as a decorator which will checks
database connection before running view, it will also attaches
@ -209,23 +205,9 @@ class UserMappingView(PGChildNodeView):
'msql': [{'get': 'msql'}, {'get': 'msql'}],
'stats': [{'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}]
'dependent': [{'get': 'dependents'}]
})
def module_js(self):
"""
This property defines (if javascript) exists for this node.
Override this property for your own logic.
"""
return make_response(
render_template(
"user_mappings/js/user_mappings.js",
_=gettext
),
200, {'Content-Type': 'application/javascript'}
)
def check_precondition(f):
"""
This function will behave as a decorator which will checks

View File

@ -237,7 +237,7 @@ class SchemaView(PGChildNodeView):
self.manager = None
self.conn = None
self.template_path = None
self.template_initial = 'schema'
self.template_initial = 'schemas'
@staticmethod
def ppas_template_path(ver):

View File

@ -128,8 +128,7 @@ class CatalogObjectView(PGChildNodeView):
'nodes': [{'get': 'node'}, {'get': 'nodes'}],
'sql': [{'get': 'sql'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}]
'dependent': [{'get': 'dependents'}]
})
def check_precondition(f):

View File

@ -155,8 +155,7 @@ class CatalogObjectColumnsView(PGChildNodeView):
'nodes': [{'get': 'node'}, {'get': 'nodes'}],
'sql': [{'get': 'sql'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}]
'dependent': [{'get': 'dependents'}]
})
def check_precondition(f):

View File

@ -171,7 +171,6 @@ class CollationView(PGChildNodeView):
'stats': [{'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}],
'get_collations': [{'get': 'get_collation'},
{'get': 'get_collation'}]
})
@ -193,7 +192,7 @@ class CollationView(PGChildNodeView):
self.conn = self.manager.connection(did=kwargs['did'])
# Set the template path for the SQL scripts
self.template_path = compile_template_path(
'collation/sql/',
'collations/sql/',
self.manager.server_type,
self.manager.version
)

View File

@ -95,9 +95,6 @@ class DomainView(PGChildNodeView, DataTypeReader):
- Works as a decorator.
Validating request on the request of create, update and modified SQL.
* module_js():
- Load JS file (domains.js) for this module.
* check_precondition(f):
- Works as a decorator.
- Checks database connection status.
@ -168,7 +165,6 @@ class DomainView(PGChildNodeView, DataTypeReader):
'stats': [{'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}],
'get_types': [{'get': 'types'}, {'get': 'types'}],
'get_collations': [
{'get': 'get_collations'},
@ -246,18 +242,6 @@ class DomainView(PGChildNodeView, DataTypeReader):
return wrap
def module_js(self):
"""
Load JS file (domains.js) for this module.
"""
return make_response(
render_template(
"domains/js/domains.js",
_=gettext
),
200, {'Content-Type': 'application/javascript'}
)
def check_precondition(f):
"""
Works as a decorator.

View File

@ -109,9 +109,6 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
- Works as a decorator.
Validating request on the request of create, update and modified SQL.
* module_js():
- Overrides this property to define javascript for Foreign Table node.
* check_precondition(f):
- Works as a decorator.
- Checks database connection status.
@ -204,7 +201,6 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
'stats': [{'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}],
'get_collations': [
{'get': 'get_collations'},
{'get': 'get_collations'}
@ -319,18 +315,6 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
return wrap
def module_js(self):
"""
Load JS file (foreign_tables.js) for this module.
"""
return make_response(
render_template(
"foreign_tables/js/foreign_tables.js",
_=gettext
),
200, {'Content-Type': 'application/javascript'}
)
def check_precondition(f):
"""
Works as a decorator.

View File

@ -108,10 +108,6 @@ class FtsConfigurationView(PGChildNodeView):
- Method is used to initialize the FtsConfigurationView and it's base
view.
* module_js()
- This property defines (if javascript) exists for this node.
Override this property for your own logic
* check_precondition()
- This function will behave as a decorator which will checks
database connection before running view, it will also attaches
@ -200,7 +196,6 @@ class FtsConfigurationView(PGChildNodeView):
'stats': [{'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}],
'parsers': [{'get': 'parsers'},
{'get': 'parsers'}],
'copyConfig': [{'get': 'copyConfig'},
@ -215,18 +210,6 @@ class FtsConfigurationView(PGChildNodeView):
self.manager = None
super(FtsConfigurationView, self).__init__(**kwargs)
def module_js(self):
"""
Load JS file (fts_configuration.js) for this module.
"""
return make_response(
render_template(
"fts_configuration/js/fts_configuration.js",
_=_
),
200, {'Content-Type': 'application/javascript'}
)
def check_precondition(f):
"""
This function will behave as a decorator which will checks
@ -242,7 +225,7 @@ class FtsConfigurationView(PGChildNodeView):
kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
# Set the template path for the SQL scripts
self.template_path = 'fts_configuration/sql/#{0}#'.format(
self.template_path = 'fts_configurations/sql/#{0}#'.format(
self.manager.version)
return f(*args, **kwargs)

View File

@ -105,10 +105,6 @@ class FtsDictionaryView(PGChildNodeView):
* __init__(**kwargs)
- Method is used to initialize the FtsDictionaryView and it's base view.
* module_js()
- This property defines (if javascript) exists for this node.
Override this property for your own logic
* check_precondition()
- This function will behave as a decorator which will checks
database connection before running view, it will also attaches
@ -192,7 +188,6 @@ class FtsDictionaryView(PGChildNodeView):
'stats': [{'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}],
'fetch_templates': [{'get': 'fetch_templates'},
{'get': 'fetch_templates'}],
})
@ -203,18 +198,6 @@ class FtsDictionaryView(PGChildNodeView):
self.manager = None
super(FtsDictionaryView, self).__init__(**kwargs)
def module_js(self):
"""
Load JS file (fts_dictionary.js) for this module.
"""
return make_response(
render_template(
"fts_dictionary/js/fts_dictionary.js",
_=_
),
200, {'Content-Type': 'application/javascript'}
)
def check_precondition(f):
"""
This function will behave as a decorator which will checks
@ -232,7 +215,7 @@ class FtsDictionaryView(PGChildNodeView):
driver = get_driver(PG_DEFAULT_DRIVER)
self.qtIdent = driver.qtIdent
# Set the template path for the SQL scripts
self.template_path = 'fts_dictionary/sql/#{0}#'.format(
self.template_path = 'fts_dictionaries/sql/#{0}#'.format(
self.manager.version)
return f(*args, **kwargs)

View File

@ -98,10 +98,6 @@ class FtsParserView(PGChildNodeView):
* __init__(**kwargs)
- Method is used to initialize the FtsParserView and it's base view.
* module_js()
- This property defines (if javascript) exists for this node.
Override this property for your own logic
* check_precondition()
- This function will behave as a decorator which will checks
database connection before running view, it will also attaches
@ -194,7 +190,6 @@ class FtsParserView(PGChildNodeView):
'stats': [{'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}],
'start_functions': [{'get': 'start_functions'},
{'get': 'start_functions'}],
'token_functions': [{'get': 'token_functions'},
@ -234,7 +229,7 @@ class FtsParserView(PGChildNodeView):
kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
# Set the template path for the SQL scripts
self.template_path = 'fts_parser/sql/#{0}#'.format(
self.template_path = 'fts_parsers/sql/#{0}#'.format(
self.manager.version)
return f(*args, **kwargs)

View File

@ -105,10 +105,6 @@ class FtsTemplateView(PGChildNodeView):
* __init__(**kwargs)
- Method is used to initialize the FtsTemplateView and it's base view.
* module_js()
- This property defines (if javascript) exists for this node.
Override this property for your own logic
* check_precondition()
- This function will behave as a decorator which will checks
database connection before running view, it will also attaches
@ -187,7 +183,6 @@ class FtsTemplateView(PGChildNodeView):
'stats': [{'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}],
'get_lexize': [{'get': 'get_lexize'}, {'get': 'get_lexize'}],
'get_init': [{'get': 'get_init'}, {'get': 'get_init'}],
})
@ -198,18 +193,6 @@ class FtsTemplateView(PGChildNodeView):
self.manager = None
super(FtsTemplateView, self).__init__(**kwargs)
def module_js(self):
"""
This property defines whether javascript exists for this node.
"""
return make_response(
render_template(
"fts_template/js/fts_templates.js",
_=gettext
),
200, {'Content-Type': 'application/javascript'}
)
def check_precondition(f):
"""
This function will behave as a decorator which will checks
@ -224,7 +207,7 @@ class FtsTemplateView(PGChildNodeView):
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
self.template_path = 'fts_template/sql/#{0}#'.format(
self.template_path = 'fts_templates/sql/#{0}#'.format(
self.manager.version)
return f(*args, **kwargs)

View File

@ -131,9 +131,6 @@ class FunctionView(PGChildNodeView, DataTypeReader):
- Works as a decorator.
Validating request on the request of create, update and modified SQL.
* module_js():
- Overrides this property to define javascript for Functions node.
* check_precondition(f):
- Works as a decorator.
- Checks database connection status.
@ -207,7 +204,6 @@ class FunctionView(PGChildNodeView, DataTypeReader):
'stats': [{'get': 'statistics'}, {'get': 'statistics'}],
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'module.js': [{}, {}, {'get': 'module_js'}],
'get_types': [{'get': 'types'}, {'get': 'types'}],
'get_languages': [{'get': 'get_languages'}, {'get': 'get_languages'}],
'vopts': [{}, {'get': 'variable_options'}],
@ -303,19 +299,6 @@ class FunctionView(PGChildNodeView, DataTypeReader):
return wrap
def module_js(self):
"""
Load JS file (functions.js) for this module.
"""
return make_response(
render_template(
"function/js/functions.js",
_=gettext
),
200, {'Content-Type': 'application/javascript'}
)
def check_precondition(f):
"""
Works as a decorator.
@ -334,12 +317,17 @@ class FunctionView(PGChildNodeView, DataTypeReader):
self.qtIdent = driver.qtIdent
self.qtLiteral = driver.qtLiteral
template_initial = None
if self.node_type == 'function':
template_initial = 'functions'
elif self.node_type == 'procedure':
template_initial = 'procedures'
elif self.node_type == 'trigger_function':
template_initial = 'trigger_functions'
# Set the template path for the SQL scripts
self.template_path = "/".join([
self.node_type
])
self.sql_template_path = "/".join([
self.template_path,
template_initial,
self.manager.server_type,
'sql',
'#{0}#'
@ -1676,19 +1664,6 @@ class ProcedureView(FunctionView):
'lanname',
'prosrc']
def module_js(self):
"""
Load JS file (procedures.js) for this module.
"""
return make_response(
render_template(
"procedure/js/procedures.js",
_=gettext
),
200, {'Content-Type': 'application/javascript'}
)
ProcedureView.register_node_view(procedure_blueprint)
@ -1787,18 +1762,5 @@ class TriggerFunctionView(FunctionView):
'lanname',
'prosrc']
def module_js(self):
"""
Load JS file (trigger_function.js) for this module.
"""
return make_response(
render_template(
"trigger_function/js/trigger_functions.js",
_=gettext
),
200, {'Content-Type': 'application/javascript'}
)
TriggerFunctionView.register_node_view(trigger_function_blueprint)

Some files were not shown because too many files have changed in this diff Show More