Skip to content

Commit

Permalink
Completed move to drawio implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
autobuild committed Nov 19, 2024
1 parent 2c45e45 commit 6fc351d
Show file tree
Hide file tree
Showing 15 changed files with 300 additions and 198 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log

Notable changes to this project:
Notable changes:

## 2.0.0

### Features

- Completed move to drawio implementation.

## 1.0.30

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "ibmdiagrams"
version = "1.0.30"
version = "2.0.0"
description = "Generate architecture diagrams following IBM Diagram Standard"
readme = "README.md"
requires-python = ">=3.11.0"
Expand Down
12 changes: 12 additions & 0 deletions src/epnode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from ibmdiagrams.ibmcloud.diagram import Diagram
from ibmdiagrams.ibmcloud.groups import IBMCloud, Region, VPC, Zone, Subnet, CloudServices, ResourceGroup, SecurityGroup, ExpandedVirtualServer
from ibmdiagrams.ibmcloud.compute import VirtualServer
from ibmdiagrams.ibmcloud.actors import User
from ibmdiagrams.ibmcloud.network import EndpointGateway, TransitGateway
from ibmdiagrams.ibmcloud.security import KeyProtect, VPNGateway
from ibmdiagrams.ibmcloud.storage import ObjectStorage

with Diagram("zone"):
with Zone("Zone 1", "10.243.0.0/24", direction="TB"):
vsi1 = ExpandedVirtualServer("VSI - Server", "10.243.0.5")
#user = User("Jay", "10.243.0.5")
2 changes: 1 addition & 1 deletion src/ibmdiagrams.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: ibmdiagrams
Version: 1.0.30
Version: 2.0.0
Summary: Generate architecture diagrams following IBM Diagram Standard
Author-email: Jay Warfield <[email protected]>
Maintainer-email: Jay Warfield <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions src/ibmdiagrams.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
LICENSE
README.md
pyproject.toml
src/epnode.py
src/ibmdiagrams/__init__.py
src/ibmdiagrams.egg-info/PKG-INFO
src/ibmdiagrams.egg-info/SOURCES.txt
Expand Down
1 change: 1 addition & 0 deletions src/ibmdiagrams.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
epnode
ibmdiagrams
23 changes: 12 additions & 11 deletions src/ibmdiagrams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,21 @@ def __init__(self,
filename = "",
output = "",
#input = "",
direction = "LR",
icontype = "STATIC"):
#icontype = "STATIC",
direction = "LR"):
self.common = Common()
self.common.setInputPython()
self.diagramid = randomid()
self.name = name

if icontype.upper() == "BUILTIN":
self.common.setBuiltinIcons()
elif icontype.upper() == "CATALOG":
self.common.setCatalogIcons()
elif icontype.upper() == "STATIC":
self.common.setStaticIcons()
else:
self.common.setStaticIcons()
#if icontype.upper() == "BUILTIN":
# self.common.setBuiltinIcons()
#elif icontype.upper() == "CATALOG":
# self.common.setCatalogIcons()
#elif icontype.upper() == "STATIC":
# self.common.setStaticIcons()
#else:
# self.common.setStaticIcons()

if direction.upper() == "LR":
self.common.setDirectionLR()
Expand All @@ -140,7 +140,8 @@ def __init__(self,
if getDiagrams() != None:
filename = "*"

self.properties = _data.getDiagramProperties(name=name, filename=filename, output=output, direction=direction, icontype=icontype)
#self.properties = _data.getDiagramProperties(name=name, filename=filename, output=output, direction=direction, icontype=icontype)
self.properties = _data.getDiagramProperties(name=name, filename=filename, output=output, direction=direction)
#_diagrams[self.diagramid] = self.properties
_data.addDiagram(self.diagramid, self.properties)
_data.updateSequence(self.diagramid)
Expand Down
10 changes: 8 additions & 2 deletions src/ibmdiagrams/ibmbase/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,19 @@ def addDiagram(self, data):
ET.SubElement(self.root, "mxCell", data['cell1'])

def addNode(self, data):
userObject = ET.SubElement(self.root, "UserObject", data['header'] | data['props'])
mxCell = ET.SubElement(userObject, "mxCell", data['cell'])
mxCell = ET.SubElement(self.root, "mxCell", data['cell'])
mxGeometry = ET.SubElement(mxCell, "mxGeometry", data['geo'])
if data['point'] != {}:
mxPoint = ET.SubElement(mxGeometry, "mxPoint", data['point'])
#userObject = ET.SubElement(self.root, "UserObject", data['header'] | data['props'])
#mxCell = ET.SubElement(userObject, "mxCell", data['cell'])
#mxGeometry = ET.SubElement(mxCell, "mxGeometry", data['geo'])

def addValue(self, data):
mxCell = ET.SubElement(self.root, "mxCell", data['cell'])
mxGeometry = ET.SubElement(mxCell, "mxGeometry", data['geo'])
if data['point'] != {}:
mxPoint = ET.SubElement(mxGeometry, "mxPoint", data['point'])

def addLink(self, data):
userObject = ET.SubElement(self.root, "UserObject", data['header'])
Expand Down
3 changes: 2 additions & 1 deletion src/ibmdiagrams/ibmbase/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ def __init__(self):
self.region = Regions.ALL
self.alternate = Alternates.WHITE
self.provider = Providers.IBM
self.iconType = IconTypes.DRAWIO
#self.iconType = IconTypes.BUILTIN
self.iconType = IconTypes.STATIC
#self.iconType = IconTypes.STATIC
#self.iconType = IconTypes.CATALOG
self.labelType = LabelTypes.CUSTOM
self.direction = Directions.LR
Expand Down
2 changes: 1 addition & 1 deletion src/ibmdiagrams/ibmbase/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def buildShape(self, id, properties, x, y, width, height, meta, general):
return node

def buildDrawioShape(self, id, properties, x, y, width, height, meta, general):
node = self.types.buildDrawioShape(id, properties, x, y, width, height, meta,general)
node = self.types.buildDrawioShape(id, properties, x, y, width, height, meta, general)
return node

def buildLink(self, id, label, source, target, startarrow, endarrow, startfill, endfill, linetype, linewidth, linecolor, fontname, fontsize, meta):
Expand Down
Loading

0 comments on commit 6fc351d

Please sign in to comment.