Fixed exclusion constraint issues:

1. Incorrect error message.
2. Properties panel Column Section data missing
3. Operator class value is missing

Fixes #6771
This commit is contained in:
Aditya Toshniwal 2021-09-23 19:28:35 +05:30 committed by Akshay Joshi
parent a6dce27ffa
commit d28f8bc7ee
3 changed files with 18 additions and 11 deletions

View File

@ -128,7 +128,7 @@ class ExclusionColumnSchema extends BaseUISchema {
get baseFields() {
let obj = this;
return [{
id: 'is_exp', label: '', type:'', editable: false, width: 20,
id: 'is_exp', label: '', type:'', cell: '', editable: false, width: 20,
disableResizing: true,
controlProps: {
formatter: {
@ -221,6 +221,9 @@ export default class ExclusionConstraintSchema extends BaseUISchema {
initialise(data) {
this.exColumnSchema.isNewExCons = this.isNew(data);
this.amname = data.amname;
if(data.amname === 'btree') {
this.exColumnSchema.setOperClassOptions(this.fieldOptions.getOperClass({indextype: data.amname}));
}
}
changeColumnOptions(columns) {
@ -246,7 +249,7 @@ export default class ExclusionConstraintSchema extends BaseUISchema {
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
},{
id: 'is_sys_obj', label: gettext('System foreign key?'),
id: 'is_sys_obj', label: gettext('System exclusion constraint?'),
type: 'switch', mode: ['properties'],
},{
id: 'comment', label: gettext('Comment'), cell: 'text',
@ -340,13 +343,13 @@ export default class ExclusionConstraintSchema extends BaseUISchema {
},{
id: 'columns', label: gettext('Columns/Expressions'),
group: gettext('Columns'), type: 'collection',
mode: ['create', 'edit'],
mode: ['create', 'edit', 'properties'],
editable: false, schema: this.exColumnSchema,
headerSchema: this.exHeaderSchema, headerVisible: (state)=>obj.isNew(state),
CustomControl: DataGridViewWithHeaderForm,
uniqueCol: ['column'],
canAdd: false, canDelete: function(state) {
// We can't update columns of existing foreign key.
// We can't update columns of existing
return obj.isNew(state);
},
readonly: obj.isReadonly, cell: ()=>({
@ -425,7 +428,7 @@ export default class ExclusionConstraintSchema extends BaseUISchema {
validate(state, setError) {
if ((_.isUndefined(state.columns) || _.isNull(state.columns) || state.columns.length < 1)) {
setError('columns', gettext('Please specify columns for Foreign key.'));
setError('columns', gettext('Please specify columns for exclusion constraint.'));
return true;
}

View File

@ -110,18 +110,21 @@ export function getFieldMetaData(field, schema, value, viewHelperProps, onlyMode
(_.isUndefined(field.max_version) ? true :
(viewHelperProps.serverInfo.version <= field.max_version))));
let _readonly = viewHelperProps.inCatalog || (viewHelperProps.mode == 'properties');
if(!_readonly) {
_readonly = evalFunc(schema, readonly, value);
retData.readonly = viewHelperProps.inCatalog || (viewHelperProps.mode == 'properties');
if(!retData.readonly) {
retData.readonly = evalFunc(schema, readonly, value);
}
retData.readonly = _readonly;
let _visible = verInLimit;
_visible = _visible && evalFunc(schema, _.isUndefined(visible) ? true : visible, value);
retData.visible = Boolean(_visible);
retData.disabled = Boolean(evalFunc(schema, disabled, value));
retData.editable = evalFunc(schema, _.isUndefined(editable) ? true : editable, value);
retData.editable = !(viewHelperProps.inCatalog || (viewHelperProps.mode == 'properties'));
if(retData.editable) {
retData.editable = evalFunc(schema, _.isUndefined(editable) ? true : editable, value);
}
let {canAdd, canEdit, canDelete, canAddRow } = field;
retData.canAdd = _.isUndefined(canAdd) ? retData.canAdd : evalFunc(schema, canAdd, value);

View File

@ -789,6 +789,7 @@ function SchemaPropertiesView({
setLoaderText('Loading...');
getInitData().then((data)=>{
data = data || {};
schema.initialise(data);
if(!unmounted) {
setOrigData(data || {});
setLoaderText('');
@ -839,7 +840,7 @@ function SchemaPropertiesView({
schema={field.schema}
accessPath={[field.id]}
formErr={{}}
controlClassName={classes.controlRow}
containerClassName={classes.controlRow}
canAdd={false}
canEdit={false}
canDelete={false}