基本页面转化,

This commit is contained in:
bwcx_jzy 2019-08-03 23:10:02 +08:00
parent d49170f7f1
commit a26fff46e2
23 changed files with 443 additions and 611 deletions

View File

@ -2,6 +2,7 @@ package cn.keepbx.jpom.common;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.extra.servlet.ServletUtil;
import cn.jiangzeyin.controller.base.AbstractController; import cn.jiangzeyin.controller.base.AbstractController;
import cn.keepbx.jpom.model.Role; import cn.keepbx.jpom.model.Role;
@ -36,7 +37,8 @@ public abstract class BaseAgentController extends BaseJpomController {
private static String getUserName(HttpServletRequest request) { private static String getUserName(HttpServletRequest request) {
String name = ServletUtil.getHeaderIgnoreCase(request, ConfigBean.JPOM_SERVER_USER_NAME); String name = ServletUtil.getHeaderIgnoreCase(request, ConfigBean.JPOM_SERVER_USER_NAME);
name = CharsetUtil.convert(name, CharsetUtil.CHARSET_ISO_8859_1, CharsetUtil.CHARSET_UTF_8); name = CharsetUtil.convert(name, CharsetUtil.CHARSET_ISO_8859_1, CharsetUtil.CHARSET_UTF_8);
return StrUtil.emptyToDefault(name, StrUtil.DASHED); name = StrUtil.emptyToDefault(name, StrUtil.DASHED);
return URLUtil.decode(name, CharsetUtil.CHARSET_UTF_8);
} }
/** /**

View File

@ -7,7 +7,6 @@ import cn.keepbx.jpom.common.BaseServerController;
import cn.keepbx.jpom.common.forward.NodeForward; import cn.keepbx.jpom.common.forward.NodeForward;
import cn.keepbx.jpom.common.forward.NodeUrl; import cn.keepbx.jpom.common.forward.NodeUrl;
import cn.keepbx.jpom.model.RunMode; import cn.keepbx.jpom.model.RunMode;
import cn.keepbx.jpom.model.data.AgentWhitelist;
import cn.keepbx.jpom.model.data.NodeModel; import cn.keepbx.jpom.model.data.NodeModel;
import cn.keepbx.jpom.model.data.UserModel; import cn.keepbx.jpom.model.data.UserModel;
import cn.keepbx.jpom.model.log.UserOperateLogV1; import cn.keepbx.jpom.model.log.UserOperateLogV1;
@ -24,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
@ -62,15 +60,6 @@ public class EditProjectController extends BaseServerController {
List<String> jsonArray = whitelistDirectoryService.getProjectDirectory(getNode()); List<String> jsonArray = whitelistDirectoryService.getProjectDirectory(getNode());
setAttribute("whitelistDirectory", jsonArray); setAttribute("whitelistDirectory", jsonArray);
if (projectInfo != null && jsonArray != null) {
for (Object obj : jsonArray) {
String itemWhitelistDirectory = AgentWhitelist.getItemWhitelistDirectory(projectInfo, obj.toString());
if (itemWhitelistDirectory != null) {
setAttribute("itemWhitelistDirectory", itemWhitelistDirectory);
break;
}
}
}
setAttribute("item", projectInfo); setAttribute("item", projectInfo);
// 运行模式 // 运行模式
JSONArray runModes = (JSONArray) JSONArray.toJSON(RunMode.values()); JSONArray runModes = (JSONArray) JSONArray.toJSON(RunMode.values());

View File

@ -87,26 +87,6 @@ public class OutGivingModel extends BaseModel {
return getNodeProject(nodeId, projectId) != null; return getNodeProject(nodeId, projectId) != null;
} }
/**
* 获取项目的信息
*
* @param get 方式自动读取
* @return json
*/
public JSONObject getFirstNodeProject(boolean get) {
List<OutGivingNodeProject> outGivingNodeProjectList = getOutGivingNodeProjectList();
if (outGivingNodeProjectList == null || outGivingNodeProjectList.isEmpty()) {
return null;
}
for (OutGivingNodeProject outGivingNodeProject : outGivingNodeProjectList) {
JSONObject projectData = outGivingNodeProject.getProjectData(true);
if (projectData != null) {
return projectData;
}
}
return null;
}
/** /**
* 获取节点的项目信息 * 获取节点的项目信息
* *

View File

@ -1,13 +1,10 @@
package cn.keepbx.jpom.model.data; package cn.keepbx.jpom.model.data;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.jiangzeyin.common.DefaultSystemLog;
import cn.jiangzeyin.common.spring.SpringUtil; import cn.jiangzeyin.common.spring.SpringUtil;
import cn.keepbx.jpom.model.BaseEnum; import cn.keepbx.jpom.model.BaseEnum;
import cn.keepbx.jpom.model.BaseJsonModel; import cn.keepbx.jpom.model.BaseJsonModel;
import cn.keepbx.jpom.service.manage.ProjectInfoService;
import cn.keepbx.jpom.service.node.NodeService; import cn.keepbx.jpom.service.node.NodeService;
import com.alibaba.fastjson.JSONObject;
/** /**
* 节点项目 * 节点项目
@ -16,7 +13,6 @@ import com.alibaba.fastjson.JSONObject;
* @date 2019/4/22 * @date 2019/4/22
*/ */
public class OutGivingNodeProject extends BaseJsonModel { public class OutGivingNodeProject extends BaseJsonModel {
private static ProjectInfoService projectInfoService;
private static NodeService nodeService; private static NodeService nodeService;
private String nodeId; private String nodeId;
@ -25,7 +21,6 @@ public class OutGivingNodeProject extends BaseJsonModel {
private int status = Status.No.getCode(); private int status = Status.No.getCode();
private String result; private String result;
private JSONObject projectInfo;
public String getResult() { public String getResult() {
return result; return result;
@ -71,31 +66,6 @@ public class OutGivingNodeProject extends BaseJsonModel {
this.projectId = projectId; this.projectId = projectId;
} }
/**
* 获取对应的项目数据
*
* @param get 防止自动读取
* @return json
*/
JSONObject getProjectData(boolean get) {
if (projectInfo != null) {
return projectInfo;
}
if (projectInfoService == null) {
projectInfoService = SpringUtil.getBean(ProjectInfoService.class);
}
if (nodeService == null) {
nodeService = SpringUtil.getBean(NodeService.class);
}
NodeModel nodeModel = nodeService.getItem(this.nodeId);
try {
projectInfo = projectInfoService.getItem(nodeModel, this.projectId);
} catch (Exception e) {
DefaultSystemLog.ERROR().error("获取信息异常", e);
}
return projectInfo;
}
/** /**
* 获取节点的数据 * 获取节点的数据
* *

View File

@ -222,7 +222,10 @@
function tableRender(data) { function tableRender(data) {
var done = data.done; var done = data.done;
delete data.done; delete data.done;
var cols = data.cols;
if (!(cols[0] instanceof Array)) {
data.cols = [cols];
}
var newWhere = { var newWhere = {
nodeId: getTopQueryString("nodeId") nodeId: getTopQueryString("nodeId")
}; };

View File

@ -44,6 +44,11 @@
.layui-tab-title li:first-child > i { .layui-tab-title li:first-child > i {
display: none; display: none;
} }
.layui-logo {
width: auto !important;
left: 20px !important;
}
</style> </style>
<div class="layui-side layui-bg-black"> <div class="layui-side layui-bg-black">

View File

@ -10,9 +10,8 @@
<div class="layui-logo"> <div class="layui-logo">
<a href="../index.html" style="color: #009688;">Jpom项目管理系统>> </a> <a href="../index.html" style="color: #009688;">Jpom项目管理系统>> </a>
<span th:title="'版本时间:'+${jpomManifest.timeStamp}+'进程ID:'+${jpomManifest.pid}"> <span th:title="'版本时间:'+${jpomManifest.timeStamp}+'进程ID:'+${jpomManifest.pid}">
<span th:text="${node.name}"></span> [[${node.name}]]<font style="font-size: 10px;"
<font style="font-size: 10px;" th:text="'('+${jpomManifest.version}+')'"></font>
th:text="'('+${jpomManifest.version}+')'"></font>
</span> </span>
</div> </div>
<div th:replace="common/userHead::userHead"></div> <div th:replace="common/userHead::userHead"></div>

View File

@ -1,9 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
#parse("./common/head.vm") <th:block th:include="common/head::head"></th:block>
<title>项目管理系统</title>
<style> <style>
body { body {
position: absolute; position: absolute;
@ -59,31 +57,29 @@
<body> <body>
<div class="console"> <div class="console">
#if($manager)
<div class="layui-row" id="optDiv"> <div class="layui-row" id="optDiv" th:if="${manager}">
<!-- layui-elem-quote --> <!-- layui-elem-quote -->
<a href="javascript:;" class="btn-op layui-btn layui-btn-sm" op="start">启动</a> <a href="javascript:;" class="btn-op layui-btn layui-btn-sm" op="start">启动</a>
<a href="javascript:;" class="btn-op layui-btn layui-btn-sm layui-btn-warm" op="restart">重启</a> <a href="javascript:;" class="btn-op layui-btn layui-btn-sm layui-btn-warm" op="restart">重启</a>
<a href="javascript:;" class="btn-op layui-btn layui-btn-sm layui-btn-danger" op="stop">停止</a> <a href="javascript:;" class="btn-op layui-btn layui-btn-sm layui-btn-danger" op="stop">停止</a>
#if($logSize)
<div class="layui-btn-group"> <div th:if="${logSize}" class="layui-btn-group">
#if($logSize.logSize)
<button id="export" class="layui-btn layui-btn-sm">导出日志</button> <th:block th:if="${logSize?.get('logSize')}">
<button id="resetLog" class="layui-btn layui-btn-sm">重置日志(<span <button id="export" class="layui-btn layui-btn-sm">导出日志</button>
id="logSize">$logSize.logSize</span>) <button id="resetLog" class="layui-btn layui-btn-sm">重置日志(<span
</button> id="logSize" th:text="${logSize?.logSize}"></span>)
#end </button>
#if($logSize.logBack) </th:block>
<button id="logBack" class="layui-btn layui-btn-sm">备份列表</button>
#end <button th:if="${logSize?.logBack}" id="logBack" class="layui-btn layui-btn-sm">备份列表</button>
</div>
#end
<div class="status">
<div class="status-div"></div>
<span></span>
</div>
</div> </div>
#end <div class="status">
<div class="status-div"></div>
<span></span>
</div>
</div>
<div class="terminal"></div> <div class="terminal"></div>
</div> </div>
</body> </body>
@ -96,7 +92,7 @@
function loadSuccess() { function loadSuccess() {
const showLogDom = $('.console .terminal'); const showLogDom = $('.console .terminal');
if ('WebSocket' in window) { if ('WebSocket' in window) {
var url = getSocketHost() + "/console?userId=$user.getUserMd5Key()&projectId=$!projectInfo.id&nodeId=$node.id"; var url = getSocketHost() + "/console?userId=[[${session.user.getUserMd5Key()}]]&projectId=[[${projectInfo?.id}]]&nodeId=[[${node?.id}]]";
const ws = new WebSocket(url); const ws = new WebSocket(url);
ws.onopen = function () { ws.onopen = function () {
showLogDom.append('WebSocket连接成功<br/>'); showLogDom.append('WebSocket连接成功<br/>');
@ -133,11 +129,9 @@
$('.status .status-div').removeClass('status-run').addClass('status-stop'); $('.status .status-div').removeClass('status-run').addClass('status-stop');
$('.status span').text(json_data.msg); $('.status span').text(json_data.msg);
setOpBtn(true); setOpBtn(true);
#if($logSize.logSize) if (op == 'status') {
if (op == 'status') { setMsg("showlog");
setMsg("showlog"); }
}
#end
} }
refreshProjectData(); refreshProjectData();
break; break;
@ -166,7 +160,7 @@
heart = setInterval(function () { heart = setInterval(function () {
const data = { const data = {
op: "heart", op: "heart",
projectId: "$!projectInfo.id" projectId: "[[${projectInfo?.id}]]"
}; };
ws.send(JSON.stringify(data)); ws.send(JSON.stringify(data));
}, 5000); }, 5000);
@ -175,7 +169,7 @@
}; };
ws.onclose = function (er) { ws.onclose = function (er) {
console.log(er) // console.log(er)
showLogDom.append('WebSocket连接已关闭<br/>'); showLogDom.append('WebSocket连接已关闭<br/>');
clearInterval(loopLogTime); clearInterval(loopLogTime);
clearInterval(heart); clearInterval(heart);
@ -207,7 +201,7 @@
function setMsg(opt) { function setMsg(opt) {
const data = { const data = {
op: opt, op: opt,
projectId: "$!projectInfo.id" projectId: "[[${projectInfo?.id}]]"
}; };
layer.load(1, { layer.load(1, {
shade: [0.3, '#fff'] shade: [0.3, '#fff']
@ -247,19 +241,17 @@
if (loopLog) { if (loopLog) {
return; return;
} }
#if($logSize) loopLog = true;
loopLog = true; loopLogTime = setInterval(function () {
loopLogTime = setInterval(function () { reqLogSize();
reqLogSize(); }, 30000);
}, 30000)
#end
} }
function reqLogSize() { function reqLogSize() {
silentAjax({ silentAjax({
url: './log/logSize', url: './log/logSize',
data: { data: {
id: "$!projectInfo.id" id: "[[${projectInfo?.id}]]"
}, },
success: function (data) { success: function (data) {
if (200 == data.code) { if (200 == data.code) {
@ -276,7 +268,7 @@
} }
$('#export').on('click', function () { $('#export').on('click', function () {
var url = "./log/export.html?id=$!projectInfo.id"; var url = "./log/export.html?id=[[${projectInfo?.id}]]";
url = appendNodeId(url); url = appendNodeId(url);
layer.msg('加载中..', { layer.msg('加载中..', {
icon: 16, icon: 16,
@ -294,7 +286,7 @@
loadingAjax({ loadingAjax({
url: './log/resetLog', url: './log/resetLog',
data: { data: {
id: "$!projectInfo.id" id: "[[${projectInfo?.id}]]"
}, },
success: function (data) { success: function (data) {
layer.msg(data.msg); layer.msg(data.msg);
@ -313,11 +305,11 @@
title: '备份列表', title: '备份列表',
shade: 0.8, shade: 0.8,
area: ['80%', '90%'], area: ['80%', '90%'],
content: './log/logBack?id=$!projectInfo.id' content: './log/logBack?id=[[${projectInfo?.id}]]'
}); });
}) })
} }
## 刷新项目数据
function refreshProjectData() { function refreshProjectData() {
try { try {
top.frames["manageList"].location.reload(); top.frames["manageList"].location.reload();

View File

@ -1,9 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
#parse("./common/head.vm") <th:block th:include="common/head::head"></th:block>
<title>项目管理系统</title>
<style> <style>
.div-project { .div-project {
width: 100%; width: 100%;
@ -21,33 +19,30 @@
<div class="layui-container div-project" id="div-project"> <div class="layui-container div-project" id="div-project">
#if($item.outGivingProject)
<blockquote class="layui-elem-quote layui-quote-nm"> <blockquote th:if="${item?.outGivingProject}" class="layui-elem-quote layui-quote-nm">
节点分发项目请在节点分发管理页面中修改 节点分发项目请在节点分发管理页面中修改
</blockquote> </blockquote>
#end
<form action="saveProject" method="post" class="layui-form" id="form_project" lay-filter="form_project"> <form action="saveProject" method="post" class="layui-form" id="form_project" lay-filter="form_project">
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label"><span class="x-red">*</span>项目名称</label> <label class="layui-form-label"><span class="x-red">*</span>项目名称</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input #if($item.outGivingProject)readonly#end type="text" name="name" placeholder="项目名称" required <input th:readonly="${item?.outGivingProject}" type="text" name="name" placeholder="项目名称" required
lay-verify="required" lay-verify="required"
class="layui-input" class="layui-input"
value="#if($item)#if($item.name)$!item.name#else$!item.id#end#end"> th:value="${item?.name}">
<div class="layui-hide"> <input type="hidden" name="edit" th:value="${item!=null}?'on':''">
<input type="hidden" name="edit" value="#if($item)on#end">
</div>
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">分组名称</label> <label class="layui-form-label">分组名称</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select name="group" lay-filter="group" #if($item.outGivingProject)disabled#end> <select name="group" lay-filter="group" th:disabled="${item?.outGivingProject}">
#foreach($i in $groups)
<option value="$i" #if($item.group==$i)selected#end>$i</option> <option th:each="i : ${groups}" th:value="${i}" th:selected="${item?.group==$i}"
#end th:text="${i}"></option>
<option value="">选择手动添加</option> <option value="">选择手动添加</option>
</select> </select>
</div> </div>
@ -58,17 +53,18 @@
<label class="layui-form-label"><span class="x-red">*</span>项目ID</label> <label class="layui-form-label"><span class="x-red">*</span>项目ID</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="id" placeholder="程序运行标志(设置后将不能修改)" required lay-verify="required" <input type="text" name="id" placeholder="程序运行标志(设置后将不能修改)" required lay-verify="required"
class="layui-input #if($item)layui-disabled#end" value="#if($item)$!item.id#end" th:class="${item}?'layui-input layui-disabled':'layui-input'" th:value="${item?.id}"
#if($item)readonly#end> th:readonly="${item?.outGivingProject}">
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label"><span class="x-red">*</span>运行方式</label> <label class="layui-form-label"><span class="x-red">*</span>运行方式</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select name="runMode" lay-filter="runMode" #if($item.outGivingProject)disabled#end> <select name="runMode" lay-filter="runMode" th:disabled="${item?.outGivingProject}">
#foreach($itemPath in $runModes)
<option value="$itemPath" #if($item.runMode==$itemPath)selected#end>$itemPath</option> <option th:each="itemPath : ${runModes}" th:value="${itemPath}"
#end th:selected="${item?.runMode==itemPath}" th:text="${itemPath}">
</option>
</select> </select>
</div> </div>
</div> </div>
@ -77,24 +73,13 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label"><span class="x-red">*</span>项目路径</label> <label class="layui-form-label"><span class="x-red">*</span>项目路径</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select name="whitelistDirectory" <select name="whitelistDirectory"
#if($item.outGivingProject)disabled#end required lay-verify="required" th:disabled="${item?.outGivingProject}" required lay-verify="required"
lay-filter="projectLib"> lay-filter="projectLib">
#if(!$itemWhitelistDirectory) <option th:unless="${#lists.isEmpty(whitelistDirectory)}" value="">请选择白名单</option>
<option value="">请选择白名单</option> <option th:each="itemPath : ${whitelistDirectory}" th:value="${itemPath}"
#end th:selected="${item?.whitelistDirectory==itemPath}" th:text="${itemPath}"></option>
#foreach($itemPath in $whitelistDirectory) <option value="" th:if="${#lists.isEmpty(whitelistDirectory)}">请添加白名单</option>
#if($item && $itemWhitelistDirectory.startsWith($itemPath))
<option value="$itemPath" selected>$itemPath</option>
#set($hasetPath=$itemPath)
#else
<option value="$itemPath">$itemPath</option>
#end
#end
#if(!$whitelistDirectory || $whitelistDirectory.size()<=0)
<option value="">请添加白名单</option>
#end
</select> </select>
</div> </div>
</div> </div>
@ -102,33 +87,40 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label" title="$!item.log"><span class="x-red">*</span>项目Jar包</label> <label class="layui-form-label" title="$!item.log"><span class="x-red">*</span>项目Jar包</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input <input th:readonly="${item?.outGivingProject}" type="text" name="lib" placeholder="jar存储的文件夹"
#if($item.outGivingProject)readonly#end type="text" name="lib" placeholder="jar存储的文件夹" required required
lay-verify="required" lay-verify="required"
class="layui-input" value="#if($item)$!item.lib#end"> class="layui-input" th:value="${item?.lib}">
</div> </div>
</div> </div>
<div class="layui-form-mid layui-word-aux" style="padding: 0 !important;"> <div class="layui-form-mid layui-word-aux" style="padding: 0 !important;">
<div class="layui-input-block" style="color: red;min-height: 0px;"> <div class="layui-input-block" style="color: red;min-height: 0px;">
结果: <span id="projectStart">请选择</span>
<span id="projectStart">#if($hasetPath)$hasetPath#else 请选择#end</span> <span id="projectEnd" style="margin-left: -4px">请填写</span>
<span id="projectEnd" style="margin-left: -4px">#if(!$item)请填写#else$!item.lib#end</span> <span th:if="${item}">&nbsp;&nbsp;日志路径:[[${item?.log}]]</span>
#if($item)
<span>&nbsp;&nbsp;日志路径:$!item.log</span>
#end
</div> </div>
<script th:if="${item}" th:inline="javascript" type="text/javascript">
asyncFn.push(function () {
$("#projectEnd").text([[${item?.lib}]]);
$("#projectStart").text([[${item?.whitelistDirectory}]]);
if ([[${item?.runMode}]] === 'ClassPath') {
$("#mainClassDiv").show();
}
});
</script>
<div class="layui-input-block" id="tipMsgDiv" style="color: red;min-height: 0px;display: none"> <div class="layui-input-block" id="tipMsgDiv" style="color: red;min-height: 0px;display: none">
提示:<span id="tipMsg"></span> 提示:<span id="tipMsg"></span>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-form-item" #if($item)style="display: none;"#end id="mainClassDiv"> <div class="layui-form-item" th:style="${item!=null}?'display: none;':''" id="mainClassDiv">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">MainClass</label> <label class="layui-form-label">MainClass</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input #if($item.outGivingProject)readonly#end type="text" name="mainClass" <input th:readonly="${item?.outGivingProject}" type="text" name="mainClass"
placeholder="程序运行的 main 类(jar模式运行可以不填)" class="layui-input" placeholder="程序运行的 main 类(jar模式运行可以不填)" class="layui-input"
value="#if($item)$!item.mainClass#end"> th:value="${item?.mainClass}">
</div> </div>
</div> </div>
</div> </div>
@ -136,17 +128,17 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">Jvm参数</label> <label class="layui-form-label">Jvm参数</label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea #if($item.outGivingProject)readonly#end name="jvm" <textarea th:readonly="${item?.outGivingProject}" name="jvm"
placeholder="jvm参数,非必填.如:-Xmin=512m -Xmax=512m" placeholder="jvm参数,非必填.如:-Xmin=512m -Xmax=512m"
class="layui-textarea">#if($item)$!item.jvm#end</textarea> class="layui-textarea" th:text="${item?.jvm}"></textarea>
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">args参数</label> <label class="layui-form-label">args参数</label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea #if($item.outGivingProject)readonly#end name="args" <textarea th:readonly="${item?.outGivingProject}" name="args"
placeholder="Main函数args参数,非必填.如:--service.port=8080" placeholder="Main函数args参数,非必填.如:--service.port=8080"
class="layui-textarea">#if($item)$!item.args#end</textarea> class="layui-textarea" th:text="${item?.args}"></textarea>
</div> </div>
</div> </div>
</div> </div>
@ -154,34 +146,34 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">WebHooks</label> <label class="layui-form-label">WebHooks</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input #if($item.outGivingProject)readonly#end type="text" name="token" placeholder="关闭程序时自动请求,非必填GET请求" <input th:readonly="${item?.outGivingProject}" type="text" name="token"
class="layui-input" placeholder="关闭程序时自动请求,非必填GET请求"
value="#if($item)$!item.token#end"> class="layui-input"
th:value="${item?.token}">
</div> </div>
</div> </div>
</div> </div>
#if($item.runCommand)
<div class="layui-form-item"> <div class="layui-form-item" th:if="${item?.get('runCommand')}">
<label class="layui-form-label">运行命令</label> <label class="layui-form-label">运行命令</label>
<div class="layui-input-block"> <div class="layui-input-block">
<blockquote class="layui-elem-quote layui-quote-nm"> <blockquote class="layui-elem-quote layui-quote-nm" th:text="${item?.runCommand}">
$item.runCommand </blockquote>
</blockquote>
</div>
</div> </div>
#end </div>
#if(!$item || $user.isProject($node.id,$!item.id))
<div class="layui-form-item" style="padding-left: 20%"> <div th:if="${item==null || session.user.isProject(node.id,item?.id)}" class="layui-form-item"
#if(!$item.outGivingProject) style="padding-left: 20%">
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="submitProject" <th:block th:unless="${item?.outGivingProject}">
id="project_submit">提交 <button class="layui-btn layui-btn-normal" lay-submit
</button> lay-filter="submitProject"
#if($item) id="project_submit">提交
<a class="layui-btn layui-btn-warm" data-id="$item.id" id="delete_project">删除</a> </button>
#end
#end <a th:if="${item}" class="layui-btn layui-btn-warm" data-id="$item.id" id="delete_project">删除</a>
</div> </th:block>
#end
</div>
</form> </form>
</div> </div>
</body> </body>
@ -217,7 +209,7 @@
} }
form.val("form_project", { form.val("form_project", {
"group": text "group": text
}) });
form.render('select'); form.render('select');
}); });
} }
@ -231,9 +223,7 @@
$("#mainClassDiv").hide(); $("#mainClassDiv").hide();
} }
}); });
#if($item.runMode=='ClassPath')
$("#mainClassDiv").show();
#end
form.on('select(projectLib)', function (data) { form.on('select(projectLib)', function (data) {
let val = data.value; let val = data.value;
@ -314,7 +304,7 @@
}); });
}); });
} }
## 刷新项目列表
function autoClose(group) { function autoClose(group) {
setTimeout(function () { setTimeout(function () {
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);

View File

@ -1,10 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
#parse("./common/head.vm") <th:block th:include="common/head::head"></th:block>
<title>项目管理系统</title> <link th:href="@{${session.jpomProxyPath}+'/static/ztree/zTreeStyle/zTreeStyle.css'}" rel="stylesheet">
<link href="$!jpomProxyPath/static/ztree/zTreeStyle/zTreeStyle.css" rel="stylesheet">
<style> <style>
body { body {
padding: 10px 10px 0px 10px; padding: 10px 10px 0px 10px;
@ -42,7 +40,7 @@
<div class="layui-layout-right" style="padding-right: 20px;padding-top: 10px;"> <div class="layui-layout-right" style="padding-right: 20px;padding-top: 10px;">
<div> <div>
文件位置:$absLib 文件位置:[[${absLib}]]
</div> </div>
</div> </div>
</div> </div>
@ -56,7 +54,7 @@
</div> </div>
</div> </div>
</body> </body>
## 删除按钮
<script type="text/html" id="bar_projects"> <script type="text/html" id="bar_projects">
<a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delete">删除</a> <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delete">删除</a>
{{# if(!d.isDirectory){ }} {{# if(!d.isDirectory){ }}
@ -83,7 +81,7 @@
}; };
const tableWhre = { const tableWhre = {
id: '$id' id: '[[${id}]]'
}; };
var curenntNode = { var curenntNode = {
@ -94,7 +92,7 @@
function loadSuccess() { function loadSuccess() {
// //
asyncLoadJs("$!jpomProxyPath/static/ztree/jquery.ztree.core.min.js", function () { asyncLoadJs("[[${session.jpomProxyPath}]]/static/ztree/jquery.ztree.core.min.js", function () {
zTreeObj = $.fn.zTree.init($("#tree"), setting); zTreeObj = $.fn.zTree.init($("#tree"), setting);
zTreeObj.addNodes(null, curenntNode, false); zTreeObj.addNodes(null, curenntNode, false);
curenntNode = zTreeObj.getNodeByTId("tree_1"); curenntNode = zTreeObj.getNodeByTId("tree_1");
@ -104,7 +102,7 @@
elem: '#tab_file', elem: '#tab_file',
url: './getFileList', url: './getFileList',
where: tableWhre, where: tableWhre,
cols: [[ cols: [
{field: 'index', title: '编号', width: '6%'}, {field: 'index', title: '编号', width: '6%'},
{ {
field: 'filename', title: '文件名称', sort: true, width: '30%', templet: function (d) { field: 'filename', title: '文件名称', sort: true, width: '30%', templet: function (d) {
@ -117,7 +115,7 @@
{field: 'modifyTime', title: '修改时间', sort: true, width: '20%'}, {field: 'modifyTime', title: '修改时间', sort: true, width: '20%'},
{field: 'fileSize', title: '文件大小', sort: true, width: '15%'}, {field: 'fileSize', title: '文件大小', sort: true, width: '15%'},
{field: 'op', title: '操作', toolbar: '#bar_projects'} {field: 'op', title: '操作', toolbar: '#bar_projects'}
]], ],
done: function (ret) { done: function (ret) {
var child = ret.data; var child = ret.data;
if (child) { if (child) {
@ -135,7 +133,7 @@
elem: '#uploadFile', elem: '#uploadFile',
accept: 'file', accept: 'file',
data: { data: {
id: '$id', id: '[[${id}]]',
levelName: function () { levelName: function () {
return $("#currentPath").text(); return $("#currentPath").text();
} }
@ -207,7 +205,7 @@
elem: '#uploadFile_Import_dom', elem: '#uploadFile_Import_dom',
accept: 'file', accept: 'file',
data: { data: {
id: '$id', id: '[[${id}]]',
type: "unzip", type: "unzip",
clearType: function () { clearType: function () {
return $("#uploadFile_Import").attr("type"); return $("#uploadFile_Import").attr("type");
@ -247,7 +245,7 @@
loadingAjax({ loadingAjax({
url: './deleteFile', url: './deleteFile',
data: { data: {
id: '$id', id: '[[${id}]]',
type: 'clear' type: 'clear'
}, },
success: function (data) { success: function (data) {
@ -302,7 +300,7 @@
//下载文件 //下载文件
function downloadFile(data) { function downloadFile(data) {
var url = "./download?id=$id&filename=" + encodeURI(data.filename) + "&levelName=" + data.levelName; var url = "./download?id=[[${id}]]&filename=" + encodeURI(data.filename) + "&levelName=" + data.levelName;
url = appendNodeId(url); url = appendNodeId(url);
self.location.href = url; self.location.href = url;
} }
@ -322,7 +320,7 @@
loadingAjax({ loadingAjax({
url: './deleteFile', url: './deleteFile',
data: { data: {
id: '$id', id: '[[${id}]]',
filename: data.filename, filename: data.filename,
levelName: data.levelName levelName: data.levelName
}, },

View File

@ -1,9 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
#parse("./common/head.vm") <th:block th:include="common/head::head"></th:block>
<title>项目管理系统</title>
<style> <style>
body { body {
padding: 20px; padding: 20px;
@ -25,8 +23,8 @@
<body> <body>
<div> <div>
<button op="a" class="layui-btn layui-btn-sm layui-btn-normal" href="./stack?tag=$!tag">导出堆栈信息</button> <button op="a" class="layui-btn layui-btn-sm layui-btn-normal" th:href="@{./stack(tag=${tag})}">导出堆栈信息</button>
<button op="a" class="layui-btn layui-btn-sm layui-btn-normal" href="./ram?tag=$!tag">导出内存信息</button> <button op="a" class="layui-btn layui-btn-sm layui-btn-normal" th:href="@{./ram(tag=${tag})}">导出内存信息</button>
<button class="layui-btn layui-btn-sm layui-btn-normal" id="threadInfos">查看线程</button> <button class="layui-btn layui-btn-sm layui-btn-normal" id="threadInfos">查看线程</button>
</div> </div>
<div class="info"> <div class="info">
@ -49,59 +47,54 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
#if($data.process) <tr th:if="${data?.process}">
<tr> <td th:text="${data?.process?.pid}"></td>
<td>$!data.process.pid</td> <td th:text="${data?.process?.command}"></td>
<td>$!data.process.command</td> <td th:text="${data?.process?.user}"></td>
<td>$!data.process.user</td> <td th:text="${data?.process?.res}"></td>
<td>$!data.process.res</td> <td th:text="${data?.process?.status}"></td>
<td>$!data.process.status</td> <td th:text="${data?.process?.cpu}"></td>
<td>$!data.process.cpu</td> <td th:text="${data?.process?.mem}"></td>
<td>$!data.process.mem</td> <td th:text="${data?.process?.time}"></td>
<td>$!data.process.time</td> <td th:text="${data?.process?.pr}"></td>
<td>$!data.process.pr</td> <td th:text="${data?.process?.ni}"></td>
<td>$!data.process.ni</td> <td th:text="${data?.process?.virt}"></td>
<td>$!data.process.virt</td> <td th:text="${data?.process?.shr}"></td>
<td>$!data.process.shr</td> </tr>
</tr> <tr th:unless="${data?.process}">
#else <td colspan=12 style="text-align:center">无数据</td>
<tr> </tr>
<td colspan=12 style="text-align:center">无数据</td>
</tr>
#end
</tbody> </tbody>
</table> </table>
</div> </div>
#if($data.beanMem) <div class="info" th:if="${data?.beanMem}">
<div class="info"> <label> jvm内存</label>
<label> jvm内存</label> <table class="layui-table" style="margin-top: 10px">
<table class="layui-table" style="margin-top: 10px"> <thead>
<thead> <tr>
<tr> <th>已使用堆内存</th>
<th>已使用堆内存</th> <th>占用堆内存</th>
<th>占用堆内存</th> <th>已分配堆内存</th>
<th>已分配堆内存</th> <th>已使用非堆内存</th>
<th>已使用非堆内存</th> <th>占用非堆内存</th>
<th>占用非堆内存</th> <th>已分配非堆内存</th>
<th>已分配非堆内存</th> <th>挂起的对象</th>
<th>挂起的对象</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> <tr>
<tr> <td th:text="${data?.beanMem?.heapUsed}"></td>
<td>$!data.beanMem.heapUsed</td> <td th:text="${data?.beanMem?.heapProportion}"></td>
<td>$!data.beanMem.heapProportion</td> <td th:text="${data?.beanMem?.heapCommitted}"></td>
<td>$!data.beanMem.heapCommitted</td> <td th:text="${data?.beanMem?.nonHeapUsed}"></td>
<td>$!data.beanMem.nonHeapUsed</td> <td th:text="${data?.beanMem?.nonHeapProportion}"></td>
<td>$!data.beanMem.nonHeapProportion</td> <td th:text="${data?.beanMem?.nonHeapCommitted}"></td>
<td>$!data.beanMem.nonHeapCommitted</td> <td th:text="${data?.beanMem?.mount}"></td>
<td>$!data.beanMem.mount</td> </tr>
</tr> </tbody>
</tbody> </table>
</table> </div>
</div>
#end
<div class="info"> <div class="info">
<label>端口信息</label> <label>端口信息</label>
@ -120,23 +113,20 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
#foreach($item in $data.netstat)
#set($hashNetStat=true) #set($hashNetStat=true)
<tr> <tr th:each="item : ${data?.netstat}">
<td>$!item.name</td> <td th:text="${item?.name}"></td>
<td>$!item.protocol</td> <td th:text="${item?.protocol}"></td>
<td>$!item.local</td> <td th:text="${item?.local}"></td>
<td>$!item.foreign</td> <td th:text="${item?.foreign}"></td>
<td>$!item.status</td> <td th:text="${item?.status}"></td>
<td>$!item.receive</td> <td th:text="${item?.receive}"></td>
<td>$!item.send</td> <td th:text="${item?.send}"></td>
</tr> </tr>
#end <tr th:if="${#lists.isEmpty(data?.netstat)}">
#if(!$hashNetStat) <td colspan=7 style="text-align:center">无数据</td>
<tr> </tr>
<td colspan=7 style="text-align:center">无数据</td>
</tr>
#end
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -1,14 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head th:replace="common/head::head">
#parse("./common/head.vm")
<title>logBack</title>
<style>
body {
padding: 10px;
}
</style>
</head> </head>
<body> <body>
@ -17,11 +10,11 @@
<tbody> <tbody>
<tr> <tr>
<td>控制台日志路径</td> <td>控制台日志路径</td>
<td>$!data.logPath</td> <td th:text="${data?.logPath}"></td>
</tr> </tr>
<tr> <tr>
<td>控制台日志备份路径</td> <td>控制台日志备份路径</td>
<td>$!data.logBackPath</td> <td th:text="${data?.logBackPath}"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -36,28 +29,24 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
#if($data.array && $data.array.size()>0)
#foreach($item in $data.array) <tr th:each="item : ${data?.array}">
<tr> <td th:text="${item.index}"></td>
<td>$item.index</td> <td th:text="${item.filename}"></td>
<td>$item.filename</td> <td th:text="${item.modifyTime}"></td>
<td>$item.modifyTime</td> <td th:text="${item.fileSize}"></td>
<td>$item.fileSize</td> <td>
<td> <button op="a" th:href="@{logBack_download(key=${item.filename},id=${data?.id})}"
<button op="a" href="logBack_download?key=$item.filename&id=$data.id" class="layui-btn layui-btn-warm layui-btn-sm">下载
class="layui-btn layui-btn-warm layui-btn-sm">下载 </button>
</button> <button name="delete" th:data-name="${item.filename}" th:data-id="${data?.id}"
<button name="delete" data-name="$item.filename" data-id="$data.id" class="layui-btn layui-btn-danger layui-btn-sm">删除
class="layui-btn layui-btn-danger layui-btn-sm">删除 </button>
</button> </td>
</td> </tr>
</tr> <tr th:if="${#lists.isEmpty(data?.array)}">
#end <td colspan="5">没有相关信息</td>
#else </tr>
<tr>
<td colspan="5">没有相关信息</td>
</tr>
#end
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -1,20 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head th:replace="common/head::head">
#parse("./common/head.vm")
<title>项目管理系统</title>
<style>
body {
padding: 10px;
}
</style>
</head> </head>
<body> <body>
<div class="layui-row"> <div class="layui-row">
#if($user.isManage($node.id))
<button onclick="editProject('');" class="layui-btn layui-btn-sm">新增项目</button> <button th:if="${session.user.isManage(node.id)}" onclick="editProject('');" class="layui-btn layui-btn-sm">新增项目
#end </button>
<button onclick="reloadTable();" class="layui-btn layui-btn-sm">刷新表格</button> <button onclick="reloadTable();" class="layui-btn layui-btn-sm">刷新表格</button>
</div> </div>
<table class="layui-table" id="tab_project" lay-filter="tab_project" style="margin: 0;"></table> <table class="layui-table" id="tab_project" lay-filter="tab_project" style="margin: 0;"></table>
@ -31,8 +25,7 @@
</script> </script>
<script type="text/html" id="status_templ"> <script type="text/html" id="status_templ">
<div title="请到控制台中管理项目"> <div title="请到控制台中管理项目">
<input type="checkbox" id="" disabled name="status" {{# if(d.status){ }} <input type="checkbox" id="" disabled name="status" {{# if(d.status){ }}checked{{# } }}
checked {{# } }}
lay-skin="switch" lay-skin="switch"
lay-text="运行中|未运行"> lay-text="运行中|未运行">
</div> </div>
@ -51,9 +44,7 @@
<select name="selectGroup" id="selectGroup" lay-verify="required" lay-filter="groupName" <select name="selectGroup" id="selectGroup" lay-verify="required" lay-filter="groupName"
lay-search=""> lay-search="">
<option value="">请选择</option> <option value="">请选择</option>
#foreach($item in $groups) <option th:each="item : ${groups}" th:value="${item}" th:text="${item}"></option>
<option value="$item">$item</option>
#end
</select> </select>
</div> </div>
</div> </div>
@ -99,7 +90,7 @@
url: './getProjectInfo', url: './getProjectInfo',
toolbar: '#toolbarDemo', toolbar: '#toolbarDemo',
where: apiWhere, where: apiWhere,
cols: [[{ cols: [{
field: 'name', title: '项目名称', width: '15%', sort: true, templet: function (d) { field: 'name', title: '项目名称', width: '15%', sort: true, templet: function (d) {
var title = '分组:' + d.group + ' 项目Id:' + d.id; var title = '分组:' + d.group + ' 项目Id:' + d.id;
title += ' lib状态:' + (d.runLibDesc || "") + " / " + (d.useLibDesc || ""); title += ' lib状态:' + (d.runLibDesc || "") + " / " + (d.useLibDesc || "");
@ -122,8 +113,7 @@
sort: true, sort: true,
width: '8%' width: '8%'
}, },
{field: 'op', title: '操作', toolbar: '#bar_projects'} {field: 'op', title: '操作', toolbar: '#bar_projects'}],
]],
done: function (data) { done: function (data) {
var projects = data.data; var projects = data.data;
var ids = []; var ids = [];

View File

@ -1,13 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
#parse("./common/head.vm") <th:block th:include="common/head::head"></th:block>
<title>项目管理系统</title>
<style> <style>
body {
padding: 20px;
}
.div-project { .div-project {
width: 100%; width: 100%;
@ -25,50 +20,45 @@
</head> </head>
<body> <body>
#if($user.isManage($node.id))
<table class="layui-table">
<thead>
<tr>
<th>序号</th>
<th>项目名称</th>
<th>项目ID</th>
<th>项目分组</th>
<th>项目路径</th>
<th>删除时间</th>
<th>操作人</th>
<th>操作</th>
</tr>
</thead>
<tbody>
#foreach($item in $!array) <table th:if="${session.user.isManage(node.id)}" class="layui-table">
#set($hashData=true) <thead>
<tr> <tr>
<td>$!velocityCount</td> <th>序号</th>
<td>$!item.projectInfoModel.name</td> <th>项目名称</th>
<td>$!item.projectInfoModel.id</td> <th>项目ID</th>
<td>$!item.projectInfoModel.group</td> <th>项目分组</th>
<td>$!item.projectInfoModel.lib</td> <th>项目路径</th>
<td>$!item.delTime</td> <th>删除时间</th>
<td>$!item.delUser</td> <th>操作人</th>
<td> <th>操作</th>
<button name="delete" onclick="projectDetail(this)" data-name="$item.filename" </tr>
index="$!velocityCount" data-id="$!item.id" </thead>
class="layui-btn layui-btn-sm">详情 <tbody>
</button>
</td> <tr th:each="item,i: ${array}">
</tr> <td th:text="${i.index}"></td>
#end <td>$!item.projectInfoModel.name</td>
#if(!$hashData) <td>$!item.projectInfoModel.id</td>
<tr> <td>$!item.projectInfoModel.group</td>
<td colspan=8 style="text-align:center">无数据</td> <td>$!item.projectInfoModel.lib</td>
</tr> <td>$!item.delTime</td>
#end <td>$!item.delUser</td>
</tbody> <td>
</table> <button name="delete" onclick="projectDetail(this)"
#else th:index="${i.index}" th:data-id="${item.id}"
<h1>你没有权限</h1> class="layui-btn layui-btn-sm">详情
#end </button>
</td>
</tr>
<tr th:if="${#lists.isEmpty(array)}">
<td colspan=8 style="text-align:center">无数据</td>
</tr>
</tbody>
</table>
<h1 th:unless="${session.user.isManage(node.id)}">你没有权限</h1>
<div class="layui-container div-project" id="div-project"> <div class="layui-container div-project" id="div-project">
<div class="layui-form-item"> <div class="layui-form-item">

View File

@ -1,9 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
#parse("./common/head.vm") <th:block th:include="common/head::head"></th:block>
<title>项目管理系统</title>
<style> <style>
body { body {
position: absolute; position: absolute;
@ -59,21 +58,18 @@
<body> <body>
<div class="console"> <div class="console">
<div th:if="${session.user.isManage(node.id)}" class="layui-row" id="optDiv">
<!-- layui-elem-quote -->
<a href="javascript:;" class="btn-op layui-btn layui-btn-sm" op="start">执行</a>
<!-- <a href="javascript:;" class="btn-op layui-btn layui-btn-sm layui-btn-warm" op="restart">重启</a>-->
<a href="javascript:;" style="display: none;" class="btn-op layui-btn layui-btn-sm layui-btn-danger"
op="stop">停止</a>
#if($user.isManage($node.id)) <div class="status">
<div class="layui-row" id="optDiv"> <div class="status-div"></div>
<!-- layui-elem-quote --> <span></span>
<a href="javascript:;" class="btn-op layui-btn layui-btn-sm" op="start">执行</a>
## <a href="javascript:;" class="btn-op layui-btn layui-btn-sm layui-btn-warm" op="restart">重启</a>
<a href="javascript:;" style="display: none;" class="btn-op layui-btn layui-btn-sm layui-btn-danger"
op="stop">停止</a>
<div class="status">
<div class="status-div"></div>
<span></span>
</div>
</div> </div>
#end </div>
<div class="terminal"></div> <div class="terminal"></div>
</div> </div>
</body> </body>
@ -85,7 +81,7 @@
const showLogDom = $('.console .terminal'); const showLogDom = $('.console .terminal');
if ('WebSocket' in window) { if ('WebSocket' in window) {
var url = getSocketHost() + "/script_run?userId=$user.getUserMd5Key()&scriptId=" + scriptId + "&nodeId=$node.id&type=script"; var url = getSocketHost() + "/script_run?userId=[[${session.user.getUserMd5Key()}]]&scriptId=" + scriptId + "&nodeId=[[${node.id}]]&type=script";
const ws = new WebSocket(url); const ws = new WebSocket(url);
ws.onopen = function () { ws.onopen = function () {
showLogDom.append('WebSocket连接成功<br/>'); showLogDom.append('WebSocket连接成功<br/>');

View File

@ -1,14 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head th:replace="common/head::head">
#parse("./common/head.vm")
<title>oss</title>
<style>
body {
padding-top: 20px;
}
</style>
</head> </head>
<body> <body>
@ -18,35 +11,31 @@
<label class="layui-form-label">模板ID</label> <label class="layui-form-label">模板ID</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="id" placeholder="请输入模板Id" required lay-verify="required" <input type="text" name="id" placeholder="请输入模板Id" required lay-verify="required"
value="$!item.id" #if($item)readonly#end class="layui-input"> th:value="${item?.id}" th:readonly="${item}" class="layui-input">
<input type="hidden" name="type" value="$type"> <input type="hidden" name="type" th:value="${type}">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">模板名称</label> <label class="layui-form-label">模板名称</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="name" placeholder="请输入模板名称" required lay-verify="required" <input type="text" name="name" placeholder="请输入模板名称" required lay-verify="required"
value="$!item.name" class="layui-input"> th:value="${item?.name}" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">模板内容</label> <label class="layui-form-label">模板内容</label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea name="context" style="height: 50vh;" placeholder="请输入模板内容" <textarea name="context" style="height: 50vh;" placeholder="请输入模板内容"
class="layui-textarea auto">$!item.context</textarea> class="layui-textarea auto" th:text="${item?.context}"></textarea>
</div> </div>
</div> </div>
#if($user.isSystemUser())
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
#if($item) <div th:if="${session.user.isSystemUser()}" class="layui-form-item">
<a class="layui-btn layui-btn-warm" data-id="$item.id" id="delete">删除</a> <div class="layui-input-block">
#end <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
</div> <a th:if="${item}" class="layui-btn layui-btn-warm" data-id="$item.id" id="delete">删除</a>
</div> </div>
#end </div>
</form> </form>
</div> </div>
</body> </body>

View File

@ -1,23 +1,17 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head th:replace="common/head::head">
#parse("./common/head.vm")
<title>项目管理系统</title>
<style>
body {
padding: 20px;
}
</style>
</head> </head>
<body> <body>
<div class="layui-row"> <div class="layui-row">
<button onclick="location.reload();" class="layui-btn layui-btn-sm">刷新表格</button> <button onclick="location.reload();" class="layui-btn layui-btn-sm">刷新表格</button>
#if($user.isSystemUser())
<th:block th:if="${session.user.isSystemUser()}">
<button onclick="editItem('');" class="layui-btn layui-btn-sm">添加模板</button> <button onclick="editItem('');" class="layui-btn layui-btn-sm">添加模板</button>
<button id="import" class="layui-btn layui-btn-sm">导入模板</button> <button id="import" class="layui-btn layui-btn-sm">导入模板</button>
#end </th:block>
</div> </div>
<div class="layui-form"> <div class="layui-form">
@ -32,28 +26,24 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
#foreach($item in $array) <tr th:each="item : ${array}">
<tr> <td th:text="${item.id}"></td>
<td>$item.id</td> <td th:text="${item.name}"></td>
<td>$item.name</td> <td th:text="${item.modifyTime}"></td>
<td>$item.modifyTime</td> <td th:text="${item.lastRunUser}"></td>
<td>$item.lastRunUser</td> <td>
<td> <button th:sId="${item.id}" onclick="runScript(this)" class="layui-btn layui-btn-warm layui-btn-sm">执行
<button onclick="runScript('$item.id')" class="layui-btn layui-btn-warm layui-btn-sm">执行 </button>
</button> <button th:sId="${item.id}" th:text="${session.user.isSystemUser()}?'修改':'预览'"
onclick="editItem(this)"
class="layui-btn layui-btn-sm">
</button>
<button onclick="editItem('$item.id')" class="layui-btn layui-btn-sm">#if($user.isSystemUser()) </td>
修改#else 预览#end </tr>
</button> <tr th:if="${#lists.isEmpty(array)}">
<td colspan="5">没有相关信息</td>
</td> </tr>
</tr>
#end
#if(!$array || $array.size()<=0)
<tr>
<td colspan="5">没有相关信息</td>
</tr>
#end
</tbody> </tbody>
</table> </table>
</div> </div>
@ -86,7 +76,8 @@
}); });
} }
function editItem(id) { function editItem(t) {
var id = $(t).attr("sId");
layerOpen({ layerOpen({
type: 2, type: 2,
title: '管理脚本模板', title: '管理脚本模板',
@ -96,7 +87,8 @@
}); });
} }
function runScript(id) { function runScript(t) {
var id = $(t).attr("sId");
tabChange({ tabChange({
id: "runScript-" + id, id: "runScript-" + id,
url: './script/console.html?id=' + id, url: './script/console.html?id=' + id,

View File

@ -1,13 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
#parse("./common/head.vm") <th:block th:include="common/head::head"></th:block>
<title>证书管理</title>
<style> <style>
body {
padding: 10px;
}
.layui-container { .layui-container {
width: 80% !important; width: 80% !important;
@ -54,9 +49,8 @@
<select name="path" id="path" lay-filter="aihao" required <select name="path" id="path" lay-filter="aihao" required
lay-verify="required"> lay-verify="required">
<option value="">请选择证书存放的路径</option> <option value="">请选择证书存放的路径</option>
#foreach($item in $certificate)
<option id="path_$item" value="$item">$item</option> <option th:each="item : ${certificate}" th:id="'path_'+${item}" th:value="${item}" th:text="${item}"></option>
#end
</select> </select>
</div> </div>
</div> </div>
@ -102,36 +96,37 @@
<script type="text/javascript"> <script type="text/javascript">
var laytpl; var laytpl;
var col = [
{field: 'id', title: 'id', width: '10%', sort: true},
{field: 'name', title: '名称', sort: true},
{field: 'domain', title: '域名', sort: true},
{
field: 'effectiveTime',
title: '生效时间',
width: '14%',
sort: true,
templet: function (d) {
return formateTime(d.effectiveTime);
}
},
{
field: 'expirationTime',
title: '到期时间',
width: '14%',
sort: true,
templet: function (d) {
return formateTime(d.expirationTime);
}
},
{field: 'op', title: '操作', align: 'center', toolbar: '#bar_cert', fixed: 'right'}
];
function loadSuccess() { function loadSuccess() {
tableRender({ tableRender({
id: 'tab_certificate', id: 'tab_certificate',
elem: '#tab_certificate', elem: '#tab_certificate',
url: './getCertList', url: './getCertList',
cols: [[ cols: [col]
{field: 'id', title: 'id', width: '10%', sort: true},
{field: 'name', title: '名称', sort: true},
{field: 'domain', title: '域名', sort: true},
{
field: 'effectiveTime',
title: '生效时间',
width: '14%',
sort: true,
templet: function (d) {
return formateTime(d.effectiveTime);
}
},
{
field: 'expirationTime',
title: '到期时间',
width: '14%',
sort: true,
templet: function (d) {
return formateTime(d.expirationTime);
}
},
{field: 'op', title: '操作', align: 'center', toolbar: '#bar_cert', fixed: 'right'}
]]
}); });
var uploadConfig, hashSelectConfig, updateFormData; var uploadConfig, hashSelectConfig, updateFormData;

View File

@ -1,35 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head th:replace="common/head::head">
#parse("./common/head.vm")
<title>nginx管理</title>
<style>
body {
padding: 10px 10px 0px 10px;
}
.layui-container {
width: 80% !important;
}
.layui-inline {
width: 80%;
}
.div_hidden {
display: none;
}
</style>
</head> </head>
<body> <body>
<div class="layui-row"> <div class="layui-row">
<button id="addNgx" class="layui-btn layui-btn-sm">新增nginx配置</button> <button id="addNgx" class="layui-btn layui-btn-sm">新增nginx配置</button>
<button onclick="reload();" class="layui-btn layui-btn-sm">刷新表格</button> <button onclick="reload();" class="layui-btn layui-btn-sm">刷新表格</button>
## <button id="reload" class="layui-btn layui-btn-sm layui-btn-danger">重启nginx</button>
<button id="reload" class="layui-btn layui-btn-sm layui-btn-danger">重启nginx</button>
</div> </div>
<table class="layui-table" id="tab_ngx" lay-filter="tab_ngx" style="margin: 0;"></table> <table class="layui-table" id="tab_ngx" lay-filter="tab_ngx" style="margin: 0;"></table>
@ -78,21 +58,22 @@
}); });
} }
var col = [
{field: 'name', title: '文件名', sort: true},
{field: 'serverCount', title: '数量', width: "5%", sort: true},
{field: 'server_name', title: '域名', sort: true},
{field: 'location', title: '根location', sort: true},
{field: 'listen', title: '监听端口', width: "10%", sort: true},
{field: 'time', title: '最后修改时间', sort: true},
{
field: 'op', title: '操作', align: 'center', toolbar: '#bar_ngx', fixed: 'right'
}
];
tableRender({ tableRender({
id: 'tab_ngx', id: 'tab_ngx',
elem: '#tab_ngx', elem: '#tab_ngx',
url: './list_data.json', url: './list_data.json',
cols: [[ cols: [col]
{field: 'name', title: '文件名', sort: true},
{field: 'serverCount', title: '数量', width: "5%", sort: true},
{field: 'server_name', title: '域名', sort: true},
{field: 'location', title: '根location', sort: true},
{field: 'listen', title: '监听端口', width: "10%", sort: true},
{field: 'time', title: '最后修改时间', sort: true},
{
field: 'op', title: '操作', align: 'center', toolbar: '#bar_ngx', fixed: 'right'
}
]]
}); });
// 删除 // 删除

View File

@ -1,13 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
#parse("./common/head.vm") <th:block th:include="common/head::head"></th:block>
<title>nginx管理</title>
<style> <style>
body {
padding: 10px;
}
.context { .context {
height: 70vh; height: 70vh;
@ -22,22 +18,23 @@
<body> <body>
<form action="" class="layui-form" id="form_ngx"> <form action="" class="layui-form" id="form_ngx">
<input type="hidden" name="genre" value="$type"> <input type="hidden" name="genre" th:value="${type}">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">文件路径</label> <label class="layui-form-label">文件路径</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="whitePath" id="whitePath" required lay-verify="required" <select name="whitePath" id="whitePath" required lay-verify="required"
#if($type=="update")disabled #end> th:disabled="${type=='update'}">
<option value="">请选择白名单路径</option> <option value="">请选择白名单路径</option>
#foreach($item in $nginx)
<option value="$item" #if($item==$data.whitePath) selected #end>$!item</option> <option th:each="item : ${nginx}" th:value="${item}" th:selected="${item==data?.whitePath}"
#end th:text="${item}">
</option>
</select> </select>
</div> </div>
<label class="layui-form-label">文件名称</label> <label class="layui-form-label">文件名称</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="name" placeholder='文件后缀必须为".conf"' class="layui-input" #if($type== <input type="text" name="name" placeholder='文件后缀必须为".conf"' class="layui-input"
"update") disabled #end value="$!data.name" required lay-verify="required"> th:disabled="${type=='update'}" th:value="${data?.name}" required lay-verify="required">
</div> </div>
</div> </div>
@ -45,7 +42,7 @@
<label class="layui-form-label">配置内容</label> <label class="layui-form-label">配置内容</label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea name="context" required lay-verify="required" placeholder="请填写nginx配置内容" <textarea name="context" required lay-verify="required" placeholder="请填写nginx配置内容"
class="layui-textarea context">$!data.context</textarea> class="layui-textarea context" th:text="${data?.context}"></textarea>
</div> </div>
</div> </div>
<div class="layui-form-item" style="padding-left: 20%"> <div class="layui-form-item" style="padding-left: 20%">
@ -53,7 +50,8 @@
</button> </button>
</div> </div>
</form> </form>
<script type="text/javascript" src="$!jpomProxyPath/static/js/auto-line-number.js?v=$staticCacheTime"></script> <script type="text/javascript"
th:src="@{${session.jpomProxyPath}+'/static/js/auto-line-number.js?v='+${session.staticCacheTime}}"></script>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1,14 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
#parse("./common/head.vm") <th:block th:include="common/head::head"></th:block>
<title>白名单目录</title>
<style> <style>
body {
padding: 10px;
}
.edit-div { .edit-div {
width: 80%; width: 80%;
height: 25vh; height: 25vh;
@ -24,7 +19,7 @@
<label class="layui-form-label">项目路径</label> <label class="layui-form-label">项目路径</label>
<div class="layui-input-block auto"> <div class="layui-input-block auto">
<textarea name="project" placeholder="请输入项目存放路径白名单,回车支持输入多个路径,系统会自动过滤 ../ 路径、不允许输入根路径" <textarea name="project" placeholder="请输入项目存放路径白名单,回车支持输入多个路径,系统会自动过滤 ../ 路径、不允许输入根路径"
class="layui-textarea auto">$!project</textarea> class="layui-textarea auto" th:text="${#strings.defaultString(project,'')}"></textarea>
</div> </div>
</div> </div>
</div> </div>
@ -33,7 +28,7 @@
<label class="layui-form-label">证书路径</label> <label class="layui-form-label">证书路径</label>
<div class="layui-input-block auto"> <div class="layui-input-block auto">
<textarea name="certificate" placeholder="请输入证书存放路径白名单,回车支持输入多个路径,系统会自动过滤 ../ 路径、不允许输入根路径" <textarea name="certificate" placeholder="请输入证书存放路径白名单,回车支持输入多个路径,系统会自动过滤 ../ 路径、不允许输入根路径"
class="layui-textarea auto">$!certificate</textarea> class="layui-textarea auto" th:text="${#strings.defaultString(certificate,'')}"></textarea>
</div> </div>
</div> </div>
</div> </div>
@ -42,7 +37,7 @@
<label class="layui-form-label">nginx目录</label> <label class="layui-form-label">nginx目录</label>
<div class="layui-input-block auto"> <div class="layui-input-block auto">
<textarea name="nginx" placeholder="请输入nginx存放路径白名单回车支持输入多个路径系统会自动过滤 ../ 路径、不允许输入根路径" <textarea name="nginx" placeholder="请输入nginx存放路径白名单回车支持输入多个路径系统会自动过滤 ../ 路径、不允许输入根路径"
class="layui-textarea auto">$!nginx</textarea> class="layui-textarea auto" th:text="${#strings.defaultString(nginx,'')}"></textarea>
</div> </div>
</div> </div>
</div> </div>

View File

@ -30,17 +30,17 @@
<label class="layui-form-label"><span class="x-red">*</span>分发ID</label> <label class="layui-form-label"><span class="x-red">*</span>分发ID</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="id" placeholder="分发ID设置后将不能修改" required lay-verify="required" <input type="text" name="id" placeholder="分发ID设置后将不能修改" required lay-verify="required"
class="layui-input #if($item)layui-disabled#end" value="$!item.id" th:class="${item}?'layui-input layui-disabled':'layui-input'" th:value="${item?.id}"
#if($item)readonly#end> th:readonly="${item}">
<input type="hidden" name="reqId" value="$reqId"> <input type="hidden" name="reqId" th:value="${reqId}">
<input type="hidden" name="type" value="$type"> <input type="hidden" name="type" value="${type}">
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label"><span class="x-red">*</span>分发名称</label> <label class="layui-form-label"><span class="x-red">*</span>分发名称</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="name" placeholder="分发名称" required lay-verify="required" <input type="text" name="name" placeholder="分发名称" required lay-verify="required"
class="layui-input" value="$!item.name"> class="layui-input" th:value="${item?.name}">
</div> </div>
</div> </div>
@ -57,7 +57,7 @@
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="form_outgiving">提交 <button class="layui-btn layui-btn-normal" lay-submit lay-filter="form_outgiving">提交
</button> </button>
<a th:if="${item}" class="layui-btn layui-btn-warm" data-id="$item.id" id="delete_outgiving">删除</a> <a th:if="${item}" class="layui-btn layui-btn-warm" th:data-id="${item?.id}" id="delete_outgiving">删除</a>
</div> </div>
</form> </form>
</div> </div>
@ -69,9 +69,9 @@
<div class="layui-input-block"> <div class="layui-input-block">
<select name="nodeId" required lay-verify="required" lay-filter="selectNode"> <select name="nodeId" required lay-verify="required" lay-filter="selectNode">
<option value="">请选择节点</option> <option value="">请选择节点</option>
#foreach($i in $nodeModels)
<option value="$i.id" nodeName="$i.name">$i.name</option> <option th:each="i : ${nodeModels}" th:value="${i.id}" th:nodeName="${i.name}"
#end th:text="${i.name}"></option>
</select> </select>
</div> </div>
</div> </div>
@ -87,21 +87,18 @@
</form> </form>
</div> </div>
</body> </body>
#foreach($i in $nodeModels)
<script type="text/html" id="node_project_$i.id"> <script type="text/html" th:each="i : ${nodeModels}" th:id="'node_project_'+${i.id}">
<div class="layui-form-item" nodeDiv="$i.id"> <div class="layui-form-item" th:nodeDiv="${i.id}">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label"><span class="x-red">*</span>{{ d.name }}</label> <label class="layui-form-label"><span class="x-red">*</span>{{ d.name }}</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select name="node_$i.id" required lay-verify="required"> <select th:name="'node_'+${i.id}" required lay-verify="required">
<option value="">选择选择项目</option> <option value="">选择选择项目</option>
#foreach($ii in $i.groupProjects) <optgroup th:each="ii : ${i.groupProjects}" th:label="${ii.group}">
<optgroup label="$ii.group"> <option th:each="iProject : ${ii.projects}" th:value="${iProject.id}"
#foreach($iProject in $ii.projects) th:text="${iProject.name}"></option>
<option value="$iProject.id">$iProject.name</option>
#end
</optgroup> </optgroup>
#end
</select> </select>
</div> </div>
</div> </div>
@ -112,7 +109,19 @@
</div> </div>
</div> </div>
</script> </script>
#end
<script type="text/javascript" th:inline="javascript" th:each="nodeP : ${item?.outGivingNodeProjectList}">
asyncFn.push(function () {
var nodeId = [[${nodeP.nodeId}]];
var selectOption = $("select[name='nodeId'] option[value='" + nodeId + "']");
addNode(nodeId, selectOption);
// 选中
$("select[name='node_" + nodeId + "']").val([[${nodeP.projectId}]]);
form.render();
});
</script>
<script type="text/javascript"> <script type="text/javascript">
var laytpl; var laytpl;
@ -134,33 +143,7 @@
}); });
// //
}); });
var selectOption;
#foreach($nodeP in $item.outGivingNodeProjectList)
selectOption = $("select[name='nodeId'] option[value='$nodeP.nodeId']");
addNode("$nodeP.nodeId", selectOption)
// 选中
$("select[name='node_$nodeP.nodeId']").val("$nodeP.projectId");
#end
form.render();
function addNode(nodeId, selectOption) {
var html = document.getElementById('node_project_' + nodeId);
var nodeName = selectOption.attr("nodeName");
laytpl(html.innerHTML).render({
name: nodeName
}, function (newHtml) {
$("#appendNodeDiv").before(newHtml);
layer.closeAll();
// 改变已经选过的选项
selectOption.attr("disabled", true);
selectOption.attr("selected", false)
form.render();
// 检查按钮状态
if ($("div[nodeDiv]").length >= $("select[name='nodeId']").find("option").length - 1) {
$("#add_selectNode").hide();
}
});
}
form.on('submit(form_outgiving)', function (data) { form.on('submit(form_outgiving)', function (data) {
var len = $("div[nodeDiv]").length; var len = $("div[nodeDiv]").length;
@ -226,8 +209,24 @@
} }
# function addNode(nodeId, selectOption) {
# 刷新列表 var html = document.getElementById('node_project_' + nodeId);
var nodeName = selectOption.attr("nodeName");
laytpl(html.innerHTML).render({
name: nodeName
}, function (newHtml) {
$("#appendNodeDiv").before(newHtml);
layer.closeAll();
// 改变已经选过的选项
selectOption.attr("disabled", true);
selectOption.attr("selected", false)
form.render();
// 检查按钮状态
if ($("div[nodeDiv]").length >= $("select[name='nodeId']").find("option").length - 1) {
$("#add_selectNode").hide();
}
});
}
function autoClose() { function autoClose() {
setTimeout(function () { setTimeout(function () {

View File

@ -73,7 +73,8 @@
<select name="whitelistDirectory" required lay-verify="required" lay-filter="whitelistDirectory"> <select name="whitelistDirectory" required lay-verify="required" lay-filter="whitelistDirectory">
<th:block th:unless="${#lists.isEmpty(whitelistDirectory)}"> <th:block th:unless="${#lists.isEmpty(whitelistDirectory)}">
<option value="">请选择白名单</option> <option value="">请选择白名单</option>
<option th:value="${itemPath}" th:each="itemPath : ${whitelistDirectory}" <option th:value="${itemPath}"
th:each="itemPath : ${whitelistDirectory}"
th:text="${itemPath}"></option> th:text="${itemPath}"></option>
</th:block> </th:block>
<option value="" th:if="${#lists.isEmpty(whitelistDirectory)}">请配置白名单</option> <option value="" th:if="${#lists.isEmpty(whitelistDirectory)}">请配置白名单</option>
@ -192,7 +193,7 @@
</script> </script>
<script type="text/javascript" th:inline="javascript" <script type="text/javascript" th:inline="javascript"
th:each="nodeP,iterStat : ${item.outGivingNodeProjectList}"> th:each="nodeP,iterStat : ${item?.outGivingNodeProjectList}">
findFirst = false; findFirst = false;
asyncFn.push(function () { asyncFn.push(function () {
loadingAjax({ loadingAjax({
@ -377,7 +378,6 @@
function checngeLib() { function checngeLib() {
var wVal = whitelistDirectorySelect.val(); var wVal = whitelistDirectorySelect.val();
console.log(wVal);
if (wVal == "") { if (wVal == "") {
layer.msg("请选择白名单"); layer.msg("请选择白名单");
return; return;