Browse Source

Update index.jsx

master-fzznrj423
fanshuai 1 year ago
parent
commit
7618cf6ba1
1 changed files with 12 additions and 7 deletions
  1. +12
    -7
      react-ui/src/pages/Experiment/experimentText/index.jsx

+ 12
- 7
react-ui/src/pages/Experiment/experimentText/index.jsx View File

@@ -1,5 +1,5 @@
import { ReactComponent as ViewParam } from '@/assets/svg/view-param.svg';
import { useAntdModal } from '@/hooks';
import { useVisible } from '@/hooks';
import { getExperimentIns } from '@/services/experiment/index.js';
import { getWorkflowById } from '@/services/pipeline/index.js';
import { elapsedTime } from '@/utils/date';
@@ -22,7 +22,7 @@ function ExperimentText() {
const navgite = useNavigate();
const locationParams = useParams(); //新版本获取路由参数接口
let graph = null;
const [paramsModalOpen, openParamsModal, closeParamsModal] = useAntdModal(false);
const [paramsModalOpen, openParamsModal, closeParamsModal] = useVisible(false);

const timers = (time) => {
let timer = new Date(time);
@@ -128,9 +128,9 @@ function ExperimentText() {
experimentStatusObjs[item.id] &&
experimentStatusObjs[item.id].phase
? item.img.slice(0, item.img.length - 4) +
'-' +
experimentStatusObjs[item.id].phase +
'.png'
'-' +
experimentStatusObjs[item.id].phase +
'.png'
: item.img,
};
});
@@ -189,6 +189,11 @@ function ExperimentText() {
});
return res;
};
// 获取文本的长度
const getTextSize = (str, maxWidth, fontSize) => {
let width = G6.Util.getTextSize(str, fontSize)[0];
return width > maxWidth ? maxWidth : width;
};
G6.registerNode(
'rect-node',
{
@@ -380,8 +385,8 @@ function ExperimentText() {
},
},
// linkCenter: true,
fitView: false,
fitViewPadding: [60, 60, 60, 80],
fitView: true,
fitViewPadding: [320, 320, 220, 320],
});

graph.on('dblclick', handlerClick);


Loading…
Cancel
Save