mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
阶段性提交
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
Vue.component("network-addresses-box", {
|
||||
props: ["vServerType", "vAddresses"],
|
||||
props: ["v-server-type", "v-addresses", "v-protocol"],
|
||||
data: function () {
|
||||
let addresses = this.vAddresses
|
||||
if (addresses == null) {
|
||||
addresses = []
|
||||
}
|
||||
let protocol = this.vProtocol
|
||||
if (protocol == null) {
|
||||
protocol = ""
|
||||
}
|
||||
return {
|
||||
addresses: addresses
|
||||
addresses: addresses,
|
||||
protocol: protocol
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -17,7 +22,7 @@ Vue.component("network-addresses-box", {
|
||||
methods: {
|
||||
addAddr: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType, {
|
||||
teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol, {
|
||||
callback: function (resp) {
|
||||
var addr = resp.data.address;
|
||||
that.addresses.push(addr);
|
||||
|
||||
46
web/public/js/components/common/size-capacity-box.js
Normal file
46
web/public/js/components/common/size-capacity-box.js
Normal file
@@ -0,0 +1,46 @@
|
||||
Vue.component("size-capacity-box", {
|
||||
props: ["v-name", "v-value", "v-count", "v-unit"],
|
||||
data: function () {
|
||||
let v = this.vValue
|
||||
if (v == null) {
|
||||
v = {
|
||||
count: this.vCount,
|
||||
unit: this.vUnit
|
||||
}
|
||||
}
|
||||
if (typeof (v["count"]) != "number") {
|
||||
v["count"] = -1
|
||||
}
|
||||
return {
|
||||
"size": v,
|
||||
countString: (v.count >= 0) ? v.count.toString() : ""
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"countString": function (newValue) {
|
||||
let value = newValue.trim()
|
||||
if (value.length == 0) {
|
||||
this.size.count = -1
|
||||
return
|
||||
}
|
||||
let count = parseInt(value)
|
||||
if (!isNaN(count)) {
|
||||
this.size.count = count
|
||||
}
|
||||
}
|
||||
},
|
||||
template: `<div class="ui fields inline">
|
||||
<input type="hidden" :name="vName" :value="JSON.stringify(size)"/>
|
||||
<div class="ui field">
|
||||
<input type="text" v-model="countString" maxlength="11" size="11"/>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown" v-model="size.unit">
|
||||
<option value="byte">字节</option>
|
||||
<option value="kb">KB</option>
|
||||
<option value="mb">MB</option>
|
||||
<option value="gb">GB</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
46
web/public/js/components/server/gzip-box.js
Normal file
46
web/public/js/components/server/gzip-box.js
Normal file
@@ -0,0 +1,46 @@
|
||||
Vue.component("gzip-box", {
|
||||
props: ["v-gzip-config"],
|
||||
data: function () {
|
||||
let gzip = this.vGzipConfig
|
||||
if (gzip == null) {
|
||||
gzip = {
|
||||
isOn: true,
|
||||
level: 0,
|
||||
minLength: null,
|
||||
maxLength: null
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
gzip: gzip,
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">压缩级别</td>
|
||||
<td>
|
||||
<select class="dropdown auto-width" name="level" v-model="gzip.level">
|
||||
<option value="0">不压缩</option>
|
||||
<option v-for="i in 9" :value="i">{{i}}</option>
|
||||
</select>
|
||||
<p class="comment">级别越高,压缩比例越大。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gzip内容最小长度</td>
|
||||
<td>
|
||||
<size-capacity-box :v-name="'minLength'" :v-value="gzip.minLength" :v-unit="'kb'"></size-capacity-box>
|
||||
<p class="comment">0表示不限制,内容长度从文件尺寸或Content-Length中获取。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gzip内容最大长度</td>
|
||||
<td>
|
||||
<size-capacity-box :v-name="'maxLength'" :v-value="gzip.maxLength" :v-unit="'mb'"></size-capacity-box>
|
||||
<p class="comment">0表示不限制,内容长度从文件尺寸或Content-Length中获取。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>`
|
||||
})
|
||||
37
web/public/js/components/server/server-name-box.js
Normal file
37
web/public/js/components/server/server-name-box.js
Normal file
@@ -0,0 +1,37 @@
|
||||
Vue.component("server-name-box", {
|
||||
props: ["v-server-names"],
|
||||
data: function () {
|
||||
let serverNames = this.vServerNames;
|
||||
if (serverNames == null) {
|
||||
serverNames = []
|
||||
}
|
||||
return {
|
||||
serverNames: serverNames
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addServerName: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/addServerNamePopup", {
|
||||
callback: function (resp) {
|
||||
var serverName = resp.data.serverName
|
||||
that.serverNames.push(serverName)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
removeServerName: function (index) {
|
||||
this.serverNames.$remove(index)
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="serverNames" :value="JSON.stringify(serverNames)"/>
|
||||
<div v-if="serverNames.length > 0">
|
||||
<div v-for="(serverName, index) in serverNames" class="ui label small">
|
||||
<em v-if="serverName.type != 'full'">{{serverName.type}}</em> {{serverName.name}} <a href="" title="删除" @click.prevent="removeServerName(index)"><i class="icon remove"></i></a>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
</div>
|
||||
<a href="" @click.prevent="addServerName()">[添加域名绑定]</a>
|
||||
</div>`
|
||||
})
|
||||
@@ -54,14 +54,7 @@
|
||||
<tr v-if="serverType == 'httpProxy' || serverType == 'httpWeb'">
|
||||
<td>绑定域名</td>
|
||||
<td>
|
||||
<input type="hidden" name="serverNames" :value="JSON.stringify(serverNames)"/>
|
||||
<div v-if="serverNames.length > 0">
|
||||
<div v-for="(serverName, index) in serverNames" class="ui label small">
|
||||
<em v-if="serverName.type != 'full'">{{serverName.type}}</em> {{serverName.name}} <a href="" title="删除" @click.prevent="removeServerName(index)"><i class="icon remove"></i></a>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
</div>
|
||||
<a href="" @click.prevent="addServerName()">[添加域名绑定]</a>
|
||||
<server-name-box></server-name-box>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
Tea.context(function () {
|
||||
this.serverType = "httpProxy";
|
||||
this.tlsProtocolName = ""
|
||||
|
||||
this.serverNames = [];
|
||||
this.origins = [];
|
||||
|
||||
|
||||
this.success = NotifySuccess("保存成功", "/servers");
|
||||
|
||||
this.changeServerType = function () {
|
||||
@@ -13,22 +10,9 @@ Tea.context(function () {
|
||||
this.tlsProtocolName = "";
|
||||
};
|
||||
|
||||
this.addServerName = function () {
|
||||
teaweb.popup("/servers/addServerNamePopup", {
|
||||
callback: function (resp) {
|
||||
var serverName = resp.data.serverName;
|
||||
this.serverNames.push(serverName);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.removeServerName = function (index) {
|
||||
this.serverNames.$remove(index);
|
||||
};
|
||||
|
||||
this.addOrigin = function () {
|
||||
teaweb.popup("/servers/addOriginPopup?serverType=" + this.serverType, {
|
||||
callback: function (resp){
|
||||
callback: function (resp) {
|
||||
this.origins.push(resp.data.origin);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,5 +3,13 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
<form class="ui form" data-tea-success="success" data-tea-action="$">
|
||||
<input type="hidden" name="webId" :value="webId"/>
|
||||
<input type="hidden" name="gzipId" :value="gzipConfig.id"/>
|
||||
|
||||
<gzip-box :v-gzip-config="gzipConfig"></gzip-box>
|
||||
|
||||
<div class="margin"></div>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
3
web/views/@default/servers/server/settings/gzip/index.js
Normal file
3
web/views/@default/servers/server/settings/gzip/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
@@ -3,5 +3,17 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<input type="hidden" name="serverType" :value="serverType"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">绑定端口 *</td>
|
||||
<td>
|
||||
<network-addresses-box :v-server-type="serverType" :v-addresses="httpConfig.addresses" :v-protocol="'http'"></network-addresses-box>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
3
web/views/@default/servers/server/settings/http/index.js
Normal file
3
web/views/@default/servers/server/settings/http/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
@@ -3,5 +3,17 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<input type="hidden" name="serverType" :value="serverType"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">绑定端口 *</td>
|
||||
<td>
|
||||
<network-addresses-box :v-server-type="serverType" :v-addresses="httpsConfig.addresses" :v-protocol="'https'"></network-addresses-box>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
@@ -2,7 +2,12 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "menu"}
|
||||
{$ if not .isOn}
|
||||
<div class="ui message">暂未启用反向代理功能,<a href="" @click.prevent="updateOn(true)">[启用]</a>。</div>
|
||||
{$end}
|
||||
{$ if .isOn}
|
||||
{$template "menu"}
|
||||
|
||||
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins" :v-server-type="serverType" :v-params="'type=server&serverId=' + serverId + '&reverseProxyId=' + reverseProxyId"></origin-list-box>
|
||||
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins" :v-server-type="serverType" :v-params="'type=server&serverId=' + serverId + '&reverseProxyId=' + reverseProxyId"></origin-list-box>
|
||||
{$end}
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
Tea.context(function () {
|
||||
this.updateOn = function (b) {
|
||||
teaweb.confirm(b ? "确定要启用反向代理服务吗?" : "确定要停用反向代理服务吗?", function () {
|
||||
this.$post(".updateOn")
|
||||
.params({
|
||||
"serverId": this.serverId,
|
||||
"isOn": b ? 1 : 0,
|
||||
"reverseProxyId": this.reverseProxyId
|
||||
})
|
||||
.success(function () {
|
||||
window.location.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">已绑定的域名</td>
|
||||
<td>
|
||||
<server-name-box :v-server-names="serverNames"></server-name-box>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
@@ -10,7 +10,7 @@
|
||||
<tr>
|
||||
<td class="title">绑定端口 *</td>
|
||||
<td>
|
||||
<network-addresses-box :v-server-type="serverType" :v-addresses="addresses"></network-addresses-box>
|
||||
<network-addresses-box :v-server-type="serverType" :v-addresses="tcpConfig.listen" :v-protocol="'tcp'"></network-addresses-box>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
undefined
|
||||
19
web/views/@default/servers/server/settings/tls/index.html
Normal file
19
web/views/@default/servers/server/settings/tls/index.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{$layout}
|
||||
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<input type="hidden" name="serverType" :value="serverType"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">绑定端口 *</td>
|
||||
<td>
|
||||
<network-addresses-box :v-server-type="serverType" :v-addresses="tlsConfig.listen" :v-protocol="'tls'"></network-addresses-box>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
3
web/views/@default/servers/server/settings/tls/index.js
Normal file
3
web/views/@default/servers/server/settings/tls/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
@@ -3,5 +3,17 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
<form class="ui form" data-tea-success="success" data-tea-action="$">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<input type="hidden" name="webId" :value="webConfig.id"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">Web目录</td>
|
||||
<td>
|
||||
<input type="text" name="root" v-model="webConfig.root"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
3
web/views/@default/servers/server/settings/web/index.js
Normal file
3
web/views/@default/servers/server/settings/web/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
Reference in New Issue
Block a user