pyegeria 5.3.3.13.dev4__py3-none-any.whl → 5.3.3.14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. pyegeria/.DS_Store +0 -0
  2. pyegeria/commands/.DS_Store +0 -0
  3. pyegeria/commands/__pycache__/__init__.cpython-312.pyc +0 -0
  4. pyegeria/commands/__pycache__/server_status_widget.cpython-312-pytest-7.4.4.pyc +0 -0
  5. pyegeria/commands/cat/__pycache__/__init__.cpython-312.pyc +0 -0
  6. pyegeria/commands/cat/__pycache__/get_asset_graph.cpython-312.pyc +0 -0
  7. pyegeria/commands/cat/__pycache__/get_collection.cpython-312.pyc +0 -0
  8. pyegeria/commands/cat/__pycache__/get_project_dependencies.cpython-312.pyc +0 -0
  9. pyegeria/commands/cat/__pycache__/get_project_structure.cpython-312.pyc +0 -0
  10. pyegeria/commands/cat/__pycache__/get_tech_type_elements.cpython-312.pyc +0 -0
  11. pyegeria/commands/cat/__pycache__/glossary_actions.cpython-312.pyc +0 -0
  12. pyegeria/commands/cat/__pycache__/list_assets.cpython-312.pyc +0 -0
  13. pyegeria/commands/cat/__pycache__/list_cert_types.cpython-312.pyc +0 -0
  14. pyegeria/commands/cat/__pycache__/list_collections.cpython-312.pyc +0 -0
  15. pyegeria/commands/cat/__pycache__/list_deployed_catalogs.cpython-312.pyc +0 -0
  16. pyegeria/commands/cat/__pycache__/list_deployed_database_schemas.cpython-312.pyc +0 -0
  17. pyegeria/commands/cat/__pycache__/list_deployed_databases.cpython-312.pyc +0 -0
  18. pyegeria/commands/cat/__pycache__/list_glossaries.cpython-312.pyc +0 -0
  19. pyegeria/commands/cat/__pycache__/list_projects.cpython-312.pyc +0 -0
  20. pyegeria/commands/cat/__pycache__/list_servers_deployed_imp.cpython-312.pyc +0 -0
  21. pyegeria/commands/cat/__pycache__/list_tech_type_elements.cpython-312.pyc +0 -0
  22. pyegeria/commands/cat/__pycache__/list_tech_types.cpython-312.pyc +0 -0
  23. pyegeria/commands/cat/__pycache__/list_terms.cpython-312.pyc +0 -0
  24. pyegeria/commands/cat/__pycache__/list_todos.cpython-312.pyc +0 -0
  25. pyegeria/commands/cat/__pycache__/list_user_ids.cpython-312.pyc +0 -0
  26. pyegeria/commands/cat/link-check.py +185 -0
  27. pyegeria/commands/cli/__pycache__/__init__.cpython-312.pyc +0 -0
  28. pyegeria/commands/cli/__pycache__/egeria_login_tui.cpython-312.pyc +0 -0
  29. pyegeria/commands/cli/__pycache__/egeria_ops.cpython-312.pyc +0 -0
  30. pyegeria/commands/cli/__pycache__/ops_config.cpython-312.pyc +0 -0
  31. pyegeria/commands/doc/.DS_Store +0 -0
  32. pyegeria/commands/doc/Visual Command Reference/.DS_Store +0 -0
  33. pyegeria/commands/doc/Visual Command Reference/cat/.DS_Store +0 -0
  34. pyegeria/commands/doc/Visual Command Reference/cat/show/.DS_Store +0 -0
  35. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/.DS_Store +0 -0
  36. pyegeria/commands/doc/glossary/.DS_Store +0 -0
  37. pyegeria/commands/doc/glossary/images/.DS_Store +0 -0
  38. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/.DS_Store +0 -0
  39. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/.DS_Store +0 -0
  40. pyegeria/commands/my/__pycache__/__init__.cpython-312.pyc +0 -0
  41. pyegeria/commands/my/__pycache__/list_my_profile.cpython-312.pyc +0 -0
  42. pyegeria/commands/my/__pycache__/list_my_roles.cpython-312.pyc +0 -0
  43. pyegeria/commands/my/__pycache__/monitor_my_todos.cpython-312.pyc +0 -0
  44. pyegeria/commands/my/__pycache__/monitor_open_todos.cpython-312.pyc +0 -0
  45. pyegeria/commands/my/__pycache__/todo_actions.cpython-312.pyc +0 -0
  46. pyegeria/commands/ops/__pycache__/__init__.cpython-312.pyc +0 -0
  47. pyegeria/commands/ops/__pycache__/gov_server_actions.cpython-312.pyc +0 -0
  48. pyegeria/commands/ops/__pycache__/list_archives.cpython-312.pyc +0 -0
  49. pyegeria/commands/ops/__pycache__/list_catalog_targets.cpython-312.pyc +0 -0
  50. pyegeria/commands/ops/__pycache__/load_archive.cpython-312.pyc +0 -0
  51. pyegeria/commands/ops/__pycache__/monitor_engine_activity.cpython-312.pyc +0 -0
  52. pyegeria/commands/ops/__pycache__/monitor_engine_activity_c.cpython-312.pyc +0 -0
  53. pyegeria/commands/ops/__pycache__/monitor_gov_eng_status.cpython-312.pyc +0 -0
  54. pyegeria/commands/ops/__pycache__/monitor_integ_daemon_status.cpython-312.pyc +0 -0
  55. pyegeria/commands/ops/__pycache__/monitor_platform_status.cpython-312.pyc +0 -0
  56. pyegeria/commands/ops/__pycache__/monitor_server_startup.cpython-312.pyc +0 -0
  57. pyegeria/commands/ops/__pycache__/monitor_server_status.cpython-312.pyc +0 -0
  58. pyegeria/commands/ops/__pycache__/refresh_integration_daemon.cpython-312.pyc +0 -0
  59. pyegeria/commands/ops/__pycache__/restart_integration_daemon.cpython-312.pyc +0 -0
  60. pyegeria/commands/ops/__pycache__/table_integ_daemon_status.cpython-312.pyc +0 -0
  61. pyegeria/commands/tech/.DS_Store +0 -0
  62. pyegeria/commands/tech/__pycache__/__init__.cpython-312.pyc +0 -0
  63. pyegeria/commands/tech/__pycache__/get_element_info.cpython-312.pyc +0 -0
  64. pyegeria/commands/tech/__pycache__/get_guid_info.cpython-312.pyc +0 -0
  65. pyegeria/commands/tech/__pycache__/get_tech_details.cpython-312.pyc +0 -0
  66. pyegeria/commands/tech/__pycache__/get_tech_type_template.cpython-312.pyc +0 -0
  67. pyegeria/commands/tech/__pycache__/list_anchored_elements.cpython-312.pyc +0 -0
  68. pyegeria/commands/tech/__pycache__/list_asset_types.cpython-312.pyc +0 -0
  69. pyegeria/commands/tech/__pycache__/list_elements_by_property_value.cpython-312.pyc +0 -0
  70. pyegeria/commands/tech/__pycache__/list_elements_for_classification.cpython-312.pyc +0 -0
  71. pyegeria/commands/tech/__pycache__/list_gov_action_processes.cpython-312.pyc +0 -0
  72. pyegeria/commands/tech/__pycache__/list_registered_services.cpython-312.pyc +0 -0
  73. pyegeria/commands/tech/__pycache__/list_related_specification.cpython-312.pyc +0 -0
  74. pyegeria/commands/tech/__pycache__/list_relationship_types.cpython-312.pyc +0 -0
  75. pyegeria/commands/tech/__pycache__/list_relationships.cpython-312.pyc +0 -0
  76. pyegeria/commands/tech/__pycache__/list_tech_templates.cpython-312.pyc +0 -0
  77. pyegeria/commands/tech/__pycache__/list_valid_metadata_values.cpython-312.pyc +0 -0
  78. pyegeria/commands/tech/list_information_supply_chains.py +1 -1
  79. pyegeria/commands/tech/list_solution_blueprints2.py +21 -10
  80. pyegeria/commands/tech/work/mermaid_graphs/Automated Manufacturing Control.html +121 -0
  81. pyegeria/commands/tech/work/mermaid_graphs/Clinical Trial Management Solution Blueprint.html +213 -0
  82. pyegeria/commands/tech/work/mermaid_graphs/Clinical Trial Subject Onboarding.html +28 -21
  83. pyegeria/commands/tech/work/mermaid_graphs/Clinical Trial Treatment Validation.html +31 -24
  84. pyegeria/commands/tech/work/mermaid_graphs/Employee Expense Payment.html +17 -10
  85. pyegeria/commands/tech/work/mermaid_graphs/Employee Management Solution Blueprint.html +124 -0
  86. pyegeria/commands/tech/work/mermaid_graphs/Hazardous Material Management Solution Blueprint.html +124 -0
  87. pyegeria/commands/tech/work/mermaid_graphs/Inventory Management.html +124 -0
  88. pyegeria/commands/tech/work/mermaid_graphs/New Drug Product Information Distribution.html +16 -9
  89. pyegeria/commands/tech/work/mermaid_graphs/New Employee Onboarding.html +16 -9
  90. pyegeria/commands/tech/work/mermaid_graphs/Personalized Medicine Order Fulfillment Solution Blueprint.html +124 -0
  91. pyegeria/commands/tech/work/mermaid_graphs/Personalized Treatment Ordering.html +17 -10
  92. pyegeria/commands/tech/work/mermaid_graphs/Physical Inventory Tracking.html +20 -13
  93. pyegeria/commands/tech/work/mermaid_graphs/Sustainability Reporting Solution Blueprint.html +149 -0
  94. pyegeria/commands/tech/work/mermaid_graphs/Sustainability Reporting.html +16 -9
  95. pyegeria/commands/tech/work/mermaid_graphs/{{displayName}}.html +15 -9
  96. pyegeria/mermaid_utilities.py +16 -8
  97. {pyegeria-5.3.3.13.dev4.dist-info → pyegeria-5.3.3.14.dist-info}/METADATA +1 -1
  98. {pyegeria-5.3.3.13.dev4.dist-info → pyegeria-5.3.3.14.dist-info}/RECORD +101 -17
  99. {pyegeria-5.3.3.13.dev4.dist-info → pyegeria-5.3.3.14.dist-info}/entry_points.txt +1 -0
  100. {pyegeria-5.3.3.13.dev4.dist-info → pyegeria-5.3.3.14.dist-info}/LICENSE +0 -0
  101. {pyegeria-5.3.3.13.dev4.dist-info → pyegeria-5.3.3.14.dist-info}/WHEEL +0 -0
pyegeria/.DS_Store ADDED
Binary file
Binary file
@@ -0,0 +1,185 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ List certification types
7
+
8
+
9
+ A simple display for certification types
10
+ """
11
+ import argparse
12
+ import os
13
+ import sys
14
+ import time
15
+ import json
16
+
17
+ from rich import box
18
+ from rich.console import Console
19
+ from rich.prompt import Prompt
20
+ from rich.markdown import Markdown
21
+ from rich.table import Table
22
+ from rich.text import Text
23
+
24
+ from pyegeria import (
25
+ InvalidParameterException,
26
+ PropertyServerException,
27
+ UserNotAuthorizedException,
28
+ print_exception_response,
29
+ AssetCatalog,
30
+ ClassificationManager,
31
+ )
32
+
33
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
34
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
35
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
36
+ EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "view-server")
37
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
38
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
39
+ )
40
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
41
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
42
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
43
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
44
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
45
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
46
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
47
+
48
+
49
+ disable_ssl_warnings = True
50
+
51
+
52
+ def display_certifications(
53
+ search_string: str,
54
+ server: str,
55
+ url: str,
56
+ username: str,
57
+ user_password: str,
58
+ time_out: int = 60,
59
+ jupyter: bool = EGERIA_JUPYTER,
60
+ width: int = EGERIA_WIDTH,
61
+ ):
62
+ console = Console(width=width, force_terminal=not jupyter, soft_wrap=True)
63
+ if (search_string is None) or ((len(search_string) < 3)) and (search_string != "*"):
64
+ raise ValueError(
65
+ "Invalid Search String - must be greater than four characters long"
66
+ )
67
+ g_client = ClassificationManager(
68
+ server, url, user_id=username, user_pwd=user_password
69
+ )
70
+ token = g_client.create_egeria_bearer_token(username, user_password)
71
+
72
+ def generate_table(search_string: str = None) -> Table:
73
+ """Make a new table."""
74
+ table = Table(
75
+ title=f"Certifications Types @ {time.asctime()}",
76
+ header_style="white on dark_blue",
77
+ style="bold white on black",
78
+ row_styles=["bold white on black"],
79
+ title_style="bold white on black",
80
+ caption_style="white on black",
81
+ show_lines=True,
82
+ box=box.ROUNDED,
83
+ caption=f"View Server '{server}' @ Platform - {url}",
84
+ expand=True,
85
+ )
86
+ table.add_column("Title", max_width=15)
87
+ table.add_column("summary")
88
+ table.add_column("domainID")
89
+ table.add_column("Unique Name", width=38)
90
+ table.add_column("Scope", width=38)
91
+ # table.add_column("Qualified Name",max_width=15)
92
+ table.add_column("Description",width=38)
93
+ table.add_column("Details")
94
+
95
+
96
+ certs = g_client.get_elements(search_string, page_size=100, time_out=time_out)
97
+ if type(certs) is str:
98
+ return table
99
+
100
+ for element in certs:
101
+ properties = element["properties"]
102
+ summary = properties.get("summary", "---")
103
+ domain = properties.get("domainIdentifier", "---")
104
+ unique_name = properties.get("qualifiedName", "---")
105
+ scope = properties.get("scope", "---")
106
+ description = properties.get("description", "---")
107
+ details = properties.get("details", "---")
108
+ title = properties.get("title", "---")
109
+ cert_guid = element["elementHeader"]["guid"]
110
+
111
+ related = g_client.get_related_elements(cert_guid)
112
+ if (len(related) > 0) and (type(related) is list):
113
+ rel_md = ""
114
+ for rel in related:
115
+ rel_type = rel["relationshipHeader"]["type"]["typeName"]
116
+ rel_element_props = rel["relatedElement"]["properties"]
117
+ rel_el_md = f"* Rel Type: {rel_type}\n"
118
+ for key in rel_element_props.keys():
119
+ rel_el_md += f"* {key}: {rel_element_props[key]}\n"
120
+ rel_md += f"----\n{rel_el_md}\n"
121
+ else:
122
+ rel_md = "---"
123
+
124
+
125
+ unique_name = "Visit my [link=https://www.willmcgugan.com]blog[/link]!"
126
+ scope = Text("[link=https://egeria-project.org]Egeria[/link]")
127
+ description = Markdown('[egeria]("https://egeria-project.org")')
128
+ details = "https://pdr-associates.com"
129
+ table.add_row(
130
+ title, summary, domain, unique_name, scope, description, details
131
+ )
132
+
133
+ g_client.close_session()
134
+
135
+ return table
136
+
137
+ try:
138
+ # with Live(generate_table(), refresh_per_second=4, screen=True) as live:
139
+ # while True:
140
+ # time.sleep(2)
141
+ # live.update(generate_table())
142
+
143
+ with console.pager(styles=True):
144
+ console.print(generate_table(search_string), soft_wrap=True)
145
+
146
+ except (
147
+ InvalidParameterException,
148
+ PropertyServerException,
149
+ UserNotAuthorizedException,
150
+ ) as e:
151
+ console.print_exception()
152
+ sys.exit(1)
153
+
154
+ except ValueError as e:
155
+ console.print(
156
+ f"\n\n====> Invalid Search String - must be greater than four characters long"
157
+ )
158
+ sys.exit(1)
159
+
160
+
161
+ def main():
162
+ parser = argparse.ArgumentParser()
163
+ parser.add_argument("--server", help="Name of the server to display status for")
164
+ parser.add_argument("--url", help="URL Platform to connect to")
165
+ parser.add_argument("--userid", help="User Id")
166
+ parser.add_argument("--password", help="User Password")
167
+ parser.add_argument("--time_out", help="Time Out")
168
+
169
+ args = parser.parse_args()
170
+
171
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
172
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
173
+ userid = args.userid if args.userid is not None else EGERIA_USER
174
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
175
+ time_out = args.time_out if args.time_out is not None else 60
176
+ try:
177
+ # search_string = Prompt.ask("Enter an asset search string:", default="*")
178
+ search_string = "CertificationType"
179
+ display_certifications(search_string, server, url, userid, user_pass, time_out)
180
+ except KeyboardInterrupt:
181
+ pass
182
+
183
+
184
+ if __name__ == "__main__":
185
+ main()
Binary file
Binary file
Binary file
@@ -104,7 +104,7 @@ def supply_chain_viewer(
104
104
  sc_mermaid_link = f"file://:{link}"
105
105
  # print("Visit my [link=https://www.willmcgugan.com]blog[/link]!")
106
106
  # sc_scope = Text(f"{sc_scope}\n\t\t/\n{sc_mermaid_link}")
107
- sc_scope = Text(f"{sc_scope}\n\t\t/\n[link={sc_mermaid_link}]{sc_mermaid_link}[/link]!", style="underline")
107
+ sc_scope = f"{sc_scope}\n\t\t/\n![{sc_mermaid_link}]({sc_mermaid_link})"
108
108
  # sc_scope.stylize("link =" + sc_mermaid_link)
109
109
 
110
110
  table.add_row(sc_name, sc_unique_name, sc_purpose_str, sc_scope, sc_desc)
@@ -19,12 +19,14 @@ from rich.prompt import Prompt
19
19
  from rich.table import Table
20
20
  from rich.text import Text
21
21
  from rich.tree import Tree
22
+
23
+ from pyegeria.mermaid_utilities import EGERIA_MERMAID_FOLDER
22
24
  from pyegeria.solution_architect_omvs import SolutionArchitect
23
25
  from pyegeria import (
24
26
  ProjectManager,
25
27
  UserNotAuthorizedException,
26
28
  PropertyServerException,
27
- InvalidParameterException,
29
+ InvalidParameterException, save_mermaid_html,
28
30
  )
29
31
 
30
32
  from pyegeria._exceptions import (
@@ -46,7 +48,7 @@ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
46
48
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
47
49
  EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
48
50
  EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "150"))
49
-
51
+ EGERIA_MERMAID_FOLDER = os.environ.get("EGERIA_MERMAID_FOLDER", "work/mermaid_graphs")
50
52
 
51
53
  def blueprint_list(
52
54
  search_string: str,
@@ -74,10 +76,10 @@ def blueprint_list(
74
76
  caption=f"View Server '{server_name}' @ Platform - {platform_url}",
75
77
  expand=True,
76
78
  )
77
- table.add_column("Blueprint Name")
78
- table.add_column("Qualified Name \n/\n GUID\n/\nVersion", width=38, no_wrap=False)
79
- table.add_column("Description")
80
- table.add_column("Solution Components")
79
+ table.add_column("Blueprint Name / Diagram Link", justify="center")
80
+ table.add_column("Qualified Name / GUID / Version", justify="center", width=38, no_wrap=False)
81
+ table.add_column("Description", justify="center")
82
+ table.add_column("Solution Components", justify="center")
81
83
 
82
84
  blueprints = client.find_solution_blueprints(search_string)
83
85
  if isinstance(blueprints, list) is False:
@@ -89,10 +91,15 @@ def blueprint_list(
89
91
  bp_guid = bp["elementHeader"]["guid"]
90
92
  bp_desc = bp["properties"].get("description",'---')
91
93
  bp_unique_name = f"{bp_qname}\n\n\t\t/\n\n{bp_guid}"
92
- bp_mermaid = bp.get("mermaid",'---')
94
+ bp_mermaid = bp.get("mermaidGraph",'---')
95
+ if bp_mermaid != '---':
96
+ link = save_mermaid_html(bp_name, bp_mermaid, EGERIA_MERMAID_FOLDER)
97
+ bp_mermaid = f"![{bp_name}]({link})"
98
+ bp_mermaid_label = f"{bp_name}\n\n\t\t/\n\n{bp_mermaid}"
93
99
 
94
100
  bp_components = bp.get("solutionComponents",[])
95
101
  comp_md=""
102
+ first_comp = True
96
103
  for component in bp_components:
97
104
  comp = component.get("solutionComponent","")
98
105
  if isinstance(comp,dict) is False:
@@ -102,6 +109,7 @@ def blueprint_list(
102
109
  comp_description = comp_props.get("description",'---')
103
110
  comp_planned = comp_props['extendedProperties'].get("plannedDeployedImplementationType",'---')
104
111
  comp_type = comp_props.get('solutionComponentType','---')
112
+
105
113
  comp_actors = comp_props.get('actors', [])
106
114
  comp_actors_list = ""
107
115
  for actor in comp_actors:
@@ -111,13 +119,16 @@ def blueprint_list(
111
119
  for prop in comp_actor_props.keys():
112
120
  comp_actor_props_md += f"* {prop}: {comp_actor_props[prop]}\n"
113
121
  comp_actors_list += comp_actor_props_md
114
-
122
+ if first_comp:
123
+ first_comp = False
124
+ else:
125
+ comp_md += "\n\n---\n\n"
115
126
  comp_md = f"Solution Component {comp_name}\n\n"
116
127
  comp_md += f"* Description: {comp_description}\n"
117
128
  comp_md += f"* Planned Deployment: {comp_planned}\n"
118
- comp_md += f"* Actors: {comp_actors_list}\n---\n"
129
+ comp_md += f"* Actors: {comp_actors_list}\n"
119
130
  comp_out = Markdown(comp_md)
120
- table.add_row(bp_name, bp_unique_name, bp_desc, comp_out)
131
+ table.add_row(bp_mermaid_label, bp_unique_name, bp_desc, comp_out)
121
132
 
122
133
  return table
123
134
 
@@ -0,0 +1,121 @@
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <style type="text/css">
6
+ #mySvgId {
7
+ width: 100%;
8
+ height: 600px;
9
+ overflow: scroll;
10
+ border: 2px solid #ccc;
11
+ position: relative;
12
+ margin-bottom: 10px;
13
+ }
14
+ svg {
15
+ cursor: grab;
16
+ }
17
+
18
+ </style>
19
+ </head>
20
+
21
+ <title>Component for Solution Blueprint - Automated Manufacturing Control </title>
22
+ <h3 style="text-align: center;">Component for Solution Blueprint - Automated Manufacturing Control </h3>
23
+ GUID : 8a222c5d-b206-454f-b861-2b803cfe3cbd
24
+
25
+
26
+ <body>
27
+
28
+ <div id="graphDiv"></div>
29
+ <script src="https://bumbu.me/svg-pan-zoom/dist/svg-pan-zoom.min.js"></script>
30
+ <script type="module">
31
+ import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
32
+
33
+ mermaid.initialize({startOnLoad: false});
34
+ await mermaid.run({
35
+ querySelector: '.mermaid',
36
+ postRenderCallback: (id) => {
37
+ const container = document.getElementById("diagram-container");
38
+ const svgElement = container.querySelector("svg");
39
+
40
+ // Initialize Panzoom
41
+ const panzoomInstance = Panzoom(svgElement, {
42
+ maxScale: 5,
43
+ minScale: 0.5,
44
+ step: 0.1,
45
+ });
46
+
47
+ // Add mouse wheel zoom
48
+ container.addEventListener("wheel", (event) => {
49
+ panzoomInstance.zoomWithWheel(event);
50
+ });
51
+ }
52
+ });
53
+
54
+
55
+ const drawDiagram = async function () {
56
+ const element = document.querySelector('#graphDiv');
57
+ const graphDefinition = `
58
+ flowchart TD
59
+ %%{init: {"flowchart": {"htmlLabels": false}} }%%
60
+
61
+ subgraph 8a222c5d-b206-454f-b861-2b803cfe3cbd [Components and Actors]
62
+ c3967953-fb5a-45a4-8d89-bcc62962e1da@{ shape: text, label: "*Description*
63
+ **A description of how the new industry 4.0 manufacturing control system operates.**"}
64
+ end
65
+ style c3967953-fb5a-45a4-8d89-bcc62962e1da color:#000000, fill:#F9F7ED, stroke:#b7c0c7
66
+ style 8a222c5d-b206-454f-b861-2b803cfe3cbd color:#3079ab, fill:#b7c0c7, stroke:#3079ab`;
67
+ const {svg} = await mermaid.render('mySvgId', graphDefinition);
68
+ element.innerHTML = svg.replace(/( )*max-width:( 0-9\.)*px;/i, '');
69
+
70
+ var doPan = false;
71
+ var eventsHandler;
72
+ var panZoom;
73
+ var mousepos;
74
+
75
+ eventsHandler = {
76
+ haltEventListeners: ['mousedown', 'mousemove', 'mouseup']
77
+
78
+ , mouseDownHandler: function (ev) {
79
+ if (event.target.className == "[object SVGAnimatedString]") {
80
+ doPan = true;
81
+ mousepos = {x: ev.clientX, y: ev.clientY}
82
+ }
83
+ ;
84
+ }
85
+
86
+ , mouseMoveHandler: function (ev) {
87
+ if (doPan) {
88
+ panZoom.panBy({x: ev.clientX - mousepos.x, y: ev.clientY - mousepos.y});
89
+ mousepos = {x: ev.clientX, y: ev.clientY};
90
+ window.getSelection().removeAllRanges();
91
+ }
92
+ }
93
+
94
+ , mouseUpHandler: function (ev) {
95
+ doPan = false;
96
+ }
97
+
98
+ , init: function (options) {
99
+ options.svgElement.addEventListener('mousedown', this.mouseDownHandler, false);
100
+ options.svgElement.addEventListener('mousemove', this.mouseMoveHandler, false);
101
+ options.svgElement.addEventListener('mouseup', this.mouseUpHandler, false);
102
+ }
103
+
104
+ , destroy: function (options) {
105
+ options.svgElement.removeEventListener('mousedown', this.mouseDownHandler, false);
106
+ options.svgElement.removeEventListener('mousemove', this.mouseMoveHandler, false);
107
+ options.svgElement.removeEventListener('mouseup', this.mouseUpHandler, false);
108
+ }
109
+ }
110
+ panZoom = svgPanZoom('#mySvgId', {
111
+ zoomEnabled: true
112
+ , controlIconsEnabled: true
113
+ , fit: 1
114
+ , center: 1
115
+ , customEventsHandler: eventsHandler
116
+ })
117
+ };
118
+ await drawDiagram();
119
+ </script>
120
+ </body>
121
+