public inbox for [email protected]
help / color / mirror / Atom feedFrom: Rahul Shirsat <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [patch][pgAdmin] RM6744 Unable to delete rows for Enum type in Create Type dialogue
Date: Thu, 16 Sep 2021 18:39:02 +0530
Message-ID: <CAKtn9dNS_sLM2VUr3Ea5uPH2Pn9JjpCA1UWHRrAhtv6zLqFHYg@mail.gmail.com> (raw)
Hi Hackers,
Please find the attached patch which resolves the below issue:
1. Enum Type - Unable to delete rows for Enum type in Create Type dialogue.
2. Range Type - Loading icons are shown in different drop down tabs.
--
*Rahul Shirsat*
Senior Software Engineer | EnterpriseDB Corporation.
Attachments:
[application/octet-stream] RM6744.patch (4.8K, 3-RM6744.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog.ui.js
index c31422185..e5afea0c2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog.ui.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog.ui.js
@@ -9,7 +9,6 @@
import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
-import SecLabelSchema from '../../../../static/js/sec_label.ui';
export default class CatalogSchema extends BaseUISchema {
constructor(fieldOptions = {}, initValues) {
@@ -51,14 +50,7 @@ export default class CatalogSchema extends BaseUISchema {
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',
- },{
- id: 'seclabels', label: gettext('Security labels'),
- schema: new SecLabelSchema(),
- editable: false, type: 'collection',
- group: gettext('Security'), mode: ['edit', 'create'],
- min_version: 90200,
- canAdd: false, canEdit: false, canDelete: false,
- },
+ }
];
}
}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.ui.js
index 16d13816b..d989ce6e2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.ui.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.ui.js
@@ -54,6 +54,8 @@ function getRangeSchema(nodeObj, treeNodeInfo, itemNodeData) {
}).catch((err)=>{
reject(err);
});
+ } else {
+ resolve(data);
}
});
},
@@ -80,6 +82,8 @@ function getRangeSchema(nodeObj, treeNodeInfo, itemNodeData) {
}).catch((err)=>{
reject(err);
});
+ } else {
+ resolve(data);
}
});
},
@@ -107,6 +111,8 @@ function getRangeSchema(nodeObj, treeNodeInfo, itemNodeData) {
}).catch((err)=>{
reject(err);
});
+ } else {
+ resolve(data);
}
});
},
@@ -157,11 +163,10 @@ class EnumerationSchema extends BaseUISchema {
return [
{
id: 'label', label: gettext('Label'),
- type: 'text', cell: 'text',
- cellHeaderClasses: 'width_percent_99',
- readonly: function (state) {
- return !obj.isNew(state);
- },
+ type: 'text', cell: 'text', minWidth: 640,
+ editable: (state) => {
+ return _.isUndefined(obj.isNew) ? true : obj.isNew(state);
+ }
}
];
}
@@ -1313,6 +1318,24 @@ export default class TypeSchema extends BaseUISchema {
this.nodeInfo = this.fieldOptions.node_info;
}
+ isInvalidColumnAdded(state) {
+
+ let tempCol = _.map(state.enum, 'label');
+ let dontAddColumn = false;
+
+ if(tempCol.length == 1 && tempCol[0] == undefined) {
+ dontAddColumn = true;
+ } else {
+ tempCol.forEach(function(enumVal) {
+ if(enumVal == undefined) {
+ dontAddColumn = true;
+ return;
+ }
+ });
+ }
+ return dontAddColumn;
+ }
+
schemaCheck(state) {
if(this.fieldOptions.node_info && 'schema' in this.fieldOptions.node_info)
{
@@ -1420,14 +1443,17 @@ export default class TypeSchema extends BaseUISchema {
{
id: 'enum', label: gettext('Enumeration type'),
schema: new EnumerationSchema(),
- editable: true,
type: 'collection',
group: gettext('Definition'), mode: ['edit', 'create'],
- canAdd: true, canEdit: false,
- canDelete: function(state) {
+ canAddRow: function(state) {
+ return !obj.isInvalidColumnAdded(state);
+ },
+ canEdit: false,
+ canDeleteRow: function(state) {
// We will disable it if it's in 'edit' mode
- return !obj.isNew(state);
+ return obj.isNew(state);
},
+ canEditRow: false,
disabled: () => obj.inCatalog(),
deps: ['typtype'],
uniqueCol : ['label'],
diff --git a/web/pgadmin/browser/static/js/node_view.jsx b/web/pgadmin/browser/static/js/node_view.jsx
index cab909d1f..1aa8dc42b 100644
--- a/web/pgadmin/browser/static/js/node_view.jsx
+++ b/web/pgadmin/browser/static/js/node_view.jsx
@@ -173,7 +173,8 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
let schema = nodeObj.getSchema.call(nodeObj, treeNodeInfo, itemNodeData);
// Show/Hide security group for nodes under the catalog
- if('catalog' in treeNodeInfo) {
+ if('catalog' in treeNodeInfo
+ && formType !== 'tab') {
schema.filterGroups = [gettext('Security')];
}
view thread (10+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [patch][pgAdmin] RM6744 Unable to delete rows for Enum type in Create Type dialogue
In-Reply-To: <CAKtn9dNS_sLM2VUr3Ea5uPH2Pn9JjpCA1UWHRrAhtv6zLqFHYg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox