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());
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");
//写入
template.process(context, wr);

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

@ -19,7 +19,6 @@ http {
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
<#list services as item>
server {
@ -30,13 +29,15 @@ http {
#access_log logs/host.access.log main;
<#list services.mappingList as mapping>
location /#{mapping.context} {
proxy_pass http://#{location};
<#list item.mappingList as mapping>
location /${mapping.context} {
proxy_pass ${mapping.location};
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-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_body_buffer_size 128k;
proxy_connect_timeout 300;

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

Loading…
Cancel
Save

Powered by TurnKey Linux.