Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
b1a387a9
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 1 年 前同步成功
通知
88
Star
4655
Fork
642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VisualDL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b1a387a9
编写于
11月 22, 2022
作者:
R
RotPublic
提交者:
GitHub
11月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复路由跳转bug (#1163)
* fileNames * fixgoutebug * fixgoutebug2 * fixtype
上级
89705493
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
59 addition
and
35 deletion
+59
-35
frontend/packages/core/src/components/Navbar.tsx
frontend/packages/core/src/components/Navbar.tsx
+40
-16
frontend/packages/core/src/routes/index.ts
frontend/packages/core/src/routes/index.ts
+2
-2
frontend/packages/mock/data/app/component_tabs.js
frontend/packages/mock/data/app/component_tabs.js
+17
-17
未找到文件。
frontend/packages/core/src/components/Navbar.tsx
浏览文件 @
b1a387a9
...
...
@@ -37,6 +37,7 @@ import useComponents from '~/hooks/useComponents';
import
{
useTranslation
}
from
'
react-i18next
'
;
import
{
fetcher
}
from
'
~/utils/fetch
'
;
import
{
Child
}
from
'
./ProfilerPage/OperatorView/type
'
;
import
{
isArray
}
from
'
lodash
'
;
const
BASE_URI
:
string
=
import
.
meta
.
env
.
SNOWPACK_PUBLIC_BASE_URI
;
const
PUBLIC_PATH
:
string
=
import
.
meta
.
env
.
SNOWPACK_PUBLIC_PATH
;
...
...
@@ -297,7 +298,8 @@ const Navbar: FunctionComponent = () => {
const
currentPath
=
useMemo
(()
=>
pathname
.
replace
(
BASE_URI
,
''
),
[
pathname
]);
const
[
components
]
=
useComponents
();
const
routePush
=
(
route
:
any
,
Components
:
any
[])
=>
{
const
routePush
=
(
route
:
any
,
component
:
any
)
=>
{
const
Components
=
isArray
(
component
)
?
[...
component
]
:
[...
component
.
values
()];
if
(
navList
.
includes
(
routeEm
[
route
.
id
]))
{
// debugger;
...
...
@@ -311,34 +313,49 @@ const Navbar: FunctionComponent = () => {
}
};
const
newcomponents
=
useMemo
(()
=>
{
const
Components
=
[];
const
Components
=
new
Map
();
const
parent
:
any
[]
=
[];
if
(
navList
.
length
>
0
)
{
for
(
const
item
of
components
)
{
// debugger;
// const Id: any = item.id;
if
(
navList
.
includes
(
routeEm
[
item
.
id
]))
{
Components
.
push
(
item
);
// Components.push(item);
Components
.
set
(
item
.
id
,
item
);
}
if
(
item
.
children
)
{
for
(
const
Route
of
item
.
children
)
{
const
flag
=
routePush
(
Route
,
Components
);
if
(
flag
&&
!
parent
.
includes
(
item
.
id
))
{
parent
.
push
(
item
.
id
);
Components
.
push
(
item
);
const
newItems
=
{
...
item
,
children
:
[
Route
]
};
Components
.
set
(
item
.
id
,
newItems
);
}
else
if
(
flag
&&
parent
.
includes
(
item
.
id
))
{
// debugger;
const
newItem
=
Components
.
get
(
item
.
id
);
const
newItems
=
{
...
newItem
,
children
:
[...
newItem
.
children
,
Route
]
};
Components
.
set
(
item
.
id
,
newItems
);
}
}
}
}
}
return
Components
;
console
.
log
(
'
Components
'
,
[...
Components
],
Components
);
// debugger;
return
[...
Components
.
values
()];
},
[
components
,
navList
]);
const
componentsInNavbar
=
useMemo
(()
=>
newcomponents
.
slice
(
0
,
MAX_ITEM_COUNT_IN_NAVBAR
),
[
newcomponents
]);
const
flattenMoreComponents
=
useMemo
(
()
=>
flatten
(
newcomponents
.
slice
(
MAX_ITEM_COUNT_IN_NAVBAR
)),
[
newcomponents
]
);
const
componentsInMoreMenu
=
useMemo
(
const
componentsInMoreMenu
:
any
=
useMemo
(
()
=>
flattenMoreComponents
.
map
(
item
=>
({
...
item
,
...
...
@@ -347,18 +364,25 @@ const Navbar: FunctionComponent = () => {
[
currentPath
,
flattenMoreComponents
]
);
const
[
navItemsInNavbar
,
setNavItemsInNavbar
]
=
useState
<
NavbarItemType
[]
>
([]);
const
routesChange
=
(
route
:
any
)
=>
{
const
routesChange
=
(
route
:
any
,
parentPath
?:
any
)
=>
{
// debugger;
if
(
navList
.
includes
(
routeEm
[
route
.
id
]))
{
// debugger;
history
.
push
(
`/
${
route
.
id
}
`
);
return
true
;
if
(
parentPath
)
{
history
.
push
(
`
${
parentPath
}
/
${
route
.
id
}
`
);
return
true
;
}
else
{
history
.
push
(
`/
${
route
.
id
}
`
);
return
true
;
}
// setDefaultRoute(route.id);
}
if
(
route
.
C
hildren
)
{
for
(
const
Route
of
route
.
C
hildren
)
{
routesChange
(
Route
);
if
(
route
.
c
hildren
)
{
for
(
const
Route
of
route
.
c
hildren
)
{
routesChange
(
Route
,
`/
${
route
.
id
}
`
);
}
}
// return false;
};
useEffect
(()
=>
{
// setLoading(true);
...
...
@@ -380,12 +404,12 @@ const Navbar: FunctionComponent = () => {
useEffect
(()
=>
{
setNavItemsInNavbar
(
oldItems
=>
componentsInNavbar
.
map
(
item
=>
{
const
children
=
item
.
children
?.
map
(
child
=>
({
const
children
=
item
.
children
?.
map
(
(
child
:
any
)
=>
({
...
child
,
active
:
child
.
path
===
currentPath
}));
if
(
item
.
children
&&
!
item
.
path
)
{
const
child
=
item
.
children
.
find
(
child
=>
child
.
path
===
currentPath
);
const
child
=
item
.
children
.
find
(
(
child
:
any
)
=>
child
.
path
===
currentPath
);
if
(
child
)
{
return
{
...
item
,
...
...
@@ -401,7 +425,7 @@ const Navbar: FunctionComponent = () => {
return
{
...
item
,
...
oldItem
,
name
:
item
.
children
?.
find
(
c
=>
c
.
id
===
oldItem
.
cid
)?.
name
??
item
.
name
,
name
:
item
.
children
?.
find
(
(
c
:
any
)
=>
c
.
id
===
oldItem
.
cid
)?.
name
??
item
.
name
,
active
:
false
,
children
};
...
...
frontend/packages/core/src/routes/index.ts
浏览文件 @
b1a387a9
...
...
@@ -81,12 +81,12 @@ const routes: Route[] = [
children
:
[
{
id
:
'
graphDynamic
'
,
path
:
'
/graphDynamic
'
,
path
:
'
/graph
/graph
Dynamic
'
,
component
:
React
.
lazy
(()
=>
import
(
'
~/pages/graphDynamic
'
))
},
{
id
:
'
graphStatic
'
,
path
:
'
/graphStatic
'
,
path
:
'
/graph
/graph
Static
'
,
component
:
React
.
lazy
(()
=>
import
(
'
~/pages/graphStatic
'
))
}
]
...
...
frontend/packages/mock/data/app/component_tabs.js
浏览文件 @
b1a387a9
...
...
@@ -14,20 +14,20 @@
* limitations under the License.
*/
//
export default [
//
'scalar',
//
'image',
//
'text',
//
'embeddings',
//
'audio',
//
'histogram',
//
'hyper_parameters',
//
'static_graph',
//
'dynamic_graph',
//
'pr_curve',
//
'roc_curve',
//
'profiler',
//
'x2paddle',
//
'fastdeploy_server'
//
];
export
default
[
'
x2paddle
'
];
export
default
[
'
scalar
'
,
'
image
'
,
//
'text',
'
embeddings
'
,
'
audio
'
,
'
histogram
'
,
'
hyper_parameters
'
,
'
static_graph
'
,
'
dynamic_graph
'
,
'
pr_curve
'
,
'
roc_curve
'
,
'
profiler
'
,
'
x2paddle
'
,
'
fastdeploy_server
'
];
// export default ['dynamic_graph
'];
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录