Skip to content

Commit

Permalink
Enabled 'Strict' control for EPAS >= 95
Browse files Browse the repository at this point in the history
  • Loading branch information
asheshv committed Sep 18, 2024
1 parent 781d52b commit 5b435cd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,33 +159,21 @@ export default class FunctionSchema extends BaseUISchema {
}
}

isGreaterThan95(state){
if (
isLessThan95ORNonSPL(state) {
return (
this.inCatalog() ||
this.node_info['node_info'].server.version < 90500 ||
this.node_info['node_info']['server'].server_type != 'ppas' ||
state.lanname != 'edbspl'
) {
state.provolatile = null;
state.proisstrict = false;
state.procost = null;
state.proleakproof = false;
return true;
} else {
return false;
}
);
}

isGreaterThan96(state){
if (
isLessThan96ORNonSPL(state){
return (
this.node_info['node_info'].server.version < 90600 ||
this.node_info['node_info']['server'].server_type != 'ppas' ||
state.lanname != 'edbspl'
) {
state.proparallel = null;
return true;
} else {
return false;
}
);
}


Expand All @@ -210,7 +198,7 @@ export default class FunctionSchema extends BaseUISchema {
if (this.type !== 'procedure') {
obj.inCatalog(state);
} else {
obj.isGreaterThan95(state);
obj.isLessThan95ORNonSPL(state);
}
},
noEmpty: true,
Expand Down Expand Up @@ -328,16 +316,30 @@ export default class FunctionSchema extends BaseUISchema {
{'label': 'VOLATILE', 'value': 'v'},
{'label': 'STABLE', 'value': 's'},
{'label': 'IMMUTABLE', 'value': 'i'},
], disabled: (this.type !== 'procedure') ? obj.inCatalog() : obj.isGreaterThan95,
], disabled: (this.type !== 'procedure') ? obj.inCatalog() : obj.isLessThan95ORNonSPL,
controlProps: {allowClear: false},
},{
id: 'proretset', label: gettext('Returns a set?'), type: 'switch',
disabled: ()=>{return !obj.isNew();}, group: gettext('Options'),
visible: obj.isVisible, readonly: obj.isReadonly,
},{
id: 'proisstrict', label: gettext('Strict?'), type: 'switch',
group: gettext('Options'), disabled: obj.inCatalog(),
group: gettext('Options'),
disabled: obj.inCatalog() ? true : obj.isLessThan95ORNonSPL,
deps: ['lanname'],
depChange: (state, source) => (
(source[source.length - 1] !== 'lanname') ? undefined : (
obj.isLessThan95ORNonSPL(state)
) ? {
provolatile: null,
proisstrict: false,
procost: null,
proleakproof: false,
proparallel: null,
} : (
obj.isLessThan95ORNonSPL(state) ? { proparallel: null } : undefined
)
),
},{
id: 'prosecdef', label: gettext('Security of definer?'),
group: gettext('Options'), type: 'switch',
Expand All @@ -357,13 +359,13 @@ export default class FunctionSchema extends BaseUISchema {
{'label': 'RESTRICTED', 'value': 'r'},
{'label': 'SAFE', 'value': 's'},
],
disabled: (this.type !== 'procedure') ? obj.inCatalog(): obj.isGreaterThan96,
disabled: (this.type !== 'procedure') ? obj.inCatalog(): obj.isLessThan96ORNonSPL,
min_version: 90600,
controlProps: {allowClear: false},
},{
id: 'procost', label: gettext('Estimated cost'), group: gettext('Options'),
cell:'string', type: 'text', deps: ['lanname'],
disabled: (this.type !== 'procedure') ? obj.isDisabled: obj.isGreaterThan95,
disabled: (this.type !== 'procedure') ? obj.isDisabled : obj.isLessThan95ORNonSPL,
},{
id: 'prorows', label: gettext('Estimated rows'), type: 'text',
deps: ['proretset'], visible: obj.isVisible,
Expand All @@ -378,7 +380,7 @@ export default class FunctionSchema extends BaseUISchema {
},{
id: 'proleakproof', label: gettext('Leak proof?'),
group: gettext('Options'), cell:'boolean', type: 'switch', min_version: 90200,
disabled: (this.type !== 'procedure') ? obj.inCatalog(): obj.isGreaterThan95,
disabled: (this.type !== 'procedure') ? obj.inCatalog() : obj.isLessThan95ORNonSPL,
deps: ['lanname'],
},{
id: 'prosupportfunc', label: gettext('Support function'),
Expand Down
4 changes: 1 addition & 3 deletions web/pgadmin/static/js/SchemaView/hooks/useFieldError.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

import { useEffect } from 'react';

const convertKeysToString = (arr) => {
return (arr||[]).map((key) => String(key))
};
const convertKeysToString = (arr) => (arr||[]).map((key) => String(key));
const isPathEqual = (path1, path2) => (
Array.isArray(path1) &&
Array.isArray(path2) &&
Expand Down

0 comments on commit 5b435cd

Please sign in to comment.