-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Conversation
ts/webui/src/static/function.ts
Outdated
const pathName = window.location.pathname; | ||
let newPathName = pathName; | ||
|
||
if (pathName.endsWith('/oview' || '/detail' || '/experiment')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be:
pathName.endsWith('/oview') || pathName.endsWith('/detail') || pathName.endsWith('/experiment')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will change it at once! it's my oversight. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had been fixed
@@ -2,19 +2,19 @@ import * as React from 'react'; | |||
import { NavLink } from 'react-router-dom'; | |||
|
|||
const OVERVIEWTABS = ( | |||
<NavLink to={'/oview'} activeClassName='selected' className='common-tabs'> | |||
<NavLink to='/oview' activeClassName='selected' className='common-tabs'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{} 配合变量使用,这里直接写字符串就行
let newPathName = pathName; | ||
|
||
if (pathName.endsWith('/oview' || '/detail' || '/experiment')) { | ||
newPathName = pathName.replace('/oview' || '/detail' || '/experiment', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the prefix is /experiment-number-1
? Will it be mistakenly replaced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ts/webui/src/static/const.ts
Outdated
const MANAGER_IP = `/api/v1/nni`; | ||
const prefix = getPrefix(); | ||
|
||
const MANAGER_IP = prefix === undefined ? '/api/v1/nni' : `/api/v1/nni${prefix}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to here,
Better change this to
const MANAGER_IP = prefix === undefined ? '/api/v1/nni' : /${prefix}
;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
related issue: #2771
With this PR merged, you could run an experiment with command
nnictl create --config xx.yml --url_prefix customURL
open webui website look like this :ip:port/customURL/oview
/api/v1/nni${prefix}
, 如果用户未设置prefix,api/v1/nni
/logs api
needs prefix? -> no need to add prefix for /logs api测试用例
(1)
nnictl create --config xx.yml
起一个实验,观察 ip:port/oview、 /detail、 /experiment 页面是否正常(2)
nnictl create --config xx.yml --url_prefix customPrefix
起一个实验,观察 ip:port/customPrefix/oview、/detail、 /experiment 页面是否正常(3)
nnictl create --config xx.yml --url_prefix /customerURL
起一个实验,此时会提醒不能以/
开头,路径无效(4)
nnictl create --config xx.yml --url_prefix customer/xxx
起一个实验,观察 ip:port/customPrefix/oview、/detail、 /experiment 页面是否正常