Commit 9936e2f2 by zhangle

bugfix: update other cluster's item

parent 15e41ed3
...@@ -72,8 +72,6 @@ application_module.controller("ConfigNamespaceController", ...@@ -72,8 +72,6 @@ application_module.controller("ConfigNamespaceController",
} }
function refreshNamespaces(viewType) { function refreshNamespaces(viewType) {
if ($rootScope.pageContext.env == '') { if ($rootScope.pageContext.env == '') {
return; return;
...@@ -173,7 +171,6 @@ application_module.controller("ConfigNamespaceController", ...@@ -173,7 +171,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 +178,8 @@ application_module.controller("ConfigNamespaceController", ...@@ -181,7 +178,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 +288,13 @@ application_module.controller("ConfigNamespaceController", ...@@ -290,11 +288,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 +311,33 @@ application_module.controller("ConfigNamespaceController", ...@@ -311,31 +311,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), "添加失败");
}); });
});
} else if ($scope.tableViewOperType == TABLE_VIEW_OPER_TYPE.UPDATE) { $scope.addItemBtnDisabled = false;
itemModal.modal('hide');
$rootScope.refreshNamespaces(namespace_view_type.TABLE);
} 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 +348,6 @@ application_module.controller("ConfigNamespaceController", ...@@ -346,8 +348,6 @@ application_module.controller("ConfigNamespaceController",
toastr.error(AppUtil.errorMsg(result), "更新失败"); toastr.error(AppUtil.errorMsg(result), "更新失败");
}); });
} }
});
}
} }
...@@ -362,12 +362,12 @@ application_module.controller("ConfigNamespaceController", ...@@ -362,12 +362,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] = {};
} }
...@@ -387,5 +387,7 @@ application_module.controller("ConfigNamespaceController", ...@@ -387,5 +387,7 @@ application_module.controller("ConfigNamespaceController",
$('.config-item-container').removeClass('hide'); $('.config-item-container').removeClass('hide');
new Clipboard('.clipboard'); new Clipboard('.clipboard');
}]); }
]);
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