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

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

@@ -20,7 +20,8 @@ func (this *CreatePopupAction) RunGet(params struct{}) {
}
func (this *CreatePopupAction) RunPost(params struct {
Name string
Name string
Description string
Must *actions.Must
CSRF *actionutils.CSRF
@@ -29,15 +30,19 @@ func (this *CreatePopupAction) RunPost(params struct {
Field("name", params.Name).
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 {
this.ErrorPage(err)
return
}
this.Data["region"] = maps.Map{
"id": createResp.NodeRegionId,
"name": params.Name,
"id": createResp.NodeRegionId,
"name": params.Name,
"description": params.Description,
}
// 日志

View File

@@ -29,10 +29,11 @@ func (this *IndexAction) RunGet(params struct{}) {
}
regionMaps = append(regionMaps, maps.Map{
"id": region.Id,
"isOn": region.IsOn,
"name": region.Name,
"countNodes": countNodesResp.Count,
"id": region.Id,
"isOn": region.IsOn,
"name": region.Name,
"description": region.Description,
"countNodes": countNodesResp.Count,
})
}
this.Data["regions"] = regionMaps

View File

@@ -30,9 +30,10 @@ func (this *UpdatePopupAction) RunGet(params struct {
}
this.Data["region"] = maps.Map{
"id": region.Id,
"isOn": region.IsOn,
"name": region.Name,
"id": region.Id,
"isOn": region.IsOn,
"name": region.Name,
"description": region.Description,
}
this.Show()
@@ -41,8 +42,9 @@ func (this *UpdatePopupAction) RunGet(params struct {
func (this *UpdatePopupAction) RunPost(params struct {
RegionId int64
Name string
IsOn bool
Name string
Description string
IsOn bool
Must *actions.Must
CSRF *actionutils.CSRF
@@ -56,6 +58,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
_, err := this.RPC().NodeRegionRPC().UpdateNodeRegion(this.AdminContext(), &pb.UpdateNodeRegionRequest{
NodeRegionId: params.RegionId,
Name: params.Name,
Description: params.Description,
IsOn: params.IsOn,
})
if err != nil {

View File

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

View File

@@ -11,7 +11,8 @@
<thead>
<tr>
<th style="width:3em"></th>
<th>区域名称</th>
<th class="width10">区域名称</th>
<th>区域说明</th>
<th class="width10 center">节点数</th>
<th class="width10">区域状态</th>
<th class="two op">操作</th>
@@ -21,6 +22,10 @@
<tr>
<td style="text-align: center;"><i class="icon bars handle grey"></i> </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>
<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"/>
</td>
</tr>
<tr>
<td>区域说明</td>
<td>
<textarea name="description" rows="3" v-model="region.description" maxlength="200"></textarea>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>