mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-25 18:20:20 -06:00
Fixed an issue where unable to change the column properties from edit dialog. Fixes #6766
This commit is contained in:
parent
a8c8ea69e3
commit
a1aa080956
@ -79,14 +79,14 @@ export default class ColumnSchema extends BaseUISchema {
|
||||
if(!_.isUndefined(state.inheritedfrom)) {
|
||||
return true;
|
||||
}
|
||||
// ie: it's position is less than 1
|
||||
if(!_.isUndefined(state.attnum) && state.attnum <= 0) {
|
||||
return true;
|
||||
|
||||
if(this.isNew(state)) {
|
||||
return false;
|
||||
}
|
||||
// if we are in edit mode
|
||||
return !this.isNew(state);
|
||||
// ie: it's position is less than 1
|
||||
return !(!_.isUndefined(state.attnum) && state.attnum > 0);
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
editableCheckForTable(state) {
|
||||
@ -152,7 +152,7 @@ export default class ColumnSchema extends BaseUISchema {
|
||||
|
||||
return [{
|
||||
id: 'name', label: gettext('Name'), cell: 'text',
|
||||
type: 'text', disabled: obj.inSchemaWithColumnCheck,
|
||||
type: 'text', readonly: obj.inSchemaWithColumnCheck,
|
||||
editable: this.editableCheckForTable, noEmpty: true,
|
||||
minWidth: 115,
|
||||
},{
|
||||
@ -226,7 +226,7 @@ export default class ColumnSchema extends BaseUISchema {
|
||||
type: 'text', disabled: this.inCatalog, mode: ['properties'],
|
||||
},{
|
||||
id: 'cltype', label: gettext('Data type'),
|
||||
disabled: obj.inSchemaWithColumnCheck, minWidth: 150,
|
||||
readonly: obj.inSchemaWithColumnCheck, minWidth: 150,
|
||||
group: gettext('Definition'), noEmpty: true,
|
||||
editable: this.editableCheckForTable,
|
||||
options: this.cltypeOptions, optionsLoaded: (options)=>{obj.datatypes = options;},
|
||||
@ -345,12 +345,12 @@ export default class ColumnSchema extends BaseUISchema {
|
||||
}
|
||||
},{
|
||||
id: 'attstattarget', label: gettext('Statistics'), cell: 'text',
|
||||
type: 'text', disabled: obj.inSchemaWithColumnCheck, mode: ['properties', 'edit'],
|
||||
type: 'text', readonly: obj.inSchemaWithColumnCheck, mode: ['properties', 'edit'],
|
||||
group: gettext('Definition'),
|
||||
},{
|
||||
id: 'attstorage', label: gettext('Storage'), group: gettext('Definition'),
|
||||
type: 'select', mode: ['properties', 'edit'],
|
||||
cell: 'select', disabled: obj.inSchemaWithColumnCheck,
|
||||
cell: 'select', readonly: obj.inSchemaWithColumnCheck,
|
||||
controlProps: { placeholder: gettext('Select storage'),
|
||||
allowClear: false,
|
||||
},
|
||||
|
@ -511,7 +511,7 @@ export function InputToggle({cid, value, onChange, options, disabled, readonly,
|
||||
{
|
||||
(options||[]).map((option)=>{
|
||||
const isSelected = option.value === value;
|
||||
const isDisabled = disabled || (readonly && !isSelected);
|
||||
const isDisabled = disabled || option.disabled || (readonly && isSelected);
|
||||
return (
|
||||
<ToggleButton key={option.label} value={option.value} component={isSelected ? PrimaryButton : DefaultButton}
|
||||
disabled={isDisabled} aria-label={option.label}>
|
||||
|
@ -202,13 +202,13 @@ describe('ColumnSchema', ()=>{
|
||||
expect(schemaObj.inSchemaWithColumnCheck(state)).toBe(true);
|
||||
|
||||
schemaObj.nodeInfo = {};
|
||||
expect(schemaObj.inSchemaWithColumnCheck(state)).toBe(false);
|
||||
expect(schemaObj.inSchemaWithColumnCheck(state)).toBe(true);
|
||||
});
|
||||
|
||||
it('editableCheckForTable', ()=>{
|
||||
let state = {};
|
||||
schemaObj.nodeInfo = {};
|
||||
expect(schemaObj.editableCheckForTable(state)).toBe(true);
|
||||
expect(schemaObj.editableCheckForTable(state)).toBe(false);
|
||||
});
|
||||
|
||||
it('depChange', ()=>{
|
||||
|
Loading…
Reference in New Issue
Block a user