Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

[webui] add basename in router #3625

Merged
merged 3 commits into from
May 19, 2021
Merged

Conversation

Lijiaoa
Copy link
Contributor

@Lijiaoa Lijiaoa commented May 10, 2021

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

  • test with Hao Ni's PR Suport prefix url for nnimanager #3643
  • Rest api: /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 页面是否正常

@Lijiaoa Lijiaoa marked this pull request as draft May 11, 2021 03:25
@Lijiaoa Lijiaoa marked this pull request as ready for review May 14, 2021 08:19
@ultmaster ultmaster linked an issue May 14, 2021 that may be closed by this pull request
const pathName = window.location.pathname;
let newPathName = pathName;

if (pathName.endsWith('/oview' || '/detail' || '/experiment')) {
Copy link
Contributor

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')

Copy link
Contributor Author

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!

Copy link
Contributor Author

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'>
Copy link
Contributor

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?

Copy link
Contributor Author

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', '');
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't support prefix with '/' on the head.
image

const MANAGER_IP = `/api/v1/nni`;
const prefix = getPrefix();

const MANAGER_IP = prefix === undefined ? '/api/v1/nni' : `/api/v1/nni${prefix}`;
Copy link
Contributor

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};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@QuanluZhang QuanluZhang merged commit 797b963 into microsoft:master May 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is there any option to set base url for the web report?
4 participants