Commit 5737e4c1 by lepdou

bugfix cluster default select

parent b3b3a1a1
......@@ -33,7 +33,7 @@
</header>
<div class="panel-body">
<form class="form-horizontal" ng-submit="create()">
<form class="form-horizontal" ng-show="step == 1" ng-submit="create()">
<div class="form-group">
<label class="col-sm-2 control-label">
<apollorequiredfiled></apollorequiredfiled>
......@@ -57,8 +57,9 @@
<div class="col-sm-5">
<table class="table table-hover" style="width: 100px">
<tbody>
<tr style="cursor: pointer" ng-repeat="env in envs">
<td width="10%"><input type="checkbox" ng-click="switchChecked(env)"></td>
<tr style="cursor: pointer" ng-repeat="env in envs" ng-click="toggleEnvCheckedStatus(env)">
<td width="10%"><input type="checkbox" ng-checked="env.checked"
ng-click="switchChecked(env, $event)"></td>
<td width="30%" ng-bind="env.name"></td>
</tr>
</tbody>
......@@ -73,6 +74,10 @@
</div>
</div>
</form>
<div class="row text-center" ng-show="step == 2">
<img src="img/sync-succ.png" style="height: 100px; width: 100px">
<h3>创建成功!</h3>
</div>
</div>
</div>
</div>
......
......@@ -7,6 +7,8 @@ cluster_module.controller('ClusterController',
var params = AppUtil.parseParams($location.$$url);
$scope.appId = params.appid;
$scope.step = 1;
EnvService.find_all_envs().then(function (result) {
$scope.envs = [];
result.forEach(function (env) {
......@@ -19,7 +21,12 @@ cluster_module.controller('ClusterController',
$scope.clusterName = '';
$scope.switchChecked = function (env) {
$scope.switchChecked = function (env, $event) {
env.checked = !env.checked;
$event.stopPropagation();
};
$scope.toggleEnvCheckedStatus = function (env) {
env.checked = !env.checked;
};
......@@ -34,11 +41,12 @@ cluster_module.controller('ClusterController',
appId: $scope.appId
}).then(function (result) {
toastr.success(env.name, "集群创建成功");
$scope.step = 2;
}, function (result) {
toastr.error(AppUtil.errorMsg(result), "集群创建失败");
})
}
})
});
if (noEnvChecked){
toastr.warning("请选择环境");
......
......@@ -131,14 +131,13 @@ directive_module.directive('apolloclusterselector', function ($compile, $window,
defaultCheckedCluster: '=apolloDefaultCheckedCluster'
},
link: function (scope, element, attrs) {
////// load env //////
scope.$watch("defaultCheckedEnv", function (newValue, oldValue) {
refreshClusterList();
});
scope.$watch("defaultCheckedEnv", refreshClusterList);
scope.$watch("defaultCheckedCluster", refreshClusterList);
refreshClusterList();
////// load env //////
function refreshClusterList() {
AppService.load_nav_tree(scope.appId).then(function (result) {
scope.clusters = [];
......@@ -246,7 +245,6 @@ directive_module.directive('apolloentrance', function ($compile, $window) {
href: '=apolloHref'
},
link: function (scope, element, attrs) {
console.log(scope.title);
}
}
});
......
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