-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor into existing Workspace component
Signed-off-by: Tyler Ohlsen <[email protected]>
- Loading branch information
Showing
8 changed files
with
237 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { Node, Edge } from 'reactflow'; | ||
import { IComponent } from '../public/component_types'; | ||
|
||
/** | ||
* TODO: remove hardcoded nodes/edges. | ||
* | ||
* Converts the stored IComponents into the low-level ReactFlow nodes and edges. | ||
* This may change entirely, depending on how/where the ReactFlow JSON will be | ||
* persisted. Using this stub helper fn in the meantime. | ||
*/ | ||
export function convertToReactFlowData(components: IComponent[]) { | ||
const dummyNodes = [ | ||
{ | ||
id: 'semantic-search', | ||
position: { x: 40, y: 10 }, | ||
data: { label: 'Semantic Search' }, | ||
type: 'group', | ||
style: { | ||
height: 110, | ||
width: 700, | ||
}, | ||
}, | ||
{ | ||
id: 'model', | ||
position: { x: 25, y: 25 }, | ||
data: { label: 'Deployed Model ID' }, | ||
type: 'default', | ||
parentNode: 'semantic-search', | ||
extent: 'parent', | ||
}, | ||
{ | ||
id: 'ingest-pipeline', | ||
position: { x: 262, y: 25 }, | ||
data: { label: 'Ingest Pipeline Name' }, | ||
type: 'default', | ||
parentNode: 'semantic-search', | ||
extent: 'parent', | ||
}, | ||
] as Array< | ||
Node< | ||
{ | ||
label: string; | ||
}, | ||
string | undefined | ||
> | ||
>; | ||
|
||
const dummyEdges = [ | ||
{ | ||
id: 'e1-2', | ||
source: 'model', | ||
target: 'ingest-pipeline', | ||
style: { | ||
strokeWidth: 2, | ||
stroke: 'black', | ||
}, | ||
markerEnd: { | ||
type: 'arrow', | ||
strokeWidth: 1, | ||
color: 'black', | ||
}, | ||
}, | ||
] as Array<Edge<any>>; | ||
|
||
return { | ||
rfNodes: dummyNodes, | ||
rfEdges: dummyEdges, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,9 @@ | |
flex-grow: 1; | ||
height: 100%; | ||
} | ||
|
||
.workspace { | ||
width: 50vh; | ||
height: 50vh; | ||
padding: 0; | ||
} |
Oops, something went wrong.