Fixed an issue where the index is not loaded in the Unique Constraint dialog. Fixes #6857

This commit is contained in:
Aditya Toshniwal
2021-10-04 19:28:27 +05:30
committed by Akshay Joshi
parent 40b8da8223
commit 7eaa3179ad
9 changed files with 33 additions and 26 deletions

View File

@@ -19,6 +19,7 @@ import _ from 'lodash';
import { getNodeExclusionConstraintSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.ui';
import * as legacyConnector from 'sources/helpers/legacyConnector';
import * as nodeAjax from '../../../pgadmin/browser/static/js/node_ajax';
import TableSchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui';
class SchemaInColl extends BaseUISchema {
constructor(schemaObj) {
@@ -196,6 +197,7 @@ describe('ExclusionConstraintSchema', ()=>{
it('depChange', ()=>{
let state = {columns: [{local_column: 'id'}]};
schemaObj.top = new TableSchema({}, null);
expect(getFieldDepChange(schemaObj, 'columns')(state, ['columns', 0], null, {
type: SCHEMA_STATE_ACTIONS.DELETE_ROW,
oldState: {

View File

@@ -18,6 +18,7 @@ import BaseUISchema from '../../../pgadmin/static/js/SchemaView/base_schema.ui';
import _ from 'lodash';
import * as nodeAjax from '../../../pgadmin/browser/static/js/node_ajax';
import { getNodeForeignKeySchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.ui';
import TableSchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui';
class SchemaInColl extends BaseUISchema {
constructor(schemaObj) {
@@ -197,8 +198,7 @@ describe('ForeignKeySchema', ()=>{
expect(getFieldDepChange(schemaObj, 'autoindex')(state, null, null, actionObj)).toEqual({});
state.oid = null;
schemaObj.nodeInfo = {table: {}};
schemaObj.top = schemaObj;
schemaObj.top = new TableSchema({}, null);
expect(getFieldDepChange(schemaObj, 'autoindex')(state, null, null, actionObj)).toEqual({
autoindex: false,
coveringindex: '',

View File

@@ -17,6 +17,7 @@ import SchemaView, { SCHEMA_STATE_ACTIONS } from '../../../pgadmin/static/js/Sch
import BaseUISchema from '../../../pgadmin/static/js/SchemaView/base_schema.ui';
import _ from 'lodash';
import PrimaryKeySchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.ui';
import TableSchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui';
class SchemaInColl extends BaseUISchema {
constructor(schemaObj) {
@@ -172,6 +173,7 @@ describe('PrimaryKeySchema', ()=>{
expect(getFieldDepChange(schemaObj, 'condeferrable')(state)).toEqual({});
expect(getFieldDepChange(schemaObj, 'condeferred')(state)).toEqual({});
schemaObj.top = new TableSchema({}, null);
expect(getFieldDepChange(schemaObj, 'columns')(state, ['columns', 0], null, {
type: SCHEMA_STATE_ACTIONS.DELETE_ROW,
oldState: {

View File

@@ -17,6 +17,7 @@ import SchemaView, { SCHEMA_STATE_ACTIONS } from '../../../pgadmin/static/js/Sch
import BaseUISchema from '../../../pgadmin/static/js/SchemaView/base_schema.ui';
import _ from 'lodash';
import UniqueConstraintSchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.ui';
import TableSchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui';
class SchemaInColl extends BaseUISchema {
constructor(schemaObj) {
@@ -171,6 +172,7 @@ describe('UniqueConstraintSchema', ()=>{
expect(getFieldDepChange(schemaObj, 'condeferrable')(state)).toEqual({});
expect(getFieldDepChange(schemaObj, 'condeferred')(state)).toEqual({});
schemaObj.top = new TableSchema({}, null);
expect(getFieldDepChange(schemaObj, 'columns')(state, ['columns', 0], null, {
type: SCHEMA_STATE_ACTIONS.DELETE_ROW,
oldState: {