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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
46 deletions
+106
-46
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
+24
-29
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;
...
@@ -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.icon.ConsoleIconFactory
;
import
com.nepxion.discovery.console.desktop.locale.ConsoleLocale
;
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.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.TopologyEntity
;
import
com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntityType
;
import
com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntityType
;
import
com.nepxion.swing.action.JSecurityAction
;
import
com.nepxion.swing.action.JSecurityAction
;
...
@@ -63,10 +64,7 @@ import com.nepxion.swing.textfield.JBasicTextField;
...
@@ -63,10 +64,7 @@ import com.nepxion.swing.textfield.JBasicTextField;
public
class
RouterTopology
extends
AbstractTopology
{
public
class
RouterTopology
extends
AbstractTopology
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
private
int
nodeStartX
=
100
;
private
LocationEntity
nodeLocationEntity
=
new
LocationEntity
(
100
,
150
,
200
,
0
);
private
int
nodeStartY
=
150
;
private
int
nodeHorizontalGap
=
200
;
private
int
nodeVerticalGap
=
0
;
private
TopologyEntity
serviceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
true
);
private
TopologyEntity
serviceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
true
);
...
@@ -197,7 +195,7 @@ public class RouterTopology extends AbstractTopology {
...
@@ -197,7 +195,7 @@ public class RouterTopology extends AbstractTopology {
private
TNode
addNode
(
RouterEntity
routerEntity
,
int
index
)
{
private
TNode
addNode
(
RouterEntity
routerEntity
,
int
index
)
{
String
nodeName
=
getNodeName
(
routerEntity
);
String
nodeName
=
getNodeName
(
routerEntity
);
TNode
node
=
createNode
(
nodeName
,
serviceNodeEntity
,
index
,
nodeStartX
,
nodeStartY
,
nodeHorizontalGap
,
nodeVerticalGap
);
TNode
node
=
createNode
(
nodeName
,
serviceNodeEntity
,
nodeLocationEntity
,
index
);
node
.
setUserObject
(
routerEntity
);
node
.
setUserObject
(
routerEntity
);
dataBox
.
addElement
(
node
);
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;
...
@@ -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.locale.ConsoleLocale
;
import
com.nepxion.discovery.console.desktop.util.UIUtil
;
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.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.TopologyEntity
;
import
com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntityType
;
import
com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntityType
;
import
com.nepxion.swing.action.JSecurityAction
;
import
com.nepxion.swing.action.JSecurityAction
;
...
@@ -74,15 +75,8 @@ import com.nepxion.swing.textfield.number.JNumberTextField;
...
@@ -74,15 +75,8 @@ import com.nepxion.swing.textfield.number.JNumberTextField;
public
class
ServiceTopology
extends
AbstractTopology
{
public
class
ServiceTopology
extends
AbstractTopology
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
private
int
groupStartX
=
120
;
private
LocationEntity
groupLocationEntity
=
new
LocationEntity
(
120
,
200
,
280
,
0
);
private
int
groupStartY
=
200
;
private
LocationEntity
nodeLocationEntity
=
new
LocationEntity
(
0
,
0
,
120
,
100
);
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
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
true
);
private
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
true
);
private
TopologyEntity
serviceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
false
);
private
TopologyEntity
serviceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
false
);
...
@@ -183,7 +177,7 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -183,7 +177,7 @@ public class ServiceTopology extends AbstractTopology {
int
count
=
groupLocationMap
.
size
();
int
count
=
groupLocationMap
.
size
();
String
groupName
=
getGroupName
(
serviceId
,
instances
.
size
(),
null
);
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
.
setGroupType
(
TGroupType
.
ELLIPSE_GROUP_TYPE
.
getType
());
group
.
setUserObject
(
serviceId
);
group
.
setUserObject
(
serviceId
);
...
@@ -199,11 +193,11 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -199,11 +193,11 @@ public class ServiceTopology extends AbstractTopology {
TNode
node
=
null
;
TNode
node
=
null
;
if
(
StringUtils
.
isNotEmpty
(
plugin
))
{
if
(
StringUtils
.
isNotEmpty
(
plugin
))
{
node
=
createNode
(
nodeName
,
serviceNodeEntity
,
i
,
nodeStartX
,
nodeStartY
,
nodeHorizontalGap
,
nodeVerticalGap
);
node
=
createNode
(
nodeName
,
serviceNodeEntity
,
nodeLocationEntity
,
i
);
node
.
putClientProperty
(
"plugin"
,
plugin
);
node
.
putClientProperty
(
"plugin"
,
plugin
);
group
.
putClientProperty
(
"plugin"
,
plugin
);
group
.
putClientProperty
(
"plugin"
,
plugin
);
}
else
{
}
else
{
node
=
createNode
(
nodeName
,
notServiceNodeEntity
,
i
,
nodeStartX
,
nodeStartY
,
nodeHorizontalGap
,
nodeVerticalGap
);
node
=
createNode
(
nodeName
,
notServiceNodeEntity
,
nodeLocationEntity
,
i
);
node
.
putClientProperty
(
"plugin"
,
""
);
node
.
putClientProperty
(
"plugin"
,
""
);
group
.
putClientProperty
(
"plugin"
,
""
);
group
.
putClientProperty
(
"plugin"
,
""
);
}
}
...
@@ -989,15 +983,15 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -989,15 +983,15 @@ public class ServiceTopology extends AbstractTopology {
}
}
public
void
setToUI
()
{
public
void
setToUI
()
{
groupStartXTextField
.
setText
(
group
StartX
+
""
);
groupStartXTextField
.
setText
(
group
LocationEntity
.
getStartX
()
+
""
);
groupStartYTextField
.
setText
(
group
StartY
+
""
);
groupStartYTextField
.
setText
(
group
LocationEntity
.
getStartY
()
+
""
);
groupHorizontalGapTextField
.
setText
(
group
HorizontalGap
+
""
);
groupHorizontalGapTextField
.
setText
(
group
LocationEntity
.
getHorizontalGap
()
+
""
);
groupVerticalGapTextField
.
setText
(
group
VerticalGap
+
""
);
groupVerticalGapTextField
.
setText
(
group
LocationEntity
.
getVerticalGap
()
+
""
);
nodeStartXTextField
.
setText
(
node
StartX
+
""
);
nodeStartXTextField
.
setText
(
node
LocationEntity
.
getStartX
()
+
""
);
nodeStartYTextField
.
setText
(
node
StartY
+
""
);
nodeStartYTextField
.
setText
(
node
LocationEntity
.
getStartY
()
+
""
);
nodeHorizontalGapTextField
.
setText
(
node
HorizontalGap
+
""
);
nodeHorizontalGapTextField
.
setText
(
node
LocationEntity
.
getHorizontalGap
()
+
""
);
nodeVerticalGapTextField
.
setText
(
node
VerticalGap
+
""
);
nodeVerticalGapTextField
.
setText
(
node
LocationEntity
.
getVerticalGap
()
+
""
);
}
}
public
boolean
setFromUI
()
{
public
boolean
setFromUI
()
{
...
@@ -1024,14 +1018,15 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -1024,14 +1018,15 @@ public class ServiceTopology extends AbstractTopology {
return
false
;
return
false
;
}
}
ServiceTopology
.
this
.
groupStartX
=
groupStartX
;
groupLocationEntity
.
setStartX
(
groupStartX
);
ServiceTopology
.
this
.
groupStartY
=
groupStartY
;
groupLocationEntity
.
setStartY
(
groupStartY
);
ServiceTopology
.
this
.
groupHorizontalGap
=
groupHorizontalGap
;
groupLocationEntity
.
setHorizontalGap
(
groupHorizontalGap
);
ServiceTopology
.
this
.
groupVerticalGap
=
groupVerticalGap
;
groupLocationEntity
.
setVerticalGap
(
groupVerticalGap
);
ServiceTopology
.
this
.
nodeStartX
=
nodeStartX
;
ServiceTopology
.
this
.
nodeStartY
=
nodeStartY
;
nodeLocationEntity
.
setStartX
(
nodeStartX
);
ServiceTopology
.
this
.
nodeHorizontalGap
=
nodeHorizontalGap
;
nodeLocationEntity
.
setStartY
(
nodeStartY
);
ServiceTopology
.
this
.
nodeVerticalGap
=
nodeVerticalGap
;
nodeLocationEntity
.
setHorizontalGap
(
nodeHorizontalGap
);
nodeLocationEntity
.
setVerticalGap
(
nodeVerticalGap
);
return
true
;
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 {
...
@@ -231,16 +231,21 @@ public abstract class AbstractTopology extends JPanel {
linkAutoHideRadioButtonMenuItem
.
setSelected
(
hide
);
linkAutoHideRadioButtonMenuItem
.
setSelected
(
hide
);
}
}
protected
TGroup
createGroup
(
String
name
,
TopologyEntity
entity
,
int
index
,
int
startX
,
int
startY
,
int
horizontalGap
,
int
verticalGap
)
{
protected
TGroup
createGroup
(
String
name
,
TopologyEntity
topologyEntity
,
LocationEntity
locationEntity
,
int
index
)
{
String
image
=
entity
.
getImage
();
String
image
=
topologyEntity
.
getImage
();
Point
location
=
new
Point
(
entity
.
isHorizontalPile
()
?
startX
+
index
*
horizontalGap
:
startX
,
entity
.
isHorizontalPile
()
?
startY
:
startY
+
index
*
verticalGap
);
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
);
return
createGroup
(
name
,
image
,
location
);
}
}
protected
TGroup
createGroup
(
String
name
,
TopologyEntity
e
ntity
)
{
protected
TGroup
createGroup
(
String
name
,
TopologyEntity
topologyE
ntity
)
{
String
image
=
e
ntity
.
getImage
();
String
image
=
topologyE
ntity
.
getImage
();
Point
location
=
e
ntity
.
getLocation
();
Point
location
=
topologyE
ntity
.
getLocation
();
return
createGroup
(
name
,
image
,
location
);
return
createGroup
(
name
,
image
,
location
);
}
}
...
@@ -255,16 +260,21 @@ public abstract class AbstractTopology extends JPanel {
...
@@ -255,16 +260,21 @@ public abstract class AbstractTopology extends JPanel {
return
group
;
return
group
;
}
}
protected
TNode
createNode
(
String
name
,
TopologyEntity
entity
,
int
index
,
int
startX
,
int
startY
,
int
horizontalGap
,
int
verticalGap
)
{
protected
TNode
createNode
(
String
name
,
TopologyEntity
topologyEntity
,
LocationEntity
locationEntity
,
int
index
)
{
String
image
=
entity
.
getImage
();
String
image
=
topologyEntity
.
getImage
();
Point
location
=
new
Point
(
entity
.
isHorizontalPile
()
?
startX
+
index
*
horizontalGap
:
startX
,
entity
.
isHorizontalPile
()
?
startY
:
startY
+
index
*
verticalGap
);
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
);
return
createNode
(
name
,
image
,
location
);
}
}
protected
TNode
createNode
(
String
name
,
TopologyEntity
e
ntity
)
{
protected
TNode
createNode
(
String
name
,
TopologyEntity
topologyE
ntity
)
{
String
image
=
e
ntity
.
getImage
();
String
image
=
topologyE
ntity
.
getImage
();
Point
location
=
e
ntity
.
getLocation
();
Point
location
=
topologyE
ntity
.
getLocation
();
return
createNode
(
name
,
image
,
location
);
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