From a3f42ec98c72ff52b24c5e6a2efa7a1790d62d6f Mon Sep 17 00:00:00 2001 From: Saurabh Asthana Date: Fri, 26 Sep 2025 15:23:08 -0700 Subject: [PATCH] show links --- timur/lib/client/jsx/components/model_map.jsx | 17 +++++++- .../jsx/components/model_map/model_link.jsx | 39 +++++++++++++++---- .../model_map/model_map_graphic.jsx | 24 +++++++++++- timur/lib/client/scss/model_map.scss | 7 ---- 4 files changed, 71 insertions(+), 16 deletions(-) diff --git a/timur/lib/client/jsx/components/model_map.jsx b/timur/lib/client/jsx/components/model_map.jsx index 8ab0075fd1..adf6fbce71 100644 --- a/timur/lib/client/jsx/components/model_map.jsx +++ b/timur/lib/client/jsx/components/model_map.jsx @@ -13,6 +13,10 @@ import AttributeReport from './model_map/attribute_report'; import MapHeading from './model_map/map_heading'; import ModelReport from './model_map/model_report'; import ModelMapGraphic from './model_map/model_map_graphic'; +import Tooltip from '@material-ui/core/Tooltip'; +import ToggleButton from '@material-ui/lab/ToggleButton'; +import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup'; +import CallMadeIcon from '@material-ui/icons/CallMade'; import {selectUser} from 'etna-js/selectors/user-selector'; import {isAdmin} from 'etna-js/utils/janus'; @@ -123,6 +127,8 @@ const ModelMap = ({}) => { return isAdmin(user, CONFIG.project_name); }, [user, CONFIG.project_name]); + const [options,setOptions] = useState([]); + return ( @@ -130,11 +136,20 @@ const ModelMap = ({}) => { className={classes.heading} name='Project' title={full_name} - /> + > + setOptions(f) } size='small'> + + + + + + + diff --git a/timur/lib/client/jsx/components/model_map/model_link.jsx b/timur/lib/client/jsx/components/model_map/model_link.jsx index fd88f73618..4238517686 100644 --- a/timur/lib/client/jsx/components/model_map/model_link.jsx +++ b/timur/lib/client/jsx/components/model_map/model_link.jsx @@ -3,27 +3,52 @@ import React from 'react'; const dist = (p1, p2) => Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y)); -const ModelLink = ({center, parent, size}) => { +const ModelLink = ({center, parent, size, type}) => { if (!parent || !center) return null; let scale = size / dist(center, parent); - return ( - - + : + + return ( + + {element} ); }; -export const Arrowhead = () => ( +export const Arrowhead = (props) => ( - + + + {showLinks && model_names.map((model_name) => { + // for each link attribute, draw a link line. + let node = layout.nodes[model_name]; + if (!node) return null; + const { attributes } = node.model; + + return Object.entries(attributes).map( ([att_name, att]) => { + if (att.attribute_type != 'link') return null; + console.log({node, p: layout.nodes[att.link_model_name]}); + + return + }).filter(_=>_); + }).filter(_=>_).flat()} {model_names.map((model_name) => { let node = layout.nodes[model_name]; return ( @@ -47,6 +68,7 @@ const ModelMapGraphic = ({ /> ); })} + {model_names.map((model_name) => { let node = layout.nodes[model_name]; diff --git a/timur/lib/client/scss/model_map.scss b/timur/lib/client/scss/model_map.scss index 6423e10e0f..5d4d996ffd 100644 --- a/timur/lib/client/scss/model_map.scss +++ b/timur/lib/client/scss/model_map.scss @@ -2,13 +2,6 @@ svg#map { overflow: visible; - line { - stroke-width: 3px; - stroke: #aca; - } - #arrow { - fill: #aca; - } } .model_node {