[区域]可以设置区域说明文字

This commit is contained in:
GoEdgeLab
2020-12-10 22:21:26 +08:00
parent 9103f1a7b8
commit f7a0c039d5
6 changed files with 41 additions and 15 deletions

View File

@@ -21,6 +21,7 @@ func (this *CreatePopupAction) RunGet(params struct{}) {
func (this *CreatePopupAction) RunPost(params struct { func (this *CreatePopupAction) RunPost(params struct {
Name string Name string
Description string
Must *actions.Must Must *actions.Must
CSRF *actionutils.CSRF CSRF *actionutils.CSRF
@@ -29,7 +30,10 @@ func (this *CreatePopupAction) RunPost(params struct {
Field("name", params.Name). Field("name", params.Name).
Require("请输入区域名称") Require("请输入区域名称")
createResp, err := this.RPC().NodeRegionRPC().CreateNodeRegion(this.AdminContext(), &pb.CreateNodeRegionRequest{Name: params.Name}) createResp, err := this.RPC().NodeRegionRPC().CreateNodeRegion(this.AdminContext(), &pb.CreateNodeRegionRequest{
Name: params.Name,
Description: params.Description,
})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
return return
@@ -38,6 +42,7 @@ func (this *CreatePopupAction) RunPost(params struct {
this.Data["region"] = maps.Map{ this.Data["region"] = maps.Map{
"id": createResp.NodeRegionId, "id": createResp.NodeRegionId,
"name": params.Name, "name": params.Name,
"description": params.Description,
} }
// 日志 // 日志

View File

@@ -32,6 +32,7 @@ func (this *IndexAction) RunGet(params struct{}) {
"id": region.Id, "id": region.Id,
"isOn": region.IsOn, "isOn": region.IsOn,
"name": region.Name, "name": region.Name,
"description": region.Description,
"countNodes": countNodesResp.Count, "countNodes": countNodesResp.Count,
}) })
} }

View File

@@ -33,6 +33,7 @@ func (this *UpdatePopupAction) RunGet(params struct {
"id": region.Id, "id": region.Id,
"isOn": region.IsOn, "isOn": region.IsOn,
"name": region.Name, "name": region.Name,
"description": region.Description,
} }
this.Show() this.Show()
@@ -42,6 +43,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
RegionId int64 RegionId int64
Name string Name string
Description string
IsOn bool IsOn bool
Must *actions.Must Must *actions.Must
@@ -56,6 +58,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
_, err := this.RPC().NodeRegionRPC().UpdateNodeRegion(this.AdminContext(), &pb.UpdateNodeRegionRequest{ _, err := this.RPC().NodeRegionRPC().UpdateNodeRegion(this.AdminContext(), &pb.UpdateNodeRegionRequest{
NodeRegionId: params.RegionId, NodeRegionId: params.RegionId,
Name: params.Name, Name: params.Name,
Description: params.Description,
IsOn: params.IsOn, IsOn: params.IsOn,
}) })
if err != nil { if err != nil {

View File

@@ -5,11 +5,17 @@
<csrf-token></csrf-token> <csrf-token></csrf-token>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
<tr> <tr>
<td>区域名称 *</td> <td class="title">区域名称 *</td>
<td> <td>
<input type="text" name="name" maxlength="100" ref="focus"/> <input type="text" name="name" maxlength="100" ref="focus"/>
</td> </td>
</tr> </tr>
<tr>
<td>区域说明</td>
<td>
<textarea name="description" rows="3" maxlength="200"></textarea>
</td>
</tr>
</table> </table>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>

View File

@@ -11,7 +11,8 @@
<thead> <thead>
<tr> <tr>
<th style="width:3em"></th> <th style="width:3em"></th>
<th>区域名称</th> <th class="width10">区域名称</th>
<th>区域说明</th>
<th class="width10 center">节点数</th> <th class="width10 center">节点数</th>
<th class="width10">区域状态</th> <th class="width10">区域状态</th>
<th class="two op">操作</th> <th class="two op">操作</th>
@@ -21,6 +22,10 @@
<tr> <tr>
<td style="text-align: center;"><i class="icon bars handle grey"></i> </td> <td style="text-align: center;"><i class="icon bars handle grey"></i> </td>
<td :class="{disabled: !region.isOn}">{{region.name}}</td> <td :class="{disabled: !region.isOn}">{{region.name}}</td>
<td>
<span v-if="region.description.length > 0">{{region.description}}</span>
<span v-else class="disabled">-</span>
</td>
<td class="center">{{region.countNodes}}</td> <td class="center">{{region.countNodes}}</td>
<td> <td>
<label-on :v-is-on="region.isOn"></label-on> <label-on :v-is-on="region.isOn"></label-on>

View File

@@ -11,6 +11,12 @@
<input type="text" name="name" maxlength="100" ref="focus" v-model="region.name"/> <input type="text" name="name" maxlength="100" ref="focus" v-model="region.name"/>
</td> </td>
</tr> </tr>
<tr>
<td>区域说明</td>
<td>
<textarea name="description" rows="3" v-model="region.description" maxlength="200"></textarea>
</td>
</tr>
<tr> <tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td> <td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr> </tr>