mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
服务没有设置所属用户时可以设置一个用户
This commit is contained in:
@@ -121,6 +121,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
// RunPost 保存
|
||||
func (this *IndexAction) RunPost(params struct {
|
||||
ServerId int64
|
||||
UserId int64
|
||||
Name string
|
||||
Description string
|
||||
ClusterId int64
|
||||
@@ -157,16 +158,28 @@ func (this *IndexAction) RunPost(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
// 修改套餐
|
||||
if params.UserPlanId > 0 {
|
||||
_, err = this.RPC().ServerRPC().UpdateServerUserPlan(this.AdminContext(), &pb.UpdateServerUserPlanRequest{
|
||||
ServerId: params.ServerId,
|
||||
UserPlanId: params.UserPlanId,
|
||||
// 修改用户
|
||||
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 {
|
||||
_, err = this.RPC().ServerRPC().UpdateServerUserPlan(this.AdminContext(), &pb.UpdateServerUserPlanRequest{
|
||||
ServerId: params.ServerId,
|
||||
UserPlanId: params.UserPlanId,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.Success()
|
||||
|
||||
@@ -10,7 +10,15 @@
|
||||
<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-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>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -66,7 +74,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>启用当前服务</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<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.plans = []
|
||||
this.userPlanId = 0
|
||||
|
||||
Reference in New Issue
Block a user