Skip to content

Commit 142b9ef

Browse files
committed
feat(auth): add cluster_manage page
1 parent 238859f commit 142b9ef

File tree

6 files changed

+201
-21
lines changed

6 files changed

+201
-21
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<!--
2+
~ Copyright 2024 Apollo Authors
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
~
16+
-->
17+
<!doctype html>
18+
<html ng-app="cluster_manage">
19+
20+
<head>
21+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
22+
<link rel="icon" href="../img/config.png">
23+
<!-- styles -->
24+
<link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css">
25+
<link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css">
26+
<link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css">
27+
<link rel="stylesheet" type="text/css" href="../styles/common-style.css">
28+
<link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css">
29+
<title>{{'Config.ClusterManage' | translate }}</title>
30+
</head>
31+
32+
<body>
33+
34+
<apollonav></apollonav>
35+
36+
<div class="container-fluid apollo-container project-setting" ng-controller="ClusterManageController">
37+
<section class="col-md-10 col-md-offset-1 panel">
38+
<header class="panel-heading">
39+
<div class="row">
40+
<div class="col-md-9">
41+
<h4 class="modal-title">{{'Config.ClusterManage' | translate }} (
42+
{{'Common.AppId' | translate }}:<label ng-bind="appId"></label> )
43+
</h4>
44+
</div>
45+
<div class="col-md-3 text-right">
46+
<a type="button" class="btn btn-info" data-dismiss="modal"
47+
href="{{ '/config.html' | prefixPath }}?#appid={{pageContext.appId}}">{{'Common.ReturnToIndex' | translate }}
48+
</a>
49+
</div>
50+
</div>
51+
</header>
52+
53+
<div class="panel-body row" >
54+
55+
<section class="context">
56+
<!-- <section class="form-horizontal">-->
57+
<!-- <div class="alert alert-info no-radius" role="alert">-->
58+
<!-- <strong>Tips:</strong>-->
59+
<!-- <ul>-->
60+
<!-- <li>{{'AccessKey.Tips.1' | translate }}</li>-->
61+
<!-- <li>{{'AccessKey.Tips.2' | translate }}</li>-->
62+
<!-- <li>{{'AccessKey.Tips.3' | translate }}</li>-->
63+
<!-- <li>{{'AccessKey.Tips.4' | translate }}</li>-->
64+
<!-- <ul>-->
65+
<!-- <li>{{'AccessKey.Tips.4.1' | translate }}</li>-->
66+
<!-- <li>{{'AccessKey.Tips.4.2' | translate }}</li>-->
67+
<!-- <li>{{'AccessKey.Tips.4.3' | translate }}</li>-->
68+
<!-- </ul>-->
69+
<!-- </ul>-->
70+
<!-- </div>-->
71+
<!-- </section>-->
72+
73+
<!--application info-->
74+
<section ng-repeat="env in envs">
75+
<hr>
76+
<h4>{{'Common.Environment' | translate }}: {{env.name}}
77+
</h4>
78+
<section class="panel cluster-info-panel config-item-container" ng-repeat="cluster in env.clusters">
79+
<header class="panel-heading">
80+
<div class="row">
81+
<div class="col-md-6 col-sm-6 header-namespace">
82+
<b class="namespace-name" data-tooltip="tooltip" data-placement="bottom">
83+
{{'Common.Cluster' | translate }}:{{cluster.name}}
84+
</b>
85+
</div>
86+
<div class="col-md-6 col-sm-6 text-right header-buttons">
87+
<a type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom"
88+
title="{{'Cluster.GrantTips' | translate }}"
89+
href="{{ '/cluster/ns_role.html' | prefixPath }}?#/appid={{appId}}&env={{env.name}}&clusterName={{cluster.name}}">
90+
<img src="/img/assign.png">
91+
{{'Cluster.Grant' | translate }}
92+
</a>
93+
</div>
94+
</div>
95+
</header>
96+
</section>
97+
98+
</section>
99+
</section>
100+
101+
</div>
102+
</section>
103+
</div>
104+
105+
<div ng-include="'../views/common/footer.html'"></div>
106+
107+
<!-- jquery.js -->
108+
<script src="../vendor/jquery.min.js" type="text/javascript"></script>
109+
110+
<!--angular-->
111+
<script src="../vendor/angular/angular.min.js"></script>
112+
<script src="../vendor/angular/angular-route.min.js"></script>
113+
<script src="../vendor/angular/angular-resource.min.js"></script>
114+
<script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
115+
<script src="../vendor/angular/loading-bar.min.js"></script>
116+
<script src="../vendor/angular/angular-cookies.min.js"></script>
117+
118+
<script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
119+
<script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
120+
<script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
121+
<!--valdr-->
122+
<script src="../vendor/valdr/valdr.min.js" type="text/javascript"></script>
123+
<script src="../vendor/valdr/valdr-message.min.js" type="text/javascript"></script>
124+
125+
<!-- bootstrap.js -->
126+
<script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
127+
128+
<script src="../vendor/lodash.min.js"></script>
129+
130+
<script src="../vendor/select2/select2.min.js" type="text/javascript"></script>
131+
<!--biz-->
132+
<!--must import-->
133+
<script type="application/javascript" src="../scripts/app.js"></script>
134+
<script type="application/javascript" src="../scripts/services/AppService.js"></script>
135+
<script type="application/javascript" src="../scripts/services/EnvService.js"></script>
136+
<script type="application/javascript" src="../scripts/services/UserService.js"></script>
137+
<script type="application/javascript" src="../scripts/services/CommonService.js"></script>
138+
<script type="application/javascript" src="../scripts/services/ClusterService.js"></script>
139+
<script type="application/javascript" src="../scripts/AppUtils.js"></script>
140+
<script type="application/javascript" src="../scripts/directive/directive.js"></script>
141+
<script type="application/javascript" src="../scripts/services/PermissionService.js"></script>
142+
143+
<script type="application/javascript" src="../scripts/controller/ClusterManageController.js"></script>
144+
</body>
145+
146+
</html>

apollo-portal/src/main/resources/static/config.html

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@
140140
apollo-img-src="'accesskey-manage'"
141141
apollo-href="'app/access_key.html?#/appid=' + pageContext.appId"></apolloentrance>
142142

143+
<apolloentrance apollo-title="'Config.ClusterManage' | translate"
144+
apollo-img-src="'project-manage'"
145+
apollo-href="'app/cluster_manage.html?#/appid=' + pageContext.appId"></apolloentrance>
146+
143147
<a class="list-group-item" ng-show="missEnvs.length > 0" ng-click="createAppInMissEnv()">
144148
<div class="row icon-text icon-plus-orange">
145149
<p class="btn-title ng-binding">{{'Config.CreateAppMissEnv' | translate }}</p>
@@ -187,27 +191,6 @@
187191
<div class="config-item-container hide" ng-class="{'view-mode-1': viewMode == 1, 'view-mode-2': viewMode == 2}"
188192
ng-controller="ConfigNamespaceController">
189193

190-
<section class="panel cluster-info-panel">
191-
<header class="panel-heading">
192-
<div class="row">
193-
<div class="col-md-6 col-sm-6 header-namespace">
194-
<b class="namespace-name" data-tooltip="tooltip" data-placement="bottom">
195-
{{'Config.CurrentlyOperatorEnv' | translate }}:{{pageContext.env}},
196-
{{'Common.Cluster' | translate }}:{{pageContext.clusterName}}
197-
</b>
198-
</div>
199-
<div class="col-md-6 col-sm-6 text-right header-buttons">
200-
<a type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom"
201-
title="{{'Cluster.GrantTips' | translate }}"
202-
href="{{ '/cluster/ns_role.html' | prefixPath }}?#/appid={{pageContext.appId}}&env={{pageContext.env}}&clusterName={{pageContext.clusterName}}">
203-
<img src="img/assign.png">
204-
{{'Cluster.Grant' | translate }}
205-
</a>
206-
</div>
207-
</div>
208-
</header>
209-
</section>
210-
211194
<div class="alert alert-info alert-dismissible" role="alert"
212195
ng-show="(!hideTip || !hideTip[pageContext.appId][pageContext.clusterName]) && envMapClusters[pageContext.env]">
213196

apollo-portal/src/main/resources/static/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@
455455
"Config.SortByKey": "Filter Config by Key",
456456
"Config.FilterConfig": "Filter",
457457
"Config.Reset": "Reset",
458+
"Config.ClusterManage": "Cluster Manage",
458459
"Delete.Title": "Delete applications, clusters, AppNamespace",
459460
"Delete.DeleteApp": "Delete application",
460461
"Delete.DeleteAppTips": "(Because deleting applications has very large impacts, only system administrators are allowed to delete them for the time being. Make sure that no client fetches the configuration of the application before deleting it.)",

apollo-portal/src/main/resources/static/i18n/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@
455455
"Config.SortByKey": "按Key值过滤",
456456
"Config.FilterConfig": "过滤配置",
457457
"Config.Reset": "重置",
458+
"Config.ClusterManage": "集群管理",
458459
"Delete.Title": "删除应用、集群、AppNamespace",
459460
"Delete.DeleteApp": "删除应用",
460461
"Delete.DeleteAppTips": "(由于删除应用影响面较大,所以现在暂时只允许系统管理员删除,请确保没有客户端读取该应用的配置后再做删除动作)",

apollo-portal/src/main/resources/static/scripts/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ var setting_module = angular.module('setting', ['app.service', 'apollo.directive
7272
var role_module = angular.module('role', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
7373
//cluster
7474
var cluster_module = angular.module('cluster', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar', 'valdr']);
75+
//cluster manage
76+
var cluster_manage_module = angular.module('cluster_manage', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar', 'valdr']);
7577
//release history
7678
var release_history_module = angular.module('release_history', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
7779
//open manage
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2024 Apollo Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
cluster_manage_module.controller('ClusterManageController',
18+
['$scope', '$location', '$window', '$translate', 'toastr', 'AppService', 'EnvService', 'ClusterService',
19+
'AppUtil',
20+
function ($scope, $location, $window, $translate, toastr, AppService, EnvService, ClusterService,
21+
AppUtil) {
22+
23+
var params = AppUtil.parseParams($location.$$url);
24+
$scope.appId = params.appid;
25+
26+
$scope.envs = [];
27+
28+
function loadClusters() {
29+
AppService.load_nav_tree($scope.appId).then(function (result) {
30+
var nodes = AppUtil.collectData(result);
31+
if (!nodes || nodes.length == 0) {
32+
toastr.error($translate.instant('Config.SystemError'));
33+
return;
34+
}
35+
nodes.forEach(function (node) {
36+
$scope.envs.push({ name: node.env, clusters: node.clusters });
37+
});
38+
console.log($scope.envs);
39+
});
40+
41+
}
42+
43+
loadClusters();
44+
45+
}
46+
]
47+
);

0 commit comments

Comments
 (0)