Skip to content

Commit

Permalink
Fix for deletion of connection in a datascope (was not workin)
Browse files Browse the repository at this point in the history
  • Loading branch information
gazillion101 authored and kamyshdm committed Jan 19, 2023
1 parent 29efbc4 commit 3d0ccce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions web/js/packages/portal/src/App/DatascopeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -261,7 +262,10 @@ const DatascopeForm: React.FC<DatascopeFormProps> = (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
Expand Down
5 changes: 5 additions & 0 deletions web/js/packages/portal/src/App/Datascopes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className=" text-left">
{alert}
Expand All @@ -162,6 +166,7 @@ export function AddDatascope(props) {
<Form onSubmit={handleSubmit} ref={form} noValidate validated={validated}>
<DatascopeForm edit={false} dbname={dbname} onDbname={setDbname} onTablesMapUpdate={onTablesMapUpdate}
onEditTable={onEditTable} AddNewTable={addNewTable}
onDeleteConnection={onDeleteConnection}
onAddTableRef={onAddTableRef} connections={conns} setAlert={setAlert}
nameToConnection={remap}/>

Expand Down
5 changes: 5 additions & 0 deletions web/js/packages/portal/src/App/EditDatascopes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ export default function EditDatascopes() {
})

}
let onDeleteConnection = (c:string) => {
delete datascope[c]
setDatascope(datascope)
}
return (
<div className=" text-left">
{alert}
Expand Down Expand Up @@ -471,6 +475,7 @@ export default function EditDatascopes() {
<h5>{selectedDatascopeDetails?.name}</h5>
<Form onSubmit={handleSubmit} ref={form} noValidate validated={validated}>
<DatascopeForm edit={true} dbname={dbname} onDbname={setDbname}
onDeleteConnection={onDeleteConnection}
onTablesMapUpdate={onTablesMapUpdate} onEditTable={onEditTable}
AddNewTable={addNewTable} onAddTableRef={onAddTableRef} connections={conns}
setAlert={setAlert} nameToConnection={remap}
Expand Down

0 comments on commit 3d0ccce

Please sign in to comment.