From 13453b943a15454ebc43447c900e760fc7536c66 Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Fri, 15 Aug 2025 15:39:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0TensorBoard?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=89=8D=E7=AB=AF=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tb_graph_ascend/monvis_plugin/fe/.babelrc | 3 + .../monvis_plugin/fe/.prettierrc | 13 + .../monvis_plugin/fe/package.json | 49 +++ .../monvis_plugin/fe/public/index.html | 10 + .../fe/src/common/SelectWithLabel/index.less | 59 ++++ .../fe/src/common/SelectWithLabel/index.tsx | 37 +++ .../fe/src/common/constant/index.ts | 57 ++++ .../fe/src/common/type/index.d.ts | 40 +++ .../fe/src/controller/index.less | 34 ++ .../monvis_plugin/fe/src/controller/index.tsx | 216 +++++++++++++ .../fe/src/controller/type/index.d.ts | 39 +++ .../fe/src/controller/useController.ts | 59 ++++ .../fe/src/graph/components/HeatMap/index.tsx | 97 ++++++ .../graph/components/HeatMap/useHeatMap.ts | 297 ++++++++++++++++++ .../src/graph/components/LineChart/index.tsx | 140 +++++++++ .../fe/src/graph/components/type/index.d.ts | 32 ++ .../monvis_plugin/fe/src/graph/index.less | 41 +++ .../monvis_plugin/fe/src/graph/index.tsx | 50 +++ .../monvis_plugin/fe/src/index.tsx | 26 ++ .../monvis_plugin/fe/src/main/index.less | 26 ++ .../monvis_plugin/fe/src/main/index.tsx | 60 ++++ .../monvis_plugin/fe/src/main/type/index.d.ts | 26 ++ .../monvis_plugin/fe/src/store/index.ts | 39 +++ .../monvis_plugin/fe/src/utils/index.ts | 27 ++ .../monvis_plugin/fe/src/utils/request.ts | 91 ++++++ .../monvis_plugin/fe/tsconfig.json | 40 +++ .../monvis_plugin/fe/webpack.config.js | 81 +++++ .../monvis_plugin/fe/webpack.dev.js | 160 ++++++++++ 28 files changed, 1849 insertions(+) create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/.babelrc create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/.prettierrc create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/package.json create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/public/index.html create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/SelectWithLabel/index.less create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/SelectWithLabel/index.tsx create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/constant/index.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/type/index.d.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/controller/index.less create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/controller/index.tsx create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/controller/type/index.d.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/controller/useController.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/graph/components/HeatMap/index.tsx create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/graph/components/HeatMap/useHeatMap.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/graph/components/LineChart/index.tsx create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/graph/components/type/index.d.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/graph/index.less create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/graph/index.tsx create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/index.tsx create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/main/index.less create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/main/index.tsx create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/main/type/index.d.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/store/index.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/utils/index.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/utils/request.ts create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/tsconfig.json create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/webpack.config.js create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/webpack.dev.js diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/.babelrc b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/.babelrc new file mode 100644 index 000000000..18151f1f8 --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@babel/preset-env", "@babel/preset-react"] +} \ No newline at end of file diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/.prettierrc b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/.prettierrc new file mode 100644 index 000000000..e3d2acb00 --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/.prettierrc @@ -0,0 +1,13 @@ +{ + "parser": "typescript", + "semi": true, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSpacing": true, + "tabWidth": 2, + "useTabs": false, + "trailingComma": "all", + "proseWrap": "always", + "endOfLine": "lf", + "printWidth": 120 +} diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/package.json b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/package.json new file mode 100644 index 000000000..bcd958160 --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/package.json @@ -0,0 +1,49 @@ +{ + "name": "fe", + "version": "1.0.0", + "main": "webpack.config.js", + "scripts": { + "dev": "webpack serve --config webpack.dev.js", + "buildWin": "cross-env NODE_ENV=production webpack && copy dist\\index.html ..\\server\\static\\", + "prettier": "prettier --config ./.prettierrc --write ./src/**/*.ts" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "devDependencies": { + "@babel/core": "^7.27.3", + "@babel/preset-env": "^7.27.2", + "@babel/preset-react": "^7.27.1", + "babel-loader": "^10.0.0", + "clean-webpack-plugin": "^4.0.0", + "cross-env": "^7.0.3", + "css-loader": "^7.1.2", + "file-loader": "^6.2.0", + "html-loader": "^5.1.0", + "html-webpack-plugin": "^5.6.3", + "inline-chunk-html-plugin": "^1.1.1", + "less": "^4.3.0", + "less-loader": "^12.3.0", + "mini-css-extract-plugin": "^2.9.2", + "prettier": "^3.5.3", + "style-loader": "^4.0.0", + "ts-loader": "^9.5.2", + "typescript": "^5.8.3", + "webpack": "^5.96.1", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "4.15.1" + }, + "dependencies": { + "ahooks": "^3.8.5", + "antd": "^5.25.3", + "axios": "^1.9.0", + "echarts": "^5.6.0", + "echarts-for-react": "^3.0.2", + "lodash": "^4.17.21", + "react": "^18.0.0", + "react-dom": "^18.0.0", + "use-sync-external-store": "^1.5.0", + "zustand": "^5.0.5" + } +} diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/public/index.html b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/public/index.html new file mode 100644 index 000000000..a0c678cdf --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/public/index.html @@ -0,0 +1,10 @@ + + + + + Graph + + +
+ + \ No newline at end of file diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/SelectWithLabel/index.less b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/SelectWithLabel/index.less new file mode 100644 index 000000000..a016ed61b --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/SelectWithLabel/index.less @@ -0,0 +1,59 @@ +/* ------------------------------------------------------------------------- + Copyright (c) 2025, Huawei Technologies. + All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--------------------------------------------------------------------------------------------*/ + +.selector { + padding: 6px 2px; + background-color: white; + box-sizing: border-box; + color: rgb(0, 0, 0); + font-size: 14px; + line-height: 1.5; + margin-bottom: 8px; + + .label { + width: 36%; + cursor: pointer; + margin-bottom: 8px; + color: rgb(68, 68, 68); + font-weight: 400; + + .question-icon { + margin-left: 6px; + font-size: medium; + background-color: white; + cursor: pointer; + } + + &:hover { + color: #0660e7; + } + } + + .select { + width: 100%; + + .ant-select-selector { + border-radius: 0px; + border: 1px solid #161616; + + } + + .ant-select-selection-item { + font-weight: 500; + } + } +} \ No newline at end of file diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/SelectWithLabel/index.tsx b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/SelectWithLabel/index.tsx new file mode 100644 index 000000000..7b9a788af --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/monvis_plugin/fe/src/common/SelectWithLabel/index.tsx @@ -0,0 +1,37 @@ +/* ------------------------------------------------------------------------- + Copyright (c) 2025, Huawei Technologies. + All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--------------------------------------------------------------------------------------------*/ + +import React from 'react'; +import { Select, Tooltip } from 'antd'; +import { QuestionCircleOutlined } from '@ant-design/icons'; +import './index.less'; +const SelectWithLabel = ({ label, className, text, ...args }: any) => { + return ( +
+ +
+ {label} + + +
+
+