|
|
|
@@ -6,8 +6,10 @@ import Hierarchy from '@antv/hierarchy'; |
|
|
|
export const nodeWidth = 110; |
|
|
|
export const nodeHeight = 50; |
|
|
|
export const vGap = nodeHeight + 20; |
|
|
|
export const hGap = nodeHeight + 20; |
|
|
|
export const hGap = nodeWidth; |
|
|
|
export const ellipseWidth = nodeWidth; |
|
|
|
export const labelPadding = 30; |
|
|
|
export const nodeFontSize = 8; |
|
|
|
|
|
|
|
// 数据集节点 |
|
|
|
const datasetNodes: NodeConfig[] = []; |
|
|
|
@@ -94,9 +96,13 @@ export function normalizeChildren(data: ModelDepsData[]) { |
|
|
|
// 获取 label |
|
|
|
export function getLabel(node: ModelDepsData | ModelDepsAPIData) { |
|
|
|
return ( |
|
|
|
fittingString(`${node.model_version_dependcy_vo.name ?? ''}`, nodeWidth - 12, 8) + |
|
|
|
fittingString( |
|
|
|
`${node.model_version_dependcy_vo.name ?? ''}`, |
|
|
|
nodeWidth - labelPadding, |
|
|
|
nodeFontSize, |
|
|
|
) + |
|
|
|
'\n' + |
|
|
|
fittingString(`${node.version}`, nodeWidth - 12, 8) |
|
|
|
fittingString(`${node.version}`, nodeWidth - labelPadding, nodeFontSize) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -231,9 +237,9 @@ const addDatasetDependency = ( |
|
|
|
node.type = 'ellipse'; |
|
|
|
node.size = [ellipseWidth, nodeHeight]; |
|
|
|
node.label = |
|
|
|
fittingString(node.dataset_name, ellipseWidth - 12, 8) + |
|
|
|
fittingString(node.dataset_name, ellipseWidth - labelPadding, nodeFontSize) + |
|
|
|
'\n' + |
|
|
|
fittingString(node.dataset_version, ellipseWidth - 12, 8); |
|
|
|
fittingString(node.dataset_version, ellipseWidth - labelPadding, nodeFontSize); |
|
|
|
|
|
|
|
const half = len / 2 - 0.5; |
|
|
|
node.x = currentNode.x! - (half - index) * (ellipseWidth + hGap / 2); |
|
|
|
@@ -263,7 +269,7 @@ const addProjectDependency = ( |
|
|
|
node.id = `$P_${node.url}_${node.branch}`; |
|
|
|
node.model_type = NodeType.project; |
|
|
|
node.type = 'rect'; |
|
|
|
node.label = fittingString(node.name, nodeWidth - 12, 8); |
|
|
|
node.label = fittingString(node.name, nodeWidth - labelPadding, nodeFontSize); |
|
|
|
node.style = getStyle(NodeType.project); |
|
|
|
node.style.radius = nodeHeight / 2; |
|
|
|
node.x = currentNode.x; |
|
|
|
|