Fixed SonarQube code smell 'Unnecessary use of boolean literals in conditional expression'.

This commit is contained in:
Akshay Joshi 2024-04-08 17:19:51 +05:30 committed by GitHub
parent c9345ad618
commit edec9adbfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 104 additions and 108 deletions

View File

@ -40,7 +40,7 @@ export class DomainConstSchema extends BaseUISchema {
type: 'checkbox',
readonly: function(state) {
let currCon = _.find(obj.top.origData.constraints, (con)=>con.conoid == state.conoid);
return !obj.isNew(state) && currCon.convalidated ? true : false;
return !obj.isNew(state) && currCon.convalidated;
},
}
];

View File

@ -132,7 +132,7 @@ export default class ForeignTableSchema extends BaseUISchema {
let newColInherits = state.inherits || [];
let oldColInherits = actionObj.oldState.inherits || [];
let tabName = undefined;
let tabName;
let tabColsResponse;
// Add columns logic
@ -199,7 +199,7 @@ export default class ForeignTableSchema extends BaseUISchema {
canAdd: true, canDelete: true, columns: ['conname','consrc', 'connoinherit', 'convalidated'],
canEdit: true,
canDeleteRow: function(state) {
return (state.conislocal || _.isUndefined(state.conislocal)) ? true : false;
return (state.conislocal || _.isUndefined(state.conislocal));
},
canEditRow: function(state) {
return obj.isNew(state);
@ -307,7 +307,7 @@ export class ColumnSchema extends BaseUISchema {
}
editable_check_for_column(state) {
return (_.isUndefined(state.inheritedid) || _.isNull(state.inheritedid) || _.isUndefined(state.inheritedfrom) || _.isNull(state.inheritedfrom)) ? true : false;
return (_.isUndefined(state.inheritedid) || _.isNull(state.inheritedid) || _.isUndefined(state.inheritedfrom) || _.isNull(state.inheritedfrom));
}
// Check whether the column is a generated column
@ -355,10 +355,10 @@ export class ColumnSchema extends BaseUISchema {
type: 'multiline', mode: ['properties', 'create', 'edit'],
},
{
id: 'cltype',
label: gettext('Data type'),
id: 'cltype',
label: gettext('Data type'),
minWidth: 150,
group: gettext('Definition'),
group: gettext('Definition'),
noEmpty: true,
editable: obj.editable_check_for_column,
disabled: (state)=>{
@ -416,7 +416,7 @@ export class ColumnSchema extends BaseUISchema {
},
{
id: 'attlen',
label: gettext('Length'),
label: gettext('Length'),
group: gettext('Definition'),
deps: ['cltype'],
type: 'int',
@ -486,10 +486,10 @@ export class ColumnSchema extends BaseUISchema {
id: 'max_val_attprecision', skipChange: true, visible: false, type: '',
},
{
id: 'attstattarget',
label: gettext('Statistics'),
id: 'attstattarget',
label: gettext('Statistics'),
cell: 'text',
type: 'text',
type: 'text',
readonly: obj.inSchemaWithColumnCheck,
mode: ['properties', 'edit'],
group: gettext('Definition'),
@ -524,12 +524,12 @@ export class ColumnSchema extends BaseUISchema {
},
},
{
id: 'attnotnull',
label: gettext('Not NULL?'),
id: 'attnotnull',
label: gettext('Not NULL?'),
cell: 'switch',
type: 'switch',
type: 'switch',
minWidth: 80,
group: gettext('Constraints'),
group: gettext('Constraints'),
editable: obj.editable_check_for_column,
},
{
@ -540,7 +540,7 @@ export class ColumnSchema extends BaseUISchema {
type: (state)=>{
let options = [
{ 'label': gettext('NONE'), 'value': 'n'},
];
];
// You can't change the existing column to Generated column.
if (this.isNew(state)) {
options.push({
@ -553,7 +553,7 @@ export class ColumnSchema extends BaseUISchema {
'value': 'g',
'disabled': true,
});
}
}
return {
type: 'toggle',
options: options,
@ -561,17 +561,17 @@ export class ColumnSchema extends BaseUISchema {
},
disabled: function(state) {
return (!this.isNew(state) && state.colconstype == 'g');
},
},
min_version: 120000,
},
{
id: 'genexpr',
label: gettext('Expression'),
id: 'genexpr',
label: gettext('Expression'),
type: 'text',
mode: ['properties', 'create', 'edit'],
mode: ['properties', 'create', 'edit'],
group: gettext('Constraints'),
min_version: 120000,
deps: ['colconstype'],
min_version: 120000,
deps: ['colconstype'],
visible: this.isTypeGenerated,
readonly: function(state) {
return !this.isNew(state);
@ -596,7 +596,7 @@ export class ColumnSchema extends BaseUISchema {
return (_.isUndefined(state.inheritedid)
|| _.isNull(state.inheritedid) ||
_.isUndefined(state.inheritedfrom) ||
_.isUndefined(state.inheritedfrom) ||
_.isNull(state.inheritedfrom));
}
},

View File

@ -132,9 +132,9 @@ export default class FTSConfigurationSchema extends BaseUISchema {
//disable parser when user select copy_config manually and vica-versa
disabled: function(state) {
let copy_config = state.copy_config;
return (_.isNull(copy_config) ||
return !(_.isNull(copy_config) ||
_.isUndefined(copy_config) ||
copy_config === '') ? false : true;
copy_config === '');
},
readonly: function(state) { return !obj.isNew(state); },
}, {
@ -145,9 +145,9 @@ export default class FTSConfigurationSchema extends BaseUISchema {
//disable copy_config when user select parser manually and vica-versa
disabled: function(state) {
let parser = state.prsname;
return (_.isNull(parser) ||
return !(_.isNull(parser) ||
_.isUndefined(parser) ||
parser === '') ? false : true;
parser === '');
},
readonly: function(state) { return !obj.isNew(state); },
}, {

View File

@ -97,7 +97,7 @@ export default class SynonymSchema extends BaseUISchema {
};
},
readonly: function() {
return !obj.inCatalog() ? false : true;
return obj.inCatalog();
}
}, {
id: 'is_sys_obj', label: gettext('System synonym?'),

View File

@ -85,7 +85,7 @@ class ForeignKeyHeaderSchema extends BaseUISchema {
optionsReloadBasis: this.fieldOptions.references?.map ? _.join(this.fieldOptions.references.map((c)=>c.label), ',') : null,
optionsLoaded: (rows)=>obj.refTables=rows,
disabled: (state) => {
return state._disable_references ? true : false;
return state._disable_references;
}
},{
id: 'referenced', label: gettext('Referencing'), editable: false, deps: ['references'],

View File

@ -122,7 +122,7 @@ export default class PartitionTableSchema extends BaseUISchema {
this.getAttachTables = getAttachTables;
this.partitionKeysObj = new PartitionKeysSchema([], getCollations, getOperatorClass);
this.partitionsObj = new PartitionsSchema(this.nodeInfo, getCollations, getOperatorClass, getAttachTables, fieldOptions.table_amname_list);
this.partitionsObj = new PartitionsSchema(this.nodeInfo, getCollations, getOperatorClass, fieldOptions.table_amname_list, getAttachTables);
this.constraintsObj = this.schemas.constraints();
}
@ -236,7 +236,7 @@ export default class PartitionTableSchema extends BaseUISchema {
return {
type: 'select', options: this.fieldOptions.table_amname_list,
controlProps: {
allowClear: obj.isNew(state) ? true : false,
allowClear: obj.isNew(state),
}
};
}, mode: ['create', 'properties', 'edit'], min_version: 120000,

View File

@ -113,7 +113,7 @@ export class PartitionKeysSchema extends BaseUISchema {
}
}
export class PartitionsSchema extends BaseUISchema {
constructor(nodeInfo, getCollations, getOperatorClass, getAttachTables=()=>[], table_amname_list) {
constructor(nodeInfo, getCollations, getOperatorClass, table_amname_list, getAttachTables=()=>[]) {
super({
oid: undefined,
is_attach: false,
@ -206,7 +206,7 @@ export class PartitionsSchema extends BaseUISchema {
return {
type: 'select', options: this.table_amname_list,
controlProps: {
allowClear: obj.isNew(state) ? true : false,
allowClear: obj.isNew(state),
}
};
}, min_version: 120000, disabled: state => {

View File

@ -367,7 +367,7 @@ export default class TableSchema extends BaseUISchema {
this.nodeInfo = nodeInfo;
this.getColumns = getColumns;
this.partitionsObj = new PartitionsSchema(this.nodeInfo, getCollations, getOperatorClass, getAttachTables, fieldOptions.table_amname_list);
this.partitionsObj = new PartitionsSchema(this.nodeInfo, getCollations, getOperatorClass, fieldOptions.table_amname_list, getAttachTables);
this.constraintsObj = this.schemas.constraints?.() || {};
this.columnsSchema = this.schemas.columns?.() || {};
this.vacuumSettingsSchema = this.schemas.vacuum_settings?.() || {};
@ -464,7 +464,7 @@ export default class TableSchema extends BaseUISchema {
id: 'oid', label: gettext('OID'), type: 'text', mode: ['properties'],
},{
id: 'relowner', label: gettext('Owner'), type: 'select',
options: this.fieldOptions.relowner, noEmpty: this.inErd ? false : true,
options: this.fieldOptions.relowner, noEmpty: !this.inErd,
mode: ['properties', 'create', 'edit'], controlProps: {allowClear: false},
readonly: this.inCatalog, visible: !this.inErd,
},{
@ -480,7 +480,7 @@ export default class TableSchema extends BaseUISchema {
return {
type: 'select', options: this.fieldOptions.spcname,
controlProps: {
allowClear: obj.isNew(state) ? true : false,
allowClear: obj.isNew(state),
}
};
}
@ -782,7 +782,7 @@ export default class TableSchema extends BaseUISchema {
return {
type: 'select', options: this.fieldOptions.table_amname_list,
controlProps: {
allowClear: obj.isNew(state) ? true : false,
allowClear: obj.isNew(state),
}
};
}, mode: ['create', 'properties', 'edit'], min_version: 120000,

View File

@ -310,7 +310,7 @@ export default class TriggerSchema extends BaseUISchema {
state.tginitdeferred = false;
}
// If constraint trigger is set then do not disable
return state.is_constraint_trigger ? false : true;
return !state.is_constraint_trigger;
}
} else {
// readonly it

View File

@ -348,7 +348,7 @@ class RangeSchema extends BaseUISchema {
this.options = [];
}
return disableCollNameControl ? false : true;
return !disableCollNameControl;
},
readonly: function(state) {
return !obj.isNew(state);

View File

@ -91,7 +91,7 @@ export default class MViewSchema extends BaseUISchema {
return {
type: 'select', options: obj.fieldOptions.table_amname_list,
controlProps: {
allowClear: obj.isNew(state) ? true : false,
allowClear: obj.isNew(state),
}
};
}, mode: ['create', 'properties', 'edit'], min_version: 120000,
@ -110,7 +110,7 @@ export default class MViewSchema extends BaseUISchema {
},{
id: 'definition', label: gettext('Definition'), cell: 'text',
type: 'sql', mode: ['create', 'edit'], group: gettext('Code'),
isFullTab: true, controlProps: { readOnly: this.nodeInfo && 'catalog' in this.nodeInfo ? true: false },
isFullTab: true, controlProps: { readOnly: this.nodeInfo && 'catalog' in this.nodeInfo },
},
{
type: 'nested-tab', group: gettext('Parameter'), mode: ['create', 'edit'],

View File

@ -97,7 +97,7 @@ export default class ViewSchema extends BaseUISchema {
id: 'definition', label: gettext('Code'), cell: 'text',
type: 'sql', mode: ['create', 'edit'], group: gettext('Code'),
isFullTab: true,
controlProps: { readOnly: obj.nodeInfo && 'catalog' in obj.nodeInfo ? true: false },
controlProps: { readOnly: obj.nodeInfo && 'catalog' in obj.nodeInfo },
},
{

View File

@ -380,7 +380,7 @@ define('pgadmin.node.database', [
// If node_info is not present in current object then it might in its
// parent in case if we used sub node control
let node_info = args.node_info || args.handler.node_info;
return 'catalog' in node_info ? false : true;
return !('catalog' in node_info);
}
return true;
},

View File

@ -97,10 +97,7 @@ export default class SubscriptionSchema extends BaseUISchema{
return false;
}
isRefresh(state){
if (!state.refresh_pub || _.isUndefined(state.refresh_pub)){
return true;
}
return false;
return !state.refresh_pub || _.isUndefined(state.refresh_pub);
}
isSSL(state) {
return this.SSL_MODES.indexOf(state.sslmode) == -1;
@ -336,7 +333,11 @@ export default class SubscriptionSchema extends BaseUISchema{
state.copy_data_after_refresh = false;
return true;
}, depChange: (state)=>{
state.copy_data_after_refresh = state.refresh_pub ? state.copy_data_after_refresh ? false : true : false;
let copy_data_after_refresh = false;
if (state.refresh_pub && !state.copy_data_after_refresh) {
copy_data_after_refresh = true;
}
state.copy_data_after_refresh = copy_data_after_refresh;
},
},{
id: 'connect', label: gettext('Connect?'),

View File

@ -99,7 +99,7 @@ export default class RoleReassign extends BaseUISchema{
helpMessage: gettext('New owner of the affected objects'),
deps: ['role_op'],
disabled: (state)=>{
return state.role_op == 'drop'? true: false;
return state.role_op == 'drop';
},
depChange: (state) =>{
if (state.role_op == 'drop'){

View File

@ -35,7 +35,7 @@ export default class BinaryPathSchema extends BaseUISchema {
width: 32,
radioType: true,
disabled: function (state) {
return state?.binaryPath && state?.binaryPath.length > 0 ? false : true;
return !(state?.binaryPath && state?.binaryPath.length > 0);
},
cell: 'radio',
deps: ['binaryPath'],

View File

@ -498,7 +498,7 @@ define('pgadmin.browser', [
url: _m.url || '#',
target: _m.target,
icon: _m.icon,
enable: enable ? enable : true,
enable: enable || true,
node: _m.node,
checked: _m.checked,
below: _m.below,

View File

@ -412,7 +412,7 @@ function Dashboard({
disableGlobalFilter: false,
minWidth: 26,
width: 80,
isVisible: !did ? true: false
isVisible: !did
},
{
accessor: 'usename',
@ -506,7 +506,7 @@ function Dashboard({
resizable: true,
disableGlobalFilter: false,
minWidth: 26,
isVisible: !did ? true: false,
isVisible: !did,
width: 80
},
{
@ -623,7 +623,7 @@ function Dashboard({
disableGlobalFilter: false,
minWidth: 26,
width: 80,
isVisible: !did ? true: false
isVisible: !did
},
{
accessor: 'Owner',

View File

@ -451,7 +451,7 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId}
<br/>{gettext('By clicking the below button, you will be redirected to the EDB BigAnimal authentication page in a new tab.')}
</Box>
</Box>}
{cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && <PrimaryButton onClick={authenticateBigAnimal} disabled={verificationIntiated ? true: false}>
{cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && <PrimaryButton onClick={authenticateBigAnimal} disabled={verificationIntiated}>
{gettext('Click here to authenticate yourself to EDB BigAnimal')}
</PrimaryButton>}
{cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && <Box className={classes.messageBox}>

View File

@ -67,7 +67,7 @@ class AzureCredSchema extends BaseUISchema {
value: 'azure_cli_credential',
},
],
disabled: pgAdmin.server_mode == 'True' ? true : false,
disabled: pgAdmin.server_mode == 'True',
helpMessage: gettext(
'Azure CLI will use the currently logged in identity through the Azure CLI on the local machine. Interactive Browser will open a browser window to authenticate a user interactively.'
),
@ -82,9 +82,7 @@ class AzureCredSchema extends BaseUISchema {
'Enter the Azure tenant ID against which the user is authenticated.'
),
disabled: (state) => {
return state.auth_type == 'interactive_browser_credential'
? false
: true;
return state.auth_type !== 'interactive_browser_credential';
},
depChange: (state) => {
if (state.auth_type == 'azure_cli_credential') {

View File

@ -53,7 +53,7 @@ class GoogleCredSchema extends BaseUISchema{
btnName: gettext('Click here to authenticate yourself to Google'),
helpMessage: gettext('After clicking the button above you will be redirected to the Google authentication page in a new browser tab.'),
disabled: (state)=>{
return state.client_secret_file ? false : true;
return !state.client_secret_file;
},
deferredDepChange: (state, source)=>{
return new Promise((resolve, reject)=>{
@ -223,7 +223,7 @@ class GoogleInstanceSchema extends BaseUISchema {
}
];
}
}
}
class GoogleStorageSchema extends BaseUISchema {
constructor() {
@ -235,22 +235,22 @@ class GoogleStorageSchema extends BaseUISchema {
get baseFields() {
return [
{
id: 'storage_type',
label: gettext('Storage type'),
id: 'storage_type',
label: gettext('Storage type'),
type: 'select',
mode: ['create'],
noEmpty: true,
options: [
{'label': gettext('SSD'), 'value': 'PD_SSD'},
{'label': gettext('HDD'), 'value': 'PD_HDD'},
],
],
},
{
id: 'storage_size',
label: gettext('Storage capacity'),
id: 'storage_size',
label: gettext('Storage capacity'),
type: 'int',
mode: ['create'],
noEmpty: true,
mode: ['create'],
noEmpty: true,
deps: ['storage_type'],
helpMessage: gettext('Size in GB.'),
}
@ -445,11 +445,11 @@ class GoogleClusterSchema extends BaseUISchema {
},
{}
);
this.googleStorageDetails = new GoogleStorageSchema(
{},
{}
);
);
this.googleNetworkDetails = new GoogleNetworkSchema({}, {});

View File

@ -34,7 +34,7 @@ class ChangePasswordSchema extends BaseUISchema {
id: 'user', label: gettext('User'), type: 'text', disabled: true, visible: this.showUser
}, {
id: 'password', label: gettext('Current Password'), type: 'password',
disabled: self.isPgpassFileUsed, noEmpty: self.isPgpassFileUsed ? false : true,
disabled: self.isPgpassFileUsed, noEmpty: !self.isPgpassFileUsed,
controlProps: {
maxLength: null
}

View File

@ -157,7 +157,7 @@ const dialogStyle = makeStyles((theme) => ({
function checkIsResizable(props) {
return props.isresizeable == 'true' ? true : false;
return props.isresizeable == 'true';
}
function setEnableResizing(props, resizeable) {

View File

@ -222,7 +222,7 @@ function Wizard({ stepList, onStepChange, onSave, className, ...props }) {
<DefaultButton onClick={() => handleNext()} className={classes.buttonMargin} startIcon={<FastForwardIcon />} disabled={activeStep == steps.length - 1 || disableNext}>
{gettext('Next')}
</DefaultButton>
<PrimaryButton className={classes.buttonMargin} startIcon={<CheckIcon />} disabled={activeStep == steps.length - 1 ? false : true} onClick={onSave}>
<PrimaryButton className={classes.buttonMargin} startIcon={<CheckIcon />} disabled={activeStep !== (steps.length - 1) } onClick={onSave}>
{gettext('Finish')}
</PrimaryButton>
</Box>

View File

@ -25,7 +25,7 @@ export function enabled(tree, supportedNodes, treeNodeData, domTreeNode) {
if (!isValidTreeNodeData(treeNodeData))
return false;
let _tree = tree ? tree : pgAdmin.Browser.tree;
let _tree = tree || pgAdmin.Browser.tree;
let treeNode = _tree.findNodeByDomElement(domTreeNode);
if (!treeNode) {
return false;

View File

@ -78,7 +78,7 @@ function manageTreeEvents(event, eventName, item) {
export class Tree {
constructor(tree, manageTree, pgBrowser, type) {
this.tree = tree;
this.tree.type = type ? type : 'browser';
this.tree.type = type || 'browser';
this.tree.onTreeEvents(manageTreeEvents);
this.rootNode = manageTree.tempTree;
@ -299,7 +299,7 @@ export class Tree {
}
hasParent(item) {
return item?.parent ? true : false;
return item?.parent;
}
isOpen(item) {
@ -332,7 +332,7 @@ export class Tree {
isInode(item) {
const children = this.children(item);
if (children === null || children === undefined) return false;
return children.length > 0 ? true : false;
return children.length > 0;
}
selected() {

View File

@ -30,10 +30,7 @@ export function parseShortcutValue(obj) {
export function isShortcutValue(obj) {
if(!obj) return false;
if([obj.alt, obj.control, obj?.key, obj?.key?.char].every((k)=>!_.isUndefined(k))){
return true;
}
return false;
return [obj.alt, obj.control, obj?.key, obj?.key?.char].every((k)=>!_.isUndefined(k));
}
// Convert shortcut obj to codemirror key format
@ -60,7 +57,7 @@ export function toCodeMirrorKey(obj) {
}
export function getEpoch(inp_date) {
let date_obj = inp_date ? inp_date : new Date();
let date_obj = inp_date || new Date();
return parseInt(date_obj.getTime()/1000);
}
@ -643,4 +640,4 @@ export function scrollbarWidth() {
const scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
}
}

View File

@ -576,7 +576,7 @@ export default class BackupSchema extends BaseUISchema {
state.on_conflict_do_nothing = false;
return true;
},
inlineNext: obj.backupType == 'server'? false : true,
inlineNext: obj.backupType !== 'server',
}, {
id: 'include_create_database',
label: gettext('Include CREATE DATABASE statement'),

View File

@ -267,10 +267,10 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
funcObj.push({
'name': argName[index],
'type': argType[index],
'is_null': argData['is_null'] ? true : false,
'expr': argData['is_expression'] ? true : false,
'is_null': argData['is_null'],
'expr': argData['is_expression'],
'value': values,
'use_default': argData['use_default'] ? true : false,
'use_default': argData['use_default'],
'default_value': defValList[index],
'disable_use_default': isUnnamedParam ? defValList[index] == DEBUGGER_ARGS.NO_DEFAULT_VALUE : defValList[index] == DEBUGGER_ARGS.NO_DEFAULT,
});

View File

@ -370,22 +370,22 @@ export default class MaintenanceSchema extends BaseUISchema {
{
'label': gettext('VACUUM'),
value: 'VACUUM',
disabled: (obj.isSchemaNode() && !obj.nodeInfo?.mview) ? true : false
disabled: (obj.isSchemaNode() && !obj.nodeInfo?.mview)
},
{
'label': gettext('ANALYZE'),
value: 'ANALYZE',
disabled: (obj.isSchemaNode() && !obj.nodeInfo?.mview) ? true : false
disabled: (obj.isSchemaNode() && !obj.nodeInfo?.mview)
},
{
'label': gettext('REINDEX'),
value: 'REINDEX',
disabled: obj.nodeInfo?.mview ? true : false
disabled: obj.nodeInfo?.mview
},
{
'label': gettext('CLUSTER'),
value: 'CLUSTER',
disabled: obj.nodeInfo?.mview ? true : obj.isSchemaNode() ? true : false
disabled: obj.nodeInfo?.mview || obj.isSchemaNode()
},
],
},

View File

@ -38,8 +38,8 @@ export function InputComponent({ label, serverList, databaseList, schemaList, di
const [selectedDatabase, setSelectedDatabase] = useState(selectedDid);
const [selectedSchema, setSelectedSchema] = useState(selectedScid);
const eventBus = useContext(SchemaDiffEventsContext);
const [disableDBSelection, setDisableDBSelection] = useState(selectedSid == null ? true : false);
const [disableSchemaSelection, setDisableSchemaSelection] = useState(selectedDid == null ? true : false);
const [disableDBSelection, setDisableDBSelection] = useState(selectedSid == null);
const [disableSchemaSelection, setDisableSchemaSelection] = useState(selectedDid == null);
const changeServer = (selectedOption) => {
setDisableDBSelection(false);
setSelectedServer(selectedOption);

View File

@ -174,7 +174,7 @@ export function SchemaDiffButtonComponent({ sourceData, targetData, selectedRowI
</PgButtonGroup>
</Box>
<Box className={classes.scriptBtn}>
<PgButtonGroup size="small" disabled={selectedRowIds?.length > 0 ? false : true}>
<PgButtonGroup size="small" disabled={selectedRowIds?.length <= 0}>
<DefaultButton startIcon={<FeaturedPlayListRoundedIcon />} onClick={generateScript}>{gettext('Generate Script')}</DefaultButton>
</PgButtonGroup>
</Box>

View File

@ -339,7 +339,7 @@ export function SchemaDiffCompare({ params }) {
const triggerGenerateScript = ({ sid, did, selectedIds, rows }) => {
setLoaderText(gettext('Generating script...'));
let generatedScript = undefined, scriptHeader;
let generatedScript, scriptHeader;
scriptHeader = gettext('-- This script was generated by the Schema Diff utility in pgAdmin 4. \n');
scriptHeader += gettext('-- For the circular dependencies, the order in which Schema Diff writes the objects is not very sophisticated \n');
@ -406,7 +406,7 @@ export function SchemaDiffCompare({ params }) {
'parentId': tempData[record.group_name]['children'][record.label].id,
'label': record.title,
'status': record.status,
'isVisible': filterParams.includes(record.status) ? true : false,
'isVisible': filterParams.includes(record.status),
'icon': `icon-${record.type}`,
'isExpanded': false,
'selected': false,
@ -448,7 +448,7 @@ export function SchemaDiffCompare({ params }) {
'parentId': chidId,
'label': record.title,
'status': record.status,
'isVisible': filterParams.includes(record.status) ? true : false,
'isVisible': filterParams.includes(record.status),
'icon': `icon-${record.type}`,
'isExpanded': false,
'selected': false,
@ -503,7 +503,7 @@ export function SchemaDiffCompare({ params }) {
'status': record.status,
'selected': false,
'itemType': record.type,
'isVisible': filterParams.includes(record.status) ? true : false,
'isVisible': filterParams.includes(record.status),
'icon': `icon-${record.type}`,
'isExpanded': false,
'oid': record.oid,

View File

@ -51,7 +51,7 @@ export default class SQLEditor {
viewMenuEnabled(obj) {
let isEnabled = (() => {
if (!_.isUndefined(obj) && !_.isNull(obj))
return (_.indexOf(this.SUPPORTED_NODES, obj._type) !== -1 ? true : false);
return (_.indexOf(this.SUPPORTED_NODES, obj._type) !== -1);
else
return false;
})();

View File

@ -71,7 +71,7 @@ function setPanelTitle(docker, panelId, title, qtState, dirty=false) {
docker.setInternalAttrs(panelId, {
isDirty: dirty,
});
setQueryToolDockerTitle(docker, panelId, true, title, qtState.current_file ? true : false);
setQueryToolDockerTitle(docker, panelId, true, title, qtState.current_file);
}
}
@ -172,7 +172,7 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
params: {
...params,
title: _.unescape(params.title),
is_query_tool: params.is_query_tool == 'true' ? true : false,
is_query_tool: params.is_query_tool == 'true',
node_name: retrieveNodeName(selectedNodeInfo),
dbname: _.unescape(params.database_name) || getDatabaseLabel(selectedNodeInfo)
},
@ -187,7 +187,7 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
bgcolor: params.bgcolor,
conn_title: getTitle(
pgAdmin, null, selectedNodeInfo, true, _.unescape(params.server_name), _.unescape(params.database_name) || getDatabaseLabel(selectedNodeInfo),
_.unescape(params.role) || _.unescape(params.user), params.is_query_tool == 'true' ? true : false),
_.unescape(params.role) || _.unescape(params.user), params.is_query_tool == 'true'),
server_name: _.unescape(params.server_name),
database_name: _.unescape(params.database_name) || getDatabaseLabel(selectedNodeInfo),
is_selected: true,
@ -676,7 +676,7 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
fgcolor: connectionData.fgcolor,
bgcolor: connectionData.bgcolor,
},
connected: respData.data.trans_id ? true : false,
connected: respData.data.trans_id,
obtaining_conn: false,
};
});

View File

@ -254,7 +254,7 @@ export function NumberEditor({row, column, onRowChange, onClose}) {
};
const onBlur = ()=>{
if(isValidData()) {
onClose(column.can_edit ? true : false);
onClose(column.can_edit);
return true;
}
return false;

View File

@ -128,7 +128,7 @@ function GenerateGraph({graphType, graphData, ...props}) {
plugins: {
legend: {
labels: {
usePointStyle: (showDataPoints && useDiffPointStyle) ? true : false
usePointStyle: (showDataPoints && useDiffPointStyle)
},
},
},

View File

@ -37,7 +37,7 @@ class UserManagementCollection extends BaseUISchema {
});
this.authOnlyInternal = (current_user['auth_sources'].length == 1 &&
current_user['auth_sources'].includes(AUTH_METHODS['INTERNAL'])) ? true : false;
current_user['auth_sources'].includes(AUTH_METHODS['INTERNAL']));
this.authSources = authSources;
this.roleOptions = roleOptions;
}
@ -146,7 +146,7 @@ class UserManagementCollection extends BaseUISchema {
}
validate(state, setError) {
let msg = undefined;
let msg;
let obj = this;
let minPassLen = pgAdmin.password_length_min;
if (obj.isUserNameEnabled(state) && isEmptyString(state.username)) {