优化HTTP报头界面

This commit is contained in:
刘祥超
2023-07-03 15:21:46 +08:00
parent 3218760f84
commit dd6b8b7157
4 changed files with 15 additions and 5 deletions

View File

@@ -29,6 +29,8 @@ func (this *CreateSetPopupAction) RunGet(params struct {
} }
func (this *CreateSetPopupAction) RunPost(params struct { func (this *CreateSetPopupAction) RunPost(params struct {
Type string
HeaderPolicyId int64 HeaderPolicyId int64
Name string Name string
Value string Value string
@@ -44,7 +46,11 @@ func (this *CreateSetPopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志 // 日志
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogCreateSettingHeader, params.HeaderPolicyId, params.Name, params.Value) if params.Type == "request" {
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogCreateSettingRequestHeader, params.HeaderPolicyId, params.Name, params.Value)
} else {
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogCreateSettingResponseHeader, params.HeaderPolicyId, params.Name, params.Value)
}
params.Name = strings.TrimSuffix(params.Name, ":") params.Name = strings.TrimSuffix(params.Name, ":")

View File

@@ -200,7 +200,7 @@ Vue.component("http-header-policy-box", {
<tbody v-for="header in requestSettingHeaders"> <tbody v-for="header in requestSettingHeaders">
<tr> <tr>
<td class="five wide"> <td class="five wide">
{{header.name}} <a href="" @click.prevent="updateSettingPopup(vRequestHeaderPolicy.id, header.id)">{{header.name}} <i class="icon expand small"></i></a>
<div> <div>
<span v-if="header.status != null && header.status.codes != null && !header.status.always"><grey-label v-for="code in header.status.codes" :key="code">{{code}}</grey-label></span> <span v-if="header.status != null && header.status.codes != null && !header.status.always"><grey-label v-for="code in header.status.codes" :key="code">{{code}}</grey-label></span>
<span v-if="header.methods != null && header.methods.length > 0"><grey-label v-for="method in header.methods" :key="method">{{method}}</grey-label></span> <span v-if="header.methods != null && header.methods.length > 0"><grey-label v-for="method in header.methods" :key="method">{{method}}</grey-label></span>
@@ -274,7 +274,7 @@ Vue.component("http-header-policy-box", {
<tbody v-for="header in responseSettingHeaders"> <tbody v-for="header in responseSettingHeaders">
<tr> <tr>
<td class="five wide"> <td class="five wide">
{{header.name}} <a href="" @click.prevent="updateSettingPopup(vResponseHeaderPolicy.id, header.id)">{{header.name}} <i class="icon expand small"></i></a>
<div> <div>
<span v-if="header.status != null && header.status.codes != null && !header.status.always"><grey-label v-for="code in header.status.codes" :key="code">{{code}}</grey-label></span> <span v-if="header.status != null && header.status.codes != null && !header.status.always"><grey-label v-for="code in header.status.codes" :key="code">{{code}}</grey-label></span>
<span v-if="header.methods != null && header.methods.length > 0"><grey-label v-for="method in header.methods" :key="method">{{method}}</grey-label></span> <span v-if="header.methods != null && header.methods.length > 0"><grey-label v-for="method in header.methods" :key="method">{{method}}</grey-label></span>

View File

@@ -1,8 +1,10 @@
{$layout "layout_popup"} {$layout "layout_popup"}
<h3>设置报头</h3> <h3 v-if="type == 'request'">添加自定义请求报头</h3>
<h3 v-if="type == 'response'">添加自定义响应报头</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success"> <form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="headerPolicyId" :value="headerPolicyId"/> <input type="hidden" name="headerPolicyId" :value="headerPolicyId"/>
<input type="hidden" name="type" :value="type"/>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
<tr> <tr>
<td class="title">报头名称<em>Name</em> *</td> <td class="title">报头名称<em>Name</em> *</td>

View File

@@ -1,9 +1,11 @@
{$layout "layout_popup"} {$layout "layout_popup"}
<h3>修改报头</h3> <h3 v-if="type == 'request'">修改自定义请求报头</h3>
<h3 v-if="type == 'response'">修改自定义响应报头</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success"> <form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="headerPolicyId" :value="headerPolicyId"/> <input type="hidden" name="headerPolicyId" :value="headerPolicyId"/>
<input type="hidden" name="headerId" :value="headerId"/> <input type="hidden" name="headerId" :value="headerId"/>
<input type="hidden" name="type" :value="type"/>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
<tr> <tr>
<td class="title">报头名称<em>Name</em> *</td> <td class="title">报头名称<em>Name</em> *</td>