Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
189c2188
Commit
189c2188
authored
Jul 15, 2016
by
Jason Song
Committed by
GitHub
Jul 15, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #329 from lepdou/history
判断是否添加重复key的时候,过滤掉已删除并且发布过的配置
parents
9f15c41d
7d90bee5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
5 deletions
+15
-5
NamespaceVO.java
.../ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java
+9
-0
NamespaceService.java
...rip/framework/apollo/portal/service/NamespaceService.java
+3
-2
config.html
apollo-portal/src/main/resources/static/config.html
+1
-1
ConfigNamespaceController.js
...ic/scripts/controller/config/ConfigNamespaceController.js
+1
-1
namespace-panel.html
...ain/resources/static/views/component/namespace-panel.html
+1
-1
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java
View file @
189c2188
...
...
@@ -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
;
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java
View file @
189c2188
...
...
@@ -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
();
...
...
apollo-portal/src/main/resources/static/config.html
View file @
189c2188
...
...
@@ -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>
...
...
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigNamespaceController.js
View file @
189c2188
...
...
@@ -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
;
...
...
apollo-portal/src/main/resources/static/views/component/namespace-panel.html
View file @
189c2188
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment