mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-11 01:50:27 +08:00
实现gzip
This commit is contained in:
@@ -71,7 +71,7 @@ func (this *IndexAction) RunPost(params struct {
|
||||
Level int
|
||||
MinLength string
|
||||
MaxLength string
|
||||
CondGroupsJSON []byte
|
||||
CondsJSON []byte
|
||||
|
||||
Must *actions.Must
|
||||
}) {
|
||||
@@ -103,7 +103,7 @@ func (this *IndexAction) RunPost(params struct {
|
||||
Level: types.Int32(params.Level),
|
||||
MinLength: minLength,
|
||||
MaxLength: maxLength,
|
||||
CondGroupsJSON: params.CondGroupsJSON,
|
||||
CondsJSON: params.CondsJSON,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
@@ -114,7 +114,7 @@ func (this *IndexAction) RunPost(params struct {
|
||||
Level: types.Int32(params.Level),
|
||||
MinLength: minLength,
|
||||
MaxLength: maxLength,
|
||||
CondGroupsJSON: params.CondGroupsJSON,
|
||||
CondsJSON: params.CondsJSON,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
@@ -5,6 +5,7 @@ Vue.component("http-cond-url-extension", {
|
||||
let cond = this.vCond
|
||||
if (cond == null) {
|
||||
cond = {
|
||||
isRequest: true,
|
||||
param: "${requestPathExtension}",
|
||||
operator: "in",
|
||||
value: "[]"
|
||||
@@ -85,7 +86,7 @@ Vue.component("http-cond-mime-type", {
|
||||
let cond = this.vCond
|
||||
if (cond == null) {
|
||||
cond = {
|
||||
type: "mime-type",
|
||||
isRequest: false,
|
||||
param: "${response.contentType}",
|
||||
operator: "mime type",
|
||||
value: "[]"
|
||||
@@ -144,7 +145,7 @@ Vue.component("http-cond-mime-type", {
|
||||
</div>
|
||||
<div class="ui fields inline" v-if="isAdding">
|
||||
<div class="ui field">
|
||||
<input type="text" size="16" maxlength="100" v-model="addingMimeType" ref="addingMimeType" placeholder="xxxxx/xxx" @keyup.enter="confirmAdding" @keypress.enter.prevent="1" />
|
||||
<input type="text" size="16" maxlength="100" v-model="addingMimeType" ref="addingMimeType" placeholder="类似于image/png" @keyup.enter="confirmAdding" @keypress.enter.prevent="1" />
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<button class="ui button tiny" type="button" @click.prevent="confirmAdding">确认</button>
|
||||
|
||||
@@ -8,7 +8,7 @@ Vue.component("http-gzip-box", {
|
||||
level: 0,
|
||||
minLength: null,
|
||||
maxLength: null,
|
||||
condGroups: []
|
||||
conds: null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ Vue.component("http-gzip-box", {
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<http-request-conds-tbody v-show="isOn() && advancedVisible" :v-cond-groups="gzip.condGroups"></http-request-conds-tbody>
|
||||
<http-request-conds-tbody v-show="isOn() && advancedVisible" :v-conds="gzip.conds"></http-request-conds-tbody>
|
||||
</table>
|
||||
</div>`
|
||||
})
|
||||
@@ -1,12 +1,16 @@
|
||||
Vue.component("http-request-conds-tbody", {
|
||||
props: ["v-cond-groups"],
|
||||
props: ["v-conds"],
|
||||
data: function () {
|
||||
let groups = this.vCondGroups
|
||||
if (groups == null) {
|
||||
groups = []
|
||||
let conds = this.vConds
|
||||
if (conds == null) {
|
||||
conds = {
|
||||
isOn: true,
|
||||
connector: "or",
|
||||
groups: []
|
||||
}
|
||||
}
|
||||
return {
|
||||
groups: groups,
|
||||
conds: conds,
|
||||
components: window.REQUEST_COND_COMPONENTS
|
||||
}
|
||||
},
|
||||
@@ -16,7 +20,7 @@ Vue.component("http-request-conds-tbody", {
|
||||
teaweb.popup("/servers/server/settings/conds/addGroupPopup", {
|
||||
height: "30em",
|
||||
callback: function (resp) {
|
||||
that.groups.push(resp.data.group)
|
||||
that.conds.groups.push(resp.data.group)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -26,14 +30,14 @@ Vue.component("http-request-conds-tbody", {
|
||||
teaweb.popup("/servers/server/settings/conds/addGroupPopup", {
|
||||
height: "30em",
|
||||
callback: function (resp) {
|
||||
Vue.set(that.groups, groupIndex, resp.data.group)
|
||||
Vue.set(that.conds.groups, groupIndex, resp.data.group)
|
||||
}
|
||||
})
|
||||
},
|
||||
removeGroup: function (groupIndex) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除这一组条件吗?", function () {
|
||||
that.groups.$remove(groupIndex)
|
||||
that.conds.groups.$remove(groupIndex)
|
||||
})
|
||||
},
|
||||
typeName: function (cond) {
|
||||
@@ -50,11 +54,11 @@ Vue.component("http-request-conds-tbody", {
|
||||
<tr>
|
||||
<td>匹配条件</td>
|
||||
<td>
|
||||
<input type="hidden" name="condGroupsJSON" :value="JSON.stringify(groups)"/>
|
||||
<input type="hidden" name="condsJSON" :value="JSON.stringify(conds)"/>
|
||||
<div class="margin"></div>
|
||||
<div v-if="groups.length > 0">
|
||||
<div v-if="conds.groups.length > 0">
|
||||
<table class="ui table">
|
||||
<tr v-for="(group, groupIndex) in groups">
|
||||
<tr v-for="(group, groupIndex) in conds.groups">
|
||||
<td style="background: white">
|
||||
<var v-for="(cond, index) in group.conds" style="font-style: normal;display: inline-block; margin-bottom:0.5em">
|
||||
<span class="ui label tiny">
|
||||
|
||||
Reference in New Issue
Block a user