路径规则、重写规则、URL跳转规则均支持匹配条件;URL跳转规则增加排序、是否启用功能

This commit is contained in:
GoEdgeLab
2021-06-09 21:45:26 +08:00
parent 40f0cc3a17
commit 2f0c0015a0
16 changed files with 275 additions and 63 deletions

View File

@@ -40,6 +40,12 @@
<p class="comment">可以用来说明此规则用途。。</p>
</td>
</tr>
<tr>
<td>匹配条件</td>
<td>
<http-request-conds-box></http-request-conds-box>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>

View File

@@ -42,45 +42,51 @@
<p class="comment">可以用来说明此规则用途。。</p>
</td>
</tr>
<tr>
<td>匹配条件</td>
<td>
<http-request-conds-box :v-conds="conds"></http-request-conds-box>
</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>
<tr>
<td>是否启用</td>
<td>
<div class="ui checkbox">
<input type="checkbox" name="isOn" v-model="locationConfig.isOn"/>
<label></label>
</div>
</td>
</tr>
<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>
<tr>
<td>是否启用</td>
<td>
<div class="ui checkbox">
<input type="checkbox" name="isOn" v-model="locationConfig.isOn"/>
<label></label>
</div>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>

View File

@@ -4,7 +4,9 @@ Tea.context(function () {
teaweb.popup("/servers/server/settings/rewrite/createPopup?webId=" + this.webId, {
height: "26em",
callback: function () {
window.location.reload()
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}

View File

@@ -52,6 +52,14 @@
</select>
</td>
</tr>
<tr>
<td>匹配条件</td>
<td><http-request-conds-box :v-conds="redirect.conds" @change="changeConds"></http-request-conds-box></td>
</tr>
<tr>
<td>是否启用</td>
<td><checkbox name="isOn" value="1" v-model="redirect.isOn"></checkbox></td>
</tr>
</table>
<submit-btn></submit-btn>

View File

@@ -10,7 +10,9 @@ Tea.context(function () {
afterURL: "",
matchPrefix: false,
matchRegexp: false,
keepRequestURI: false
keepRequestURI: false,
conds: null,
isOn: true
}
}
@@ -38,4 +40,8 @@ Tea.context(function () {
}
})
})
this.changeConds = function (conds) {
this.redirect.conds = conds
}
})

View File

@@ -4,14 +4,7 @@
<div class="right-box">
<form class="ui form" method="post" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<table class="ui table selectable definition">
<tr>
<td class="title">URL跳转设置</td>
<td>
<http-host-redirect-box :v-redirects="redirects"></http-host-redirect-box>
</td>
</tr>
</table>
<http-host-redirect-box :v-redirects="redirects" @change="change"></http-host-redirect-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -1,3 +1,14 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
this.change = function (values) {
this.$post("$")
.params({
webId: this.webId,
hostRedirectsJSON: JSON.stringify(values)
})
.success(function () {
NotifyReloadSuccess("保存成功")()
})
}
})

View File

@@ -28,6 +28,10 @@
<p class="comment">隐式表示不在客户端显示重写后的URL显式表示在客户端跳转URL将会显示重写后的URL。</p>
</td>
</tr>
<tr>
<td>匹配条件</td>
<td><http-request-conds-box></http-request-conds-box></td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>

View File

@@ -4,7 +4,9 @@ Tea.context(function () {
teaweb.popup("/servers/server/settings/rewrite/createPopup?webId=" + this.webId, {
height: "26em",
callback: function () {
window.location.reload()
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}

View File

@@ -29,6 +29,10 @@
<p class="comment">隐式表示不在客户端显示重写后的URL显式表示在客户端跳转URL将会显示重写后的URL。</p>
</td>
</tr>
<tr>
<td>匹配条件</td>
<td><http-request-conds-box :v-conds="rewriteRule.conds"></http-request-conds-box></td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>