Files
EdgeAdmin/web/public/js/components/server/http-gzip-box.js

75 lines
2.1 KiB
JavaScript
Raw Normal View History

2020-09-20 11:56:49 +08:00
Vue.component("http-gzip-box", {
2020-09-23 18:43:38 +08:00
props: ["v-gzip-config", "v-gzip-ref", "v-is-location"],
2020-09-16 09:09:10 +08:00
data: function () {
let gzip = this.vGzipConfig
if (gzip == null) {
gzip = {
isOn: true,
level: 0,
minLength: null,
2020-09-29 11:28:39 +08:00
maxLength: null,
condGroups: []
2020-09-16 09:09:10 +08:00
}
}
return {
gzip: gzip,
2020-09-29 11:28:39 +08:00
advancedVisible: false
2020-09-16 09:09:10 +08:00
}
},
2020-09-27 18:40:55 +08:00
methods: {
isOn: function () {
return (!this.vIsLocation || this.vGzipRef.isPrior) && this.vGzipRef.isOn
2020-09-29 11:28:39 +08:00
},
changeAdvancedVisible: function (v) {
this.advancedVisible = v
2020-09-27 18:40:55 +08:00
}
},
2020-09-16 09:09:10 +08:00
template: `<div>
2020-09-23 18:43:38 +08:00
<input type="hidden" name="gzipRefJSON" :value="JSON.stringify(vGzipRef)"/>
2020-09-16 09:09:10 +08:00
<table class="ui table selectable definition">
2020-09-23 18:43:38 +08:00
<prior-checkbox :v-config="vGzipRef" v-if="vIsLocation"></prior-checkbox>
<tbody v-show="!vIsLocation || vGzipRef.isPrior">
2020-09-27 18:40:55 +08:00
<tr>
2020-09-29 11:28:39 +08:00
<td class="title">启用Gzip压缩</td>
2020-09-27 18:40:55 +08:00
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="vGzipRef.isOn"/>
<label></label>
</div>
</td>
</tr>
</tbody>
<tbody v-show="isOn()">
2020-09-23 18:43:38 +08:00
<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>
2020-09-29 11:28:39 +08:00
</tr>
</tbody>
<more-options-tbody @change="changeAdvancedVisible"></more-options-tbody>
<tbody v-show="isOn() && advancedVisible">
2020-09-23 18:43:38 +08:00
<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>
</tbody>
2020-09-29 11:28:39 +08:00
<http-request-conds-tbody v-show="isOn() && advancedVisible" :v-cond-groups="gzip.condGroups"></http-request-conds-tbody>
2020-09-16 09:09:10 +08:00
</table>
</div>`
})