Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
08376811
Commit
08376811
authored
Jul 19, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加图形化灰度发布功能
parent
15d085d0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
45 deletions
+105
-45
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/RouterTopology.java
+3
-5
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
+23
-28
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/topology/AbstractTopology.java
+22
-12
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/topology/LocationEntity.java
+57
-0
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/RouterTopology.java
View file @
08376811
...
...
@@ -45,6 +45,7 @@ import com.nepxion.discovery.console.desktop.entity.RouterEntity;
import
com.nepxion.discovery.console.desktop.icon.ConsoleIconFactory
;
import
com.nepxion.discovery.console.desktop.locale.ConsoleLocale
;
import
com.nepxion.discovery.console.desktop.workspace.topology.AbstractTopology
;
import
com.nepxion.discovery.console.desktop.workspace.topology.LocationEntity
;
import
com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntity
;
import
com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntityType
;
import
com.nepxion.swing.action.JSecurityAction
;
...
...
@@ -63,10 +64,7 @@ import com.nepxion.swing.textfield.JBasicTextField;
public
class
RouterTopology
extends
AbstractTopology
{
private
static
final
long
serialVersionUID
=
1L
;
private
int
nodeStartX
=
100
;
private
int
nodeStartY
=
150
;
private
int
nodeHorizontalGap
=
200
;
private
int
nodeVerticalGap
=
0
;
private
LocationEntity
nodeLocationEntity
=
new
LocationEntity
(
100
,
150
,
200
,
0
);
private
TopologyEntity
serviceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
true
);
...
...
@@ -197,7 +195,7 @@ public class RouterTopology extends AbstractTopology {
private
TNode
addNode
(
RouterEntity
routerEntity
,
int
index
)
{
String
nodeName
=
getNodeName
(
routerEntity
);
TNode
node
=
createNode
(
nodeName
,
serviceNodeEntity
,
index
,
nodeStartX
,
nodeStartY
,
nodeHorizontalGap
,
nodeVerticalGap
);
TNode
node
=
createNode
(
nodeName
,
serviceNodeEntity
,
nodeLocationEntity
,
index
);
node
.
setUserObject
(
routerEntity
);
dataBox
.
addElement
(
node
);
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
View file @
08376811
...
...
@@ -49,6 +49,7 @@ import com.nepxion.discovery.console.desktop.icon.ConsoleIconFactory;
import
com.nepxion.discovery.console.desktop.locale.ConsoleLocale
;
import
com.nepxion.discovery.console.desktop.util.UIUtil
;
import
com.nepxion.discovery.console.desktop.workspace.topology.AbstractTopology
;
import
com.nepxion.discovery.console.desktop.workspace.topology.LocationEntity
;
import
com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntity
;
import
com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntityType
;
import
com.nepxion.swing.action.JSecurityAction
;
...
...
@@ -74,15 +75,8 @@ import com.nepxion.swing.textfield.number.JNumberTextField;
public
class
ServiceTopology
extends
AbstractTopology
{
private
static
final
long
serialVersionUID
=
1L
;
private
int
groupStartX
=
120
;
private
int
groupStartY
=
200
;
private
int
groupHorizontalGap
=
280
;
private
int
groupVerticalGap
=
0
;
private
int
nodeStartX
=
0
;
private
int
nodeStartY
=
0
;
private
int
nodeHorizontalGap
=
120
;
private
int
nodeVerticalGap
=
100
;
private
LocationEntity
groupLocationEntity
=
new
LocationEntity
(
120
,
200
,
280
,
0
);
private
LocationEntity
nodeLocationEntity
=
new
LocationEntity
(
0
,
0
,
120
,
100
);
private
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
true
);
private
TopologyEntity
serviceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
false
);
...
...
@@ -183,7 +177,7 @@ public class ServiceTopology extends AbstractTopology {
int
count
=
groupLocationMap
.
size
();
String
groupName
=
getGroupName
(
serviceId
,
instances
.
size
(),
null
);
TGroup
group
=
createGroup
(
groupName
,
serviceGroupEntity
,
count
,
groupStartX
,
groupStartY
,
groupHorizontalGap
,
groupVerticalGap
);
TGroup
group
=
createGroup
(
groupName
,
serviceGroupEntity
,
groupLocationEntity
,
count
);
group
.
setGroupType
(
TGroupType
.
ELLIPSE_GROUP_TYPE
.
getType
());
group
.
setUserObject
(
serviceId
);
...
...
@@ -199,11 +193,11 @@ public class ServiceTopology extends AbstractTopology {
TNode
node
=
null
;
if
(
StringUtils
.
isNotEmpty
(
plugin
))
{
node
=
createNode
(
nodeName
,
serviceNodeEntity
,
i
,
nodeStartX
,
nodeStartY
,
nodeHorizontalGap
,
nodeVerticalGap
);
node
=
createNode
(
nodeName
,
serviceNodeEntity
,
nodeLocationEntity
,
i
);
node
.
putClientProperty
(
"plugin"
,
plugin
);
group
.
putClientProperty
(
"plugin"
,
plugin
);
}
else
{
node
=
createNode
(
nodeName
,
notServiceNodeEntity
,
i
,
nodeStartX
,
nodeStartY
,
nodeHorizontalGap
,
nodeVerticalGap
);
node
=
createNode
(
nodeName
,
notServiceNodeEntity
,
nodeLocationEntity
,
i
);
node
.
putClientProperty
(
"plugin"
,
""
);
group
.
putClientProperty
(
"plugin"
,
""
);
}
...
...
@@ -989,15 +983,15 @@ public class ServiceTopology extends AbstractTopology {
}
public
void
setToUI
()
{
groupStartXTextField
.
setText
(
group
StartX
+
""
);
groupStartYTextField
.
setText
(
group
StartY
+
""
);
groupHorizontalGapTextField
.
setText
(
group
HorizontalGap
+
""
);
groupVerticalGapTextField
.
setText
(
group
VerticalGap
+
""
);
groupStartXTextField
.
setText
(
group
LocationEntity
.
getStartX
()
+
""
);
groupStartYTextField
.
setText
(
group
LocationEntity
.
getStartY
()
+
""
);
groupHorizontalGapTextField
.
setText
(
group
LocationEntity
.
getHorizontalGap
()
+
""
);
groupVerticalGapTextField
.
setText
(
group
LocationEntity
.
getVerticalGap
()
+
""
);
nodeStartXTextField
.
setText
(
node
StartX
+
""
);
nodeStartYTextField
.
setText
(
node
StartY
+
""
);
nodeHorizontalGapTextField
.
setText
(
node
HorizontalGap
+
""
);
nodeVerticalGapTextField
.
setText
(
node
VerticalGap
+
""
);
nodeStartXTextField
.
setText
(
node
LocationEntity
.
getStartX
()
+
""
);
nodeStartYTextField
.
setText
(
node
LocationEntity
.
getStartY
()
+
""
);
nodeHorizontalGapTextField
.
setText
(
node
LocationEntity
.
getHorizontalGap
()
+
""
);
nodeVerticalGapTextField
.
setText
(
node
LocationEntity
.
getVerticalGap
()
+
""
);
}
public
boolean
setFromUI
()
{
...
...
@@ -1024,14 +1018,15 @@ public class ServiceTopology extends AbstractTopology {
return
false
;
}
ServiceTopology
.
this
.
groupStartX
=
groupStartX
;
ServiceTopology
.
this
.
groupStartY
=
groupStartY
;
ServiceTopology
.
this
.
groupHorizontalGap
=
groupHorizontalGap
;
ServiceTopology
.
this
.
groupVerticalGap
=
groupVerticalGap
;
ServiceTopology
.
this
.
nodeStartX
=
nodeStartX
;
ServiceTopology
.
this
.
nodeStartY
=
nodeStartY
;
ServiceTopology
.
this
.
nodeHorizontalGap
=
nodeHorizontalGap
;
ServiceTopology
.
this
.
nodeVerticalGap
=
nodeVerticalGap
;
groupLocationEntity
.
setStartX
(
groupStartX
);
groupLocationEntity
.
setStartY
(
groupStartY
);
groupLocationEntity
.
setHorizontalGap
(
groupHorizontalGap
);
groupLocationEntity
.
setVerticalGap
(
groupVerticalGap
);
nodeLocationEntity
.
setStartX
(
nodeStartX
);
nodeLocationEntity
.
setStartY
(
nodeStartY
);
nodeLocationEntity
.
setHorizontalGap
(
nodeHorizontalGap
);
nodeLocationEntity
.
setVerticalGap
(
nodeVerticalGap
);
return
true
;
}
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/topology/AbstractTopology.java
View file @
08376811
...
...
@@ -231,16 +231,21 @@ public abstract class AbstractTopology extends JPanel {
linkAutoHideRadioButtonMenuItem
.
setSelected
(
hide
);
}
protected
TGroup
createGroup
(
String
name
,
TopologyEntity
entity
,
int
index
,
int
startX
,
int
startY
,
int
horizontalGap
,
int
verticalGap
)
{
String
image
=
entity
.
getImage
();
Point
location
=
new
Point
(
entity
.
isHorizontalPile
()
?
startX
+
index
*
horizontalGap
:
startX
,
entity
.
isHorizontalPile
()
?
startY
:
startY
+
index
*
verticalGap
);
protected
TGroup
createGroup
(
String
name
,
TopologyEntity
topologyEntity
,
LocationEntity
locationEntity
,
int
index
)
{
String
image
=
topologyEntity
.
getImage
();
int
startX
=
locationEntity
.
getStartX
();
int
startY
=
locationEntity
.
getStartY
();
int
horizontalGap
=
locationEntity
.
getHorizontalGap
();
int
verticalGap
=
locationEntity
.
getVerticalGap
();
Point
location
=
new
Point
(
topologyEntity
.
isHorizontalPile
()
?
startX
+
index
*
horizontalGap
:
startX
,
topologyEntity
.
isHorizontalPile
()
?
startY
:
startY
+
index
*
verticalGap
);
return
createGroup
(
name
,
image
,
location
);
}
protected
TGroup
createGroup
(
String
name
,
TopologyEntity
e
ntity
)
{
String
image
=
e
ntity
.
getImage
();
Point
location
=
e
ntity
.
getLocation
();
protected
TGroup
createGroup
(
String
name
,
TopologyEntity
topologyE
ntity
)
{
String
image
=
topologyE
ntity
.
getImage
();
Point
location
=
topologyE
ntity
.
getLocation
();
return
createGroup
(
name
,
image
,
location
);
}
...
...
@@ -255,16 +260,21 @@ public abstract class AbstractTopology extends JPanel {
return
group
;
}
protected
TNode
createNode
(
String
name
,
TopologyEntity
entity
,
int
index
,
int
startX
,
int
startY
,
int
horizontalGap
,
int
verticalGap
)
{
String
image
=
entity
.
getImage
();
Point
location
=
new
Point
(
entity
.
isHorizontalPile
()
?
startX
+
index
*
horizontalGap
:
startX
,
entity
.
isHorizontalPile
()
?
startY
:
startY
+
index
*
verticalGap
);
protected
TNode
createNode
(
String
name
,
TopologyEntity
topologyEntity
,
LocationEntity
locationEntity
,
int
index
)
{
String
image
=
topologyEntity
.
getImage
();
int
startX
=
locationEntity
.
getStartX
();
int
startY
=
locationEntity
.
getStartY
();
int
horizontalGap
=
locationEntity
.
getHorizontalGap
();
int
verticalGap
=
locationEntity
.
getVerticalGap
();
Point
location
=
new
Point
(
topologyEntity
.
isHorizontalPile
()
?
startX
+
index
*
horizontalGap
:
startX
,
topologyEntity
.
isHorizontalPile
()
?
startY
:
startY
+
index
*
verticalGap
);
return
createNode
(
name
,
image
,
location
);
}
protected
TNode
createNode
(
String
name
,
TopologyEntity
e
ntity
)
{
String
image
=
e
ntity
.
getImage
();
Point
location
=
e
ntity
.
getLocation
();
protected
TNode
createNode
(
String
name
,
TopologyEntity
topologyE
ntity
)
{
String
image
=
topologyE
ntity
.
getImage
();
Point
location
=
topologyE
ntity
.
getLocation
();
return
createNode
(
name
,
image
,
location
);
}
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/topology/LocationEntity.java
0 → 100644
View file @
08376811
package
com
.
nepxion
.
discovery
.
console
.
desktop
.
workspace
.
topology
;
/**
* <p>Title: Nepxion Discovery</p>
* <p>Description: Nepxion Discovery</p>
* <p>Copyright: Copyright (c) 2017-2050</p>
* <p>Company: Nepxion</p>
* @author Haojun Ren
* @version 1.0
*/
public
class
LocationEntity
{
private
int
startX
;
private
int
startY
;
private
int
horizontalGap
;
private
int
verticalGap
;
public
LocationEntity
(
int
startX
,
int
startY
,
int
horizontalGap
,
int
verticalGap
)
{
this
.
startX
=
startX
;
this
.
startY
=
startY
;
this
.
horizontalGap
=
horizontalGap
;
this
.
verticalGap
=
verticalGap
;
}
public
int
getStartX
()
{
return
startX
;
}
public
void
setStartX
(
int
startX
)
{
this
.
startX
=
startX
;
}
public
int
getStartY
()
{
return
startY
;
}
public
void
setStartY
(
int
startY
)
{
this
.
startY
=
startY
;
}
public
int
getHorizontalGap
()
{
return
horizontalGap
;
}
public
void
setHorizontalGap
(
int
horizontalGap
)
{
this
.
horizontalGap
=
horizontalGap
;
}
public
int
getVerticalGap
()
{
return
verticalGap
;
}
public
void
setVerticalGap
(
int
verticalGap
)
{
this
.
verticalGap
=
verticalGap
;
}
}
\ No newline at end of file
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