mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where the Properties panel was not loaded for catalog tables. Fixes #6778
This commit is contained in:
parent
f192be3667
commit
78c8fbbe00
@ -363,11 +363,9 @@ export default class ColumnSchema extends BaseUISchema {
|
|||||||
},{
|
},{
|
||||||
id: 'defval', label: gettext('Default'), cell: 'text',
|
id: 'defval', label: gettext('Default'), cell: 'text',
|
||||||
type: 'text', group: gettext('Constraints'), deps: ['cltype', 'colconstype'],
|
type: 'text', group: gettext('Constraints'), deps: ['cltype', 'colconstype'],
|
||||||
|
readonly: obj.inSchemaWithColumnCheck,
|
||||||
disabled: function(state) {
|
disabled: function(state) {
|
||||||
var isDisabled = false;
|
var isDisabled = ['serial', 'bigserial', 'smallserial'].indexOf(state.cltype) > -1;
|
||||||
if(!obj.inSchemaWithModelCheck(state)) {
|
|
||||||
isDisabled = ['serial', 'bigserial', 'smallserial'].indexOf(state.cltype) > -1;
|
|
||||||
}
|
|
||||||
isDisabled = isDisabled || state.colconstype != 'n';
|
isDisabled = isDisabled || state.colconstype != 'n';
|
||||||
return isDisabled;
|
return isDisabled;
|
||||||
}, depChange: (state)=>{
|
}, depChange: (state)=>{
|
||||||
@ -381,7 +379,7 @@ export default class ColumnSchema extends BaseUISchema {
|
|||||||
}
|
}
|
||||||
}, editable: function(state) {
|
}, editable: function(state) {
|
||||||
// inheritedfrom has value then we should disable it
|
// inheritedfrom has value then we should disable it
|
||||||
if (!isEmptyString(state.inheritedfrom)) {
|
if (!isEmptyString(state.inheritedfrom) || !this.editableCheckForTable(state)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -61,7 +61,7 @@ export function getNodeTableSchema(treeNodeInfo, itemNodeData, pgBrowser) {
|
|||||||
()=>getNodeAjaxOptions('get_op_class', pgBrowser.Nodes['table'], treeNodeInfo, itemNodeData),
|
()=>getNodeAjaxOptions('get_op_class', pgBrowser.Nodes['table'], treeNodeInfo, itemNodeData),
|
||||||
{
|
{
|
||||||
relowner: pgBrowser.serverInfo[treeNodeInfo.server._id].user.name,
|
relowner: pgBrowser.serverInfo[treeNodeInfo.server._id].user.name,
|
||||||
schema: treeNodeInfo.schema._label,
|
schema: treeNodeInfo.schema?._label,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -69,6 +69,7 @@ export function getNodeTableSchema(treeNodeInfo, itemNodeData, pgBrowser) {
|
|||||||
export class ConstraintsSchema extends BaseUISchema {
|
export class ConstraintsSchema extends BaseUISchema {
|
||||||
constructor(nodeInfo, getFkObj, getExConsObj, otherOptions) {
|
constructor(nodeInfo, getFkObj, getExConsObj, otherOptions) {
|
||||||
super();
|
super();
|
||||||
|
this.nodeInfo = nodeInfo;
|
||||||
this.primaryKeyObj = new PrimaryKeySchema({
|
this.primaryKeyObj = new PrimaryKeySchema({
|
||||||
spcname: otherOptions.spcname,
|
spcname: otherOptions.spcname,
|
||||||
}, nodeInfo);
|
}, nodeInfo);
|
||||||
@ -99,6 +100,7 @@ export class ConstraintsSchema extends BaseUISchema {
|
|||||||
group: gettext('Primary Key'), mode: ['edit', 'create'],
|
group: gettext('Primary Key'), mode: ['edit', 'create'],
|
||||||
canEdit: true, canDelete: true, deps:['is_partitioned', 'typname'],
|
canEdit: true, canDelete: true, deps:['is_partitioned', 'typname'],
|
||||||
columns : ['name', 'columns'],
|
columns : ['name', 'columns'],
|
||||||
|
disabled: this.inCatalog,
|
||||||
canAdd: function(state) {
|
canAdd: function(state) {
|
||||||
if (state.is_partitioned && obj.top.getServerVersion() < 110000) {
|
if (state.is_partitioned && obj.top.getServerVersion() < 110000) {
|
||||||
return false;
|
return false;
|
||||||
@ -135,6 +137,7 @@ export class ConstraintsSchema extends BaseUISchema {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
columns : ['name', 'columns','references_table_name'],
|
columns : ['name', 'columns','references_table_name'],
|
||||||
|
disabled: this.inCatalog,
|
||||||
canAddRow: obj.anyColumnAdded,
|
canAddRow: obj.anyColumnAdded,
|
||||||
depChange: (state)=>{
|
depChange: (state)=>{
|
||||||
if (state.is_partitioned && obj.top.getServerVersion() < 110000 || state.columns?.length <= 0) {
|
if (state.is_partitioned && obj.top.getServerVersion() < 110000 || state.columns?.length <= 0) {
|
||||||
@ -149,6 +152,7 @@ export class ConstraintsSchema extends BaseUISchema {
|
|||||||
canEdit: true, canDelete: true, deps:['is_partitioned'],
|
canEdit: true, canDelete: true, deps:['is_partitioned'],
|
||||||
canAdd: true,
|
canAdd: true,
|
||||||
columns : ['name', 'consrc'],
|
columns : ['name', 'consrc'],
|
||||||
|
disabled: this.inCatalog,
|
||||||
},{
|
},{
|
||||||
id: 'unique_constraint', label: '',
|
id: 'unique_constraint', label: '',
|
||||||
schema: this.uniqueConsObj,
|
schema: this.uniqueConsObj,
|
||||||
@ -156,6 +160,7 @@ export class ConstraintsSchema extends BaseUISchema {
|
|||||||
group: gettext('Unique'), mode: ['edit', 'create'],
|
group: gettext('Unique'), mode: ['edit', 'create'],
|
||||||
canEdit: true, canDelete: true, deps:['is_partitioned', 'typname'],
|
canEdit: true, canDelete: true, deps:['is_partitioned', 'typname'],
|
||||||
columns : ['name', 'columns'],
|
columns : ['name', 'columns'],
|
||||||
|
disabled: this.inCatalog,
|
||||||
canAdd: function(state) {
|
canAdd: function(state) {
|
||||||
if (state.is_partitioned && obj.top.getServerVersion() < 110000) {
|
if (state.is_partitioned && obj.top.getServerVersion() < 110000) {
|
||||||
return false;
|
return false;
|
||||||
@ -175,6 +180,7 @@ export class ConstraintsSchema extends BaseUISchema {
|
|||||||
group: gettext('Exclude'), mode: ['edit', 'create'],
|
group: gettext('Exclude'), mode: ['edit', 'create'],
|
||||||
canEdit: true, canDelete: true, deps:['is_partitioned'],
|
canEdit: true, canDelete: true, deps:['is_partitioned'],
|
||||||
columns : ['name', 'columns', 'constraint'],
|
columns : ['name', 'columns', 'constraint'],
|
||||||
|
disabled: this.inCatalog,
|
||||||
canAdd: function(state) {
|
canAdd: function(state) {
|
||||||
if (state.is_partitioned && obj.top.getServerVersion() < 110000) {
|
if (state.is_partitioned && obj.top.getServerVersion() < 110000) {
|
||||||
return false;
|
return false;
|
||||||
@ -350,8 +356,9 @@ export default class TableSchema extends BaseUISchema {
|
|||||||
if (!isEmptyString(state.typname)) {
|
if (!isEmptyString(state.typname)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for column grid when to edit/delete (for each row)
|
// Check for column grid when to edit/delete (for each row)
|
||||||
@ -559,13 +566,7 @@ export default class TableSchema extends BaseUISchema {
|
|||||||
group: gettext('Columns'),
|
group: gettext('Columns'),
|
||||||
schema: this.columnsSchema,
|
schema: this.columnsSchema,
|
||||||
mode: ['create', 'edit'],
|
mode: ['create', 'edit'],
|
||||||
disabled: function() {
|
disabled: this.inCatalog,
|
||||||
if(this.nodeInfo && 'catalog' in this.nodeInfo)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
deps: ['typname', 'is_partitioned'],
|
deps: ['typname', 'is_partitioned'],
|
||||||
depChange: (state, source, topState, actionObj)=>{
|
depChange: (state, source, topState, actionObj)=>{
|
||||||
if(source[0] === 'columns') {
|
if(source[0] === 'columns') {
|
||||||
|
@ -125,8 +125,11 @@ export function getFieldMetaData(field, schema, value, viewHelperProps, onlyMode
|
|||||||
|
|
||||||
let {canAdd, canEdit, canDelete, canAddRow } = field;
|
let {canAdd, canEdit, canDelete, canAddRow } = field;
|
||||||
retData.canAdd = _.isUndefined(canAdd) ? retData.canAdd : evalFunc(schema, canAdd, value);
|
retData.canAdd = _.isUndefined(canAdd) ? retData.canAdd : evalFunc(schema, canAdd, value);
|
||||||
|
retData.canAdd = !disabled && retData.canAdd;
|
||||||
retData.canEdit = _.isUndefined(canEdit) ? retData.canEdit : evalFunc(schema, canEdit, value);
|
retData.canEdit = _.isUndefined(canEdit) ? retData.canEdit : evalFunc(schema, canEdit, value);
|
||||||
|
retData.canEdit = !disabled && retData.canEdit;
|
||||||
retData.canDelete = _.isUndefined(canDelete) ? retData.canDelete : evalFunc(schema, canDelete, value);
|
retData.canDelete = _.isUndefined(canDelete) ? retData.canDelete : evalFunc(schema, canDelete, value);
|
||||||
|
retData.canDelete = !disabled && retData.canDelete;
|
||||||
retData.canAddRow = _.isUndefined(canAddRow) ? retData.canAddRow : evalFunc(schema, canAddRow, value);
|
retData.canAddRow = _.isUndefined(canAddRow) ? retData.canAddRow : evalFunc(schema, canAddRow, value);
|
||||||
return retData;
|
return retData;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user