diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/partition.utils.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/partition.utils.ui.js index 66c01b05c..c3f160b48 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/partition.utils.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/partition.utils.ui.js @@ -4,30 +4,18 @@ import BaseUISchema from 'sources/SchemaView/base_schema.ui'; import { emptyValidator, isEmptyString } from '../../../../../../../../static/js/validators'; export class PartitionKeysSchema extends BaseUISchema { - constructor(columns=[], getOperatorClass, getCollations) { + constructor(columns=[]) { super({ key_type: 'column', }); this.columns = columns; this.columnsReloadBasis = false; - this.getOperatorClass = getOperatorClass; - this.getCollations = getCollations; - this.op_class_types = []; } changeColumnOptions(columns) { this.columns = columns; } - setOpClassTypes(options) { - - if(!options || (_.isArray(options) && options.length == 0)) - return this.op_class_types; - - if(this.op_class_types.length == 0) - this.op_class_types = options; - } - get baseFields() { let obj = this; return [{ @@ -81,7 +69,7 @@ export class PartitionKeysSchema extends BaseUISchema { },{ id: 'collationame', label: gettext('Collation'), cell: 'select', type: 'select', group: gettext('partition'), deps:['key_type'], - options: obj._top.getCollations(), mode: ['create', 'properties', 'edit'], + options: obj.top.getCollations(), mode: ['create', 'properties', 'edit'], editable: function(state) { if(state.key_type == 'expression') { return false; @@ -100,8 +88,7 @@ export class PartitionKeysSchema extends BaseUISchema { return true; }, disabled: ()=>{return !(obj.isNew()); }, - options: obj._top.getOperatorClass(), mode: ['create', 'properties', 'edit'], - optionsLoaded: (options)=>{obj.setOpClassTypes(options);}, + options: obj.top.getOperatorClass(), mode: ['create', 'properties', 'edit'], }]; } diff --git a/web/regression/javascript/schema_ui_files/partition.ui.spec.js b/web/regression/javascript/schema_ui_files/partition.ui.spec.js index 9e55da6fb..df73685fd 100644 --- a/web/regression/javascript/schema_ui_files/partition.ui.spec.js +++ b/web/regression/javascript/schema_ui_files/partition.ui.spec.js @@ -46,6 +46,9 @@ describe('PartitionTableSchema', ()=>{ } } }); + schemaObj.top = schemaObj; + schemaObj.top.getCollations = ()=>Promise.resolve({}); + schemaObj.top.getOperatorClass = ()=>Promise.resolve({}); }); afterAll(() => { diff --git a/web/regression/javascript/schema_ui_files/partition.utils.ui.spec.js b/web/regression/javascript/schema_ui_files/partition.utils.ui.spec.js index 78c09afbf..3745f1320 100644 --- a/web/regression/javascript/schema_ui_files/partition.utils.ui.spec.js +++ b/web/regression/javascript/schema_ui_files/partition.utils.ui.spec.js @@ -29,6 +29,8 @@ class SchemaInColl extends BaseUISchema { this.collSchema = schemaObj; this.columns = columns; } + getCollations() {} + getOperatorClass() {} get baseFields() { return [{ @@ -52,7 +54,12 @@ describe('PartitionKeysSchema', ()=>{ mount = createMount(); spyOn(nodeAjax, 'getNodeAjaxOptions').and.returnValue(Promise.resolve([])); spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([])); - schemaObj = new SchemaInColl(new PartitionKeysSchema()); + let partitionObj = new PartitionKeysSchema(); + partitionObj.top = { + getCollations : ()=>{}, + getOperatorClass : ()=>{}, + }; + schemaObj = new SchemaInColl(partitionObj); }); afterAll(() => { @@ -164,6 +171,8 @@ describe('PartitionsSchema', ()=>{ spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([])); schemaObj = new PartitionsSchema(); schemaObj.top = schemaObj; + schemaObj.top.getCollations = ()=>Promise.resolve({}); + schemaObj.top.getOperatorClass = ()=>Promise.resolve({}); }); afterAll(() => {