mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	节点选择认证时增加推荐
This commit is contained in:
		@@ -219,6 +219,7 @@ func (this *CreateNodeAction) RunPost(params struct {
 | 
			
		||||
					"name":       grantResp.NodeGrant.Name,
 | 
			
		||||
					"method":     grantResp.NodeGrant.Method,
 | 
			
		||||
					"methodName": grantutils.FindGrantMethodName(grantResp.NodeGrant.Method),
 | 
			
		||||
					"username":   grantResp.NodeGrant.Username,
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -165,6 +165,7 @@ func (this *DetailAction) RunGet(params struct {
 | 
			
		||||
					"name":       grantResp.NodeGrant.Name,
 | 
			
		||||
					"method":     grantResp.NodeGrant.Method,
 | 
			
		||||
					"methodName": grantutils.FindGrantMethodName(grantResp.NodeGrant.Method),
 | 
			
		||||
					"username":   grantResp.NodeGrant.Username,
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -150,6 +150,7 @@ func (this *UpdateAction) RunGet(params struct {
 | 
			
		||||
					"name":       grantResp.NodeGrant.Name,
 | 
			
		||||
					"method":     grantResp.NodeGrant.Method,
 | 
			
		||||
					"methodName": grantutils.FindGrantMethodName(grantResp.NodeGrant.Method),
 | 
			
		||||
					"username":   grantResp.NodeGrant.Username,
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,11 @@ func (this *UpdateNodeSSHAction) RunGet(params struct {
 | 
			
		||||
		"id":   node.Id,
 | 
			
		||||
		"name": node.Name,
 | 
			
		||||
	}
 | 
			
		||||
	if nodeResp.Node.NodeCluster != nil {
 | 
			
		||||
		this.Data["clusterId"] = nodeResp.Node.NodeCluster.Id
 | 
			
		||||
	} else {
 | 
			
		||||
		this.Data["clusterId"] = 0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// SSH
 | 
			
		||||
	loginParams := maps.Map{
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,10 @@ func (this *SelectPopupAction) Init() {
 | 
			
		||||
	this.Nav("", "", "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *SelectPopupAction) RunGet(params struct{}) {
 | 
			
		||||
func (this *SelectPopupAction) RunGet(params struct {
 | 
			
		||||
	NodeClusterId int64
 | 
			
		||||
	NsClusterId   int64
 | 
			
		||||
}) {
 | 
			
		||||
	// 所有的认证
 | 
			
		||||
	grantsResp, err := this.RPC().NodeGrantRPC().FindAllEnabledNodeGrants(this.AdminContext(), &pb.FindAllEnabledNodeGrantsRequest{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -37,6 +40,28 @@ func (this *SelectPopupAction) RunGet(params struct{}) {
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["grants"] = grantMaps
 | 
			
		||||
 | 
			
		||||
	// 推荐的认证
 | 
			
		||||
	suggestGrantsResp, err := this.RPC().NodeGrantRPC().FindSuggestNodeGrants(this.AdminContext(), &pb.FindSuggestNodeGrantsRequest{
 | 
			
		||||
		NodeClusterId: params.NodeClusterId,
 | 
			
		||||
		NsClusterId:   params.NsClusterId,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	var suggestGrantMaps = []maps.Map{}
 | 
			
		||||
	for _, grant := range suggestGrantsResp.NodeGrants {
 | 
			
		||||
		suggestGrantMaps = append(suggestGrantMaps, maps.Map{
 | 
			
		||||
			"id":          grant.Id,
 | 
			
		||||
			"name":        grant.Name,
 | 
			
		||||
			"method":      grant.Method,
 | 
			
		||||
			"methodName":  grantutils.FindGrantMethodName(grant.Method),
 | 
			
		||||
			"username":    grant.Username,
 | 
			
		||||
			"description": grant.Description,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["suggestGrants"] = suggestGrantMaps
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
@@ -102,6 +103,46 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
		this.Data["newVersion"] = ""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 登录信息
 | 
			
		||||
	var loginMap maps.Map = nil
 | 
			
		||||
	if node.NodeLogin != nil {
 | 
			
		||||
		loginParams := maps.Map{}
 | 
			
		||||
		if len(node.NodeLogin.Params) > 0 {
 | 
			
		||||
			err = json.Unmarshal(node.NodeLogin.Params, &loginParams)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				this.ErrorPage(err)
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		grantMap := maps.Map{}
 | 
			
		||||
		grantId := loginParams.GetInt64("grantId")
 | 
			
		||||
		if grantId > 0 {
 | 
			
		||||
			grantResp, err := this.RPC().NodeGrantRPC().FindEnabledNodeGrant(this.AdminContext(), &pb.FindEnabledNodeGrantRequest{NodeGrantId: grantId})
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				this.ErrorPage(err)
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			if grantResp.NodeGrant != nil {
 | 
			
		||||
				grantMap = maps.Map{
 | 
			
		||||
					"id":         grantResp.NodeGrant.Id,
 | 
			
		||||
					"name":       grantResp.NodeGrant.Name,
 | 
			
		||||
					"method":     grantResp.NodeGrant.Method,
 | 
			
		||||
					"methodName": grantutils.FindGrantMethodName(grantResp.NodeGrant.Method),
 | 
			
		||||
					"username":   grantResp.NodeGrant.Username,
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		loginMap = maps.Map{
 | 
			
		||||
			"id":     node.NodeLogin.Id,
 | 
			
		||||
			"name":   node.NodeLogin.Name,
 | 
			
		||||
			"type":   node.NodeLogin.Type,
 | 
			
		||||
			"params": loginParams,
 | 
			
		||||
			"grant":  grantMap,
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Data["node"] = maps.Map{
 | 
			
		||||
		"id":          node.Id,
 | 
			
		||||
		"name":        node.Name,
 | 
			
		||||
@@ -131,6 +172,8 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
			"cacheTotalDiskSize":   numberutils.FormatBytes(status.CacheTotalDiskSize),
 | 
			
		||||
			"cacheTotalMemorySize": numberutils.FormatBytes(status.CacheTotalMemorySize),
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		"login": loginMap,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
 
 | 
			
		||||
@@ -90,6 +90,7 @@ func (this *UpdateAction) RunGet(params struct {
 | 
			
		||||
					"name":       grantResp.NodeGrant.Name,
 | 
			
		||||
					"method":     grantResp.NodeGrant.Method,
 | 
			
		||||
					"methodName": grantutils.FindGrantMethodName(grantResp.NodeGrant.Method),
 | 
			
		||||
					"username":   grantResp.NodeGrant.Username,
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -37,6 +37,12 @@ func (this *UpdateNodeSSHAction) RunGet(params struct {
 | 
			
		||||
		"name": node.Name,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if nodeResp.NsNode.NsCluster != nil {
 | 
			
		||||
		this.Data["clusterId"] = nodeResp.NsNode.NsCluster.Id
 | 
			
		||||
	} else {
 | 
			
		||||
		this.Data["clusterId"] = 0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// SSH
 | 
			
		||||
	loginParams := maps.Map{
 | 
			
		||||
		"host":    "",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,23 +1,26 @@
 | 
			
		||||
Vue.component("grant-selector", {
 | 
			
		||||
	props: ["vGrant"],
 | 
			
		||||
	props: ["v-grant", "v-node-cluster-id", "v-ns-cluster-id"],
 | 
			
		||||
	data: function () {
 | 
			
		||||
		return {
 | 
			
		||||
			grantId: (this.vGrant == null) ? 0 : this.vGrant.id,
 | 
			
		||||
			grant: this.vGrant
 | 
			
		||||
			grant: this.vGrant,
 | 
			
		||||
			nodeClusterId: (this.vNodeClusterId != null) ? this.vNodeClusterId : 0,
 | 
			
		||||
			nsClusterId: (this.vNsClusterId != null) ? this.vNsClusterId : 0
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		// 选择授权
 | 
			
		||||
		select: function () {
 | 
			
		||||
			let that = this;
 | 
			
		||||
			teaweb.popup("/clusters/grants/selectPopup", {
 | 
			
		||||
			teaweb.popup("/clusters/grants/selectPopup?nodeClusterId=" + this.nodeClusterId + "&nsClusterId=" + this.nsClusterId, {
 | 
			
		||||
				callback: (resp) => {
 | 
			
		||||
					that.grantId = resp.data.grant.id;
 | 
			
		||||
					if (that.grantId > 0) {
 | 
			
		||||
						that.grant = resp.data.grant;
 | 
			
		||||
					}
 | 
			
		||||
					that.notifyUpdate()
 | 
			
		||||
				}
 | 
			
		||||
				},
 | 
			
		||||
				height: "26em"
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +67,7 @@ Vue.component("grant-selector", {
 | 
			
		||||
	},
 | 
			
		||||
	template: `<div>
 | 
			
		||||
	<input type="hidden" name="grantId" :value="grantId"/>
 | 
			
		||||
	<div class="ui label small basic" v-if="grant != null">{{grant.name}}<span class="small">({{grant.methodName}})</span> <a href="" title="修改" @click.prevent="update()"><i class="icon pencil small"></i></a> <a href="" title="删除" @click.prevent="remove()"><i class="icon remove"></i></a> </div>
 | 
			
		||||
	<div class="ui label small basic" v-if="grant != null">{{grant.name}}<span class="small grey">({{grant.methodName}})</span><span class="small grey" v-if="grant.username != null && grant.username.length > 0">({{grant.username}})</span> <a href="" title="修改" @click.prevent="update()"><i class="icon pencil small"></i></a> <a href="" title="删除" @click.prevent="remove()"><i class="icon remove"></i></a> </div>
 | 
			
		||||
	<div v-if="grant == null">
 | 
			
		||||
		<a href="" @click.prevent="select()">[选择已有认证]</a>     <a href="" @click.prevent="create()">[添加新认证]</a>
 | 
			
		||||
	</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ Vue.component("node-login-suggest-ports", {
 | 
			
		||||
	template: `<span>
 | 
			
		||||
	<span v-if="isLoading">正在检查端口...</span>
 | 
			
		||||
	<span v-if="availablePorts.length > 0">
 | 
			
		||||
		推荐端口:<a href="" v-for="port in availablePorts" @click.prevent="selectPort(port)" class="ui label tiny basic blue" style="border: 1px #2185d0 dashed; font-weight: normal">{{port}}</a>
 | 
			
		||||
		可能端口:<a href="" v-for="port in availablePorts" @click.prevent="selectPort(port)" class="ui label tiny basic blue" style="border: 1px #2185d0 dashed; font-weight: normal">{{port}}</a>
 | 
			
		||||
		   
 | 
			
		||||
	</span>
 | 
			
		||||
	<span v-if="ports.length > 0">
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>SSH登录认证</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<grant-selector></grant-selector>
 | 
			
		||||
					<grant-selector :v-node-cluster-id="clusterId"></grant-selector>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			</tbody>
 | 
			
		||||
@@ -117,7 +117,7 @@
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td>SSH登录认证 *</td>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <grant-selector :v-grant="node.grant" @change="changeGrant"></grant-selector>
 | 
			
		||||
                            <grant-selector :v-grant="node.grant" :v-node-cluster-id="clusterId" @change="changeGrant"></grant-selector>
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                </table>
 | 
			
		||||
@@ -147,6 +147,8 @@ nodeId: "{{node.uniqueId}}"
 | 
			
		||||
secret: "{{node.secret}}"</source-code-box>
 | 
			
		||||
            <div class="row">然后再使用<code-label>bin/edge-node start</code-label>命令启动节点。</div>
 | 
			
		||||
            <div>
 | 
			
		||||
                <div class="ui divider"></div>
 | 
			
		||||
                <a href="" @click.prevent="finish">安装完成</a>
 | 
			
		||||
                <a href="" @click.prevent="finish" style="float: right">跳过安装</a>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -113,7 +113,7 @@
 | 
			
		||||
				<td>SSH登录认证</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<div v-if="node.login != null && node.login.grant != null && node.login.grant.id > 0">
 | 
			
		||||
						<a :href="'/clusters/grants/grant?grantId=' + node.login.grant.id">{{node.login.grant.name}}<span class="small">({{node.login.grant.methodName}})</span></a>
 | 
			
		||||
						<a :href="'/clusters/grants/grant?grantId=' + node.login.grant.id">{{node.login.grant.name}}<span class="small grey">({{node.login.grant.methodName}})</span><span class="small grey" v-if="node.login.grant.username.length > 0">({{node.login.grant.username}})</span></a>
 | 
			
		||||
					</div>
 | 
			
		||||
					<span v-else class="disabled">
 | 
			
		||||
						尚未设置
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>SSH登录认证</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <grant-selector :v-grant="grant"></grant-selector>
 | 
			
		||||
                    <grant-selector :v-grant="grant" :v-node-cluster-id="clusterId"></grant-selector>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,8 @@ Tea.context(function () {
 | 
			
		||||
				id: this.node.login.grant.id,
 | 
			
		||||
				name: this.node.login.grant.name,
 | 
			
		||||
				method: this.node.login.grant.method,
 | 
			
		||||
				methodName: this.node.login.grant.methodName
 | 
			
		||||
				methodName: this.node.login.grant.methodName,
 | 
			
		||||
				username: this.node.login.grant.username
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td>SSH登录认证 *</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<grant-selector :v-grant="grant"></grant-selector>
 | 
			
		||||
				<grant-selector :v-grant="grant" :v-node-cluster-id="clusterId"></grant-selector>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</table>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										29
									
								
								web/views/@default/clusters/grants/selectPopup.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								web/views/@default/clusters/grants/selectPopup.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
.grants-box {
 | 
			
		||||
  margin-top: 1em;
 | 
			
		||||
}
 | 
			
		||||
.grant-box {
 | 
			
		||||
  float: left;
 | 
			
		||||
  width: 12em;
 | 
			
		||||
  height: 4.5em;
 | 
			
		||||
  overflow-x: hidden;
 | 
			
		||||
  overflow-y: auto;
 | 
			
		||||
  margin-right: 0.5em;
 | 
			
		||||
  border: 1px #ccc solid;
 | 
			
		||||
  margin-bottom: 0.5em;
 | 
			
		||||
  padding: 0.5em 0.3em;
 | 
			
		||||
  text-align: left;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
.grant-box .small {
 | 
			
		||||
  font-size: 0.8em;
 | 
			
		||||
}
 | 
			
		||||
.grant-box div.method {
 | 
			
		||||
  margin-top: 0.3em;
 | 
			
		||||
}
 | 
			
		||||
.grant-box div.method .small {
 | 
			
		||||
  font-size: 0.8em;
 | 
			
		||||
}
 | 
			
		||||
.grant-box::-webkit-scrollbar {
 | 
			
		||||
  width: 4px;
 | 
			
		||||
}
 | 
			
		||||
/*# sourceMappingURL=selectPopup.css.map */
 | 
			
		||||
							
								
								
									
										1
									
								
								web/views/@default/clusters/grants/selectPopup.css.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								web/views/@default/clusters/grants/selectPopup.css.map
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"sources":["selectPopup.less"],"names":[],"mappings":"AAAA;EACC,eAAA;;AAGD;EACC,WAAA;EACA,WAAA;EACA,aAAA;EACA,kBAAA;EACA,gBAAA;EACA,mBAAA;EACA,sBAAA;EACA,oBAAA;EACA,oBAAA;EACA,gBAAA;EACA,eAAA;;AAXD,UAaC;EACC,gBAAA;;AAdF,UAiBC,IAAG;EACF,iBAAA;;AAlBF,UAiBC,IAAG,OAGF;EACC,gBAAA;;AAKH,UAAU;EACT,UAAA","file":"selectPopup.css"}
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{$layout "layout_popup"}
 | 
			
		||||
 | 
			
		||||
<h3>选择认证</h3>
 | 
			
		||||
<h3>选择SSH认证</h3>
 | 
			
		||||
 | 
			
		||||
<form class="ui form">
 | 
			
		||||
    <div class="ui fields inline">
 | 
			
		||||
@@ -10,12 +10,31 @@
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
 | 
			
		||||
<table class="ui table">
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td>
 | 
			
		||||
            <span v-if="grants.length == 0">暂时还没有可用的认证。</span>
 | 
			
		||||
            <a class="ui label small basic" v-for="grant in grants" :class="{blue:grantId == grant.id}" @click.prevent="selectGrant(grant)" style="margin-bottom:0.5em">{{grant.name}} <span class="small">({{grant.methodName}})</span><span v-if="grant.username.length > 0" class="small">({{grant.username}})</span></a>
 | 
			
		||||
            <p class="comment">请点击选中某个认证。</p>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
</table>
 | 
			
		||||
<div class="ui divider"></div>
 | 
			
		||||
 | 
			
		||||
<span v-if="grants.length == 0">暂时还没有可用的认证。</span>
 | 
			
		||||
 | 
			
		||||
<h4 v-if="suggestGrants.length > 0">可能的认证</h4>
 | 
			
		||||
<div class="grants-box" v-if="suggestGrants.length > 0">
 | 
			
		||||
    <div class="grant-box" v-for="grant in suggestGrants">
 | 
			
		||||
        <div :class="{blue:grantId == grant.id}" @click.prevent="selectGrant(grant)"><a href="">{{grant.name}}</a> <span v-if="grant.username.length > 0" class="small grey">({{grant.username}})</span>
 | 
			
		||||
            <div class="method">
 | 
			
		||||
                <span class="small grey">{{grant.methodName}}</span>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="clear"></div>
 | 
			
		||||
 | 
			
		||||
<h4>全部认证</h4>
 | 
			
		||||
<div class="grants-box">
 | 
			
		||||
    <div class="grant-box" v-for="grant in grants">
 | 
			
		||||
        <div :class="{blue:grantId == grant.id}" @click.prevent="selectGrant(grant)"><a href="">{{grant.name}}</a> <span v-if="grant.username.length > 0" class="small grey">({{grant.username}})</span>
 | 
			
		||||
            <div class="method">
 | 
			
		||||
                <span class="small grey">{{grant.methodName}}</span>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="clear"></div>
 | 
			
		||||
<p class="comment">请点击使用某个认证。</p>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								web/views/@default/clusters/grants/selectPopup.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								web/views/@default/clusters/grants/selectPopup.less
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
.grants-box {
 | 
			
		||||
	margin-top: 1em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.grant-box {
 | 
			
		||||
	float: left;
 | 
			
		||||
	width: 12em;
 | 
			
		||||
	height: 4.5em;
 | 
			
		||||
	overflow-x: hidden;
 | 
			
		||||
	overflow-y: auto;
 | 
			
		||||
	margin-right: 0.5em;
 | 
			
		||||
	border: 1px #ccc solid;
 | 
			
		||||
	margin-bottom: 0.5em;
 | 
			
		||||
	padding: 0.5em 0.3em;
 | 
			
		||||
	text-align: left;
 | 
			
		||||
	cursor: pointer;
 | 
			
		||||
 | 
			
		||||
	.small {
 | 
			
		||||
		font-size: 0.8em;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	div.method {
 | 
			
		||||
		margin-top: 0.3em;
 | 
			
		||||
 | 
			
		||||
		.small {
 | 
			
		||||
			font-size: 0.8em;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.grant-box::-webkit-scrollbar {
 | 
			
		||||
	width: 4px;
 | 
			
		||||
}
 | 
			
		||||
@@ -29,6 +29,46 @@
 | 
			
		||||
            </div>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td colspan="2"><more-options-indicator></more-options-indicator></td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tbody v-show="moreOptionsVisible">
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>SSH主机地址</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <div v-if="node.login != null && node.login.params != null && node.login.params.host != null">
 | 
			
		||||
                    <span v-if="node.login.params.host.length > 0">{{node.login.params.host}}</span>
 | 
			
		||||
                    <span v-else class="disabled">尚未设置</span>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div v-else class="disabled">
 | 
			
		||||
                    尚未设置
 | 
			
		||||
                </div>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>SSH主机端口</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <div v-if="node.login != null && node.login.params != null && node.login.params.host != null">
 | 
			
		||||
                    <span v-if="node.login.params.port > 0">{{node.login.params.port}}</span>
 | 
			
		||||
                    <span v-else class="disabled">尚未设置</span>
 | 
			
		||||
                </div>
 | 
			
		||||
                <span v-else class="disabled">
 | 
			
		||||
                            尚未设置
 | 
			
		||||
                        </span>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>SSH登录认证</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <div v-if="node.login != null && node.login.grant != null && node.login.grant.id > 0">
 | 
			
		||||
                    <a :href="'/clusters/grants/grant?grantId=' + node.login.grant.id">{{node.login.grant.name}}<span class="small grey">({{node.login.grant.methodName}})</span><span class="small grey" v-if="node.login.grant.username.length > 0">({{node.login.grant.username}})</span></a>
 | 
			
		||||
                </div>
 | 
			
		||||
                <span v-else class="disabled">
 | 
			
		||||
                            尚未设置
 | 
			
		||||
                        </span>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
    </tbody>
 | 
			
		||||
</table>
 | 
			
		||||
<div class="ui divider"></div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>SSH登录认证</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <grant-selector :v-grant="grant"></grant-selector>
 | 
			
		||||
                    <grant-selector :v-grant="grant" :v-ns-cluster-id="clusterId"></grant-selector>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,8 @@ Tea.context(function () {
 | 
			
		||||
				id: this.node.login.grant.id,
 | 
			
		||||
				name: this.node.login.grant.name,
 | 
			
		||||
				method: this.node.login.grant.method,
 | 
			
		||||
				methodName: this.node.login.grant.methodName
 | 
			
		||||
				methodName: this.node.login.grant.methodName,
 | 
			
		||||
				username: this.node.login.grant.username
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td>SSH登录认证 *</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<grant-selector :v-grant="grant"></grant-selector>
 | 
			
		||||
				<grant-selector :v-grant="grant" :v-ns-cluster-id="clusterId"></grant-selector>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</table>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user