-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: feat: new panels: evaluations and transformations
- Loading branch information
1 parent
998ef81
commit 13f5277
Showing
10 changed files
with
247 additions
and
44 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,49 @@ | ||
import React from "react"; | ||
import { TreeWrapper } from "./TreeWrapper"; | ||
import { SelectedBrickWrapper } from "./SelectedBrickWrapper"; | ||
import { BrickTreeContext } from "../libs/BrickTreeContext"; | ||
import { BrickData, BricksByMountPoint } from "../libs/interfaces"; | ||
import { SelectedBrickContext } from "../libs/SelectedBrickContext"; | ||
import { CollapsedBrickIdsContext } from "../libs/CollapsedBrickIdsContext"; | ||
import { ShowFullNameContext } from "../libs/ShowFullNameContext"; | ||
|
||
export function BricksPanel(): React.ReactElement { | ||
const [tree, setTree] = React.useState<BricksByMountPoint>(); | ||
const [collapsedBrickIds, setCollapsedBrickIds] = React.useState<number[]>( | ||
[] | ||
); | ||
const [showFullName, setShowFullName] = React.useState<boolean>(false); | ||
const [selectedBrick, setSelectedBrick] = React.useState<BrickData>(); | ||
|
||
return ( | ||
<div className="panel bricks-panel"> | ||
<SelectedBrickContext.Provider | ||
value={{ | ||
selectedBrick, | ||
setSelectedBrick, | ||
}} | ||
> | ||
<BrickTreeContext.Provider | ||
value={{ | ||
tree, | ||
setTree, | ||
}} | ||
> | ||
<CollapsedBrickIdsContext.Provider | ||
value={{ | ||
collapsedBrickIds, | ||
setCollapsedBrickIds, | ||
}} | ||
> | ||
<ShowFullNameContext.Provider | ||
value={{ showFullName, setShowFullName }} | ||
> | ||
<TreeWrapper /> | ||
</ShowFullNameContext.Provider> | ||
</CollapsedBrickIdsContext.Provider> | ||
</BrickTreeContext.Provider> | ||
<SelectedBrickWrapper /> | ||
</SelectedBrickContext.Provider> | ||
</div> | ||
); | ||
} |
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,69 @@ | ||
import React from "react"; | ||
import { PanelSelector } from "./PanelSelector"; | ||
import { PropTree, StandaloneValue } from "./PropTree"; | ||
|
||
export function EvaluationsPanel(): React.ReactElement { | ||
return ( | ||
<div className="panel evaluations-panel"> | ||
<div className="evaluations-toolbar"> | ||
<PanelSelector /> | ||
</div> | ||
<div className="table-view"> | ||
<table className="bp3-html-table bp3-html-table-bordered bp3-html-table-condensed"> | ||
<thead> | ||
<tr> | ||
<th>Expression</th> | ||
<th>Context</th> | ||
<th>Result</th> | ||
</tr> | ||
</thead> | ||
<tbody className="source-code"> | ||
<tr> | ||
<td> | ||
<StandaloneValue value="<% EVENT.detail %>" /> | ||
{/* <span className="prop-value-punctuation">{'"'}</span> | ||
<span className="prop-value-string">{'<% EVENT.detail %>'}</span> | ||
<span className="prop-value-punctuation">{'"'}</span> */} | ||
</td> | ||
<td> | ||
<PropTree | ||
properties={{ | ||
EVENT: { | ||
type: "oops", | ||
detail: "good", | ||
}, | ||
}} | ||
/> | ||
</td> | ||
<td> | ||
<StandaloneValue value="good" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<StandaloneValue value="<% DATA.map(item => item.id) %>" /> | ||
</td> | ||
<td> | ||
<PropTree | ||
properties={{ | ||
DATA: [ | ||
{ | ||
id: 1, | ||
}, | ||
{ | ||
id: 2, | ||
}, | ||
], | ||
}} | ||
/> | ||
</td> | ||
<td> | ||
<StandaloneValue value={[1, 2]} /> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
); | ||
} |
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,24 @@ | ||
import React from "react"; | ||
import { HTMLSelect } from "@blueprintjs/core"; | ||
import { useSelectedPanelContext } from "../libs/SelectedPanelContext"; | ||
|
||
export function PanelSelector(): React.ReactElement { | ||
const { selectedPanel, setSelectedPanel } = useSelectedPanelContext(); | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLSelectElement>): void => { | ||
setSelectedPanel(event.target.value); | ||
}; | ||
|
||
return ( | ||
<div> | ||
{ | ||
<HTMLSelect | ||
value={selectedPanel} | ||
options={["Bricks", "Evaluations", "Transformations"]} | ||
onChange={handleChange} | ||
minimal | ||
/> | ||
} | ||
</div> | ||
); | ||
} |
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,13 @@ | ||
import React from "react"; | ||
import { PanelSelector } from "./PanelSelector"; | ||
|
||
export function TransformationsPanel(): React.ReactElement { | ||
return ( | ||
<div className="panel transformations-panel"> | ||
<div className="transformations-toolbar"> | ||
<PanelSelector /> | ||
</div> | ||
<div className="table-view">TransformationsPanel</div> | ||
</div> | ||
); | ||
} |
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,14 @@ | ||
import React from "react"; | ||
|
||
export interface ContextOfSelectedPanel { | ||
selectedPanel?: string; | ||
setSelectedPanel?: React.Dispatch<string>; | ||
} | ||
|
||
export const SelectedPanelContext = React.createContext<ContextOfSelectedPanel>( | ||
{} | ||
); | ||
|
||
// istanbul ignore next | ||
export const useSelectedPanelContext = (): ContextOfSelectedPanel => | ||
React.useContext(SelectedPanelContext); |
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