新版本 UI 同步添加 common.js

This commit is contained in:
bwcx_jzy 2021-08-04 11:53:59 +08:00
parent f87c5d9bfa
commit 1d20ecbf6a
5 changed files with 78 additions and 71 deletions

View File

@ -14,6 +14,7 @@
7. 【server】节点升级上传新包成功后删除历史包
8. 【server】新版本 UI 菜单系统管理、节点升级只有系统管理员可见
9. 【server】新版本 UI 脚本模板同步添加执行参数(感谢@轻描淡写 [Gitee issues I43G4B](https://gitee.com/dromara/Jpom/issues/I43G4B)
10. 【server】新版本 UI 同步添加 common.js
### 解决BUG、优化功能
@ -77,8 +78,7 @@
11. 【server】项目控制台新增心跳消息避免超过一定时间后无法操作的情况
12. 【server】ssh 新增心跳消息,避免超过一定时间后无法操作的情况
13. 【server】系统缓存中的文件占用空间大小调整为定时更新10分钟
14. 【server】修复 bug分发列表页面点击【创建分发项目】按钮之后不能正常显示【分发节点】感谢
@xingenhi [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/bd38528fbd3067d220b7569f08449d7796e07c74) [@Hotstrip](https://gitee.com/hotstrip)
14. 【server】修复 bug分发列表页面点击【创建分发项目】按钮之后不能正常显示【分发节点】感谢 @xingenhi [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/bd38528fbd3067d220b7569f08449d7796e07c74) [@Hotstrip](https://gitee.com/hotstrip)
15. 【server】fix: 编辑管理员时用户名不可修改
16. 【server】折叠显示部分列表操作按钮减少误操作
@ -104,12 +104,9 @@
项目监控页面,线程数据加载失败问题 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/b11c5443db6468a2bf7f6a9fa933f8d965899624) [@Hotstrip](https://gitee.com/hotstrip)
3. 【server】fix bug: 修复低版本浏览器不支持 `.replaceAll()`
方法 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/0fb475963153b76546409ac3065a0efe9e647541) [@杨巍](https://gitee.com/fat_magpie_beijing_tony)
4. 【server】update: 更新分发列表 --
关联分发项目页面操作逻辑(跟老版本操作逻辑一致)[点击查看提交记录](https://gitee.com/dromara/Jpom/commit/cd6e4ae89f833e5e7ef11bd12c324a487de27b1a) [@李道甫](https://gitee.com/koushare_dfli)
5. 【server】update: 优化项目文件管理页面,加载目录树时会多次显示 loading
层 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/71b3779bffb36259e0980ce25d4e4082a9d7c2e6) [@Hotstrip](https://gitee.com/hotstrip)
6. 【server】fix bug: 修复节点请求超时可能导致节点项目列表为空
bug [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/e3182dfa04c27e63a29d67b292a7bfef834f875e) [@Hotstrip](https://gitee.com/hotstrip)
4. 【server】update: 更新分发列表 -- 关联分发项目页面操作逻辑(跟老版本操作逻辑一致)[点击查看提交记录](https://gitee.com/dromara/Jpom/commit/cd6e4ae89f833e5e7ef11bd12c324a487de27b1a) [@李道甫](https://gitee.com/koushare_dfli)
5. 【server】update: 优化项目文件管理页面,加载目录树时会多次显示 loading 层 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/71b3779bffb36259e0980ce25d4e4082a9d7c2e6) [@Hotstrip](https://gitee.com/hotstrip)
6. 【server】fix bug: 修复节点请求超时可能导致节点项目列表为空 bug [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/e3182dfa04c27e63a29d67b292a7bfef834f875e) [@Hotstrip](https://gitee.com/hotstrip)
7. 【agent】 fix bug: index 获取进程列表 NPE (感谢@夏末秋初)
8. 【server】fix bug: 修复上传项目压缩文件创建项目目录异常[点击这里查看对应 issue](https://gitee.com/dromara/Jpom/issues/I29FRJ)
9. 【server】fix bug创建构建时如果选择
@ -118,9 +115,9 @@
11. 【server】update 构建初始化仓库拉取指定分支,不先拉取主分支再切换到指定分支(感谢@大灰灰)
12. 【server】程序关闭时候自动关闭 h2 数据连接池,避免数据库文件被损坏
13. 【server】style:
优化logo登录页面初始化页面 [点击查看对应提交记录](https://gitee.com/dromara/Jpom/commit/5d4783f0be7d44bb04275b059ccd1509620c5828) [@长得丑活得久i](https://gitee.com/zsf_008)
优化logo登录页面初始化页面 [点击查看对应提交记录](https://gitee.com/dromara/Jpom/commit/5d4783f0be7d44bb04275b059ccd1509620c5828) [@长得丑活得久i](https://gitee.com/zsf_008)
14. 【server】fix bug:
修复在没有配置nginx白名单时访问nginx列表数据一直加载中问题[点击这里查看对应 issue](https://github.com/dromara/Jpom/issues/5) [@长得丑活得久i](https://gitee.com/zsf_008)
修复在没有配置nginx白名单时访问nginx列表数据一直加载中问题[点击这里查看对应 issue](https://github.com/dromara/Jpom/issues/5) [@长得丑活得久i](https://gitee.com/zsf_008)
15. 新增 .gitattributes 文件控制命令文件的编码格式以及换行符(感谢@ℳ๓₯㎕斌)
------
@ -155,7 +152,7 @@
13. 【Agent】解决控制台输出 `Failed to check connection: java.net.ConnectException: Connection refused: connect`,因为没有关闭对应的 jmx
14. 【Agent】解决首页控制台 java 进程列表慢的问题(采用定时拉取并缓存)
15. 【server】fix bug:
节点列表页面,展开某个节点之后点击操作按钮会出现新的一行无效数据。 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/b9ecdfa649d27c46bca696e6df088a0908056ff6)
节点列表页面,展开某个节点之后点击操作按钮会出现新的一行无效数据。 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/b9ecdfa649d27c46bca696e6df088a0908056ff6)
16. 【server】fix bug: 节点列表页面,在没有安装节点的情况下,点击终端按钮会在控制台报错。[点击这里查看对应 issue](https://gitee.com/dromara/Jpom/issues/I3J4UI)
17. 【server】fix bug: 节点管理里面的 Nginx 管理,关闭服务的接口参数传递错了。[点击这里查看对应 issue](https://gitee.com/dromara/Jpom/issues/I3IFZY)
18. 【server】优化系统配置页面的样式在小屏幕设备上会出现多个竖方向上的滚动条甚至有时候会遮住底部的操作按钮

View File

@ -28,16 +28,16 @@ public abstract class BaseJpomInterceptor extends BaseInterceptor {
// return false;
// }
public static void sendRedirects(HttpServletRequest request, HttpServletResponse response, String url) throws IOException {
String newUrl = UrlRedirectUtil.getHeaderProxyPath(request, PROXY_PATH) + url;
UrlRedirectUtil.sendRedirect(request, response, newUrl);
}
public static String getRedirect(HttpServletRequest request, String url) {
String newUrl = UrlRedirectUtil.getHeaderProxyPath(request, PROXY_PATH) + url;
String redirect = UrlRedirectUtil.getRedirect(request, newUrl);
return String.format("redirect:%s", redirect);
}
// public static void sendRedirects(HttpServletRequest request, HttpServletResponse response, String url) throws IOException {
// String newUrl = UrlRedirectUtil.getHeaderProxyPath(request, PROXY_PATH) + url;
// UrlRedirectUtil.sendRedirect(request, response, newUrl);
// }
//
// public static String getRedirect(HttpServletRequest request, String url) {
// String newUrl = UrlRedirectUtil.getHeaderProxyPath(request, PROXY_PATH) + url;
// String redirect = UrlRedirectUtil.getRedirect(request, newUrl);
// return String.format("redirect:%s", redirect);
// }
public static String getHeaderProxyPath(HttpServletRequest request) {
String proxyPath = ServletUtil.getHeaderIgnoreCase(request, PROXY_PATH);

View File

@ -171,41 +171,41 @@ public class LoginInterceptor extends BaseJpomInterceptor {
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
super.postHandle(request, response, handler, modelAndView);
HttpSession session;
try {
session = getSession();
} catch (Exception ignored) {
return;
}
try {
// 静态资源地址参数
session.setAttribute("staticCacheTime", DateUtil.currentSeconds());
// 代理二级路径
Object jpomProxyPath = session.getAttribute("jpomProxyPath");
if (jpomProxyPath == null) {
String path = getHeaderProxyPath(request);
session.setAttribute("jpomProxyPath", path);
}
} catch (Exception ignored) {
}
try {
// 统一的js 注入
String jsCommonContext = (String) session.getAttribute("jsCommonContext");
if (jsCommonContext == null) {
String path = ExtConfigBean.getInstance().getPath();
File file = FileUtil.file(String.format("%s/script/common.js", path));
if (file.exists()) {
jsCommonContext = FileUtil.readString(file, CharsetUtil.CHARSET_UTF_8);
jsCommonContext = URLEncoder.DEFAULT.encode(jsCommonContext, CharsetUtil.CHARSET_UTF_8);
}
session.setAttribute("jsCommonContext", jsCommonContext);
}
} catch (IllegalStateException ignored) {
}
}
// @Override
// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// super.postHandle(request, response, handler, modelAndView);
// HttpSession session;
// try {
// session = getSession();
// } catch (Exception ignored) {
// return;
// }
// try {
// // 静态资源地址参数
// session.setAttribute("staticCacheTime", DateUtil.currentSeconds());
// // 代理二级路径
// Object jpomProxyPath = session.getAttribute("jpomProxyPath");
// if (jpomProxyPath == null) {
// String path = getHeaderProxyPath(request);
// session.setAttribute("jpomProxyPath", path);
// }
// } catch (Exception ignored) {
// }
// try {
// // 统一的js 注入
// String jsCommonContext = (String) session.getAttribute("jsCommonContext");
// if (jsCommonContext == null) {
// String path = ExtConfigBean.getInstance().getPath();
// File file = FileUtil.file(String.format("%s/script/common.js", path));
// if (file.exists()) {
// jsCommonContext = FileUtil.readString(file, CharsetUtil.CHARSET_UTF_8);
// jsCommonContext = URLEncoder.DEFAULT.encode(jsCommonContext, CharsetUtil.CHARSET_UTF_8);
// }
// session.setAttribute("jsCommonContext", jsCommonContext);
// }
// } catch (IllegalStateException ignored) {
// }
// }
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {

View File

@ -3,6 +3,7 @@ package io.jpom.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.core.net.URLEncoder;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.servlet.ServletUtil;
@ -18,6 +19,7 @@ import io.jpom.model.data.UserModel;
import io.jpom.permission.CacheControllerFeature;
import io.jpom.service.user.RoleService;
import io.jpom.service.user.UserService;
import io.jpom.system.ExtConfigBean;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@ -50,8 +53,6 @@ public class IndexControl extends BaseServerController {
/**
* 加载首页
*
* @return page
*/
@GetMapping(value = {"index", "", "/"}, produces = MediaType.TEXT_HTML_VALUE)
@NotLogin
@ -59,12 +60,20 @@ public class IndexControl extends BaseServerController {
public void index(HttpServletResponse response) throws IOException {
InputStream inputStream = ResourceUtil.getStream("classpath:/dist/index.html");
String html = IoUtil.read(inputStream, CharsetUtil.CHARSET_UTF_8);
//<div id="jpomCommonJs"></div>
String path = ExtConfigBean.getInstance().getPath();
File file = FileUtil.file(String.format("%s/script/common.js", path));
String jsCommonContext = StrUtil.EMPTY;
if (file.exists()) {
jsCommonContext = FileUtil.readString(file, CharsetUtil.CHARSET_UTF_8);
}
html = StrUtil.replace(html, "<div id=\"jpomCommonJs\"></div>", jsCommonContext);
ServletUtil.write(response, html, ContentType.TEXT_HTML.getValue());
}
/**
* @return
* @return json
* @author Hotstrip
* 检查是否需要初始化系统
* check if need to init system

View File

@ -1,25 +1,26 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org.1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="keywords" content="Jpom,Java项目管理,Jar管理,Java管理系统,服务器项目运维"/>
<meta name="description" content="Jpom-项目管理系统"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title build="<%= htmlWebpackPlugin.options.build %>" ><%= htmlWebpackPlugin.options.title %></title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="keywords" content="Jpom,Java项目管理,Jar管理,Java管理系统,服务器项目运维"/>
<meta name="description" content="Jpom-项目管理系统"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title build="<%= htmlWebpackPlugin.options.build %>"><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<script>
window.routerBase = "/";
window.routerBase = "/";
</script>
<div id="app"></div>
<!-- built files will be auto injected -->
<div id="jpomCommonJs"><!--Don't delete this line, place for public JS --></div>
</body>
</html>