From 8c3d1e48c817113af94934bde9878a646d17a6f8 Mon Sep 17 00:00:00 2001 From: yogeshmahajan-1903 Date: Mon, 16 Dec 2024 11:48:50 +0530 Subject: [PATCH] Allow deleting the entry while creating/adding new label to enumeration type.#8208 --- .../databases/schemas/types/static/js/type.ui.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 573a650d6ea..6b958361388 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 @@ -209,7 +209,7 @@ class EnumerationSchema extends BaseUISchema { return [ { id: 'label', label: gettext('Label'), - type: 'text', cell: 'text', minWidth: 640, + type: 'text', cell: 'text', minWidth: 620, editable: (state) => { return _.isUndefined(obj.isNew) ? true : obj.isNew(state); } @@ -1301,6 +1301,7 @@ export default class TypeSchema extends BaseUISchema { }, { id: 'enum', label: gettext('Enumeration type'), + editable: true, schema: new EnumerationSchema(), type: 'collection', group: gettext('Definition'), mode: ['edit', 'create'], @@ -1308,14 +1309,12 @@ export default class TypeSchema extends BaseUISchema { return !obj.isInvalidColumnAdded(state); }, canEdit: false, - canDeleteRow: function(state) { - // We will disable it if it's in 'edit' mode - return obj.isNew(state); - }, - canEditRow: false, + canDelete: true, + canReorder: (state)=>(this.isNew(state)), + canDeleteRow: (state)=>(_.isUndefined(state.label)), + canEditRow: true, disabled: () => obj.inCatalog(), deps: ['typtype'], - uniqueCol : ['label'], visible: (state) => isVisible(state, 'e'), }, { type: 'nested-fieldset',