Commit 5d404bd9 by lepdou

bugfix when add item value is null

parent 8bc7b70f
......@@ -8,6 +8,7 @@ import com.ctrip.framework.apollo.common.utils.ExceptionUtils;
import com.ctrip.framework.apollo.core.dto.ItemDTO;
import com.ctrip.framework.apollo.core.dto.NamespaceDTO;
import com.ctrip.framework.apollo.core.dto.ReleaseDTO;
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import com.ctrip.framework.apollo.core.enums.Env;
import com.ctrip.framework.apollo.core.utils.StringUtils;
import com.ctrip.framework.apollo.portal.api.AdminServiceAPI;
......@@ -93,14 +94,7 @@ public class NamespaceService {
NamespaceVO namespaceVO = new NamespaceVO();
namespaceVO.setNamespace(namespace);
//先从当前appId下面找,包含私有的和公共的
AppNamespace appNamespace = appNamespaceService.findByAppIdAndName(appId, namespace.getNamespaceName());
//再从公共的app namespace里面找
if (appNamespace == null) {
appNamespace = appNamespaceService.findPublicAppNamespace(namespace.getNamespaceName());
}
namespaceVO.setFormat(appNamespace.getFormat());
namespaceVO.setFormat(getNamespaceFormat(namespace));
List<NamespaceVO.ItemVO> itemVos = new LinkedList<>();
namespaceVO.setItems(itemVos);
......@@ -145,6 +139,21 @@ public class NamespaceService {
return namespaceVO;
}
private String getNamespaceFormat(NamespaceDTO namespace){
//先从当前appId下面找,包含私有的和公共的
AppNamespace appNamespace = appNamespaceService.findByAppIdAndName(namespace.getAppId(), namespace.getNamespaceName());
//再从公共的app namespace里面找
if (appNamespace == null) {
appNamespace = appNamespaceService.findPublicAppNamespace(namespace.getNamespaceName());
}
if (appNamespace == null){
return ConfigFileFormat.Properties.getValue();
}else {
return appNamespace.getFormat();
}
}
private List<NamespaceVO.ItemVO> countDeletedItemNum(List<ItemDTO> newItems, Map<String, String> releaseItems) {
Map<String, ItemDTO> newItemMap = BeanUtils.mapByKey("key", newItems);
......
......@@ -220,6 +220,9 @@ application_module.controller("ConfigNamespaceController",
if (selectedClusters.length == 0) {
toastr.error("请选择集群");
} else {
if (!$scope.item.value) {
$scope.item.value = "";
}
selectedClusters.forEach(function (cluster) {
if ($scope.tableViewOperType == TABLE_VIEW_OPER_TYPE.CREATE) {
......@@ -238,9 +241,7 @@ application_module.controller("ConfigNamespaceController",
});
} else if ($scope.tableViewOperType == TABLE_VIEW_OPER_TYPE.UPDATE) {
if (!$scope.item.value) {
$scope.item.value = "";
}
if (!$scope.item.comment) {
$scope.item.comment = "";
}
......
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