Unverified Commit c05a9228 authored by Lijiaoa's avatar Lijiaoa Committed by GitHub
Browse files

update prefix rest api format and fix getPrefix function bug (#3674)


Co-authored-by: default avatarLijiao <Lijiaoa@outlook.com>
parent 964d9a92
...@@ -5,8 +5,8 @@ const METRIC_GROUP_UPDATE_THRESHOLD = 100; ...@@ -5,8 +5,8 @@ const METRIC_GROUP_UPDATE_THRESHOLD = 100;
const METRIC_GROUP_UPDATE_SIZE = 20; const METRIC_GROUP_UPDATE_SIZE = 20;
const prefix = getPrefix(); const prefix = getPrefix();
const RESTAPI = '/api/v1/nni';
const MANAGER_IP = prefix === undefined ? '/api/v1/nni' : `${prefix}`; const MANAGER_IP = prefix === undefined ? RESTAPI : `${prefix}${RESTAPI}`;
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';
......
...@@ -8,12 +8,13 @@ import { MetricDataRecord, FinalType, TableObj, Tensorboard } from './interface' ...@@ -8,12 +8,13 @@ import { MetricDataRecord, FinalType, TableObj, Tensorboard } from './interface'
function getPrefix(): string | undefined { function getPrefix(): string | undefined {
const pathName = window.location.pathname; const pathName = window.location.pathname;
let newPathName = pathName; let newPathName = pathName;
const pathArr: string[] = ['/oview', '/detail', '/experiment'];
if (pathName.endsWith('/oview') || pathName.endsWith('/detail') || pathName.endsWith('/experiment')) { pathArr.forEach(item => {
newPathName = pathName.replace('/oview' || '/detail' || '/experiment', ''); if (pathName.endsWith(item)) {
} newPathName = pathName.replace(item, '');
}
return newPathName === '' ? undefined : newPathName; });
return newPathName === '' || newPathName === '/' ? undefined : newPathName;
} }
async function requestAxios(url: string): Promise<any> { async function requestAxios(url: string): Promise<any> {
......
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