Fixed issues reported by SonarQube with tag 'bad-practice'.
parent
9e40995ab0
commit
6620f9263d
|
@ -1056,15 +1056,15 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
|||
create_req = False
|
||||
|
||||
for key in required_create_keys:
|
||||
if key in diff_dict:
|
||||
if (key == 'columns' and ((
|
||||
'added' in diff_dict[key] and
|
||||
len(diff_dict[key]['added']) > 0
|
||||
) or ('changed' in diff_dict[key] and
|
||||
len(diff_dict[key]['changed']) > 0) or (
|
||||
'deleted' in diff_dict[key] and
|
||||
len(diff_dict[key]['deleted']) > 0)
|
||||
)) or key != 'columns':
|
||||
if key in diff_dict and \
|
||||
((key == 'columns' and
|
||||
(('added' in diff_dict[key] and
|
||||
len(diff_dict[key]['added']) > 0) or
|
||||
('changed' in diff_dict[key] and
|
||||
len(diff_dict[key]['changed']) > 0) or
|
||||
('deleted' in diff_dict[key] and
|
||||
len(diff_dict[key]['deleted']) > 0))) or
|
||||
key != 'columns'):
|
||||
create_req = True
|
||||
|
||||
if create_req:
|
||||
|
|
|
@ -17,32 +17,30 @@ define(
|
|||
title = _.escape(title);
|
||||
message = _.escape(message);
|
||||
info = _.escape(info);
|
||||
let text = '<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">\
|
||||
<div class="panel panel-default">\
|
||||
<div class="panel-heading" role="tab" id="headingOne">\
|
||||
<h4 class="panel-title">\
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">\
|
||||
' + gettext('Error message') + '</a>\
|
||||
</h4>\
|
||||
</div>\
|
||||
<div id="collapseOne" class="panel-collapse collapse show" role="tabpanel" aria-labelledby="headingOne">\
|
||||
<div class="panel-body" style="overflow: auto;">' + message + '</div>\
|
||||
</div>\
|
||||
</div>';
|
||||
let text ='<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">'
|
||||
+ '<div class="panel panel-default">'
|
||||
+ '<div class="panel-heading" role="tab" id="headingOne">'
|
||||
+ '<h4 class="panel-title">'
|
||||
+ '<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">' + gettext('Error message') + '</a>'
|
||||
+ '</h4>'
|
||||
+ '</div>'
|
||||
+ '<div id="collapseOne" class="panel-collapse collapse show" role="tabpanel" aria-labelledby="headingOne">'
|
||||
+ '<div class="panel-body" style="overflow: auto;">' + message + '</div>'
|
||||
+ '</div>'
|
||||
+ '</div>';
|
||||
|
||||
if (info != null && info != '') {
|
||||
text += '<div class="panel panel-default">\
|
||||
<div class="panel-heading" role="tab" id="headingTwo">\
|
||||
<h4 class="panel-title">\
|
||||
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">\
|
||||
' + gettext('Additional info') + '</a>\
|
||||
</h4>\
|
||||
</div>\
|
||||
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">\
|
||||
<div class="panel-body" style="overflow: auto;">' + info + '</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>';
|
||||
text += '<div class="panel panel-default">'
|
||||
+ '<div class="panel-heading" role="tab" id="headingTwo">'
|
||||
+ '<h4 class="panel-title">'
|
||||
+ '<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">' + gettext('Additional info') + '</a>'
|
||||
+ '</h4>'
|
||||
+ '</div>'
|
||||
+ '<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">'
|
||||
+ '<div class="panel-body" style="overflow: auto;">' + info + '</div>'
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
+ '</div>';
|
||||
}
|
||||
|
||||
text += '</div>';
|
||||
|
|
|
@ -60,9 +60,8 @@ define([
|
|||
},
|
||||
// listen and respond to changes in dialog settings.
|
||||
settingUpdated: function(key, oldValue, newValue) {
|
||||
switch (key) {
|
||||
case 'pg_msg':
|
||||
var doc = iframe.contentWindow || iframe.contentDocument;
|
||||
if(key === 'pg_msg') {
|
||||
let doc = iframe.contentWindow || iframe.contentDocument;
|
||||
if (doc.document) {
|
||||
doc = doc.document;
|
||||
}
|
||||
|
@ -70,8 +69,6 @@ define([
|
|||
doc.open();
|
||||
doc.write(newValue);
|
||||
doc.close();
|
||||
|
||||
break;
|
||||
}
|
||||
},
|
||||
// listen to internal dialog events.
|
||||
|
@ -79,8 +76,7 @@ define([
|
|||
// triggered when a dialog option gets update.
|
||||
// warning! this will not be triggered for settings updates.
|
||||
onupdate: function(option, oldValue, newValue) {
|
||||
switch (option) {
|
||||
case 'resizable':
|
||||
if(option === 'resizable') {
|
||||
if (newValue) {
|
||||
this.elements.content.removeAttribute('style');
|
||||
iframe && iframe.removeAttribute('style');
|
||||
|
@ -88,7 +84,6 @@ define([
|
|||
this.elements.content.style.minHeight = 'inherit';
|
||||
iframe && (iframe.style.minHeight = 'inherit');
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -124,13 +119,13 @@ define([
|
|||
if (contentType.indexOf('text/html') == 0) {
|
||||
var alertMessage = promptmsg;
|
||||
if (type === 'error') {
|
||||
alertMessage = '\
|
||||
<div class="media text-danger text-14">\
|
||||
<div class="media-body media-middle">\
|
||||
<div class="alert-text" role="alert">' + promptmsg + '</div><br/>\
|
||||
<div class="alert-text" role="alert">' + gettext('Click for details.') + '</div>\
|
||||
</div>\
|
||||
</div>';
|
||||
alertMessage =
|
||||
'<div class="media text-danger text-14">'
|
||||
+ '<div class="media-body media-middle">'
|
||||
+ '<div class="alert-text" role="alert">' + promptmsg + '</div><br/>'
|
||||
+ '<div class="alert-text" role="alert">' + gettext('Click for details.') + '</div>'
|
||||
+ '</div>'
|
||||
+ '</div>';
|
||||
}
|
||||
|
||||
alertify.notify(
|
||||
|
@ -173,13 +168,13 @@ define([
|
|||
}
|
||||
}
|
||||
if (contentType.indexOf('text/html') >= 0) {
|
||||
var alertMessage = '\
|
||||
<div class="media text-danger text-14">\
|
||||
<div class="media-body media-middle">\
|
||||
<div class="alert-text" role="alert">' + gettext('INTERNAL SERVER ERROR') + '</div><br/>\
|
||||
<div class="alert-text" role="alert">' + gettext('Click for details.') + '</div>\
|
||||
</div>\
|
||||
</div>';
|
||||
var alertMessage =
|
||||
'<div class="media text-danger text-14">'
|
||||
+ '<div class="media-body media-middle">'
|
||||
+ '<div class="alert-text" role="alert">' + gettext('INTERNAL SERVER ERROR') + '</div><br/>'
|
||||
+ '<div class="alert-text" role="alert">' + gettext('Click for details.') + '</div>'
|
||||
+ '</div>'
|
||||
+ '</div>';
|
||||
|
||||
alertify.notify(
|
||||
alertMessage, 'error', 0, () => {
|
||||
|
|
|
@ -581,15 +581,12 @@ define([
|
|||
|
||||
// triggered when a dialog option gets update.
|
||||
onupdate: function(option, oldValue, newValue) {
|
||||
|
||||
switch (option) {
|
||||
case 'resizable':
|
||||
if(option === 'resizable') {
|
||||
if (newValue) {
|
||||
this.elements.content.removeAttribute('style');
|
||||
} else {
|
||||
this.elements.content.style.minHeight = 'inherit';
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue