mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-26 02:30:21 -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)) {
|
if(!_.isUndefined(state.inheritedfrom)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// ie: it's position is less than 1
|
|
||||||
if(!_.isUndefined(state.attnum) && state.attnum <= 0) {
|
if(this.isNew(state)) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
// if we are in edit mode
|
// ie: it's position is less than 1
|
||||||
return !this.isNew(state);
|
return !(!_.isUndefined(state.attnum) && state.attnum > 0);
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
editableCheckForTable(state) {
|
editableCheckForTable(state) {
|
||||||
@ -152,7 +152,7 @@ export default class ColumnSchema extends BaseUISchema {
|
|||||||
|
|
||||||
return [{
|
return [{
|
||||||
id: 'name', label: gettext('Name'), cell: 'text',
|
id: 'name', label: gettext('Name'), cell: 'text',
|
||||||
type: 'text', disabled: obj.inSchemaWithColumnCheck,
|
type: 'text', readonly: obj.inSchemaWithColumnCheck,
|
||||||
editable: this.editableCheckForTable, noEmpty: true,
|
editable: this.editableCheckForTable, noEmpty: true,
|
||||||
minWidth: 115,
|
minWidth: 115,
|
||||||
},{
|
},{
|
||||||
@ -226,7 +226,7 @@ export default class ColumnSchema extends BaseUISchema {
|
|||||||
type: 'text', disabled: this.inCatalog, mode: ['properties'],
|
type: 'text', disabled: this.inCatalog, mode: ['properties'],
|
||||||
},{
|
},{
|
||||||
id: 'cltype', label: gettext('Data type'),
|
id: 'cltype', label: gettext('Data type'),
|
||||||
disabled: obj.inSchemaWithColumnCheck, minWidth: 150,
|
readonly: obj.inSchemaWithColumnCheck, minWidth: 150,
|
||||||
group: gettext('Definition'), noEmpty: true,
|
group: gettext('Definition'), noEmpty: true,
|
||||||
editable: this.editableCheckForTable,
|
editable: this.editableCheckForTable,
|
||||||
options: this.cltypeOptions, optionsLoaded: (options)=>{obj.datatypes = options;},
|
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',
|
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'),
|
group: gettext('Definition'),
|
||||||
},{
|
},{
|
||||||
id: 'attstorage', label: gettext('Storage'), group: gettext('Definition'),
|
id: 'attstorage', label: gettext('Storage'), group: gettext('Definition'),
|
||||||
type: 'select', mode: ['properties', 'edit'],
|
type: 'select', mode: ['properties', 'edit'],
|
||||||
cell: 'select', disabled: obj.inSchemaWithColumnCheck,
|
cell: 'select', readonly: obj.inSchemaWithColumnCheck,
|
||||||
controlProps: { placeholder: gettext('Select storage'),
|
controlProps: { placeholder: gettext('Select storage'),
|
||||||
allowClear: false,
|
allowClear: false,
|
||||||
},
|
},
|
||||||
|
@ -511,7 +511,7 @@ export function InputToggle({cid, value, onChange, options, disabled, readonly,
|
|||||||
{
|
{
|
||||||
(options||[]).map((option)=>{
|
(options||[]).map((option)=>{
|
||||||
const isSelected = option.value === value;
|
const isSelected = option.value === value;
|
||||||
const isDisabled = disabled || (readonly && !isSelected);
|
const isDisabled = disabled || option.disabled || (readonly && isSelected);
|
||||||
return (
|
return (
|
||||||
<ToggleButton key={option.label} value={option.value} component={isSelected ? PrimaryButton : DefaultButton}
|
<ToggleButton key={option.label} value={option.value} component={isSelected ? PrimaryButton : DefaultButton}
|
||||||
disabled={isDisabled} aria-label={option.label}>
|
disabled={isDisabled} aria-label={option.label}>
|
||||||
|
@ -202,13 +202,13 @@ describe('ColumnSchema', ()=>{
|
|||||||
expect(schemaObj.inSchemaWithColumnCheck(state)).toBe(true);
|
expect(schemaObj.inSchemaWithColumnCheck(state)).toBe(true);
|
||||||
|
|
||||||
schemaObj.nodeInfo = {};
|
schemaObj.nodeInfo = {};
|
||||||
expect(schemaObj.inSchemaWithColumnCheck(state)).toBe(false);
|
expect(schemaObj.inSchemaWithColumnCheck(state)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('editableCheckForTable', ()=>{
|
it('editableCheckForTable', ()=>{
|
||||||
let state = {};
|
let state = {};
|
||||||
schemaObj.nodeInfo = {};
|
schemaObj.nodeInfo = {};
|
||||||
expect(schemaObj.editableCheckForTable(state)).toBe(true);
|
expect(schemaObj.editableCheckForTable(state)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('depChange', ()=>{
|
it('depChange', ()=>{
|
||||||
|
Loading…
Reference in New Issue
Block a user