Commit 9936e2f2 by zhangle

bugfix: update other cluster's item

parent 15e41ed3
......@@ -72,8 +72,6 @@ application_module.controller("ConfigNamespaceController",
}
function refreshNamespaces(viewType) {
if ($rootScope.pageContext.env == '') {
return;
......@@ -173,7 +171,6 @@ application_module.controller("ConfigNamespaceController",
$("#rollbackAlertDialog").modal('show');
}
$scope.toRollbackNamespace = {};
function preRollback(namespace) {
$scope.toRollbackNamespace = namespace;
......@@ -181,7 +178,8 @@ application_module.controller("ConfigNamespaceController",
ReleaseService.findActiveReleases($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName,
$scope.toRollbackNamespace.baseInfo.namespaceName, 0, 2)
$scope.toRollbackNamespace.baseInfo.namespaceName,
0, 2)
.then(function (result) {
if (result.length <= 1) {
toastr.error("没有可以回滚的发布历史");
......@@ -290,11 +288,13 @@ application_module.controller("ConfigNamespaceController",
if (selectedClusters.length == 0) {
toastr.error("请选择集群");
} else {
return;
}
if (!$scope.item.value) {
$scope.item.value = "";
}
selectedClusters.forEach(function (cluster) {
if ($scope.tableViewOperType == TABLE_VIEW_OPER_TYPE.CREATE) {
//check key unique
......@@ -311,31 +311,33 @@ application_module.controller("ConfigNamespaceController",
}
$scope.addItemBtnDisabled = true;
selectedClusters.forEach(function (cluster) {
ConfigService.create_item($rootScope.pageContext.appId,
cluster.env,
cluster.name,
toOperationNamespace.baseInfo.namespaceName,
$scope.item).then(
function (result) {
toastr.success(cluster.env + " , " + $scope.item.key,
"添加成功");
itemModal.modal('hide');
$scope.addItemBtnDisabled = false;
$rootScope.refreshNamespaces(namespace_view_type.TABLE);
toastr.success(cluster.env + " , " + $scope.item.key, "添加成功");
}, function (result) {
$scope.addItemBtnDisabled = false;
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) {
$scope.item.comment = "";
}
ConfigService.update_item($rootScope.pageContext.appId,
cluster.env,
cluster.name,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName,
toOperationNamespace.baseInfo.namespaceName,
$scope.item).then(
function (result) {
......@@ -346,8 +348,6 @@ application_module.controller("ConfigNamespaceController",
toastr.error(AppUtil.errorMsg(result), "更新失败");
});
}
});
}
}
......@@ -362,12 +362,12 @@ application_module.controller("ConfigNamespaceController",
function closeTip(clusterName) {
var hideTip = JSON.parse(localStorage.getItem("hideTip"));
if (!hideTip){
if (!hideTip) {
hideTip = {};
hideTip[$rootScope.pageContext.appId] = {};
}
if (!hideTip[$rootScope.pageContext.appId]){
if (!hideTip[$rootScope.pageContext.appId]) {
hideTip[$rootScope.pageContext.appId] = {};
}
......@@ -387,5 +387,7 @@ application_module.controller("ConfigNamespaceController",
$('.config-item-container').removeClass('hide');
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