mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 16:50:26 +08:00
服务没有设置所属用户时可以设置一个用户
This commit is contained in:
@@ -121,6 +121,7 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
// RunPost 保存
|
// RunPost 保存
|
||||||
func (this *IndexAction) RunPost(params struct {
|
func (this *IndexAction) RunPost(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
|
UserId int64
|
||||||
Name string
|
Name string
|
||||||
Description string
|
Description string
|
||||||
ClusterId int64
|
ClusterId int64
|
||||||
@@ -157,6 +158,17 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改用户
|
||||||
|
if params.UserId > 0 {
|
||||||
|
_, err = this.RPC().ServerRPC().UpdateServerUser(this.AdminContext(), &pb.UpdateServerUserRequest{
|
||||||
|
ServerId: params.ServerId,
|
||||||
|
UserId: params.UserId,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// 修改套餐
|
// 修改套餐
|
||||||
if params.UserPlanId > 0 {
|
if params.UserPlanId > 0 {
|
||||||
_, err = this.RPC().ServerRPC().UpdateServerUserPlan(this.AdminContext(), &pb.UpdateServerUserPlanRequest{
|
_, err = this.RPC().ServerRPC().UpdateServerUserPlan(this.AdminContext(), &pb.UpdateServerUserPlanRequest{
|
||||||
@@ -168,6 +180,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.Success()
|
this.Success()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,15 @@
|
|||||||
<td>所属用户</td>
|
<td>所属用户</td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="user != null">{{user.fullname}} <span class="small">({{user.username}})</span><link-icon :href="'/users/user?userId=' + user.id"></link-icon></span>
|
<span v-if="user != null">{{user.fullname}} <span class="small">({{user.username}})</span><link-icon :href="'/users/user?userId=' + user.id"></link-icon></span>
|
||||||
<span v-else class="disabled">-</span>
|
<div v-if="user == null">
|
||||||
|
<div v-show="!userSelectorVisible">
|
||||||
|
<span class="disabled">没有指定用户</span> <a href="" @click.prevent="showUserSelector">[指定用户]</a>
|
||||||
|
</div>
|
||||||
|
<div v-show="userSelectorVisible">
|
||||||
|
<user-selector style="display:inline-block"></user-selector>
|
||||||
|
<p class="comment"><span class="red">修改服务所属用户时需要同时保证证书、域名等信息也属于该用户,否则可能产生难以预料的结果。</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -66,7 +74,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>是否启用</td>
|
<td>启用当前服务</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
<input type="checkbox" name="isOn" value="1" v-model="server.isOn"/>
|
<input type="checkbox" name="isOn" value="1" v-model="server.isOn"/>
|
||||||
|
|||||||
@@ -4,6 +4,12 @@ Tea.context(function () {
|
|||||||
/**
|
/**
|
||||||
* 用户相关
|
* 用户相关
|
||||||
*/
|
*/
|
||||||
|
this.userSelectorVisible = false
|
||||||
|
|
||||||
|
this.showUserSelector = function () {
|
||||||
|
this.userSelectorVisible = !this.userSelectorVisible
|
||||||
|
}
|
||||||
|
|
||||||
this.userId = 0
|
this.userId = 0
|
||||||
this.plans = []
|
this.plans = []
|
||||||
this.userPlanId = 0
|
this.userPlanId = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user