Commit 189c2188 by Jason Song Committed by GitHub

Merge pull request #329 from lepdou/history

判断是否添加重复key的时候,过滤掉已删除并且发布过的配置
parents 9f15c41d 7d90bee5
......@@ -65,6 +65,7 @@ public class NamespaceVO {
public static class ItemVO{
private ItemDTO item;
private boolean isModified;
private boolean isDeleted;
private String oldValue;
private String newValue;
......@@ -76,6 +77,14 @@ public class NamespaceVO {
this.item = item;
}
public boolean isDeleted() {
return isDeleted;
}
public void setDeleted(boolean deleted) {
isDeleted = deleted;
}
public boolean isModified() {
return isModified;
}
......
......@@ -128,7 +128,7 @@ public class NamespaceService {
}
//deleted items
List<NamespaceVO.ItemVO> deletedItems = countDeletedItemNum(items, releaseItems);
List<NamespaceVO.ItemVO> deletedItems = parseDeletedItems(items, releaseItems);
itemVos.addAll(deletedItems);
modifiedItemCnt += deletedItems.size();
......@@ -161,7 +161,7 @@ public class NamespaceService {
namespace.setPublic(isPublic);
}
private List<NamespaceVO.ItemVO> countDeletedItemNum(List<ItemDTO> newItems, Map<String, String> releaseItems) {
private List<NamespaceVO.ItemVO> parseDeletedItems(List<ItemDTO> newItems, Map<String, String> releaseItems) {
Map<String, ItemDTO> newItemMap = BeanUtils.mapByKey("key", newItems);
List<NamespaceVO.ItemVO> deletedItems = new LinkedList<>();
......@@ -170,6 +170,7 @@ public class NamespaceService {
if (newItemMap.get(key) == null) {
NamespaceVO.ItemVO deletedItem = new NamespaceVO.ItemVO();
deletedItem.setDeleted(true);
ItemDTO deletedItemDto = new ItemDTO();
deletedItemDto.setKey(key);
String oldValue = entry.getValue();
......
......@@ -159,7 +159,7 @@
ng-if="config.item.key && config.isModified">
<td width="20%" title="{{config.item.key}}">
<span class="label label-danger"
ng-show="!config.item.lastModifiedBy">deleted</span>
ng-show="config.isDeleted">deleted</span>
<span ng-bind="config.item.key | limitTo: 250"></span>
<span ng-bind="config.item.key.length > 250 ? '...' :''"></span>
</td>
......
......@@ -228,7 +228,7 @@ application_module.controller("ConfigNamespaceController",
//check key unique
var hasRepeatKey = false;
toOperationNamespace.items.forEach(function (item) {
if ($scope.item.key == item.item.key){
if (!item.isDeleted && $scope.item.key == item.item.key){
toastr.error("key=" + $scope.item.key + " 已存在");
hasRepeatKey = true;
return;
......
......@@ -152,7 +152,7 @@
<tbody>
<tr ng-repeat="config in namespace.items" ng-class="{warning:config.isModified}"
ng-if="config.item.key && config.item.lastModifiedBy">
ng-if="config.item.key && !config.isDeleted">
<td width="20%" title="{{config.item.key}}">
<span ng-bind="config.item.key | limitTo: 250"></span>
<span ng-bind="config.item.key.length > 250 ? '...' :''"></span>
......
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