Skip to content

Commit

Permalink
Merge branch 'master' into bugs/523
Browse files Browse the repository at this point in the history
  • Loading branch information
hkfb committed Sep 3, 2021
2 parents 60b10d3 + 1382fac commit ebb151e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/webviz-subsurface-components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
- name: 📚 Update Storybook and GitHub demo application
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')) && matrix.python-version == '3.6'
run: |
cp ./react/{index.html,output.css,output.js,storybook-static} ..
cp -r ./react/{index.html,output.css,output.js,storybook-static} ..
git config --local user.email "webviz-github-action"
git config --local user.name "webviz-github-action"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const GroupTreeComponent: React.FC<Props> = React.memo(
({ id, data }: Props) => {
return (
<DataProvider id={id} data={data}>
<GroupTreeViewer />
<GroupTreeViewer id={id} />
</DataProvider>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ const useStyles = makeStyles(() =>
})
);

const GroupTreeViewer: React.FC = () => {
interface Props {
id: string;
}

const GroupTreeViewer: React.FC<Props> = ({ id }: Props) => {
const classes = useStyles();
const divRef = useRef<HTMLDivElement>(null);
const data = useContext(DataContext);
Expand All @@ -35,13 +39,13 @@ const GroupTreeViewer: React.FC = () => {
);
useEffect(() => {
// Clear possible elements added from earlier updates.
const node = document.getElementById("grouptree_tree");
const node = document.getElementById(id);
if (node) {
node.innerHTML = "";
}

renderer.current = new GroupTree(
"#grouptree_tree",
id,
cloneDeep(data),
"oilrate",
currentDateTime
Expand All @@ -62,7 +66,7 @@ const GroupTreeViewer: React.FC = () => {
return (
<div className={classes.root}>
<SettingsBar />
<div id="grouptree_tree" ref={divRef} />
<div id={id} ref={divRef} />
{/* <GroupTreePlot root={root} currentFlowRate={currentFlowRate} /> */}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export default class GroupTree {
* @param defaultFlowrate
*/
constructor(dom_element_id, tree_data, defaultFlowrate, currentDateTime) {
// Add "#" if missing.
if (dom_element_id.charAt(0) !== "#") {
dom_element_id = "#" + dom_element_id;
}

this._currentFlowrate = defaultFlowrate;
this._currentDateTime = currentDateTime;
this._transitionTime = 200;
Expand Down

0 comments on commit ebb151e

Please sign in to comment.