public inbox for [email protected]
help / color / mirror / Atom feedFrom: Pradip Parkale <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM6780]: While inheriting table, if newly added column present in parent table then merge columns
Date: Tue, 19 Oct 2021 14:31:01 +0530
Message-ID: <CAJ9T6StR12jJW=t3GLToU7JFr9qpxxY+WNeWe8qyjxfG1-33Uw@mail.gmail.com> (raw)
Hi Hackers,
Please find the attached patch which resolved #6780 While inheriting
table, if newly added column present in parent table then merge columns.
--
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation
Attachments:
[application/octet-stream] RM6780.patch (2.2K, 3-RM6780.patch)
download | inline diff:
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 a8e1b8cca..f8127cc3f 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
@@ -537,7 +537,24 @@ export default class TableSchema extends BaseUISchema {
tabColsResponse.then((res)=>{
resolve((state)=>{
let finalCols = res.map((col)=>obj.columnsSchema.getNewData(col));
- finalCols = [...state.columns, ...finalCols];
+ let currentSelectedCols = [];
+ if (!_.isEmpty(state.columns)){
+ currentSelectedCols = state.columns;
+ }
+ let colNameList = [];
+ state.columns.forEach((col=>{
+ colNameList.push(col.name);
+ }));
+ for (let col of Object.values(finalCols)) {
+ if(!colNameList.includes(col.name)){
+ currentSelectedCols.push(col);
+ }
+ }
+
+ if (!_.isEmpty(currentSelectedCols)){
+ finalCols = currentSelectedCols;
+ }
+
obj.changeColumnOptions(finalCols);
return {
adding_inherit_cols: false,
diff --git a/web/regression/javascript/schema_ui_files/table.ui.spec.js b/web/regression/javascript/schema_ui_files/table.ui.spec.js
index 0ddf9accd..c225c532b 100644
--- a/web/regression/javascript/schema_ui_files/table.ui.spec.js
+++ b/web/regression/javascript/schema_ui_files/table.ui.spec.js
@@ -277,10 +277,10 @@ describe('TableSchema', ()=>{
},
});
deferredPromise.then((depChange)=>{
- let finalCols = [newCol, newCol];
+ let finalCols = [newCol];
expect(depChange(state)).toEqual({
adding_inherit_cols: false,
- columns: [newCol, newCol],
+ columns: [newCol],
});
expect(schemaObj.changeColumnOptions).toHaveBeenCalledWith(finalCols);
done();
view thread (2+ 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: [pgAdmin][RM6780]: While inheriting table, if newly added column present in parent table then merge columns
In-Reply-To: <CAJ9T6StR12jJW=t3GLToU7JFr9qpxxY+WNeWe8qyjxfG1-33Uw@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