mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed the SonarQube Code smells having Rule 'Functions, methods and lambdas should not have too many parameters'.
This commit is contained in:
parent
3d5a2046c4
commit
b5f0190799
@ -698,8 +698,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return SQL.strip('\n'), data['name']
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, coid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, coid, **kwargs):
|
||||
"""
|
||||
This function will generates reverse engineered sql for collation
|
||||
object
|
||||
@ -713,6 +712,9 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
diff_schema: Target Schema for schema diff
|
||||
json_resp: True then return json response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
scid=scid, coid=coid)
|
||||
|
@ -690,8 +690,7 @@ AND relkind != 'c'))"""
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, doid=None, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, doid=None, **kwargs):
|
||||
"""
|
||||
Returns the SQL for the Domain object.
|
||||
|
||||
@ -704,6 +703,8 @@ AND relkind != 'c'))"""
|
||||
diff_schema: Target Schema for schema diff
|
||||
json_resp: True then return json response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
|
@ -818,8 +818,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
return internal_server_error(errormsg=str(e))
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, foid=None, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, foid=None, **kwargs):
|
||||
"""
|
||||
Returns the SQL for the Foreign Table object.
|
||||
|
||||
@ -832,6 +831,9 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
diff_schema: Target Schema for schema diff
|
||||
json_resp: True then return json response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
status, data = self._fetch_properties(gid, sid, did, scid, foid,
|
||||
inherits=True)
|
||||
if not status:
|
||||
|
@ -882,8 +882,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, cfgid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, cfgid, **kwargs):
|
||||
"""
|
||||
This function will reverse generate sql for sql panel
|
||||
:param gid: group id
|
||||
@ -894,6 +893,9 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param diff_schema: Target Schema for schema diff
|
||||
:param json_resp: True then return json response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
try:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'sql.sql']),
|
||||
|
@ -778,8 +778,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, dcid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, dcid, **kwargs):
|
||||
"""
|
||||
This function will reverse generate sql for sql panel
|
||||
:param gid: group id
|
||||
@ -790,6 +789,8 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param diff_schema: Target Schema for schema diff
|
||||
:param json_resp: True then return json response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
|
@ -824,8 +824,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, pid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, pid, **kwargs):
|
||||
"""
|
||||
This function will reverse generate sql for sql panel
|
||||
:param gid: group id
|
||||
@ -836,6 +835,9 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param diff_schema: Target Schema for schema diff
|
||||
:param json_resp: True then return json response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
try:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'sql.sql']),
|
||||
|
@ -712,8 +712,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, tid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, tid, **kwargs):
|
||||
"""
|
||||
This function will reverse generate sql for sql panel
|
||||
:param gid: group id
|
||||
@ -724,6 +723,9 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param diff_schema: Target Schema for schema diff
|
||||
:param json_resp: True then return json response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'sql.sql']),
|
||||
tid=tid,
|
||||
|
@ -1016,8 +1016,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
resp_data['pronamespace'])
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, fnid=None, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, fnid=None, **kwargs):
|
||||
"""
|
||||
Returns the SQL for the Function object.
|
||||
|
||||
@ -1028,6 +1027,9 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
scid: Schema Id
|
||||
fnid: Function Id
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
resp_data = self._fetch_properties(gid, sid, did, scid, fnid)
|
||||
# Most probably this is due to error
|
||||
if not isinstance(resp_data, dict):
|
||||
|
@ -668,8 +668,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return sql, data['name'] if 'name' in data else old_data['name']
|
||||
|
||||
@check_precondition(action="sql")
|
||||
def sql(self, gid, sid, did, scid, pkgid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, pkgid, **kwargs):
|
||||
"""
|
||||
This function will generate sql for sql panel
|
||||
|
||||
@ -682,6 +681,9 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
diff_schema: Schema diff target schema name
|
||||
json_resp: json response or plain text response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
try:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']), scid=scid,
|
||||
|
@ -689,8 +689,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition(action="sql")
|
||||
def sql(self, gid, sid, did, scid, seid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, seid, **kwargs):
|
||||
"""
|
||||
This function will generate sql for sql panel
|
||||
|
||||
@ -703,6 +702,8 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
diff_schema: Schema diff target schema name
|
||||
json_resp: json response or plain text response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
|
@ -660,8 +660,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return SQL.strip('\n'), name
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, syid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, syid, **kwargs):
|
||||
"""
|
||||
This function will generates reverse engineered sql for synonym object
|
||||
|
||||
@ -674,6 +673,9 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
diff_schema:
|
||||
json_resp:
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
scid=scid, syid=syid)
|
||||
|
@ -541,7 +541,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return internal_server_error(errormsg=str(e))
|
||||
|
||||
@check_precondition
|
||||
def delete(self, gid, sid, did, scid, tid, trid=None, only_sql=False):
|
||||
def delete(self, gid, sid, did, scid, tid, **kwargs):
|
||||
"""
|
||||
This function will updates existing the compound trigger object
|
||||
|
||||
@ -553,6 +553,9 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
tid: Table ID
|
||||
trid: Trigger ID
|
||||
"""
|
||||
trid = kwargs.get('trid', None)
|
||||
only_sql = kwargs.get('only_sql', False)
|
||||
|
||||
if trid is None:
|
||||
data = request.form if request.form else json.loads(
|
||||
request.data, encoding='utf-8'
|
||||
|
@ -645,8 +645,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return internal_server_error(errormsg=str(e))
|
||||
|
||||
@check_precondition
|
||||
def delete(self, gid, sid, did, scid, tid, idx=None,
|
||||
only_sql=False):
|
||||
def delete(self, gid, sid, did, scid, tid, **kwargs):
|
||||
"""
|
||||
This function will updates existing the schema object
|
||||
|
||||
@ -658,6 +657,9 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
tid: Table ID
|
||||
idx: Index ID
|
||||
"""
|
||||
idx = kwargs.get('idx', None)
|
||||
only_sql = kwargs.get('only_sql', False)
|
||||
|
||||
if idx is None:
|
||||
data = request.form if request.form else json.loads(
|
||||
request.data, encoding='utf-8'
|
||||
|
@ -717,7 +717,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
return internal_server_error(errormsg=str(e))
|
||||
|
||||
@BaseTableView.check_precondition
|
||||
def delete(self, gid, sid, did, scid, tid, ptid=None, only_sql=False):
|
||||
def delete(self, gid, sid, did, scid, tid, ptid=None):
|
||||
"""
|
||||
This function will delete the table object
|
||||
|
||||
|
@ -392,10 +392,13 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return internal_server_error(errormsg=str(e))
|
||||
|
||||
@check_precondition
|
||||
def delete(self, gid, sid, did, scid, tid, rid=None, only_sql=False):
|
||||
def delete(self, gid, sid, did, scid, tid, **kwargs):
|
||||
"""
|
||||
This function will drop a rule object
|
||||
"""
|
||||
rid = kwargs.get('rid', None)
|
||||
only_sql = kwargs.get('only_sql', False)
|
||||
|
||||
if rid is None:
|
||||
data = request.form if request.form else json.loads(
|
||||
request.data, encoding='utf-8'
|
||||
|
@ -575,7 +575,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return internal_server_error(errormsg=str(e))
|
||||
|
||||
@check_precondition
|
||||
def delete(self, gid, sid, did, scid, tid, trid=None, only_sql=False):
|
||||
def delete(self, gid, sid, did, scid, tid, **kwargs):
|
||||
"""
|
||||
This function will updates existing the trigger object
|
||||
|
||||
@ -587,6 +587,9 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
tid: Table ID
|
||||
trid: Trigger ID
|
||||
"""
|
||||
trid = kwargs.get('trid', None)
|
||||
only_sql = kwargs.get('only_sql', False)
|
||||
|
||||
if trid is None:
|
||||
data = request.form if request.form else json.loads(
|
||||
request.data, encoding='utf-8'
|
||||
|
@ -1339,8 +1339,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
return SQL, data['name'] if 'name' in data else old_data['name']
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, tid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, tid, **kwargs):
|
||||
"""
|
||||
This function will generates reverse engineered sql for type object
|
||||
|
||||
@ -1353,6 +1352,9 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
diff_schema: Target Schema for schema diff
|
||||
json_resp: True then return json response
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
|
@ -1209,11 +1209,12 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
return sql_data
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, vid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, vid, **kwargs):
|
||||
"""
|
||||
This function will generate sql to render into the sql panel
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
display_comments = True
|
||||
|
||||
@ -1756,11 +1757,12 @@ class MViewNode(ViewNode, VacuumSettings):
|
||||
return SQL, data['name'] if 'name' in data else old_data['name']
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, vid, diff_schema=None,
|
||||
json_resp=True):
|
||||
def sql(self, gid, sid, did, scid, vid, **kwargs):
|
||||
"""
|
||||
This function will generate sql to render into the sql panel
|
||||
"""
|
||||
diff_schema = kwargs.get('diff_schema', None)
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
display_comments = True
|
||||
|
||||
|
@ -889,7 +889,7 @@ var Cell = Backgrid.Cell = Backbone.View.extend({
|
||||
$el.empty();
|
||||
var model = this.model;
|
||||
var columnName = this.column.get("name");
|
||||
var value = this.formatter.fromRaw(model.get(columnName), model);
|
||||
var value = _.escape(this.formatter.fromRaw(model.get(columnName), model));
|
||||
$el.append($(`<span class="display-text" title="${value}">${value}</span>`));
|
||||
$el.addClass(columnName);
|
||||
this.updateStateClassesMaybe();
|
||||
|
Loading…
Reference in New Issue
Block a user