Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
0fe0fd86
Unverified
Commit
0fe0fd86
authored
Aug 10, 2021
by
Ni Hao
Committed by
GitHub
Aug 10, 2021
Browse files
Fix prefix static source 404 issue (#4051)
parent
23b8e8ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
ts/nni_manager/common/experimentStartupInfo.ts
ts/nni_manager/common/experimentStartupInfo.ts
+5
-0
ts/nni_manager/rest_server/nniRestServer.ts
ts/nni_manager/rest_server/nniRestServer.ts
+3
-3
ts/webui/src/static/function.ts
ts/webui/src/static/function.ts
+7
-1
No files found.
ts/nni_manager/common/experimentStartupInfo.ts
View file @
0fe0fd86
...
...
@@ -126,3 +126,8 @@ export function getDispatcherPipe(): string | null {
export
function
getAPIRootUrl
():
string
{
return
getExperimentStartupInfo
().
apiRootUrl
;
}
export
function
getPrefixUrl
():
string
{
const
prefix
=
getExperimentStartupInfo
().
urlprefix
===
''
?
''
:
`/
${
getExperimentStartupInfo
().
urlprefix
}
`
;
return
prefix
;
}
ts/nni_manager/rest_server/nniRestServer.ts
View file @
0fe0fd86
...
...
@@ -11,7 +11,7 @@ import * as component from '../common/component';
import
{
RestServer
}
from
'
../common/restServer
'
import
{
getLogDir
}
from
'
../common/utils
'
;
import
{
createRestHandler
}
from
'
./restHandler
'
;
import
{
getAPIRootUrl
}
from
'
../common/experimentStartupInfo
'
;
import
{
getAPIRootUrl
,
getPrefixUrl
}
from
'
../common/experimentStartupInfo
'
;
/**
* NNI Main rest server, provides rest API to support
...
...
@@ -38,7 +38,7 @@ export class NNIRestServer extends RestServer {
* NNIRestServer's own router registration
*/
protected
registerRestHandler
():
void
{
this
.
app
.
use
(
express
.
static
(
'
static
'
));
this
.
app
.
use
(
getPrefixUrl
(),
express
.
static
(
'
static
'
));
this
.
app
.
use
(
bodyParser
.
json
({
limit
:
'
50mb
'
}));
this
.
app
.
use
(
this
.
API_ROOT_URL
,
createRestHandler
(
this
));
this
.
app
.
use
(
this
.
LOGS_ROOT_URL
,
express
.
static
(
getLogDir
()));
...
...
@@ -50,7 +50,7 @@ export class NNIRestServer extends RestServer {
target
:
'
https://netron.app
'
});
});
this
.
app
.
get
(
'
*
'
,
(
req
:
express
.
Request
,
res
:
express
.
Response
)
=>
{
this
.
app
.
get
(
`
${
getPrefixUrl
()}
/*`
,
(
req
:
express
.
Request
,
res
:
express
.
Response
)
=>
{
res
.
sendFile
(
path
.
resolve
(
'
static/index.html
'
));
});
}
...
...
ts/webui/src/static/function.ts
View file @
0fe0fd86
...
...
@@ -14,7 +14,13 @@ function getPrefix(): string | undefined {
newPathName
=
pathName
.
replace
(
item
,
''
);
}
});
return
newPathName
===
''
||
newPathName
===
'
/
'
?
undefined
:
newPathName
;
let
result
=
newPathName
===
''
||
newPathName
===
'
/
'
?
undefined
:
newPathName
;
if
(
result
!==
undefined
)
{
if
(
result
.
endsWith
(
'
/
'
))
{
result
=
result
.
slice
(
0
,
result
.
length
-
1
);
}
}
return
result
;
}
async
function
requestAxios
(
url
:
string
):
Promise
<
any
>
{
...
...
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