mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	显示SSH认证相关集群、节点
This commit is contained in:
		@@ -10,7 +10,7 @@ Vue.component("grant-selector", {
 | 
			
		||||
		// 选择授权
 | 
			
		||||
		select: function () {
 | 
			
		||||
			let that = this;
 | 
			
		||||
			teaweb.popup("/nodes/grants/selectPopup", {
 | 
			
		||||
			teaweb.popup("/clusters/grants/selectPopup", {
 | 
			
		||||
				callback: (resp) => {
 | 
			
		||||
					that.grantId = resp.data.grant.id;
 | 
			
		||||
					if (that.grantId > 0) {
 | 
			
		||||
@@ -22,7 +22,7 @@ Vue.component("grant-selector", {
 | 
			
		||||
 | 
			
		||||
		// 创建授权
 | 
			
		||||
		create: function () {
 | 
			
		||||
			teaweb.popup("/nodes/grants/createPopup", {
 | 
			
		||||
			teaweb.popup("/clusters/grants/createPopup", {
 | 
			
		||||
				height: "31em",
 | 
			
		||||
				callback: (resp) => {
 | 
			
		||||
					this.grantId = resp.data.grant.id;
 | 
			
		||||
@@ -39,7 +39,7 @@ Vue.component("grant-selector", {
 | 
			
		||||
				window.location.reload();
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
			teaweb.popup("/nodes/grants/updatePopup?grantId=" + this.grant.id, {
 | 
			
		||||
			teaweb.popup("/clusters/grants/updatePopup?grantId=" + this.grant.id, {
 | 
			
		||||
				height: "31em",
 | 
			
		||||
				callback: (resp) => {
 | 
			
		||||
					this.grant = resp.data.grant;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								web/views/@default/clusters/grants/@grant_menu.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								web/views/@default/clusters/grants/@grant_menu.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
<first-menu>
 | 
			
		||||
	<menu-item href="/clusters/grants">认证列表</menu-item>
 | 
			
		||||
	<span class="item">|</span>
 | 
			
		||||
	<menu-item :href="'/clusters/grants/grant?grantId=' + grant.id" code="index">{{grant.name}}详情</menu-item>
 | 
			
		||||
	<menu-item :href="'/clusters/grants/update?grantId=' + grant.id" code="update">修改</menu-item>
 | 
			
		||||
</first-menu>
 | 
			
		||||
							
								
								
									
										4
									
								
								web/views/@default/clusters/grants/@menu.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								web/views/@default/clusters/grants/@menu.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
<first-menu>
 | 
			
		||||
	<menu-item href="/clusters/grants" code="index">认证列表</menu-item>
 | 
			
		||||
	<menu-item href="/clusters/grants/create" code="create">创建认证</menu-item>
 | 
			
		||||
</first-menu>
 | 
			
		||||
@@ -48,11 +48,16 @@
 | 
			
		||||
		</tbody>
 | 
			
		||||
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td>描述</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<textarea name="description" rows="3"></textarea>
 | 
			
		||||
			</td>
 | 
			
		||||
			<td colspan="2"><more-options-indicator></more-options-indicator></td>
 | 
			
		||||
		</tr>
 | 
			
		||||
		<tbody v-show="moreOptionsVisible">
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>描述</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<textarea name="description" rows="3"></textarea>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
		</tbody>
 | 
			
		||||
	</table>
 | 
			
		||||
	<submit-btn></submit-btn>
 | 
			
		||||
</form>
 | 
			
		||||
							
								
								
									
										5
									
								
								web/views/@default/clusters/grants/create.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								web/views/@default/clusters/grants/create.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.method = "user";
 | 
			
		||||
 | 
			
		||||
	this.success = NotifySuccess("保存成功", "/clusters/grants");
 | 
			
		||||
});
 | 
			
		||||
@@ -1,10 +1,5 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "menu"}
 | 
			
		||||
 | 
			
		||||
<second-menu>
 | 
			
		||||
	<menu-item :href="'/nodes/grants/grant?grantId=' + grant.id" active="true">详情</menu-item>
 | 
			
		||||
	<menu-item :href="'/nodes/grants/update?grantId=' + grant.id">修改</menu-item>
 | 
			
		||||
</second-menu>
 | 
			
		||||
{$template "grant_menu"}
 | 
			
		||||
 | 
			
		||||
<table class="ui table selectable definition">
 | 
			
		||||
	<tr>
 | 
			
		||||
@@ -55,4 +50,18 @@
 | 
			
		||||
			<span v-if="grant.description.length == 0">-</span>
 | 
			
		||||
		</td>
 | 
			
		||||
	</tr>
 | 
			
		||||
</table>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<div class="ui divider"></div>
 | 
			
		||||
<h3>使用此认证的集群</h3>
 | 
			
		||||
<div>
 | 
			
		||||
	<p v-if="clusters.length == 0" class="comment">暂时还没有集群使用此认证。</p>
 | 
			
		||||
	<a :href="'/clusters/cluster?clusterId=' + cluster.id" class="ui label small" v-for="cluster in clusters">{{cluster.name}}</a>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="ui divider"></div>
 | 
			
		||||
<h3>使用此认证的节点</h3>
 | 
			
		||||
<div>
 | 
			
		||||
	<p v-if="nodes.length == 0" class="comment">暂时还没有节点使用此认证。</p>
 | 
			
		||||
	<a :href="'/clusters/cluster/node?clusterId=' + node.cluster.id + '&nodeId=' + node.id" class="ui label small" :class="{red:!node.isOn}" v-for="node in nodes">{{node.name}}<span class="small">({{node.cluster.name}})</span></a>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										37
									
								
								web/views/@default/clusters/grants/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								web/views/@default/clusters/grants/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "menu"}
 | 
			
		||||
 | 
			
		||||
<div class="ui message" v-if="grants.length == 0">暂时还没有认证信息。</div>
 | 
			
		||||
 | 
			
		||||
<table class="ui table selectable" v-if="grants.length > 0">
 | 
			
		||||
	<thead>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<th>ID</th>
 | 
			
		||||
			<th>名称</th>
 | 
			
		||||
			<th>类型</th>
 | 
			
		||||
			<th>集群数</th>
 | 
			
		||||
			<th>节点数</th>
 | 
			
		||||
			<th class="two op">操作</th>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</thead>
 | 
			
		||||
	<tr v-for="grant in grants">
 | 
			
		||||
		<td>{{grant.id}}</td>
 | 
			
		||||
		<td>{{grant.name}}</td>
 | 
			
		||||
		<td>
 | 
			
		||||
			<span class="ui label tiny">{{grant.method.name}}</span>
 | 
			
		||||
		</td>
 | 
			
		||||
		<td>
 | 
			
		||||
			<span v-if="grant.countClusters > 0">{{grant.countClusters}}</span>
 | 
			
		||||
			<span v-else class="disabled">0</span>
 | 
			
		||||
		</td>
 | 
			
		||||
		<td>
 | 
			
		||||
			<span v-if="grant.countNodes > 0">{{grant.countNodes}}</span>
 | 
			
		||||
			<span v-else class="disabled">0</span>
 | 
			
		||||
		</td>
 | 
			
		||||
		<td>
 | 
			
		||||
			<a :href="'/clusters/grants/grant?grantId=' + grant.id">详情</a>   <a href="" @click.prevent="deleteGrant(grant.id)">删除</a>
 | 
			
		||||
		</td>
 | 
			
		||||
	</tr>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<div class="page" v-html="page"></div>
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			<td class="title">选择认证</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<span v-if="grants.length == 0">暂时还没有可用的认证。</span>
 | 
			
		||||
				<a class="ui label small" v-for="grant in grants" :class="{blue:grantId == grant.id}" @click.prevent="selectGrant(grant)">{{grant.name}} <span class="small">({{grant.methodName}})</span></a>
 | 
			
		||||
				<a class="ui label small" 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></a>
 | 
			
		||||
				<p class="comment">请点击选中某个认证。</p>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</table>
 | 
			
		||||
@@ -1,10 +1,5 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "menu"}
 | 
			
		||||
 | 
			
		||||
<second-menu>
 | 
			
		||||
	<menu-item :href="'/nodes/grants/grant?grantId=' + grant.id">详情</menu-item>
 | 
			
		||||
	<menu-item :href="'/nodes/grants/update?grantId=' + grant.id" active="true">修改</menu-item>
 | 
			
		||||
</second-menu>
 | 
			
		||||
{$template "grant_menu"}
 | 
			
		||||
 | 
			
		||||
<div class="margin"></div>
 | 
			
		||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
 | 
			
		||||
							
								
								
									
										5
									
								
								web/views/@default/clusters/grants/update.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								web/views/@default/clusters/grants/update.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.method = this.grant.method;
 | 
			
		||||
 | 
			
		||||
	this.success = NotifySuccess("保存成功", "/clusters/grants/grant?grantId=" + this.grant.id);
 | 
			
		||||
});
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
<first-menu>
 | 
			
		||||
	<menu-item href="/nodes/grants" code="index">认证列表</menu-item>
 | 
			
		||||
	<menu-item href="/nodes/grants/create" code="create">创建认证</menu-item>
 | 
			
		||||
</first-menu>
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.method = "user";
 | 
			
		||||
 | 
			
		||||
	this.success = NotifySuccess("保存成功", "/nodes/grants");
 | 
			
		||||
});
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "menu"}
 | 
			
		||||
 | 
			
		||||
<div class="ui message" v-if="grants.length == 0">暂时还没有认证信息。</div>
 | 
			
		||||
 | 
			
		||||
<table class="ui table selectable" v-if="grants.length > 0">
 | 
			
		||||
	<thead>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<th>ID</th>
 | 
			
		||||
			<th>名称</th>
 | 
			
		||||
			<th>类型</th>
 | 
			
		||||
			<th class="two op">操作</th>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</thead>
 | 
			
		||||
	<tr v-for="grant in grants">
 | 
			
		||||
		<td>{{grant.id}}</td>
 | 
			
		||||
		<td>{{grant.name}}</td>
 | 
			
		||||
		<td>{{grant.method.name}}</td>
 | 
			
		||||
		<td>
 | 
			
		||||
			<a :href="'/nodes/grants/grant?grantId=' + grant.id">详情</a>   <a href="" @click.prevent="deleteGrant(grant.id)">删除</a>
 | 
			
		||||
		</td>
 | 
			
		||||
	</tr>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<div class="page" v-html="page"></div>
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.method = this.grant.method;
 | 
			
		||||
 | 
			
		||||
	this.success = NotifySuccess("保存成功", "/nodes/grants/grant?grantId=" + this.grant.id);
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user