0.0.1-SNAPSHOT
wangbing 5 years ago
parent 597b13390b
commit c0017343e9

@ -220,7 +220,7 @@ public class AjaxController {
PortLoadResponse portLoadResponse = (PortLoadResponse) loadPort("", LocalData.getSysToken()); PortLoadResponse portLoadResponse = (PortLoadResponse) loadPort("", LocalData.getSysToken());
context.put("services",portLoadResponse.getResult()); context.put("services",portLoadResponse.getResult());
Template template = freeMarkerConfigurer.getConfiguration().getTemplate("nginx.conf"); Template template = freeMarkerConfigurer.getConfiguration().getTemplate("nginx.conf.ftl");
wr = new OutputStreamWriter(new FileOutputStream(config), "UTF-8"); wr = new OutputStreamWriter(new FileOutputStream(config), "UTF-8");
//写入 //写入
template.process(context, wr); template.process(context, wr);

@ -1,8 +1,12 @@
package com.example.module.admin.req; package com.example.module.admin.req;
import com.example.frame.base.BaseUpdateRequest; import com.example.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import xyz.wbsite.wsqlite.anonation.TableField;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
@ -13,7 +17,7 @@ import javax.validation.constraints.Pattern;
* @version 0.0.1 * @version 0.0.1
* @since 2019-09-28 * @since 2019-09-28
*/ */
public class MappingUpdateRequest extends BaseUpdateRequest { public class MappingUpdateRequest extends BaseUpdateRequest {
/** /**
* *
@ -36,7 +40,10 @@ public class MappingUpdateRequest extends BaseUpdateRequest {
@NotNull(message = "映射值不能为空") @NotNull(message = "映射值不能为空")
@Pattern(regexp = "[^/]*", message = "映射值不能存在/") @Pattern(regexp = "[^/]*", message = "映射值不能存在/")
@Pattern(regexp = "\\w*", message = "映射值需为英文") @Pattern(regexp = "\\w*", message = "映射值需为英文")
private String value; private String context;
@TableField
private String location;
/** /**
* BZ - * BZ -
@ -51,12 +58,20 @@ public class MappingUpdateRequest extends BaseUpdateRequest {
this.name = name; this.name = name;
} }
public String getValue() { public String getContext() {
return value; return context;
}
public void setContext(String context) {
this.context = context;
}
public String getLocation() {
return location;
} }
public void setValue(String value) { public void setLocation(String location) {
this.value = value; this.location = location;
} }
public String getBz() { public String getBz() {

@ -19,7 +19,6 @@ http {
default_type application/octet-stream; default_type application/octet-stream;
sendfile on; sendfile on;
keepalive_timeout 65; keepalive_timeout 65;
<#list services as item> <#list services as item>
server { server {
@ -30,13 +29,15 @@ http {
#access_log logs/host.access.log main; #access_log logs/host.access.log main;
<#list services.mappingList as mapping> <#list item.mappingList as mapping>
location /#{mapping.context} { location /${mapping.context} {
proxy_pass http://#{location}; proxy_pass ${mapping.location};
proxy_redirect off; proxy_redirect off;
proxy_set_header Host $host; proxy_set_header Host $remote_addr:$server_port;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header request_uri $scheme://$remote_addr:$server_port$request_uri;
proxy_set_header proxy_context /${mapping.context};
client_max_body_size 50m; client_max_body_size 50m;
client_body_buffer_size 128k; client_body_buffer_size 128k;
proxy_connect_timeout 300; proxy_connect_timeout 300;

@ -69,14 +69,12 @@
<el-input v-model="form.name" clearable size="small" placeholder="简要描述"></el-input> <el-input v-model="form.name" clearable size="small" placeholder="简要描述"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="路径" prop="context"> <el-form-item label="路径" prop="context">
<el-input v-model="form.value" clearable size="small" placeholder="字母数字组合"> <el-input v-model="form.context" clearable size="small" placeholder="字母数字组合">
<template slot="prepend">:{{form.port}}/</template> <template slot="prepend">:{{form.port}}/</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="地址" prop="location"> <el-form-item label="地址" prop="location">
<el-input v-model="form.value" clearable size="small" placeholder="字母数字组合"> <el-input v-model="form.location" clearable size="small" placeholder="路径或URL"></el-input>
<template slot="prepend">http://</template>
</el-input>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="bz"> <el-form-item label="备注" prop="bz">
<el-input type="textarea" v-model="form.bz" clearable size="small" <el-input type="textarea" v-model="form.bz" clearable size="small"
@ -98,6 +96,16 @@
width="150px" width="150px"
label="名称" label="名称"
prop="name"> prop="name">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.name }}</span>
<el-popover
placement="top-start"
width="200"
trigger="hover"
:content="scope.row.bz">
<i slot="reference" class="el-icon-warning-outline"></i>
</el-popover>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="150px" width="150px"
@ -179,7 +187,8 @@
title: "", title: "",
dialog: false, dialog: false,
id: '', id: '',
value: '', context: '',
location: '',
name: '', name: '',
bz: '' bz: ''
}, },
@ -218,7 +227,8 @@
this.form.port = arg[1].value; this.form.port = arg[1].value;
this.form.id = ''; this.form.id = '';
this.form.name = ''; this.form.name = '';
this.form.value = ''; this.form.context = '';
this.form.location = '';
this.form.bz = ''; this.form.bz = '';
this.form.dialog = true; this.form.dialog = true;
break; break;
@ -228,7 +238,8 @@
this.form.serviceId = arg[1].serviceId; this.form.serviceId = arg[1].serviceId;
this.form.port = arg[2].value; this.form.port = arg[2].value;
this.form.name = arg[1].name; this.form.name = arg[1].name;
this.form.value = arg[1].value; this.form.context = arg[1].context;
this.form.location = arg[1].location;
this.form.bz = arg[1].bz; this.form.bz = arg[1].bz;
this.form.dialog = true; this.form.dialog = true;
break; break;
@ -239,6 +250,7 @@
nav.e(response.errors[0].message); nav.e(response.errors[0].message);
} else { } else {
this.onFind(); this.onFind();
this.nginxReload();
this.form.dialog = false; this.form.dialog = false;
} }
}.bind(this)) }.bind(this))
@ -248,6 +260,7 @@
nav.e(response.errors[0].message); nav.e(response.errors[0].message);
} else { } else {
this.onFind(); this.onFind();
this.nginxReload();
this.form.dialog = false; this.form.dialog = false;
} }
}.bind(this)) }.bind(this))
@ -263,8 +276,9 @@
if (response.errors.length > 0) { if (response.errors.length > 0) {
nav.e(response.errors[0].message); nav.e(response.errors[0].message);
} else { } else {
nav.s("删除成功") nav.s("删除成功");
this.onFind(); this.onFind();
this.nginxReload();
} }
}.bind(this)) }.bind(this))
}.bind(this)).catch(function (action) { }.bind(this)).catch(function (action) {

Loading…
Cancel
Save

Powered by TurnKey Linux.