0.0.1-SNAPSHOT
王兵 5 years ago
parent c5e46e8493
commit 1c71769564

@ -10,7 +10,7 @@
<module name="wsqlite" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="1.8">
<bytecodeTargetLevel>
<module name="admin" target="1.8" />
<module name="nginx-admin" target="1.8" />
<module name="wsqlite" target="1.8" />

@ -1,21 +1,23 @@
package com.example.action.screen;
import com.example.frame.base.Screen;
import com.example.frame.utils.ProcessUtil;
import com.example.module.admin.ent.NginxCtrl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
public class Mapping extends Screen {
@Autowired
private NginxCtrl nginxCtrl;
@Value("${mapping.default.port}")
private String serverPort;
@Override
public void exec(Model model, HttpServletRequest request, HttpServletResponse response) {
model.addAttribute("run", nginxCtrl.isRunning() ? "true" : "false");
model.addAttribute("serverPort", serverPort);
}
}

@ -22,8 +22,8 @@ public class MappingUpdateRequest extends BaseUpdateRequest {
@NotNull(message = "主键不能为NULL")
private Long id;
@NotNull(message = "服务Id不能为空")
private Long serviceId;
@NotNull(message = "服务端口不能为空")
private String servicePort;
@NotNull(message = "映射名称不能为空")
private String name;
@ -88,11 +88,11 @@ public class MappingUpdateRequest extends BaseUpdateRequest {
this.id = id;
}
public Long getServiceId() {
return serviceId;
public String getServicePort() {
return servicePort;
}
public void setServiceId(Long serviceId) {
this.serviceId = serviceId;
public void setServicePort(String servicePort) {
this.servicePort = servicePort;
}
}

@ -1,51 +0,0 @@
# 生产环境
server.service=80
server.servlet.context-path=/
spring.mvc.static-path-pattern=/static/**
spring.resources.static-locations=classpath:static/
spring.application.name=EXAMPLE-WEB
spring.main.banner-mode=off
spring.devtools.restart.enabled=false
# 编码配置
spring.http.encoding.force=true
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
server.tomcat.uri-encoding=UTF-8
# 根路径、欢迎页
web.welcome.page=/mapping.htm
# 不需要验证授权, 或该请求有自己的验证机制
web.url.auth.excluded=/favicon.ico,/static/**,/api,/login.htm
# 日志配置
logging.path=/root/
logging.levels=INFO
logging.config=classpath:logback-config.xml
# jackson 相关配置
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8
spring.jackson.default-property-inclusion=use_defaults
spring.jackson.mapper.sort-properties-alphabetically=true
spring.jackson.deserialization.fail-on-unknown-properties=false
# freemarker
spring.freemarker.enabled=true
spring.freemarker.allow-request-override=false
spring.freemarker.cache=true
spring.freemarker.check-template-location=true
spring.freemarker.charset=UTF-8
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=false
spring.freemarker.expose-session-attributes=false
spring.freemarker.expose-spring-macro-helpers=false
spring.freemarker.settings.template_update_delay=1
spring.freemarker.settings.locale=zh_CN
spring.freemarker.settings.datetime_format=yyyy-MM-dd HH:mm:ss
spring.freemarker.settings.date_format=yyyy-MM-dd
spring.freemarker.settings.number_format=#.##
spring.freemarker.settings.classic_compatible=true
spring.freemarker.settings.whitespace_stripping=true
spring.freemarker.settings.url_escaping_charset=utf-8
# 文件上传配置
spring.servlet.multipart.resolveLazily=false
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=100MB
dbpath=
nginx-path=

@ -1,10 +1,10 @@
# 开发环境
server.service=8080
server.port=8888
server.servlet.context-path=/
spring.mvc.static-path-pattern=/static/**
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
spring.application.name=EXAMPLE-WEB
spring.main.banner-mode=CONSOLE
spring.application.name=nginx-admin
spring.main.banner-mode=OFF
spring.devtools.restart.enabled=true
# 编码配置
spring.http.encoding.force=true
@ -51,3 +51,4 @@ dbpath=
nginx-path=
admin.username=admin
admin.password=admin
mapping.default.port=8080

@ -31,7 +31,7 @@ http {
keepalive_timeout 65;
#gzip on;
<#list services.keySet() as key>
<#list services?keys as key>
server {
listen ${key};

@ -35,7 +35,7 @@
</el-card>
<el-row>
<el-col :span="24">
<span style="float: right;">
<span>
<el-button type="success" size="small" icon="el-icon-plus" @click="onAction(['create',{}])">新增
</el-button>
<el-button size="small" icon="el-icon-refresh" @click="onRefresh"></el-button>
@ -44,7 +44,11 @@
</el-row>
<el-table
:data="result.filter(data => !vm.search || data.name.toLowerCase().includes(vm.search.toLowerCase())|| data.value.toLowerCase().includes(vm.search.toLowerCase()))"
:data="result.filter(
data => !vm.search
|| data.name.toLowerCase().includes(vm.search.toLowerCase())
|| data.context.toLowerCase().includes(vm.search.toLowerCase())
|| data.location.toLowerCase().includes(vm.search.toLowerCase()))"
style="width: 100%">
<el-table-column
width="150px"
@ -97,7 +101,7 @@
<template slot-scope="scope">
<el-button
size="mini"
@click="onAction(['edit',scope.row,item])">编辑
@click="onAction(['edit',scope.row])">编辑
</el-button>
<el-button
size="mini"
@ -111,34 +115,33 @@
<el-dialog :title="form.title" :visible.sync="form.dialog" width="550px">
<el-form :model="form" :rules="formRules" ref="form" label-width="80px"
style="width: 400px;margin: 0 auto">
<el-form-item label="映射名称" required prop="name">
<el-form-item label="映射名称" prop="name">
<el-row>
<el-col :span="22">
<el-input v-model="form.name" clearable size="small" placeholder="映射名称"></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="映射端口" required prop="servicePort">
<el-form-item label="端口路径" prop="context">
<el-row>
<el-col :span="22">
<el-input v-model="form.servicePort" type="number" clearable size="small" placeholder="映射端口"></el-input>
<el-col :span="8">
<el-input v-model="form.servicePort" type="number" clearable size="small"
placeholder="映射端口"></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="映射路径" required prop="context">
<el-row>
<el-col :span="22">
<el-col :span="1">
</el-col>
<el-col :span="13">
<el-input v-model="form.context" clearable size="small" placeholder="字母数字组合">
<template slot="prepend">http://host:{{form.servicePort}}</template>
</el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="映射类型" required prop="type">
<el-form-item label="映射类型" prop="type">
<el-radio v-model="form.type" label="HTTP">HTTP</el-radio>
<el-radio v-model="form.type" label="FILE">FILE</el-radio>
</el-form-item>
<el-form-item label="映射地址" required prop="location">
<el-form-item label="映射地址" prop="location">
<el-row>
<el-col :span="22">
<el-input v-model="form.location" clearable size="small"
@ -213,6 +216,7 @@
dialog: false,
id: '',
type: 'HTTP',
servicePort: '',
context: '',
location: '',
name: '',
@ -228,8 +232,8 @@
{pattern: "^[0-9]*$", message: '映射端口只能为数字', trigger: 'blur'},
],
context: [
{required: true, message: '映射路径不能为空', trigger: 'blur'},
{pattern: "^/[a-zA-Z][a-zA-Z0-9_-]*$|^/$", message: '上下文须是(/)或(/+字母+字母数字及_', trigger: 'blur'},
{required: true, message: '映射上下文不能为空', trigger: 'blur'},
{pattern: "^/[a-zA-Z][a-zA-Z0-9_-]*$|^/$", message: '上下文须是(/)或(/+字母+字母数字及_组合', trigger: 'blur'},
],
location: [
{required: true, message: '映射地址不能为空', trigger: 'change'},
@ -271,7 +275,7 @@
switch (action) {
case "create":
this.form.title = '新增';
this.form.servicePoert = "8080";
this.form.servicePort = "${serverPort?default("8080")}";
this.form.port = arg[1].value;
this.form.id = '';
this.form.name = '';
@ -284,8 +288,7 @@
case "edit":
this.form.title = '编辑';
this.form.id = arg[1].id;
this.form.serviceId = arg[1].serviceId;
this.form.port = arg[2].value;
this.form.servicePort = arg[1].servicePort;
this.form.name = arg[1].name;
this.form.context = arg[1].context;
this.form.type = arg[1].type;

Loading…
Cancel
Save

Powered by TurnKey Linux.