mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed 'Remove the unnecessary boolean literals' code smell
This commit is contained in:
parent
b8f63adf41
commit
b73aa6d000
@ -13,7 +13,7 @@ let pgBrowser = pgAdmin.Browser;
|
|||||||
|
|
||||||
export function childCreateMenuEnabled(itemData, item, data) {
|
export function childCreateMenuEnabled(itemData, item, data) {
|
||||||
// If check is false then , we will allow create menu
|
// If check is false then , we will allow create menu
|
||||||
if (data && data.check === false) {
|
if (data && !data.check) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ define('pgadmin.node.column', [
|
|||||||
// Below function will enable right click menu for creating column
|
// Below function will enable right click menu for creating column
|
||||||
canCreate: function(itemData, item, data) {
|
canCreate: function(itemData, item, data) {
|
||||||
// If check is false then , we will allow create menu
|
// If check is false then , we will allow create menu
|
||||||
if (data && data.check == false)
|
if (data && !data.check)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
let t = pgBrowser.tree, i = item, d = itemData, parents = [];
|
let t = pgBrowser.tree, i = item, d = itemData, parents = [];
|
||||||
|
@ -100,7 +100,7 @@ define('pgadmin.node.check_constraint', [
|
|||||||
// Below function will enable right click menu for creating check constraint.
|
// Below function will enable right click menu for creating check constraint.
|
||||||
canCreate: function(itemData, item, data) {
|
canCreate: function(itemData, item, data) {
|
||||||
// If check is false then , we will allow create menu
|
// If check is false then , we will allow create menu
|
||||||
if (data && data.check == false)
|
if (data && !data.check)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
let t = pgBrowser.tree, i = item, d = itemData, parents = [];
|
let t = pgBrowser.tree, i = item, d = itemData, parents = [];
|
||||||
|
@ -58,7 +58,7 @@ define('pgadmin.node.exclusion_constraint', [
|
|||||||
|
|
||||||
canCreate: function(itemData, item, data) {
|
canCreate: function(itemData, item, data) {
|
||||||
// If check is false then , we will allow create menu
|
// If check is false then , we will allow create menu
|
||||||
if (data && data.check == false)
|
if (data && !data.check)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
let t = pgBrowser.tree, i = item, d = itemData, parents = [],
|
let t = pgBrowser.tree, i = item, d = itemData, parents = [],
|
||||||
|
@ -94,7 +94,7 @@ define('pgadmin.node.foreign_key', [
|
|||||||
},
|
},
|
||||||
canCreate: function(itemData, item, data) {
|
canCreate: function(itemData, item, data) {
|
||||||
// If check is false then , we will allow create menu
|
// If check is false then , we will allow create menu
|
||||||
if (data && data.check == false)
|
if (data && !data.check)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
let t = pgBrowser.tree, i = item, d = itemData, parents = [],
|
let t = pgBrowser.tree, i = item, d = itemData, parents = [],
|
||||||
|
@ -52,7 +52,7 @@ define('pgadmin.node.unique_constraint', [
|
|||||||
},
|
},
|
||||||
canCreate: function(itemData, item, data) {
|
canCreate: function(itemData, item, data) {
|
||||||
// If check is false then , we will allow create menu
|
// If check is false then , we will allow create menu
|
||||||
if (data && data.check == false)
|
if (data && !data.check)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
let t = pgBrowser.tree, i = item, d = itemData, parents = [],
|
let t = pgBrowser.tree, i = item, d = itemData, parents = [],
|
||||||
|
@ -94,7 +94,7 @@ define('pgadmin.node.index', [
|
|||||||
// Below function will enable right click menu for creating column
|
// Below function will enable right click menu for creating column
|
||||||
canCreate: function(itemData, item, data) {
|
canCreate: function(itemData, item, data) {
|
||||||
// If check is false then , we will allow create menu
|
// If check is false then , we will allow create menu
|
||||||
if (data && data.check == false)
|
if (data && !data.check)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
let t = pgBrowser.tree, i = item, d = itemData, parents = [],
|
let t = pgBrowser.tree, i = item, d = itemData, parents = [],
|
||||||
|
@ -361,7 +361,7 @@ function(gettext, $, Backbone, Backform, Backgrid, pgNode) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Insert Delete Cell into Grid
|
// Insert Delete Cell into Grid
|
||||||
if (data.disabled == false && data.canDelete) {
|
if (data.disabled && data.canDelete) {
|
||||||
gridSchema.columns.unshift({
|
gridSchema.columns.unshift({
|
||||||
name: 'pg-backform-delete width_percent_5', label: '',
|
name: 'pg-backform-delete width_percent_5', label: '',
|
||||||
cell: Backgrid.Extension.DeleteCell,
|
cell: Backgrid.Extension.DeleteCell,
|
||||||
@ -404,7 +404,7 @@ function(gettext, $, Backbone, Backform, Backgrid, pgNode) {
|
|||||||
$gridBody.append(self.$grid);
|
$gridBody.append(self.$grid);
|
||||||
|
|
||||||
// Add button callback
|
// Add button callback
|
||||||
if (!(data.disabled || data.canAdd == false)) {
|
if (!(data.disabled || !data.canAdd)) {
|
||||||
$gridBody.find('button.add').first().on('click',(e) => {
|
$gridBody.find('button.add').first().on('click',(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let canAddRow = _.isFunction(data.canAddRow) ?
|
let canAddRow = _.isFunction(data.canAddRow) ?
|
||||||
|
@ -49,7 +49,7 @@ define([
|
|||||||
$(myPanel).data('pgAdminName', that.name);
|
$(myPanel).data('pgAdminName', that.name);
|
||||||
myPanel.initSize(that.width, that.height);
|
myPanel.initSize(that.width, that.height);
|
||||||
|
|
||||||
if (myPanel.showTitle == false)
|
if (!myPanel.showTitle)
|
||||||
myPanel.title(false);
|
myPanel.title(false);
|
||||||
|
|
||||||
myPanel.icon(that.icon);
|
myPanel.icon(that.icon);
|
||||||
|
@ -64,7 +64,7 @@ define('pgadmin.browser.node', [
|
|||||||
child.callbacks = _.extend({}, parent.callbacks, props.callbacks);
|
child.callbacks = _.extend({}, parent.callbacks, props.callbacks);
|
||||||
|
|
||||||
// Let's not bind the callbacks, or initialize the child.
|
// Let's not bind the callbacks, or initialize the child.
|
||||||
if (initialize === false)
|
if (!initialize)
|
||||||
return child;
|
return child;
|
||||||
|
|
||||||
var bindToChild = function(cb) {
|
var bindToChild = function(cb) {
|
||||||
@ -1140,11 +1140,11 @@ define('pgadmin.browser.node', [
|
|||||||
let tree = pgBrowser.tree,
|
let tree = pgBrowser.tree,
|
||||||
auto_expand = pgBrowser.get_preference('browser', 'auto_expand_sole_children');
|
auto_expand = pgBrowser.get_preference('browser', 'auto_expand_sole_children');
|
||||||
|
|
||||||
if (auto_expand && auto_expand.value == true && tree.children(item).length == 1) {
|
if (auto_expand && auto_expand.value && tree.children(item).length == 1) {
|
||||||
// Automatically expand the child node, if a treeview node has only a single child.
|
// Automatically expand the child node, if a treeview node has only a single child.
|
||||||
const first_child = tree.first(item);
|
const first_child = tree.first(item);
|
||||||
|
|
||||||
if (first_child._loaded == true) {
|
if (first_child._loaded) {
|
||||||
tree.open(first_child);
|
tree.open(first_child);
|
||||||
} else {
|
} else {
|
||||||
const openSoleItem = setInterval(() => {
|
const openSoleItem = setInterval(() => {
|
||||||
|
@ -49,11 +49,11 @@ export function Search() {
|
|||||||
|
|
||||||
// Below will be called when any changes has been made to state
|
// Below will be called when any changes has been made to state
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(menuSearchResult.fetched == true){
|
if(menuSearchResult.fetched){
|
||||||
setIsMenuLoading(false);
|
setIsMenuLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(helpSearchResult.fetched == true){
|
if(helpSearchResult.fetched){
|
||||||
setIsHelpLoading(false);
|
setIsHelpLoading(false);
|
||||||
}
|
}
|
||||||
}, [menuSearchResult, helpSearchResult]);
|
}, [menuSearchResult, helpSearchResult]);
|
||||||
@ -97,11 +97,11 @@ export function Search() {
|
|||||||
for(let i=0; i < items.length; i++){
|
for(let i=0; i < items.length; i++){
|
||||||
Object.keys(items[i]).forEach( (value) => {
|
Object.keys(items[i]).forEach( (value) => {
|
||||||
if(value != 'element' && value != 'No object selected'){
|
if(value != 'element' && value != 'No object selected'){
|
||||||
menuItemsHtmlElement.push( <li key={ 'li-menu-' + i }><a tabIndex='0' id={ 'li-menu-' + i } href={'#'} className={ (items[i]['element'].classList.contains('disabled') == true ? 'dropdown-item menu-groups-a disabled':'dropdown-item menu-groups-a')} key={ 'menu-' + i } onClick={() => {items[i]['element'].click(); toggleDropdownMenu();}}>
|
menuItemsHtmlElement.push( <li key={ 'li-menu-' + i }><a tabIndex='0' id={ 'li-menu-' + i } href={'#'} className={ (items[i]['element'].classList.contains('disabled') ? 'dropdown-item menu-groups-a disabled':'dropdown-item menu-groups-a')} key={ 'menu-' + i } onClick={() => {items[i]['element'].click(); toggleDropdownMenu();}}>
|
||||||
{value}
|
{value}
|
||||||
<span key={ 'menu-span-' + i }>{refactorPathToMenu(items[i][value])}</span>
|
<span key={ 'menu-span-' + i }>{refactorPathToMenu(items[i][value])}</span>
|
||||||
</a>
|
</a>
|
||||||
{ ((items[i]['element'].classList.contains('disabled') == true && items[i]['element'].getAttribute('data-disabled') != undefined) ? <i className='fa fa-info-circle quick-search-tooltip' data-toggle='tooltip' title={items[i]['element'].getAttribute('data-disabled')} aria-label='Test data tooltip' aria-hidden='true'></i> : '' )}
|
{ ((items[i]['element'].classList.contains('disabled') && items[i]['element'].getAttribute('data-disabled') != undefined) ? <i className='fa fa-info-circle quick-search-tooltip' data-toggle='tooltip' title={items[i]['element'].getAttribute('data-disabled')} aria-label='Test data tooltip' aria-hidden='true'></i> : '' )}
|
||||||
</li>);
|
</li>);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -200,7 +200,7 @@ export function Search() {
|
|||||||
:''}
|
:''}
|
||||||
<div >
|
<div >
|
||||||
|
|
||||||
{ (menuSearchResult.fetched == true && isMenuLoading == false ) ?
|
{ (menuSearchResult.fetched && !isMenuLoading ) ?
|
||||||
<div>
|
<div>
|
||||||
<div className='menu-groups'>
|
<div className='menu-groups'>
|
||||||
<span className='fa fa-window-maximize'></span> {gettext('MENU ITEMS')} ({menuSearchResult.data.length})
|
<span className='fa fa-window-maximize'></span> {gettext('MENU ITEMS')} ({menuSearchResult.data.length})
|
||||||
@ -210,9 +210,9 @@ export function Search() {
|
|||||||
{refactorMenuItems(menuSearchResult.data)}
|
{refactorMenuItems(menuSearchResult.data)}
|
||||||
</div> : ( (isMenuLoading) ? (<div className='pad-12'><div className="search-icon">{gettext('Searching...')}</div></div>) : '')}
|
</div> : ( (isMenuLoading) ? (<div className='pad-12'><div className="search-icon">{gettext('Searching...')}</div></div>) : '')}
|
||||||
|
|
||||||
{(menuSearchResult.data.length == 0 && menuSearchResult.fetched == true && isMenuLoading == false) ? (<div className='pad-12 no-results'><span className='fa fa-info-circle'></span> {gettext('No search results')}</div>):''}
|
{(menuSearchResult.data.length == 0 && menuSearchResult.fetched && !isMenuLoading) ? (<div className='pad-12 no-results'><span className='fa fa-info-circle'></span> {gettext('No search results')}</div>):''}
|
||||||
|
|
||||||
{ (helpSearchResult.fetched == true && isHelpLoading == false) ?
|
{ (helpSearchResult.fetched && !isHelpLoading) ?
|
||||||
<div>
|
<div>
|
||||||
<div className='help-groups'>
|
<div className='help-groups'>
|
||||||
<span className='fa fa-question-circle'></span> {gettext('HELP ARTICLES')} {Object.keys(helpSearchResult.data).length > 10 ?
|
<span className='fa fa-question-circle'></span> {gettext('HELP ARTICLES')} {Object.keys(helpSearchResult.data).length > 10 ?
|
||||||
@ -228,7 +228,7 @@ export function Search() {
|
|||||||
})}
|
})}
|
||||||
|
|
||||||
{(Object.keys(helpSearchResult.data).length == 0) ? (<div className='pad-12 no-results'><span className='fa fa-info-circle'></span> {gettext('No search results')}</div>):''}
|
{(Object.keys(helpSearchResult.data).length == 0) ? (<div className='pad-12 no-results'><span className='fa fa-info-circle'></span> {gettext('No search results')}</div>):''}
|
||||||
</div> : ( (isHelpLoading && isMenuLoading == false) ? (
|
</div> : ( (isHelpLoading && !isMenuLoading) ? (
|
||||||
<div>
|
<div>
|
||||||
<div className='help-groups'>
|
<div className='help-groups'>
|
||||||
<span className='fa fa-question-circle'></span>
|
<span className='fa fa-question-circle'></span>
|
||||||
|
@ -214,7 +214,7 @@ export function validateBigAnimalStep3(cloudDBDetails, nodeInfo) {
|
|||||||
isError = true;
|
isError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cloudDBDetails.high_availability == true && (isEmptyString(cloudDBDetails.replicas) || cloudDBDetails.replicas <= 0)) {
|
if(cloudDBDetails.high_availability && (isEmptyString(cloudDBDetails.replicas) || cloudDBDetails.replicas <= 0)) {
|
||||||
isError = true;
|
isError = true;
|
||||||
}
|
}
|
||||||
if (isEmptyString(cloudDBDetails.gid)) cloudDBDetails.gid = nodeInfo['server_group']._id;
|
if (isEmptyString(cloudDBDetails.gid)) cloudDBDetails.gid = nodeInfo['server_group']._id;
|
||||||
|
@ -1442,7 +1442,7 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert Edit Cell into Grid
|
// Insert Edit Cell into Grid
|
||||||
if (data.disabled == false && data.canEdit) {
|
if (!data.disabled && data.canEdit) {
|
||||||
let editCell = Backgrid.Extension.ObjectCell.extend({
|
let editCell = Backgrid.Extension.ObjectCell.extend({
|
||||||
schema: gridSchema.schema,
|
schema: gridSchema.schema,
|
||||||
});
|
});
|
||||||
@ -1521,7 +1521,7 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add button callback
|
// Add button callback
|
||||||
if (!(data.disabled || data.canAdd == false)) {
|
if (!(data.disabled || !data.canAdd)) {
|
||||||
$dialog.find('button.add').first().on('click',(e) => {
|
$dialog.find('button.add').first().on('click',(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let canAddRow = _.isFunction(data.canAddRow) ?
|
let canAddRow = _.isFunction(data.canAddRow) ?
|
||||||
@ -1703,12 +1703,12 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set visibility of Add button
|
// Set visibility of Add button
|
||||||
if (data.disabled || data.canAdd == false) {
|
if (data.disabled || !data.canAdd) {
|
||||||
$(gridBody).find('button.add').remove();
|
$(gridBody).find('button.add').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert Delete Cell into Grid
|
// Insert Delete Cell into Grid
|
||||||
if (data.disabled == false && data.canDelete) {
|
if (!data.disabled && data.canDelete) {
|
||||||
gridSchema.columns.unshift({
|
gridSchema.columns.unshift({
|
||||||
name: 'pg-backform-delete',
|
name: 'pg-backform-delete',
|
||||||
label: '',
|
label: '',
|
||||||
@ -1722,7 +1722,7 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert Edit Cell into Grid
|
// Insert Edit Cell into Grid
|
||||||
if (data.disabled == false && data.canEdit) {
|
if (!data.disabled && data.canEdit) {
|
||||||
let editCell = Backgrid.Extension.ObjectCell.extend({
|
let editCell = Backgrid.Extension.ObjectCell.extend({
|
||||||
schema: gridSchema.schema,
|
schema: gridSchema.schema,
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user