Commit 30424a91 by vss宋顺

Merge branch 'master' into 'release'

portal bugfix and add many tips See merge request !24
parents 47a4fabd 2fd37c26
...@@ -13,6 +13,10 @@ Apollo(配置中心) ...@@ -13,6 +13,10 @@ Apollo(配置中心)
Apollo(阿波罗)是携程框架部门研发的配置管理平台,能够集中化管理应用不同环境、不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限、流程治理等特性。 Apollo(阿波罗)是携程框架部门研发的配置管理平台,能够集中化管理应用不同环境、不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限、流程治理等特性。
服务端基于Spring Boot和Spring Cloud开发,打包后可以直接运行,不需要额外安装Tomcat等应用容器。
客户端不依赖任何框架,能够运行于所有Java运行时环境。
更多介绍参见[Apollo配置中心介绍](https://github.com/ctripcorp/apollo/wiki/Apollo%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E4%BB%8B%E7%BB%8D) 更多介绍参见[Apollo配置中心介绍](https://github.com/ctripcorp/apollo/wiki/Apollo%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E4%BB%8B%E7%BB%8D)
#Features #Features
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
应用负责人</label> 应用负责人</label>
<div class="col-sm-6"> <div class="col-sm-6">
<apollouserselector apollo-id="userSelectWidgetId"></apollouserselector> <apollouserselector apollo-id="userSelectWidgetId"></apollouserselector>
<br>
<small>(负责人具有项目管理的最高权限,比如分配配置的修改权,发布权等)</small> <small>(负责人具有项目管理的最高权限,比如分配配置的修改权,发布权等)</small>
</div> </div>
</div> </div>
......
...@@ -34,6 +34,19 @@ ...@@ -34,6 +34,19 @@
</header> </header>
<div class="panel-body"> <div class="panel-body">
<div class="alert alert-info" role="alert">
<strong>Tips:</strong>
<ul>
<li>通过添加集群,可以使同一份程序在不同的集群(如不同的数据中心)使用不同的配置</li>
<li>
Apollo默认会读取机器上/opt/settings/server.properties(linux)或C:\opt\settings\server.properties(windows)文件中的idc属性作为集群名字,
如SHAJQ(金桥数据中心)、SHAOY(欧阳数据中心)
</li>
<li>在这里创建的集群名字需要和机器上server.properties中的idc属性一致</li>
</ul>
</div>
<form class="form-horizontal" name="clusterForm" valdr-type="Cluster" ng-show="step == 1" <form class="form-horizontal" name="clusterForm" valdr-type="Cluster" ng-show="step == 1"
ng-submit="create()"> ng-submit="create()">
<div class="form-group"> <div class="form-group">
......
...@@ -73,11 +73,24 @@ ...@@ -73,11 +73,24 @@
</a> </a>
<apolloentrance apollo-title="'添加集群'" apollo-img-src="'plus-orange'" <apolloentrance apollo-title="'添加集群'" apollo-img-src="'plus-orange'"
apollo-href="'cluster.html?#/appid=' + pageContext.appId"></apolloentrance> apollo-href="'cluster.html?#/appid=' + pageContext.appId"
ng-show="hasCreateClusterPermission"></apolloentrance>
<span class="list-group-item cursor-pointer hover" ng-click="showMasterPermissionTips()"
ng-show="!hasCreateClusterPermission">
<div class="row icon-text icon-plus-orange">
<p class="btn-title">添加集群</p>
</div>
</span>
<apolloentrance apollo-title="'添加Namespace'" apollo-img-src="'plus-orange'" <apolloentrance apollo-title="'添加Namespace'" apollo-img-src="'plus-orange'"
apollo-href="'namespace.html?#/appid=' + pageContext.appId" apollo-href="'namespace.html?#/appid=' + pageContext.appId"
ng-show="hasCreateNamespacePermission"></apolloentrance> ng-show="hasCreateNamespacePermission"></apolloentrance>
<span class="list-group-item cursor-pointer hover" ng-click="showMasterPermissionTips()"
ng-show="!hasCreateNamespacePermission">
<div class="row icon-text icon-plus-orange">
<p class="btn-title">添加Namespace</p>
</div>
</span>
<apolloentrance apollo-title="'项目权限'" apollo-img-src="'user-manage'" <apolloentrance apollo-title="'项目权限'" apollo-img-src="'user-manage'"
apollo-href="'/app/role.html?#/appid=' + pageContext.appId" apollo-href="'/app/role.html?#/appid=' + pageContext.appId"
...@@ -124,7 +137,8 @@ ...@@ -124,7 +137,8 @@
pre-release-ns="prepareReleaseNamespace" pre-release-ns="prepareReleaseNamespace"
create-item="createItem" edit-item="editItem" create-item="createItem" edit-item="editItem"
pre-delete-item="preDeleteItem" commit-change="commitChange" pre-delete-item="preDeleteItem" commit-change="commitChange"
pre-rollback="preRollback" show-text="showText"></apollonspanel> pre-rollback="preRollback" show-text="showText"
show-no-modify-permission-dialog="showNoModifyPermissionDialog"></apollonspanel>
</div> </div>
<!-- delete modal--> <!-- delete modal-->
...@@ -132,7 +146,16 @@ ...@@ -132,7 +146,16 @@
apollo-detail="'确定要删除配置吗?'" apollo-confirm="deleteItem"></apolloconfirmdialog> apollo-detail="'确定要删除配置吗?'" apollo-confirm="deleteItem"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'releaseNoPermissionDialog'" apollo-title="'发布'" <apolloconfirmdialog apollo-dialog-id="'releaseNoPermissionDialog'" apollo-title="'发布'"
apollo-detail="'您没有发布权限哦~ 请找 ' + masterUsers + ' 分配权限'" apollo-detail="'您没有发布权限哦~ 请找项目管理员 ' + masterUsers + ' 分配发布权限'"
apollo-show-cancel-btn="false"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'modifyNoPermissionDialog'" apollo-title="'申请配置权限'"
apollo-detail="'请找项目管理员 ' + masterUsers + ' 分配编辑或发布权限'"
apollo-show-cancel-btn="false"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'masterNoPermissionDialog'" apollo-title="'申请配置权限'"
apollo-detail="'您不是项目管理员, 只有项目管理员才有添加集群、namespace的权限。
如需管理员权限,请找项目管理员 ' + masterUsers + ' 分配管理员权限'"
apollo-show-cancel-btn="false"></apolloconfirmdialog> apollo-show-cancel-btn="false"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'namespaceLockedDialog'" apollo-title="'编辑受限'" <apolloconfirmdialog apollo-dialog-id="'namespaceLockedDialog'" apollo-title="'编辑受限'"
......
...@@ -43,6 +43,13 @@ ...@@ -43,6 +43,13 @@
</header> </header>
<div class="panel-body"> <div class="panel-body">
<div class="row" ng-show="syncItemStep == 1"> <div class="row" ng-show="syncItemStep == 1">
<div class="alert-info alert">
<strong>Tips:</strong>
<ul>
<li>通过同步配置功能,可以使多个环境、集群间的配置保持一致</li>
<li>需要注意的是,同步完之后需要发布后才会对应用生效</li>
</ul>
</div>
<div class="form-horizontal"> <div class="form-horizontal">
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">同步的Namespace</label> <label class="col-sm-2 control-label">同步的Namespace</label>
......
...@@ -34,6 +34,25 @@ ...@@ -34,6 +34,25 @@
<div class="panel-body"> <div class="panel-body">
<div class="alert alert-info" role="alert" ng-show="type == 'link'">
<strong>Tips:</strong>
<ul>
<li>公共namespace所属的应用通过关联公共namespace来配置公共部分的配置</li>
<li>其它应用可以通过关联公共namespace来覆盖公共部分的配置</li>
<li>如果其它应用不需要覆盖公共部分的配置,那么无需关联公共namespace</li>
</ul>
</div>
<div class="alert alert-info" ng-show="type == 'create'">
<strong>Tips:</strong>
<ul>
<li>
通过创建一个公共的namespace可以实现公共组件的配置,或多个应用共享同一份配置的需求
</li>
<li>创建完公共的namespace且关联到当前应用后,就可以配置公共部分的配置了</li>
<li>如果其它应用需要覆盖公共部分的配置,可以在其它应用那里关联公共的namespace,然后在关联的namespace里面配置需要覆盖的配置即可</li>
<li>如果其它应用不需要覆盖公共部分的配置,那么就不需要在其它应用那里关联公共的namespace</li>
</ul>
</div>
<div class="row text-right" style="padding-right: 20px;"> <div class="row text-right" style="padding-right: 20px;">
<div class="btn-group btn-group-sm" role="group" aria-label="..."> <div class="btn-group btn-group-sm" role="group" aria-label="...">
<button type="button" class="btn btn-default" ng-class="{active:type=='link'}" <button type="button" class="btn btn-default" ng-class="{active:type=='link'}"
...@@ -45,6 +64,7 @@ ...@@ -45,6 +64,7 @@
</div> </div>
</div> </div>
<form class="form-horizontal" name="namespaceForm" valdr-type="AppNamespace" <form class="form-horizontal" name="namespaceForm" valdr-type="AppNamespace"
style="margin-top: 30px;" ng-show="step == 1" ng-submit="createNamespace()"> style="margin-top: 30px;" ng-show="step == 1" ng-submit="createNamespace()">
<div class="form-group"> <div class="form-group">
...@@ -122,7 +142,8 @@ ...@@ -122,7 +142,8 @@
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-3 col-sm-10"> <div class="col-sm-offset-3 col-sm-10">
<button type="submit" class="btn btn-primary" <button type="submit" class="btn btn-primary"
ng-disabled="(type == 'create' && namespaceForm.$invalid) || submitBtnDisabled">提交 ng-disabled="(type == 'create' && namespaceForm.$invalid) || submitBtnDisabled">
提交
</button> </button>
</div> </div>
</div> </div>
......
...@@ -207,5 +207,9 @@ application_module.controller("ConfigBaseInfoController", ...@@ -207,5 +207,9 @@ application_module.controller("ConfigBaseInfoController",
}); });
$scope.showMasterPermissionTips = function () {
$("#masterNoPermissionDialog").modal('show');
}
}]); }]);
...@@ -47,6 +47,8 @@ application_module.controller("ConfigNamespaceController", ...@@ -47,6 +47,8 @@ application_module.controller("ConfigNamespaceController",
$scope.showText = showText; $scope.showText = showText;
$scope.showNoModifyPermissionDialog = showNoModifyPermissionDialog;
$scope.releaseBtnDisabled = false; $scope.releaseBtnDisabled = false;
$scope.rollbackBtnDisabled = false; $scope.rollbackBtnDisabled = false;
$scope.addItemBtnDisabled = false; $scope.addItemBtnDisabled = false;
...@@ -72,8 +74,6 @@ application_module.controller("ConfigNamespaceController", ...@@ -72,8 +74,6 @@ application_module.controller("ConfigNamespaceController",
} }
function refreshNamespaces(viewType) { function refreshNamespaces(viewType) {
if ($rootScope.pageContext.env == '') { if ($rootScope.pageContext.env == '') {
return; return;
...@@ -173,7 +173,6 @@ application_module.controller("ConfigNamespaceController", ...@@ -173,7 +173,6 @@ application_module.controller("ConfigNamespaceController",
$("#rollbackAlertDialog").modal('show'); $("#rollbackAlertDialog").modal('show');
} }
$scope.toRollbackNamespace = {}; $scope.toRollbackNamespace = {};
function preRollback(namespace) { function preRollback(namespace) {
$scope.toRollbackNamespace = namespace; $scope.toRollbackNamespace = namespace;
...@@ -181,7 +180,8 @@ application_module.controller("ConfigNamespaceController", ...@@ -181,7 +180,8 @@ application_module.controller("ConfigNamespaceController",
ReleaseService.findActiveReleases($rootScope.pageContext.appId, ReleaseService.findActiveReleases($rootScope.pageContext.appId,
$rootScope.pageContext.env, $rootScope.pageContext.env,
$rootScope.pageContext.clusterName, $rootScope.pageContext.clusterName,
$scope.toRollbackNamespace.baseInfo.namespaceName, 0, 2) $scope.toRollbackNamespace.baseInfo.namespaceName,
0, 2)
.then(function (result) { .then(function (result) {
if (result.length <= 1) { if (result.length <= 1) {
toastr.error("没有可以回滚的发布历史"); toastr.error("没有可以回滚的发布历史");
...@@ -290,11 +290,13 @@ application_module.controller("ConfigNamespaceController", ...@@ -290,11 +290,13 @@ application_module.controller("ConfigNamespaceController",
if (selectedClusters.length == 0) { if (selectedClusters.length == 0) {
toastr.error("请选择集群"); toastr.error("请选择集群");
} else { return;
}
if (!$scope.item.value) { if (!$scope.item.value) {
$scope.item.value = ""; $scope.item.value = "";
} }
selectedClusters.forEach(function (cluster) {
if ($scope.tableViewOperType == TABLE_VIEW_OPER_TYPE.CREATE) { if ($scope.tableViewOperType == TABLE_VIEW_OPER_TYPE.CREATE) {
//check key unique //check key unique
...@@ -311,31 +313,33 @@ application_module.controller("ConfigNamespaceController", ...@@ -311,31 +313,33 @@ application_module.controller("ConfigNamespaceController",
} }
$scope.addItemBtnDisabled = true; $scope.addItemBtnDisabled = true;
selectedClusters.forEach(function (cluster) {
ConfigService.create_item($rootScope.pageContext.appId, ConfigService.create_item($rootScope.pageContext.appId,
cluster.env, cluster.env,
cluster.name, cluster.name,
toOperationNamespace.baseInfo.namespaceName, toOperationNamespace.baseInfo.namespaceName,
$scope.item).then( $scope.item).then(
function (result) { function (result) {
toastr.success(cluster.env + " , " + $scope.item.key, toastr.success(cluster.env + " , " + $scope.item.key, "添加成功");
"添加成功");
itemModal.modal('hide');
$scope.addItemBtnDisabled = false;
$rootScope.refreshNamespaces(namespace_view_type.TABLE);
}, function (result) { }, function (result) {
$scope.addItemBtnDisabled = false;
toastr.error(AppUtil.errorMsg(result), "添加失败"); toastr.error(AppUtil.errorMsg(result), "添加失败");
}); });
});
$scope.addItemBtnDisabled = false;
itemModal.modal('hide');
$rootScope.refreshNamespaces(namespace_view_type.TABLE);
} else if ($scope.tableViewOperType == TABLE_VIEW_OPER_TYPE.UPDATE) { } else {
if (!$scope.item.comment) { if (!$scope.item.comment) {
$scope.item.comment = ""; $scope.item.comment = "";
} }
ConfigService.update_item($rootScope.pageContext.appId, ConfigService.update_item($rootScope.pageContext.appId,
cluster.env, $rootScope.pageContext.env,
cluster.name, $rootScope.pageContext.clusterName,
toOperationNamespace.baseInfo.namespaceName, toOperationNamespace.baseInfo.namespaceName,
$scope.item).then( $scope.item).then(
function (result) { function (result) {
...@@ -346,8 +350,6 @@ application_module.controller("ConfigNamespaceController", ...@@ -346,8 +350,6 @@ application_module.controller("ConfigNamespaceController",
toastr.error(AppUtil.errorMsg(result), "更新失败"); toastr.error(AppUtil.errorMsg(result), "更新失败");
}); });
} }
});
}
} }
...@@ -362,12 +364,12 @@ application_module.controller("ConfigNamespaceController", ...@@ -362,12 +364,12 @@ application_module.controller("ConfigNamespaceController",
function closeTip(clusterName) { function closeTip(clusterName) {
var hideTip = JSON.parse(localStorage.getItem("hideTip")); var hideTip = JSON.parse(localStorage.getItem("hideTip"));
if (!hideTip){ if (!hideTip) {
hideTip = {}; hideTip = {};
hideTip[$rootScope.pageContext.appId] = {}; hideTip[$rootScope.pageContext.appId] = {};
} }
if (!hideTip[$rootScope.pageContext.appId]){ if (!hideTip[$rootScope.pageContext.appId]) {
hideTip[$rootScope.pageContext.appId] = {}; hideTip[$rootScope.pageContext.appId] = {};
} }
...@@ -384,8 +386,14 @@ application_module.controller("ConfigNamespaceController", ...@@ -384,8 +386,14 @@ application_module.controller("ConfigNamespaceController",
$('#showText').modal('show'); $('#showText').modal('show');
} }
function showNoModifyPermissionDialog() {
$("#modifyNoPermissionDialog").modal('show');
}
$('.config-item-container').removeClass('hide'); $('.config-item-container').removeClass('hide');
new Clipboard('.clipboard'); new Clipboard('.clipboard');
}]); }
]);
...@@ -17,7 +17,8 @@ directive_module.directive('apollonspanel', ...@@ -17,7 +17,8 @@ directive_module.directive('apollonspanel',
editItem: '=', editItem: '=',
preDeleteItem: '=', preDeleteItem: '=',
commitChange: '=', commitChange: '=',
showText: '=' showText: '=',
showNoModifyPermissionDialog: '='
}, },
link: function (scope, element, attrs) { link: function (scope, element, attrs) {
......
<a class="list-group-item" href="{{href}}"> <a class="list-group-item hover" href="{{href}}">
<div class="row icon-text icon-{{imgSrc}}"> <div class="row icon-text icon-{{imgSrc}}">
<p class="btn-title">{{title}}</p> <p class="btn-title">{{title}}</p>
</div> </div>
......
...@@ -57,6 +57,12 @@ ...@@ -57,6 +57,12 @@
<img src="img/sync.png"> <img src="img/sync.png">
同步配置 同步配置
</a> </a>
<a type="button" class="btn btn-danger btn-sm J_tableview_btn"
data-tooltip="tooltip" data-placement="bottom" title="您没有任何配置权限,请申请"
ng-click="showNoModifyPermissionDialog()"
ng-show="!namespace.hasModifyPermission && !namespace.hasReleasePermission">
申请配置权限
</a>
</div> </div>
</div> </div>
</header> </header>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment