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
749a463a
Unverified
Commit
749a463a
authored
Jun 28, 2021
by
liuzhe-lz
Committed by
GitHub
Jun 28, 2021
Browse files
Support prefix for webui static files (#3874)
parent
af5551f9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
9 deletions
+8
-9
ts/webui/config/webpack.config.js
ts/webui/config/webpack.config.js
+4
-7
ts/webui/src/components/stateless-component/NNItabs.tsx
ts/webui/src/components/stateless-component/NNItabs.tsx
+3
-1
ts/webui/src/index.tsx
ts/webui/src/index.tsx
+1
-1
No files found.
ts/webui/config/webpack.config.js
View file @
749a463a
...
@@ -54,19 +54,16 @@ module.exports = function(webpackEnv) {
...
@@ -54,19 +54,16 @@ module.exports = function(webpackEnv) {
// Webpack uses `publicPath` to determine where the app is being served from.
// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
// It requires a trailing slash, or the file assets will get an incorrect path.
// In development, we always serve from the root. This makes config easier.
// In development, we always serve from the root. This makes config easier.
const
publicPath
=
isEnvProduction
//const publicPath = isEnvProduction ? paths.servedPath : isEnvDevelopment && '/';
?
paths
.
servedPath
const
publicPath
=
'
./
'
;
:
isEnvDevelopment
&&
'
/
'
;
// Some apps do not use client-side routing with pushState.
// Some apps do not use client-side routing with pushState.
// For these, "homepage" can be set to "." to enable relative asset paths.
// For these, "homepage" can be set to "." to enable relative asset paths.
const
shouldUseRelativeAssetPaths
=
publicPath
===
'
./
'
;
const
shouldUseRelativeAssetPaths
=
true
;
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
const
publicUrl
=
isEnvProduction
const
publicUrl
=
'
.
'
;
?
publicPath
.
slice
(
0
,
-
1
)
:
isEnvDevelopment
&&
''
;
// Get environment variables to inject into our app.
// Get environment variables to inject into our app.
const
env
=
getClientEnvironment
(
publicUrl
);
const
env
=
getClientEnvironment
(
publicUrl
);
...
...
ts/webui/src/components/stateless-component/NNItabs.tsx
View file @
749a463a
import
*
as
React
from
'
react
'
;
import
*
as
React
from
'
react
'
;
import
{
NavLink
}
from
'
react-router-dom
'
;
import
{
NavLink
}
from
'
react-router-dom
'
;
import
{
getPrefix
}
from
'
../../static/function
'
;
const
OVERVIEWTABS
=
(
const
OVERVIEWTABS
=
(
<
NavLink
to
=
'/oview'
activeClassName
=
'selected'
className
=
'common-tabs'
>
<
NavLink
to
=
'/oview'
activeClassName
=
'selected'
className
=
'common-tabs'
>
Overview
Overview
...
@@ -15,7 +17,7 @@ const DETAILTABS = (
...
@@ -15,7 +17,7 @@ const DETAILTABS = (
const
NNILOGO
=
(
const
NNILOGO
=
(
<
NavLink
to
=
'/oview'
>
<
NavLink
to
=
'/oview'
>
<
img
src
=
'/logo.png'
alt
=
'NNI logo'
style
=
{
{
height
:
40
}
}
/>
<
img
src
=
{
(
getPrefix
()
||
''
)
+
'
/logo.png
'
}
alt
=
'NNI logo'
style
=
{
{
height
:
40
}
}
/>
</
NavLink
>
</
NavLink
>
);
);
...
...
ts/webui/src/index.tsx
View file @
749a463a
...
@@ -17,7 +17,7 @@ ReactDOM.render(
...
@@ -17,7 +17,7 @@ ReactDOM.render(
<
Suspense
<
Suspense
fallback
=
{
fallback
=
{
<
div
className
=
'loading'
>
<
div
className
=
'loading'
>
<
img
src
=
'/loading.gif'
/>
<
img
src
=
{
(
path
||
''
)
+
'
/loading.gif
'
}
/>
</
div
>
</
div
>
}
}
>
>
...
...
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