@@ -12,7 +12,7 @@ import {
1212 calculateSelectedColumnsHeight ,
1313} from '../LineageColumnLevel/help'
1414import { useColumns , type Column } from '../LineageColumnLevel/useColumns'
15- import { calculateNodeBaseHeight } from '../help'
15+ import { calculateNodeBaseHeight , calculateNodeDetailsHeight } from '../help'
1616import { NodeAppendix } from '../node/NodeAppendix'
1717import { NodeBadge } from '../node/NodeBadge'
1818import { NodeBase } from '../node/NodeBase'
@@ -39,6 +39,7 @@ import { Tooltip } from '@/components/Tooltip/Tooltip'
3939import type { ColumnLevelLineageAdjacencyList } from '../LineageColumnLevel/ColumnLevelLineageContext'
4040import { ModelName } from '@/components/ModelName/ModelName'
4141import { Metadata } from '@/components/Metadata/Metadata'
42+ import { Badge } from '@/components/Badge/Badge'
4243
4344export const ModelNode = React . memo ( function ModelNode ( {
4445 id,
@@ -90,21 +91,35 @@ export const ModelNode = React.memo(function ModelNode({
9091 const modelType = data . model_type . toLowerCase ( ) as NodeType
9192 const hasColumnsFilter =
9293 shouldShowColumns && columns . length > MAX_COLUMNS_TO_DISPLAY
93-
94- const baseNodeHeight = calculateNodeBaseHeight ( {
95- nodeOptionsCount : 0 ,
94+ // We are not including the footer, because we need actual height to dynamically adjust node container height
95+ const nodeBaseHeight = calculateNodeBaseHeight ( {
96+ includeNodeFooterHeight : false ,
97+ includeCeilingHeight : false ,
98+ includeFloorHeight : false ,
9699 } )
100+ const nodeDetailsHeight =
101+ zoom > ZOOM_TRESHOLD
102+ ? calculateNodeDetailsHeight ( {
103+ nodeDetailsCount : 0 ,
104+ } )
105+ : 0
97106 const selectedColumnsHeight = calculateSelectedColumnsHeight (
98107 modelSelectedColumns . length ,
99108 )
100- const columnsHeight = calculateColumnsHeight ( {
101- columnsCount : shouldShowColumns
102- ? calculateNodeColumnsCount ( columns . length )
103- : 0 ,
104- hasColumnsFilter,
105- } )
109+ const columnsHeight =
110+ zoom > ZOOM_TRESHOLD && shouldShowColumns
111+ ? calculateColumnsHeight ( {
112+ columnsCount : calculateNodeColumnsCount ( columns . length ) ,
113+ hasColumnsFilter,
114+ } )
115+ : 0
106116
107- const nodeHeight = baseNodeHeight + selectedColumnsHeight + columnsHeight
117+ // If zoom is less than ZOOM_TRESHOLD, we are making node looks bigger
118+ const nodeHeight =
119+ ( zoom > ZOOM_TRESHOLD ? nodeBaseHeight : nodeBaseHeight * 2 ) +
120+ nodeDetailsHeight +
121+ selectedColumnsHeight +
122+ columnsHeight
108123
109124 return (
110125 < NodeContainer
@@ -124,7 +139,7 @@ export const ModelNode = React.memo(function ModelNode({
124139 position = "top"
125140 className = "bg-lineage-node-appendix-background"
126141 >
127- < HorizontalContainer className = "gap-1 items-center h-5" >
142+ < HorizontalContainer className = "gap-1 items-center overflow-visible h-5" >
128143 { zoom > ZOOM_TRESHOLD && (
129144 < >
130145 < NodeBadge > { data . kind . toUpperCase ( ) } </ NodeBadge >
@@ -165,7 +180,7 @@ export const ModelNode = React.memo(function ModelNode({
165180 ) }
166181 >
167182 < NodeHeader
168- className = " shrink-0 h-7"
183+ className = { cn ( zoom > ZOOM_TRESHOLD ? ' shrink-0 h-7' : 'h-full' ) }
169184 onClick = { toggleSelectedNode }
170185 >
171186 < NodeHandles
@@ -193,60 +208,50 @@ export const ModelNode = React.memo(function ModelNode({
193208 >
194209 < HorizontalContainer
195210 className = { cn (
196- 'items-center px-1 w-auto shrink-0' ,
197- leftId ? 'pl-2' : 'pl-1' ,
198- getNodeTypeColor ( modelType ) ,
199- ) }
200- >
201- < NodeBadge
202- size = "2xs"
203- className = "bg-[transparent] text-[white]"
204- >
205- { modelType . toUpperCase ( ) }
206- </ NodeBadge >
207- </ HorizontalContainer >
208- < HorizontalContainer
209- className = { cn (
210- 'gap-2 items-center px-2' ,
211- rightId ? 'pr-3' : 'pr-2' ,
211+ 'gap-2 items-center pl-4 pr-2' ,
212212 getNodeTypeBorderColor ( modelType ) ,
213213 ) }
214214 >
215215 < ModelName
216+ showTooltip
216217 hideCatalog
217- showTooltip = { zoom > ZOOM_TRESHOLD }
218+ hideSchema = { zoom <= ZOOM_TRESHOLD }
218219 hideIcon
219220 name = { data . displayName }
220221 grayscale
221- showCopy
222- className = "w-full text-xs overflow-hidden cursor-default truncate"
222+ className = { cn (
223+ 'w-full overflow-hidden cursor-default truncate' ,
224+ zoom > ZOOM_TRESHOLD ? ' text-xs' : 'text-2xl justify-center' ,
225+ ) }
223226 />
224227 </ HorizontalContainer >
225228 </ NodeHandles >
226229 </ NodeHeader >
227230 { shouldShowColumns && (
228- < VerticalContainer className = "border-t border-lineage-node-border" >
229- < VerticalContainer className = "h-auto shrink-0" >
230- { modelSelectedColumns . map ( column => (
231- < ModelNodeColumn
232- key = { column . id }
233- id = { column . id }
234- nodeId = { nodeId }
235- modelName = { data . name }
236- name = { column . name }
237- description = { column . description }
238- type = { column . data_type }
239- className = "p-1 first:border-t-0 h-6"
240- columnLineageData = {
241- (
242- column as Column & {
243- columnLineageData ?: ColumnLevelLineageAdjacencyList
244- }
245- ) . columnLineageData
246- }
247- />
248- ) ) }
249- </ VerticalContainer >
231+ < >
232+ { modelSelectedColumns . length > 0 && (
233+ < VerticalContainer className = "h-auto shrink-0 border-t border-lineage-node-border" >
234+ { modelSelectedColumns . map ( column => (
235+ < ModelNodeColumn
236+ key = { column . id }
237+ id = { column . id }
238+ nodeId = { nodeId }
239+ modelName = { data . name }
240+ name = { column . name }
241+ description = { column . description }
242+ type = { column . data_type }
243+ className = "p-1 first:border-t-0 h-6"
244+ columnLineageData = {
245+ (
246+ column as Column & {
247+ columnLineageData ?: ColumnLevelLineageAdjacencyList
248+ }
249+ ) . columnLineageData
250+ }
251+ />
252+ ) ) }
253+ </ VerticalContainer >
254+ ) }
250255 { columns . length > 0 && (
251256 < NodePorts
252257 ports = { columns }
@@ -275,11 +280,33 @@ export const ModelNode = React.memo(function ModelNode({
275280 }
276281 />
277282 ) }
283+ className = "border-t border-lineage-node-border"
278284 />
279285 ) }
280- </ VerticalContainer >
286+ </ >
281287 ) }
282288 </ NodeBase >
289+ < NodeAppendix
290+ position = "bottom"
291+ className = "bg-lineage-node-appendix-background"
292+ >
293+ < HorizontalContainer
294+ className = { cn (
295+ 'gap-1 items-center overflow-visible' ,
296+ zoom > ZOOM_TRESHOLD ? 'h-5' : 'h-8' ,
297+ ) }
298+ >
299+ < Badge
300+ size = { zoom > ZOOM_TRESHOLD ? '2xs' : 'm' }
301+ className = { cn (
302+ 'text-[white] font-black' ,
303+ getNodeTypeColor ( modelType ) ,
304+ ) }
305+ >
306+ { modelType . toUpperCase ( ) }
307+ </ Badge >
308+ </ HorizontalContainer >
309+ </ NodeAppendix >
283310 </ NodeContainer >
284311 )
285312} )
0 commit comments