diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js index 769570961..61623fd4c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js @@ -69,7 +69,7 @@ export default class DatabaseSchema extends BaseUISchema { defseqacl: [], is_template: false, deftypeacl: [], - schema_res:'', + schema_res: [], ...initValues, }); this.getVariableSchema = getVariableSchema; @@ -195,6 +195,7 @@ export default class DatabaseSchema extends BaseUISchema { type: 'select', group: gettext('Advanced'), mode: ['properties', 'edit', 'create'], helpMessage: gettext('Note: Changes to the schema restriction will require the Schemas node in the browser to be refreshed before they will be shown.'), + helpMessageMode: ['edit', 'create'], controlProps: { multiple: true, allowClear: false, creatable: true, }, depChange: (state)=>{ diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js index bd0f5191b..ac7649ab5 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/server.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js @@ -741,6 +741,7 @@ define('pgadmin.node.server', [ getSchema: (treeNodeInfo, itemNodeData)=>{ let schema = new ServerSchema( getNodeListById(pgBrowser.Nodes['server_group'], treeNodeInfo, itemNodeData), + itemNodeData.user_id, { gid: treeNodeInfo['server_group']._id, } diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.ui.js b/web/pgadmin/browser/server_groups/servers/static/js/server.ui.js index b0653a982..f54ea0941 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/server.ui.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/server.ui.js @@ -19,7 +19,7 @@ import current_user from 'pgadmin.user_management.current_user'; import { isEmptyString } from 'sources/validators'; export default class ServerSchema extends BaseUISchema { - constructor(serverGroupOptions=[], initValues) { + constructor(serverGroupOptions=[], userId, initValues) { super({ gid: undefined, id: undefined, @@ -36,7 +36,7 @@ export default class ServerSchema extends BaseUISchema { connect_now: true, password: undefined, save_password: false, - db_res: '', + db_res: [], passfile: undefined, sslcompression: false, sslcert: undefined, @@ -57,13 +57,14 @@ export default class ServerSchema extends BaseUISchema { }); this.serverGroupOptions = serverGroupOptions; + this.userId = userId; _.bindAll(this, 'isShared', 'isSSL'); } get SSL_MODES() { return ['prefer', 'require', 'verify-ca', 'verify-full']; } isShared(state) { - if(!this.isNew(state) && state.user_id != current_user.id && state.shared) { + if(!this.isNew(state) && this.userId != current_user.id && state.shared) { return true; } return false; @@ -103,7 +104,7 @@ export default class ServerSchema extends BaseUISchema { { id: 'server_owner', label: gettext('Shared Server Owner'), type: 'text', mode: ['properties'], visible: function(state) { - var serverOwner = state.user_id; + var serverOwner = obj.userId; if (state.shared && serverOwner != current_user.id && pgAdmin.server_mode == 'True'){ return true; } @@ -141,7 +142,7 @@ export default class ServerSchema extends BaseUISchema { id: 'shared', label: gettext('Shared?'), type: 'switch', mode: ['properties', 'create', 'edit'], readonly: function(state){ - var serverOwner = state.user_id; + var serverOwner = obj.userId; if (obj.isNew(state) && serverOwner != current_user.id) { return true; } @@ -413,7 +414,7 @@ export default class ServerSchema extends BaseUISchema { id: 'db_res', label: gettext('DB restriction'), type: 'select', group: gettext('Advanced'), options: [], mode: ['properties', 'edit', 'create'], readonly: obj.isConnected, controlProps: { - multiple: true, allowClear: false, creatable: true}, + multiple: true, allowClear: false, creatable: true, noDropdown: true}, }, { id: 'passfile', label: gettext('Password file'), type: 'file', diff --git a/web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js b/web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js index 2954f40fd..8cb7dc05a 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/variable.ui.js @@ -112,10 +112,16 @@ export default class VariableSchema extends BaseUISchema { { id: 'value', label: gettext('Value'), type: 'text', deps: ['name'], - depChange: (state, changeSource)=>{ - if(changeSource == 'name') { - return {...state - , value: null + depChange: (state, source)=>{ + if(source[source.length-1] == 'name') { + let variable = this.varTypes[state.name]; + if(variable.vartype === 'bool'){ + return { + value: false, + }; + } + return { + value: null }; } }, diff --git a/web/pgadmin/static/js/SchemaView/MappedControl.jsx b/web/pgadmin/static/js/SchemaView/MappedControl.jsx index 3dfb017b5..30da77f00 100644 --- a/web/pgadmin/static/js/SchemaView/MappedControl.jsx +++ b/web/pgadmin/static/js/SchemaView/MappedControl.jsx @@ -52,7 +52,7 @@ function MappedFormControlBase({type, value, id, onChange, className, visible, i case 'password': return ; case 'select': - return ; + return ; case 'select-refresh': return ; case 'switch': diff --git a/web/pgadmin/static/js/SchemaView/index.jsx b/web/pgadmin/static/js/SchemaView/index.jsx index d2aa26838..eea308fc0 100644 --- a/web/pgadmin/static/js/SchemaView/index.jsx +++ b/web/pgadmin/static/js/SchemaView/index.jsx @@ -819,6 +819,9 @@ function SchemaPropertiesView({ readonly = true; if(modeSupported) { group = groupLabels[group] || group || defaultTab; + if(field.helpMessageMode && field.helpMessageMode.indexOf(viewHelperProps.mode) == -1) { + field.helpMessage = ''; + } if(!tabs[group]) tabs[group] = []; if(field && field.type === 'nested-fieldset') { diff --git a/web/pgadmin/static/js/components/FormComponents.jsx b/web/pgadmin/static/js/components/FormComponents.jsx index c4d06ffe7..3187a1d85 100644 --- a/web/pgadmin/static/js/components/FormComponents.jsx +++ b/web/pgadmin/static/js/components/FormComponents.jsx @@ -381,7 +381,7 @@ export function InputFileSelect({controlProps, onChange, disabled, readonly, ... inpRef.current.focus(); }; return ( - showFileDialog(controlProps, onFileSelect)} disabled={disabled||readonly} aria-label={gettext('Select a file')}> } /> diff --git a/web/regression/javascript/schema_ui_files/server.ui.spec.js b/web/regression/javascript/schema_ui_files/server.ui.spec.js index fb524c406..3628bde7f 100644 --- a/web/regression/javascript/schema_ui_files/server.ui.spec.js +++ b/web/regression/javascript/schema_ui_files/server.ui.spec.js @@ -20,7 +20,7 @@ describe('ServerSchema', ()=>{ let mount; let schemaObj = new ServerSchema([{ label: 'Servers', value: 1, - }], { + }], 0, { user_id: 'jasmine', }); let getInitData = ()=>Promise.resolve({});