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 c3f160b48..72e60fb4c 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,12 +4,14 @@ import BaseUISchema from 'sources/SchemaView/base_schema.ui'; import { emptyValidator, isEmptyString } from '../../../../../../../../static/js/validators'; export class PartitionKeysSchema extends BaseUISchema { - constructor(columns=[]) { + constructor(columns=[], getCollations, getOperatorClass) { super({ key_type: 'column', }); this.columns = columns; this.columnsReloadBasis = false; + this.getCollations = getCollations; + this.getOperatorClass = getOperatorClass; } changeColumnOptions(columns) { @@ -69,7 +71,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.getCollations, mode: ['create', 'properties', 'edit'], editable: function(state) { if(state.key_type == 'expression') { return false; @@ -88,7 +90,7 @@ export class PartitionKeysSchema extends BaseUISchema { return true; }, disabled: ()=>{return !(obj.isNew()); }, - options: obj.top.getOperatorClass(), mode: ['create', 'properties', 'edit'], + options: obj.getOperatorClass, mode: ['create', 'properties', 'edit'], }]; } @@ -111,7 +113,7 @@ export class PartitionKeysSchema extends BaseUISchema { } } export class PartitionsSchema extends BaseUISchema { - constructor(nodeInfo) { + constructor(nodeInfo, getCollations, getOperatorClass) { super({ oid: undefined, is_attach: false, @@ -126,7 +128,7 @@ export class PartitionsSchema extends BaseUISchema { sub_partition_type: 'range', }); - this.subPartitionsObj = new PartitionKeysSchema(); + this.subPartitionsObj = new PartitionKeysSchema([], getCollations, getOperatorClass); this.nodeInfo = nodeInfo; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui.js index 1e55400f7..88c986959 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui.js @@ -300,14 +300,12 @@ export default class TableSchema extends BaseUISchema { this.getPrivilegeRoleSchema = getPrivilegeRoleSchema; this.nodeInfo = nodeInfo; this.getColumns = getColumns; - this.getCollations = getCollations; - this.getOperatorClass = getOperatorClass; - this.partitionKeysObj = new PartitionKeysSchema(); - this.partitionsObj = new PartitionsSchema(this.nodeInfo); + this.partitionsObj = new PartitionsSchema(this.nodeInfo, getCollations, getOperatorClass); this.constraintsObj = this.schemas.constraints(); this.columnsSchema = this.schemas.columns(); this.vacuumSettingsSchema = this.schemas.vacuum_settings(); + this.partitionKeysObj = new PartitionKeysSchema([], getCollations, getOperatorClass); } get idAttribute() { 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 df73685fd..9e55da6fb 100644 --- a/web/regression/javascript/schema_ui_files/partition.ui.spec.js +++ b/web/regression/javascript/schema_ui_files/partition.ui.spec.js @@ -46,9 +46,6 @@ 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 3745f1320..207e4c9de 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 @@ -55,10 +55,6 @@ describe('PartitionKeysSchema', ()=>{ spyOn(nodeAjax, 'getNodeAjaxOptions').and.returnValue(Promise.resolve([])); spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([])); let partitionObj = new PartitionKeysSchema(); - partitionObj.top = { - getCollations : ()=>{}, - getOperatorClass : ()=>{}, - }; schemaObj = new SchemaInColl(partitionObj); }); @@ -171,8 +167,6 @@ 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(() => {