Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
797b9635
Unverified
Commit
797b9635
authored
May 19, 2021
by
Lijiaoa
Committed by
GitHub
May 19, 2021
Browse files
[webui] add basename in router (#3625)
parent
af929fdb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
5 deletions
+26
-5
ts/webui/src/components/stateless-component/NNItabs.tsx
ts/webui/src/components/stateless-component/NNItabs.tsx
+3
-3
ts/webui/src/index.tsx
ts/webui/src/index.tsx
+4
-1
ts/webui/src/static/const.ts
ts/webui/src/static/const.ts
+7
-1
ts/webui/src/static/function.ts
ts/webui/src/static/function.ts
+12
-0
No files found.
ts/webui/src/components/stateless-component/NNItabs.tsx
View file @
797b9635
...
@@ -2,19 +2,19 @@ import * as React from 'react';
...
@@ -2,19 +2,19 @@ import * as React from 'react';
import
{
NavLink
}
from
'
react-router-dom
'
;
import
{
NavLink
}
from
'
react-router-dom
'
;
const
OVERVIEWTABS
=
(
const
OVERVIEWTABS
=
(
<
NavLink
to
=
{
'
/oview
'
}
activeClassName
=
'selected'
className
=
'common-tabs'
>
<
NavLink
to
=
'/oview'
activeClassName
=
'selected'
className
=
'common-tabs'
>
Overview
Overview
</
NavLink
>
</
NavLink
>
);
);
const
DETAILTABS
=
(
const
DETAILTABS
=
(
<
NavLink
to
=
{
'
/detail
'
}
activeClassName
=
'selected'
className
=
'common-tabs'
>
<
NavLink
to
=
'/detail'
activeClassName
=
'selected'
className
=
'common-tabs'
>
Trials detail
Trials detail
</
NavLink
>
</
NavLink
>
);
);
const
NNILOGO
=
(
const
NNILOGO
=
(
<
NavLink
to
=
{
'
/oview
'
}
>
<
NavLink
to
=
'/oview'
>
<
img
src
=
{
require
(
'
../../static/img/logo.png
'
)
}
alt
=
'NNI logo'
style
=
{
{
height
:
40
}
}
/>
<
img
src
=
{
require
(
'
../../static/img/logo.png
'
)
}
alt
=
'NNI logo'
style
=
{
{
height
:
40
}
}
/>
</
NavLink
>
</
NavLink
>
);
);
...
...
ts/webui/src/index.tsx
View file @
797b9635
import
React
,
{
lazy
,
Suspense
}
from
'
react
'
;
import
React
,
{
lazy
,
Suspense
}
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
ReactDOM
from
'
react-dom
'
;
import
App
from
'
./App
'
;
import
App
from
'
./App
'
;
import
{
getPrefix
}
from
'
./static/function
'
;
import
{
BrowserRouter
as
Router
,
Route
,
Switch
}
from
'
react-router-dom
'
;
import
{
BrowserRouter
as
Router
,
Route
,
Switch
}
from
'
react-router-dom
'
;
const
Overview
=
lazy
(()
=>
import
(
'
./components/Overview
'
));
const
Overview
=
lazy
(()
=>
import
(
'
./components/Overview
'
));
const
TrialsDetail
=
lazy
(()
=>
import
(
'
./components/TrialsDetail
'
));
const
TrialsDetail
=
lazy
(()
=>
import
(
'
./components/TrialsDetail
'
));
...
@@ -9,8 +10,10 @@ import './index.css';
...
@@ -9,8 +10,10 @@ import './index.css';
import
'
./static/style/loading.scss
'
;
import
'
./static/style/loading.scss
'
;
import
*
as
serviceWorker
from
'
./serviceWorker
'
;
import
*
as
serviceWorker
from
'
./serviceWorker
'
;
const
path
=
getPrefix
();
ReactDOM
.
render
(
ReactDOM
.
render
(
<
Router
>
<
Router
basename
=
{
path
===
undefined
?
null
:
path
}
>
<
Suspense
<
Suspense
fallback
=
{
fallback
=
{
<
div
className
=
'loading'
>
<
div
className
=
'loading'
>
...
...
ts/webui/src/static/const.ts
View file @
797b9635
import
{
getPrefix
}
from
'
./function
'
;
// when there are more trials than this threshold, metrics will be updated in group of this size to avoid freezing
// when there are more trials than this threshold, metrics will be updated in group of this size to avoid freezing
const
METRIC_GROUP_UPDATE_THRESHOLD
=
100
;
const
METRIC_GROUP_UPDATE_THRESHOLD
=
100
;
const
METRIC_GROUP_UPDATE_SIZE
=
20
;
const
METRIC_GROUP_UPDATE_SIZE
=
20
;
const
MANAGER_IP
=
`/api/v1/nni`
;
const
prefix
=
getPrefix
();
const
MANAGER_IP
=
prefix
===
undefined
?
'
/api/v1/nni
'
:
`
${
prefix
}
`
;
const
DOWNLOAD_IP
=
`/logs`
;
const
DOWNLOAD_IP
=
`/logs`
;
const
WEBUIDOC
=
'
https://nni.readthedocs.io/en/latest/Tutorial/WebUI.html
'
;
const
WEBUIDOC
=
'
https://nni.readthedocs.io/en/latest/Tutorial/WebUI.html
'
;
const
trialJobStatus
=
[
const
trialJobStatus
=
[
'
UNKNOWN
'
,
'
UNKNOWN
'
,
'
WAITING
'
,
'
WAITING
'
,
...
...
ts/webui/src/static/function.ts
View file @
797b9635
...
@@ -4,6 +4,17 @@ import { IContextualMenuProps } from '@fluentui/react';
...
@@ -4,6 +4,17 @@ import { IContextualMenuProps } from '@fluentui/react';
import
{
MANAGER_IP
}
from
'
./const
'
;
import
{
MANAGER_IP
}
from
'
./const
'
;
import
{
MetricDataRecord
,
FinalType
,
TableObj
,
Tensorboard
}
from
'
./interface
'
;
import
{
MetricDataRecord
,
FinalType
,
TableObj
,
Tensorboard
}
from
'
./interface
'
;
function
getPrefix
():
string
|
undefined
{
const
pathName
=
window
.
location
.
pathname
;
let
newPathName
=
pathName
;
if
(
pathName
.
endsWith
(
'
/oview
'
)
||
pathName
.
endsWith
(
'
/detail
'
)
||
pathName
.
endsWith
(
'
/experiment
'
))
{
newPathName
=
pathName
.
replace
(
'
/oview
'
||
'
/detail
'
||
'
/experiment
'
,
''
);
}
return
newPathName
===
''
?
undefined
:
newPathName
;
}
async
function
requestAxios
(
url
:
string
):
Promise
<
any
>
{
async
function
requestAxios
(
url
:
string
):
Promise
<
any
>
{
const
response
=
await
axios
.
get
(
url
);
const
response
=
await
axios
.
get
(
url
);
if
(
response
.
status
===
200
)
{
if
(
response
.
status
===
200
)
{
...
@@ -346,6 +357,7 @@ function getTensorboardMenu(queryTensorboardList: Tensorboard[], stopFunc, seeDe
...
@@ -346,6 +357,7 @@ function getTensorboardMenu(queryTensorboardList: Tensorboard[], stopFunc, seeDe
return
tensorboardMenu
;
return
tensorboardMenu
;
}
}
export
{
export
{
getPrefix
,
convertTime
,
convertTime
,
convertDuration
,
convertDuration
,
convertTimeAsUnit
,
convertTimeAsUnit
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment