From 3d0cccebc5aa79d075e5973091d3d02a3bbf854a Mon Sep 17 00:00:00 2001 From: gazillion101 Date: Thu, 19 Jan 2023 00:24:38 -0800 Subject: [PATCH] Fix for deletion of connection in a datascope (was not workin) --- web/js/packages/portal/src/App/DatascopeForm.tsx | 4 ++++ web/js/packages/portal/src/App/Datascopes.tsx | 5 +++++ web/js/packages/portal/src/App/EditDatascopes.tsx | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/web/js/packages/portal/src/App/DatascopeForm.tsx b/web/js/packages/portal/src/App/DatascopeForm.tsx index 978c718c..652c981a 100644 --- a/web/js/packages/portal/src/App/DatascopeForm.tsx +++ b/web/js/packages/portal/src/App/DatascopeForm.tsx @@ -36,6 +36,7 @@ export interface DatascopeFormProps { onTablesMapUpdate: (ar: internal.TablesMap) => void, onAddTableRef: (ar: any) => void, connections: internal.Connection[], + onDeleteConnection: (c: string) => void, AddNewTable: (ar: string, dbtype: string, schema?: string, table?: string) => void, nameToConnection: internal.ConnectionMap, dbname: string, @@ -261,7 +262,10 @@ const DatascopeForm: React.FC = (props) => { let d = connections.filter(function (value, index, arr) { return value !== db.name; }) + // need to send upstream + setConnections(d) + props.onDeleteConnection(db.name) } let showDependencies = () => { // map tables diff --git a/web/js/packages/portal/src/App/Datascopes.tsx b/web/js/packages/portal/src/App/Datascopes.tsx index 2c3a92f0..53104867 100644 --- a/web/js/packages/portal/src/App/Datascopes.tsx +++ b/web/js/packages/portal/src/App/Datascopes.tsx @@ -148,6 +148,10 @@ export function AddDatascope(props) { let onTablesMapUpdate = (t: internal.TablesMap) => { setDatascope(t) } + let onDeleteConnection = (c:string) => { + delete datascope[c] + setDatascope(datascope) + } return (
{alert} @@ -162,6 +166,7 @@ export function AddDatascope(props) {
diff --git a/web/js/packages/portal/src/App/EditDatascopes.tsx b/web/js/packages/portal/src/App/EditDatascopes.tsx index f45334de..d2ea3023 100644 --- a/web/js/packages/portal/src/App/EditDatascopes.tsx +++ b/web/js/packages/portal/src/App/EditDatascopes.tsx @@ -372,6 +372,10 @@ export default function EditDatascopes() { }) } + let onDeleteConnection = (c:string) => { + delete datascope[c] + setDatascope(datascope) + } return (
{alert} @@ -471,6 +475,7 @@ export default function EditDatascopes() {
{selectedDatascopeDetails?.name}