实现路径规则各项数据修改

This commit is contained in:
刘祥超
2020-09-22 11:36:51 +08:00
parent a4b806fa7e
commit 6d6fb22d78
110 changed files with 1799 additions and 182 deletions

View File

@@ -0,0 +1,4 @@
<first-menu>
<menu-item :href="'/servers/server/settings/locations?serverId=' + serverId">所有路径规则 &raquo;</menu-item>
<menu-item :href="'/servers/server/settings/locations/location?serverId=' + serverId + '&locationId=' + locationId" :active="true">{{locationConfig.pattern}}</menu-item>
</first-menu>

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,13 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<div class="margin"></div>
<p class="ui message">此功能暂未开放,敬请期待。</p>
</div>
</div>

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,20 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-access-log-config-box
:v-access-log-config="accessLogConfig"
:v-fields="fields"
:v-default-field-codes="defaultFieldCodes"
:v-access-log-policies="accessLogPolicies"></http-access-log-config-box>
<submit-btn></submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,16 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-cache-config-box :v-cache-config="cacheConfig" :v-cache-policies="policies"></http-cache-config-box>
<submit-btn></submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,17 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<div class="margin"></div>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-charsets-box :v-usual-charsets="usualCharsets" :v-all-charsets="allCharsets" :v-charset="charset"></http-charsets-box>
<submit-btn></submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -10,7 +10,7 @@
<tr>
<td>路径匹配规则 *</td>
<td>
<input type="text" name="pattern" maxlength="500"/>
<input type="text" name="pattern" maxlength="500" ref="focus"/>
<p class="comment">路径通常以斜杠(/)开头,比如/hello。如果匹配类型是正则表达式匹配则可以是一个正则表达式</p>
</td>
</tr>
@@ -36,7 +36,7 @@
<tr>
<td class="title">名称</td>
<td>
<input type="text" name="name" ref="focus" maxlength="100"/>
<input type="text" name="name" maxlength="100"/>
<p class="comment">可以用来说明此规则用途。。</p>
</td>
</tr>

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,21 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<div class="margin"></div>
<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"/>
<http-gzip-box :v-gzip-config="gzipConfig"></http-gzip-box>
<div class="margin"></div>
<submit-btn></submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,15 @@
{$layout "layout_popup"}
<h3>添加需要删除的Header</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="headerPolicyId" :value="headerPolicyId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">名称<em>Name</em></td>
<td>
<input type="text" name="name" maxlength="100" ref="focus"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -0,0 +1,22 @@
{$layout "layout_popup"}
<h3>设置Header</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="headerPolicyId" :value="headerPolicyId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">名称<em>Name</em></td>
<td>
<input type="text" name="name" value="" maxlength="200" placeholder="类似于Server、Content-Type之类" ref="focus"/>
</td>
</tr>
<tr>
<td><em>Value</em></td>
<td>
<input type="text" name="value" maxlength="500"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,12 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<http-header-policy-box :v-request-header-policy="requestHeaderPolicy" :v-response-header-policy="responseHeaderPolicy" :v-params="'serverId=' + serverId"></http-header-policy-box>
</div>
</div>

View File

@@ -0,0 +1,23 @@
{$layout "layout_popup"}
<h3>修改Header</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="headerPolicyId" :value="headerPolicyId"/>
<input type="hidden" name="headerId" :value="headerId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">名称<em>Name</em></td>
<td>
<input type="text" name="name" value="" v-model="headerConfig.name" maxlength="200" placeholder="类似于Server、Content-Type之类" ref="focus"/>
</td>
</tr>
<tr>
<td><em>Value</em></td>
<td>
<input type="text" name="value" v-model="headerConfig.value" maxlength="500"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -2,9 +2,79 @@
{$template "/left_menu"}
<div class="right-box">
<first-menu>
<menu-item :href="'/servers/server/settings/locations?serverId=' + serverId">所有路径规则 &raquo;</menu-item>
<menu-item :href="'/servers/server/settings/locations/location?serverId=' + serverId + '&locationId=' + locationId" :active="true">{{locationConfig.pattern}}</menu-item>
</first-menu>
{$template "/servers/server/settings/locations/left_menu"}
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="locationId" :value="locationConfig.id"/>
<table class="ui table selectable definition">
<tr>
<td>路径匹配规则 *</td>
<td>
<input type="text" name="pattern" v-model="pattern" maxlength="500" ref="focus"/>
<p class="comment">路径通常以斜杠(/)开头,比如/hello。如果匹配类型是正则表达式匹配则可以是一个正则表达式</p>
</td>
</tr>
<tr>
<td>匹配类型</td>
<td>
<select class="ui dropdown auto-width" name="patternType" v-model="type" @change="changePatternType(type)">
<option v-for="patternType in patternTypes" :value="patternType.type">{{patternType.name}}</option>
</select>
<p class="comment" v-if="selectedType != null" v-html="selectedType.description"></p>
</td>
</tr>
<tr>
<td>是否终止往下匹配</td>
<td>
<div class="ui checkbox">
<input type="checkbox" name="isBreak" value="1" v-model="locationConfig.isBreak"/>
<label></label>
</div>
<p class="comment">如果选中了此选项,一旦匹配成功,不会继续匹配其他的路径规则。</p>
</td>
</tr>
<tr>
<td class="title">名称</td>
<td>
<input type="text" name="name" maxlength="100" v-model="locationConfig.name"/>
<p class="comment">可以用来说明此规则用途。。</p>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>不区分大小写</td>
<td>
<div class="ui checkbox">
<input type="checkbox" name="isCaseInsensitive" value="1" v-model="isCaseInsensitive"/>
<label></label>
</div>
<p class="comment">选中表示匹配规则中的路径中的英文字母不区分大小写。</p>
</td>
</tr>
<tr>
<td>反向匹配</td>
<td>
<div class="ui checkbox">
<input type="checkbox" name="isReverse" value="1" v-model="isReverse"/>
<label></label>
</div>
<p class="comment">选中表示匹配所有<strong>不符合规则</strong>的路径。</p>
</td>
</tr>
<tr>
<td>描述</td>
<td>
<textarea rows="3" name="description" maxlength="200" v-model="locationConfig.description"></textarea>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,15 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
this.$delay(function () {
this.changePatternType(this.type)
})
this.selectedType = null
this.changePatternType = function (type) {
this.selectedType = this.patternTypes.$find(function (k, v) {
return v.type == type;
})
}
})

View File

@@ -0,0 +1,28 @@
{$layout "layout_popup"}
<h3>添加特殊页面</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<table class="ui table selectable definition">
<tr>
<td class="title">响应状态码 *</td>
<td>
<input type="text" name="status" size="3" placeholder="状态码" maxlength="3" style="width:5.2em" ref="focus"/>
<p class="comment">比如404或者50x。</p>
</td>
</tr>
<tr>
<td>URL *</td>
<td>
<input type="text" name="url" maxlength="500" placeholder="页面文件路径或者完整的URL"/>
<p class="comment">页面文件是相对于节点安装目录的页面文件比如web/pages/40x.html或者一个完整的URL。</p>
</td>
</tr>
<tr>
<td>新状态码</td>
<td>
<input type="text" name="newStatus" size="3" placeholder="状态码" maxlength="3" style="width:5.2em"/>
<p class="comment">可以用来修改响应的状态码,不填表示不改变原有状态码。</p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,16 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-pages-and-shutdown-box :v-pages="pages" :v-shutdown-config="shutdownConfig"></http-pages-and-shutdown-box>
<submit-btn></submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,29 @@
{$layout "layout_popup"}
<h3>修改特殊页面</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="pageId" :value="pageConfig.id"/>
<table class="ui table selectable definition">
<tr>
<td class="title">响应状态码 *</td>
<td>
<input type="text" name="status" size="3" placeholder="状态码" maxlength="3" style="width:5.2em" ref="focus" v-model="pageConfig.status"/>
<p class="comment">比如404或者50x。</p>
</td>
</tr>
<tr>
<td>URL *</td>
<td>
<input type="text" name="url" maxlength="500" placeholder="页面文件路径或者完整的URL" v-model="pageConfig.url"/>
<p class="comment">页面文件是相对于节点安装目录的页面文件比如web/pages/40x.html或者一个完整的URL。</p>
</td>
</tr>
<tr>
<td>新状态码</td>
<td>
<input type="text" name="newStatus" size="3" placeholder="状态码" maxlength="3" style="width:5.2em" v-model="newStatus"/>
<p class="comment">可以用来修改响应的状态码,不填表示不改变原有状态码。</p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,8 @@
Tea.context(function () {
this.success = NotifyPopup
this.newStatus = ""
if (this.pageConfig.newStatus > 0) {
this.newStatus = this.pageConfig.newStatus
}
})

View File

@@ -0,0 +1,4 @@
<first-menu>
<menu-item :href="'/servers/server/settings/locations/reverseProxy?serverId=' + serverId + '&locationId=' + locationId" code="index">源站列表</menu-item>
<menu-item :href="'/servers/server/settings/locations/reverseProxy/scheduling?serverId=' + serverId + '&locationId=' + locationId" code="scheduling">调度算法</menu-item>
</first-menu>

View File

@@ -0,0 +1,34 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
{$template "menu"}
<div class="margin"></div>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="locationId" :value="locationId"/>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
<table class="ui table selectable definition">
<tr>
<td class="title">是否启用反向代理</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="reverseProxyRef.isOn"/>
<label></label>
</div>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>
<div v-if="reverseProxyRef.isOn">
<div class="ui divider"></div>
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins" :v-server-type="serverType"
:v-params="'type=server&serverId=' + serverId + '&reverseProxyId=' + reverseProxyConfig.id"></origin-list-box>
</div>
</div>
</div>

View File

@@ -0,0 +1,17 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
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()
})
})
}
})

View File

@@ -0,0 +1,13 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
{$template "menu"}
<origin-scheduling-view-box :v-scheduling="scheduling" :v-params="'type=server&serverId=' + serverId + '&reverseProxyId=' + reverseProxyId"></origin-scheduling-view-box>
</div>
</div>

View File

@@ -0,0 +1,60 @@
{$layout "layout_popup"}
<h3>修改调度算法</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="dataType" :value="dataType"/>
<input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="reverseProxyId" :value="reverseProxyId"/>
<table class="ui table selectable definition">
<tr>
<td class="title">选择调度算法</td>
<td>
<select class="ui dropdown auto-width" name="type" v-model="selectedType"
@change="changeSchedulingType()">
<option v-for="schedulingType in schedulingTypes"
:value="schedulingType.code">{{schedulingType.name}}</option>
</select>
<p class="comment">{{schedulingTypeDescription}}</p>
</td>
</tr>
<tr v-if="selectedType == 'hash'">
<td>
Key
</td>
<td>
<input type="text" name="hashKey" v-model="hashKey" maxlength="500"/>
<p class="comment">用来计算Hash的字符串其中可以使用变量。</p>
</td>
</tr>
<tr v-if="selectedType == 'hash'">
<td>常用变量</td>
<td>
<select class="ui dropdown" style="width:12em" v-model="hashVar" @change="changeHashVar()">
<option></option>
<option value="${remoteAddr}">客户端IP</option>
<option value="${host}${requestURI}">请求URL</option>
</select>
</td>
</tr>
<tr v-if="selectedType == 'sticky'">
<td>参数类型</td>
<td>
<select class="ui dropdown" style="width:12em" name="stickyType" v-model="stickyType">
<option value="cookie">Cookie</option>
<option value="header">HTTP Header</option>
<option value="argument">URL参数</option>
</select>
</td>
</tr>
<tr v-if="selectedType == 'sticky'">
<td>参数名</td>
<td>
<input type="text" name="stickyParam" v-model="stickyParam" maxlength="50"/>
<p class="comment">记录或指定后端服务器的参数名只能是英文字母和数字的组合不允许有下划线因为在HTTP Header中下划线是不标准的</p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,39 @@
Tea.context(function () {
var that = this;
this.success = NotifyPopup
this.selectedType = this.scheduling.code;
this.schedulingTypeDescription = null;
this.changeSchedulingType = function () {
this.schedulingTypeDescription = this.schedulingTypes.$find(function (k, v) {
return v.code == that.selectedType;
}).description;
};
this.changeSchedulingType();
// hash
this.hashKey = "";
this.hashVar = "";
if (this.scheduling.code == "hash") {
this.hashKey = this.scheduling.options.key;
} else {
this.hashKey = "${remoteAddr}";
}
this.changeHashVar = function () {
if (this.hashVar.length > 0) {
this.hashKey = this.hashVar;
}
};
// sticky
if (this.scheduling.code == "sticky") {
this.stickyType = this.scheduling.options.type;
this.stickyParam = this.scheduling.options.param;
} else {
this.stickyType = "cookie";
this.stickyParam = "Origin";
}
});

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,16 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-stat-config-box :v-stat-config="statConfig"></http-stat-config-box>
<submit-btn></submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,16 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-firewall-config-box :v-firewall-config="firewallConfig" :v-firewall-policies="firewallPolicies"></http-firewall-config-box>
<submit-btn></submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1 @@
undefined

View File

@@ -0,0 +1,23 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<form class="ui form" data-tea-success="success" data-tea-action="$">
<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>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})