Commit e5b1ddc6 authored by wenmo's avatar wenmo

Flink执行图改进

parent e2e7c5a3
...@@ -6,16 +6,25 @@ import styles from "./index.less"; ...@@ -6,16 +6,25 @@ import styles from "./index.less";
import React, {useState} from "react"; import React, {useState} from "react";
const StudioGraph = (props:any) => { const StudioGraph = (props:any) => {
const {graphData,current,currentSession} = props; const {data,current,currentSession} = props;
const config = { const config = {
data:graphData, data,
nodeCfg: { nodeCfg: {
size: [140, 25], size: [140, 65],
/*anchorPoints: [
[0.5, 1],
[0.5, 0],
],*/
items: { items: {
padding: 6, padding: [6, 0, 0],
containerStyle: { containerStyle: {
fill: '#fff', fill: '#fff',
width:'100px',
display: 'inline-block',
overflow:'hidden',
textOverflow:'ellipsis',
whiteSpace:'nowrap',
}, },
style: (cfg, group, type) => { style: (cfg, group, type) => {
const styles = { const styles = {
...@@ -28,33 +37,29 @@ const StudioGraph = (props:any) => { ...@@ -28,33 +37,29 @@ const StudioGraph = (props:any) => {
}, },
text: { text: {
fill: '#aaa', fill: '#aaa',
width:'100px',
display: 'inline-block',
overflow:'hidden',
textOverflow:'ellipsis',
whiteSpace:'nowrap',
}, },
}; };
return styles[type]; return styles[type];
}, },
}, },
nodeStateStyles: { nodeStateStyles: {
hover: { hover: {
stroke: '#1890ff', stroke: '#1890ff',
lineWidth: 2, lineWidth: 2,
}, },
}, },
title: {
containerStyle: {
fill: 'transparent',
},
style: {
fill: '#000',
fontSize: 12,
},
},
style: { style: {
fill: '#E6EAF1',
stroke: '#B2BED5',
radius: [2, 2, 2, 2], radius: [2, 2, 2, 2],
}, },
}, },
edgeCfg: { edgeCfg: {
type: 'polyline',
label: { label: {
style: { style: {
fill: '#aaa', fill: '#aaa',
...@@ -62,51 +67,33 @@ const StudioGraph = (props:any) => { ...@@ -62,51 +67,33 @@ const StudioGraph = (props:any) => {
fillOpacity: 1, fillOpacity: 1,
}, },
}, },
style: (edge) => { endArrow: {
const stroke = edge.target === '0' ? '#c86bdd' : '#5ae859'; fill: '#ddd',
return {
stroke,
lineWidth: 1,
strokeOpacity: 0.5,
};
}, },
edgeStateStyles: { edgeStateStyles: {
hover: { hover: {
stroke: '#1890ff',
lineWidth: 2, lineWidth: 2,
strokeOpacity: 1,
}, },
}, },
}, },
markerCfg: (cfg) => { markerCfg: (cfg) => {
const {edges} = graphData; const { edges } = data;
return { return {
position: 'right', position: 'right',
show: edges.find((item) => item.source == cfg.id), show: edges.find((item) => item.source === cfg.id),
collapsed: !edges.find((item) => item.source == cfg.id), collapsed: !edges.find((item) => item.source === cfg.id),
}; };
}, },
behaviors: ['drag-canvas', 'zoom-canvas', 'drag-node'], behaviors: ['drag-canvas', 'zoom-canvas', 'drag-node'],
/*layout: {
rankdir: 'TB',
ranksepFunc: () => 20,
},*/
}; };
/*const buildGraphEdges=(nodes)=>{
let edges = [];
for(let i in nodes){
if(nodes[i].predecessors){
for(let j in nodes[i].predecessors){
edges.push({source: nodes[i].predecessors[j].id.toString(),
target: nodes[i].id.toString(),
value: nodes[i].predecessors[j].ship_strategy})
}
}
}
return edges;
};*/
return ( return (
<>{graphData? <FlowAnalysisGraph {...config} /> :<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />} <>{data? <FlowAnalysisGraph {...config} /> :<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />}
</> </>
); );
}; };
......
...@@ -218,6 +218,7 @@ const StudioMenu = (props: any) => { ...@@ -218,6 +218,7 @@ const StudioMenu = (props: any) => {
items: [ items: [
{ {
text: data.nodes[i].contents, text: data.nodes[i].contents,
value: data.nodes[i].parallelism,
}, },
], ],
}; };
...@@ -384,12 +385,10 @@ const StudioMenu = (props: any) => { ...@@ -384,12 +385,10 @@ const StudioMenu = (props: any) => {
cancelText="取消" cancelText="取消"
> >
<Tooltip title="停止所有的 FlinkSql 任务,暂不可用"> <Tooltip title="停止所有的 FlinkSql 任务,暂不可用">
{/*<Badge size="small" count={1} offset={[-5, 5]}>*/}
<Button <Button
type="text" type="text"
icon={<PauseCircleTwoTone twoToneColor="#ddd"/>} icon={<PauseCircleTwoTone twoToneColor="#ddd"/>}
/> />
{/*</Badge>*/}
</Tooltip> </Tooltip>
</Popconfirm> </Popconfirm>
<Divider type="vertical"/> <Divider type="vertical"/>
...@@ -431,7 +430,7 @@ const StudioMenu = (props: any) => { ...@@ -431,7 +430,7 @@ const StudioMenu = (props: any) => {
visible={graphModalVisible} visible={graphModalVisible}
onCancel={() => handleGraphModalVisible(false)} onCancel={() => handleGraphModalVisible(false)}
> >
<StudioGraph graphData={graphData} /> <StudioGraph data={graphData} />
</Modal> </Modal>
</Row> </Row>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment