Browse Source

Merge pull request #596 from Baoqi/combine_ui

make escheduler-ui works in combined server
pull/2/head
乔占卫 5 years ago committed by GitHub
parent
commit
c44e9c4b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java
  2. 6
      escheduler-ui/build/config.js
  3. 2
      escheduler-ui/package.json
  4. 2
      escheduler-ui/src/js/conf/home/store/user/actions.js
  5. 4
      escheduler-ui/src/js/conf/login/App.vue
  6. 2
      escheduler-ui/src/js/module/io/index.js
  7. 8
      escheduler-ui/src/view/common/meta.inc
  8. 2
      escheduler-ui/src/view/common/outro.inc

8
escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java

@ -75,7 +75,7 @@ public class AppConfiguration implements WebMvcConfigurer {
//i18n
registry.addInterceptor(localeChangeInterceptor());
registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/doc.html", "*.html");
registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/doc.html", "*.html", "/ui/**");
}
@ -87,6 +87,12 @@ public class AppConfiguration implements WebMvcConfigurer {
registry.addResourceHandler("/ui/**").addResourceLocations("file:ui/");
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/ui/").setViewName("forward:/ui/index.html");
registry.addViewController("/").setViewName("forward:/ui/index.html");
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping(PATH_PATTERN).allowedOrigins("*").allowedMethods("*");

6
escheduler-ui/build/config.js

@ -189,11 +189,15 @@ const baseConfig = {
},
plugins: [
new webpack.ProvidePlugin({ vue: 'Vue', _: 'lodash' }),
new webpack.DefinePlugin({
PUBLIC_PATH: JSON.stringify(process.env.PUBLIC_PATH ? process.env.PUBLIC_PATH : '')
}),
new HtmlWebpackExtPlugin({
cache: true,
delimiter: '$',
locals: {
NODE_ENV:isProduction
NODE_ENV:isProduction,
PUBLIC_PATH: process.env.PUBLIC_PATH ? process.env.PUBLIC_PATH : ''
}
}),
...pages

2
escheduler-ui/package.json

@ -11,7 +11,7 @@
"lint:fix": "standard \"**/*.{js,vue}\" --fix",
"start": "npm run dev",
"combo": "node ./build/combo.js",
"build:combined": "npm run clean && cross-env NODE_ENV=production webpack --config ./build/webpack.config.combined.js"
"build:combined": "npm run clean && cross-env NODE_ENV=production PUBLIC_PATH=/escheduler/ui webpack --config ./build/webpack.config.combined.js"
},
"dependencies": {
"autoprefixer": "^9.1.0",

2
escheduler-ui/src/js/conf/home/store/user/actions.js

@ -37,7 +37,7 @@ export default {
signOut () {
io.post(`signOut`, res => {
setTimeout(() => {
window.location.href = '/view/login/index.html'
window.location.href = `${PUBLIC_PATH}/view/login/index.html`
}, 100)
}).catch(e => {
console.log(e)

4
escheduler-ui/src/js/conf/login/App.vue

@ -69,9 +69,9 @@
setTimeout(() => {
this.spinnerLoading = false
if (this.userName === 'admin') {
window.location.href = '/#/security/tenant'
window.location.href = `${PUBLIC_PATH}/#/security/tenant`
} else {
window.location.href = '/#/home'
window.location.href = `${PUBLIC_PATH}/#/home`
}
}, 1000)
}).catch(e => {

2
escheduler-ui/src/js/module/io/index.js

@ -44,7 +44,7 @@ io.config.timeout = 0
io.config.maxContentLength = 200000
io.config.validateStatus = function (status) {
if (status === 401 || status === 504) {
window.location.href = '/view/login/index.html'
window.location.href = `${PUBLIC_PATH}/view/login/index.html`
return
}
return status

8
escheduler-ui/src/view/common/meta.inc

@ -11,12 +11,12 @@
<meta name="theme-color" content="#4a8dee">
<meta name="msapplication-navbutton-color" content="#4a8dee">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1">
<link rel="shortcut icon" href="/images/favicon.ico"/>
<link href="/combo/1.0.0/base.css?v1.0.0.1" rel="stylesheet">
<link href="/combo/1.0.0/3rd.css?v1.0.0.1" rel="stylesheet">
<link rel="shortcut icon" href="${locals.PUBLIC_PATH}/images/favicon.ico"/>
<link href="${locals.PUBLIC_PATH}/combo/1.0.0/base.css?v1.0.0.1" rel="stylesheet">
<link href="${locals.PUBLIC_PATH}/combo/1.0.0/3rd.css?v1.0.0.1" rel="stylesheet">
<!--[if lt IE 9]>
<script src="/combo/1.0.0/es5.js"></script>
<script src="${locals.PUBLIC_PATH}/combo/1.0.0/es5.js"></script>
<![endif]-->
<script>

2
escheduler-ui/src/view/common/outro.inc

@ -2,7 +2,7 @@
<!--<script src="https://s1.analysys.cn/libs/??jqueryui/1.12.1/jquery-ui.min.js,twitter-bootstrap/3.3.7/js/bootstrap.min.js,jsPlumb/2.8.5/js/jsplumb.min.js"></script> -->
<!--<script src="https://s1.analysys.cn/libs/??highlight.js/9.13.1/highlight.min.js,element-ui/2.4.9/index.js,clipboard.js/2.0.1/clipboard.min.js,d3/3.3.6/d3.min.js,dayjs/1.7.8/dayjs.min.js"></script> -->
<script src="/combo/1.0.0/3rd.js?v1.0.0.1" type="text/javascript"></script>
<script src="${locals.PUBLIC_PATH}/combo/1.0.0/3rd.js?v1.0.0.1" type="text/javascript"></script>

Loading…
Cancel
Save