"src/include/threadwise_4d_tensor_op.hpp" did not exist on "24d2f034fac9ec797477baee9fd36f4a930db068"
Unverified Commit 797b9635 authored by Lijiaoa's avatar Lijiaoa Committed by GitHub
Browse files

[webui] add basename in router (#3625)

parent af929fdb
...@@ -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>
); );
......
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'>
......
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',
......
...@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment