systemview 1.0.0 → 1.1.1

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 (264) hide show
  1. package/api/Connections.js +36 -0
  2. package/api/connections.txt +1 -0
  3. package/api/index.js +78 -0
  4. package/babel.config.js +12 -0
  5. package/cli/index.js +23 -6
  6. package/cli/launchApp.js +0 -0
  7. package/cli/runTest.js +0 -0
  8. package/cli/utils/cli.js +48 -0
  9. package/cli/utils/init.js +17 -0
  10. package/cli/utils/log.js +11 -0
  11. package/package.json +7 -4
  12. package/plugin/SystemViewModule.js +97 -0
  13. package/plugin/getAllTest.js +21 -0
  14. package/plugin/index.js +40 -0
  15. package/src/App.css +38 -0
  16. package/src/App.js +30 -0
  17. package/src/ServiceContext.js +9 -0
  18. package/src/assets/arrow.png +0 -0
  19. package/src/assets/check.svg +1 -0
  20. package/src/assets/clear.png +0 -0
  21. package/src/assets/edit.png +0 -0
  22. package/src/assets/error.svg +1 -0
  23. package/src/assets/eval-icon.svg +10 -0
  24. package/src/assets/expand-arrow.svg +41 -0
  25. package/src/assets/expand-button.svg +41 -0
  26. package/src/assets/fonts/FontsFree-Net-SFMono-Regular.ttf +0 -0
  27. package/src/assets/fonts/Malkor-Regular.ttf +0 -0
  28. package/src/assets/iconfinder-icon (1).svg +14 -0
  29. package/src/assets/iconfinder-icon.svg +14 -0
  30. package/src/assets/icons-save-60.png +0 -0
  31. package/src/assets/loading.gif +0 -0
  32. package/src/assets/missing-doc.png +0 -0
  33. package/src/assets/saved-doc.png +0 -0
  34. package/src/assets/sysly.png +0 -0
  35. package/src/assets/test-icon.svg +10 -0
  36. package/src/assets/test-missing.png +0 -0
  37. package/src/assets/test-saved.png +0 -0
  38. package/src/assets/x.svg +1 -0
  39. package/src/atoms/Button/Button.js +20 -0
  40. package/src/atoms/Button/Button.test.js +27 -0
  41. package/src/atoms/Button/__snapshots__/Button.test.js.snap +9 -0
  42. package/src/atoms/Button/styles.scss +35 -0
  43. package/src/atoms/Count/index.js +10 -0
  44. package/src/atoms/Count/styles.scss +25 -0
  45. package/src/atoms/DataTable/DataTable.js +27 -0
  46. package/src/atoms/DataTable/DataTable.test.js +55 -0
  47. package/src/atoms/DataTable/__snapshots__/DataTable.test.js.snap +36 -0
  48. package/src/atoms/DataTable/styles.scss +28 -0
  49. package/src/atoms/DescriptionBox/DescriptionBox.js +24 -0
  50. package/src/atoms/DescriptionBox/DescriptionBox.test.js +36 -0
  51. package/src/atoms/DescriptionBox/__snapshots__/DescriptionBox.test.js.snap +14 -0
  52. package/src/atoms/DescriptionBox/styles.scss +24 -0
  53. package/src/atoms/DescriptionText/DescriptionText.js +12 -0
  54. package/src/atoms/DescriptionText/DescriptionText.test.js +22 -0
  55. package/src/atoms/DescriptionText/styles.scss +10 -0
  56. package/src/atoms/DocsIcon/DocsIcon.js +20 -0
  57. package/src/atoms/DocsIcon/DocsIcon.test.js +23 -0
  58. package/src/atoms/DocsIcon/styles.scss +7 -0
  59. package/src/atoms/ExpandableIcon/ExpandableIcon.js +30 -0
  60. package/src/atoms/ExpandableIcon/ExpandableIcon.test.js +18 -0
  61. package/src/atoms/ExpandableIcon/styles.scss +5 -0
  62. package/src/atoms/JsonTextBox/JsonTextBox.js +61 -0
  63. package/src/atoms/JsonTextBox/JsonTextBox.test.js +0 -0
  64. package/src/atoms/JsonTextBox/styles.scss +41 -0
  65. package/src/atoms/Link/Link.js +17 -0
  66. package/src/atoms/Link/Link.test.js +33 -0
  67. package/src/atoms/Link/styles.scss +8 -0
  68. package/src/atoms/List/List.js +8 -0
  69. package/src/atoms/List/List.test.js +26 -0
  70. package/src/atoms/List/styles.scss +9 -0
  71. package/src/atoms/Markdown/Markdown.js +48 -0
  72. package/src/atoms/Markdown/styles.scss +414 -0
  73. package/src/atoms/RunTestIcon/index.js +41 -0
  74. package/src/atoms/RunTestIcon/styles.scss +16 -0
  75. package/src/atoms/SaveIcon/SaveIcon.js +6 -0
  76. package/src/atoms/SaveIcon/styles.scss +3 -0
  77. package/src/atoms/Selector/Selector.js +28 -0
  78. package/src/atoms/Selector/Selector.test.js +0 -0
  79. package/src/atoms/Selector/styles.scss +1 -0
  80. package/src/atoms/StatusIndicator/StatusIndicator.js +16 -0
  81. package/src/atoms/StatusIndicator/styles.scss +33 -0
  82. package/src/atoms/TestsIcon/TestsIcon.js +17 -0
  83. package/src/atoms/TestsIcon/TestsIcon.test.js +18 -0
  84. package/src/atoms/TestsIcon/styles.scss +0 -0
  85. package/src/atoms/Text/Text.js +8 -0
  86. package/src/atoms/Text/Text.test.js +21 -0
  87. package/src/atoms/Text/styles.scss +0 -0
  88. package/src/atoms/Textbox/Textbox.js +33 -0
  89. package/src/atoms/Textbox/Textbox.test.js +23 -0
  90. package/src/atoms/Textbox/styles.scss +14 -0
  91. package/src/atoms/Title/Title.js +12 -0
  92. package/src/atoms/Title/Title.test.js +0 -0
  93. package/src/atoms/Title/styles.scss +6 -0
  94. package/src/atoms/Toggle/Toggle.js +13 -0
  95. package/src/atoms/Toggle/Toggle.test.js +0 -0
  96. package/src/atoms/Toggle/styles.scss +62 -0
  97. package/src/atoms/TypeSelector/TypeSelector.js +28 -0
  98. package/src/atoms/TypeSelector/TypeSelector.test.js +0 -0
  99. package/src/atoms/TypeSelector/styles.scss +9 -0
  100. package/src/index.css +20 -0
  101. package/src/index.js +24 -0
  102. package/src/logo.svg +7 -0
  103. package/src/molecules/Args/Args.js +302 -0
  104. package/src/molecules/Args/Args.test.js +0 -0
  105. package/src/molecules/Args/styles.scss +166 -0
  106. package/src/molecules/AutoCompleteBox/AutoCompleteBox.js +101 -0
  107. package/src/molecules/AutoCompleteBox/AutoCompleteBox.test.js +0 -0
  108. package/src/molecules/AutoCompleteBox/styles.scss +35 -0
  109. package/src/molecules/DataTableForm/DataTableForm.js +167 -0
  110. package/src/molecules/DataTableForm/DataTableForm.test.js +0 -0
  111. package/src/molecules/DataTableForm/styles.scss +51 -0
  112. package/src/molecules/EditBox/EditBox.js +49 -0
  113. package/src/molecules/EditBox/EditBox.test.js +0 -0
  114. package/src/molecules/EditBox/styles.scss +38 -0
  115. package/src/molecules/ExpandableList/ExpandableList.js +26 -0
  116. package/src/molecules/ExpandableList/ExpandableList.test.js +33 -0
  117. package/src/molecules/ExpandableList/styles.scss +18 -0
  118. package/src/molecules/ExpandableSection/ExpandableSection.js +36 -0
  119. package/src/molecules/ExpandableSection/ExpandableSection.test.js +0 -0
  120. package/src/molecules/ExpandableSection/styles.scss +22 -0
  121. package/src/molecules/ServerModulesList/ServerModulesList.js +75 -0
  122. package/src/molecules/ServerModulesList/styles.scss +28 -0
  123. package/src/molecules/TargetSelector/TargetSelector.js +34 -0
  124. package/src/molecules/TargetSelector/TargetSelector.test.js +0 -0
  125. package/src/molecules/TargetSelector/styles.scss +0 -0
  126. package/src/molecules/TestCaption/TestCaption.js +26 -0
  127. package/src/molecules/TestCaption/TestCaption.test.js +0 -0
  128. package/src/molecules/TestCaption/styles.scss +40 -0
  129. package/src/molecules/TestSummary/index.js +212 -0
  130. package/src/molecules/TestSummary/styles.scss +83 -0
  131. package/src/molecules/TextWith2Links/TextWith2Links.js +10 -0
  132. package/src/molecules/TextWith2Links/styles.scss +0 -0
  133. package/src/molecules/ValidationInput/ValidationInput.js +64 -0
  134. package/src/molecules/ValidationInput/ValidationInput.test.js +0 -0
  135. package/src/molecules/ValidationInput/ValidationMessages.js +178 -0
  136. package/src/molecules/ValidationInput/ValidationOptions.js +113 -0
  137. package/src/molecules/ValidationInput/styles.scss +74 -0
  138. package/src/molecules/ValidationInput/validator.js +244 -0
  139. package/src/organisms/Documentation/Documentation.js +128 -0
  140. package/src/organisms/Documentation/Documentation.test.js +0 -0
  141. package/src/organisms/Documentation/styles.scss +22 -0
  142. package/src/organisms/MultiTestSection/MultiTestSection.js +85 -0
  143. package/src/organisms/MultiTestSection/MultiTestSection.test.js +0 -0
  144. package/src/organisms/MultiTestSection/styles.scss +22 -0
  145. package/src/organisms/SavedTests/SavedTests.js +209 -0
  146. package/src/organisms/SavedTests/SavedTests.test.js +0 -0
  147. package/src/organisms/SavedTests/styles.scss +76 -0
  148. package/src/organisms/SavedTests/transformTests.js +51 -0
  149. package/src/organisms/ScratchPad/ScratchPad.js +128 -0
  150. package/src/organisms/ScratchPad/ScratchPad.test.js +0 -0
  151. package/src/organisms/ScratchPad/styles.scss +100 -0
  152. package/src/organisms/SystemNavigator/SystemNavigator.js +148 -0
  153. package/src/organisms/SystemNavigator/SystemNavigator.test.js +24 -0
  154. package/src/organisms/SystemNavigator/styles.scss +38 -0
  155. package/src/organisms/TestContainer/TestContainer.js +72 -0
  156. package/src/organisms/TestContainer/TestContainer.test.js +0 -0
  157. package/src/organisms/TestContainer/styles.scss +20 -0
  158. package/src/organisms/TestPanel/AfterTest/AfterTest.js +16 -0
  159. package/src/organisms/TestPanel/AfterTest/AfterTest.test.js +0 -0
  160. package/src/organisms/TestPanel/AfterTest/styles.scss +0 -0
  161. package/src/organisms/TestPanel/BeforeTest/BeforeTest.js +16 -0
  162. package/src/organisms/TestPanel/BeforeTest/BeforeTest.test.js +0 -0
  163. package/src/organisms/TestPanel/BeforeTest/styles.scss +0 -0
  164. package/src/organisms/TestPanel/Evaluations.js +369 -0
  165. package/src/organisms/TestPanel/EventsTest/EventsTest.js +19 -0
  166. package/src/organisms/TestPanel/EventsTest/styles.scss +0 -0
  167. package/src/organisms/TestPanel/MainTest/MainTest.js +20 -0
  168. package/src/organisms/TestPanel/MainTest/MainTest.test.js +0 -0
  169. package/src/organisms/TestPanel/MainTest/styles.scss +143 -0
  170. package/src/organisms/TestPanel/TestPanel.js +170 -0
  171. package/src/organisms/TestPanel/TestPanel.test.js +0 -0
  172. package/src/organisms/TestPanel/components/Argument.class.js +94 -0
  173. package/src/organisms/TestPanel/components/FullTestController.js +78 -0
  174. package/src/organisms/TestPanel/components/Test.class.js +162 -0
  175. package/src/organisms/TestPanel/components/TestController.class.js +135 -0
  176. package/src/organisms/TestPanel/components/test-helpers.js +109 -0
  177. package/src/organisms/TestPanel/styles.scss +45 -0
  178. package/src/pages/SystemView/SystemView.js +68 -0
  179. package/src/pages/SystemView/styles.scss +81 -0
  180. package/src/reportWebVitals.js +13 -0
  181. package/src/sass/bootstrap/_alert.scss +51 -0
  182. package/src/sass/bootstrap/_badge.scss +47 -0
  183. package/src/sass/bootstrap/_breadcrumb.scss +38 -0
  184. package/src/sass/bootstrap/_button-group.scss +166 -0
  185. package/src/sass/bootstrap/_buttons.scss +143 -0
  186. package/src/sass/bootstrap/_card.scss +270 -0
  187. package/src/sass/bootstrap/_carousel.scss +191 -0
  188. package/src/sass/bootstrap/_close.scss +34 -0
  189. package/src/sass/bootstrap/_code.scss +56 -0
  190. package/src/sass/bootstrap/_custom-forms.scss +297 -0
  191. package/src/sass/bootstrap/_dropdown.scss +131 -0
  192. package/src/sass/bootstrap/_forms.scss +333 -0
  193. package/src/sass/bootstrap/_functions.scss +86 -0
  194. package/src/sass/bootstrap/_grid.scss +52 -0
  195. package/src/sass/bootstrap/_images.scss +42 -0
  196. package/src/sass/bootstrap/_input-group.scss +159 -0
  197. package/src/sass/bootstrap/_jumbotron.scss +16 -0
  198. package/src/sass/bootstrap/_list-group.scss +115 -0
  199. package/src/sass/bootstrap/_media.scss +8 -0
  200. package/src/sass/bootstrap/_mixins.scss +42 -0
  201. package/src/sass/bootstrap/_modal.scss +168 -0
  202. package/src/sass/bootstrap/_nav.scss +118 -0
  203. package/src/sass/bootstrap/_navbar.scss +311 -0
  204. package/src/sass/bootstrap/_pagination.scss +77 -0
  205. package/src/sass/bootstrap/_popover.scss +183 -0
  206. package/src/sass/bootstrap/_print.scss +124 -0
  207. package/src/sass/bootstrap/_progress.scss +33 -0
  208. package/src/sass/bootstrap/_reboot.scss +482 -0
  209. package/src/sass/bootstrap/_root.scss +19 -0
  210. package/src/sass/bootstrap/_tables.scss +180 -0
  211. package/src/sass/bootstrap/_tooltip.scss +115 -0
  212. package/src/sass/bootstrap/_transitions.scss +36 -0
  213. package/src/sass/bootstrap/_type.scss +125 -0
  214. package/src/sass/bootstrap/_utilities.scss +14 -0
  215. package/src/sass/bootstrap/_variables.scss +894 -0
  216. package/src/sass/bootstrap/bootstrap-grid.scss +32 -0
  217. package/src/sass/bootstrap/bootstrap-reboot.scss +12 -0
  218. package/src/sass/bootstrap/bootstrap.scss +42 -0
  219. package/src/sass/bootstrap/mixins/_alert.scss +13 -0
  220. package/src/sass/bootstrap/mixins/_background-variant.scss +21 -0
  221. package/src/sass/bootstrap/mixins/_badge.scss +12 -0
  222. package/src/sass/bootstrap/mixins/_border-radius.scss +35 -0
  223. package/src/sass/bootstrap/mixins/_box-shadow.scss +5 -0
  224. package/src/sass/bootstrap/mixins/_breakpoints.scss +123 -0
  225. package/src/sass/bootstrap/mixins/_buttons.scss +109 -0
  226. package/src/sass/bootstrap/mixins/_caret.scss +65 -0
  227. package/src/sass/bootstrap/mixins/_clearfix.scss +7 -0
  228. package/src/sass/bootstrap/mixins/_float.scss +11 -0
  229. package/src/sass/bootstrap/mixins/_forms.scss +137 -0
  230. package/src/sass/bootstrap/mixins/_gradients.scss +45 -0
  231. package/src/sass/bootstrap/mixins/_grid-framework.scss +67 -0
  232. package/src/sass/bootstrap/mixins/_grid.scss +52 -0
  233. package/src/sass/bootstrap/mixins/_hover.scss +39 -0
  234. package/src/sass/bootstrap/mixins/_image.scss +36 -0
  235. package/src/sass/bootstrap/mixins/_list-group.scss +21 -0
  236. package/src/sass/bootstrap/mixins/_lists.scss +7 -0
  237. package/src/sass/bootstrap/mixins/_nav-divider.scss +10 -0
  238. package/src/sass/bootstrap/mixins/_navbar-align.scss +10 -0
  239. package/src/sass/bootstrap/mixins/_pagination.scss +22 -0
  240. package/src/sass/bootstrap/mixins/_reset-text.scss +17 -0
  241. package/src/sass/bootstrap/mixins/_resize.scss +6 -0
  242. package/src/sass/bootstrap/mixins/_screen-reader.scss +35 -0
  243. package/src/sass/bootstrap/mixins/_size.scss +6 -0
  244. package/src/sass/bootstrap/mixins/_table-row.scss +30 -0
  245. package/src/sass/bootstrap/mixins/_text-emphasis.scss +14 -0
  246. package/src/sass/bootstrap/mixins/_text-hide.scss +9 -0
  247. package/src/sass/bootstrap/mixins/_text-truncate.scss +8 -0
  248. package/src/sass/bootstrap/mixins/_transition.scss +9 -0
  249. package/src/sass/bootstrap/mixins/_visibility.scss +7 -0
  250. package/src/sass/bootstrap/utilities/_align.scss +8 -0
  251. package/src/sass/bootstrap/utilities/_background.scss +19 -0
  252. package/src/sass/bootstrap/utilities/_borders.scss +59 -0
  253. package/src/sass/bootstrap/utilities/_clearfix.scss +3 -0
  254. package/src/sass/bootstrap/utilities/_display.scss +38 -0
  255. package/src/sass/bootstrap/utilities/_embed.scss +52 -0
  256. package/src/sass/bootstrap/utilities/_flex.scss +46 -0
  257. package/src/sass/bootstrap/utilities/_float.scss +9 -0
  258. package/src/sass/bootstrap/utilities/_position.scss +36 -0
  259. package/src/sass/bootstrap/utilities/_screenreaders.scss +11 -0
  260. package/src/sass/bootstrap/utilities/_sizing.scss +12 -0
  261. package/src/sass/bootstrap/utilities/_spacing.scss +51 -0
  262. package/src/sass/bootstrap/utilities/_text.scss +52 -0
  263. package/src/sass/bootstrap/utilities/_visibility.scss +11 -0
  264. package/src/setupTests.js +5 -0
@@ -0,0 +1,36 @@
1
+ const fs = require("fs");
2
+
3
+ module.exports = function ConnectedServices() {
4
+ const LOCAL_STORAGE = "./api/connections.txt";
5
+ this.save = (serviceData, index) => {
6
+ const connections = JSON.parse(fs.readFileSync(LOCAL_STORAGE, "utf8"));
7
+ if (typeof index === "number") connections[index] = serviceData;
8
+ else connections.push(serviceData);
9
+ fs.writeFileSync(LOCAL_STORAGE, JSON.stringify(connections), "utf8");
10
+ };
11
+
12
+ this.findService = (url, code, id) => {
13
+ const connections = JSON.parse(fs.readFileSync(LOCAL_STORAGE, "utf8"));
14
+ const index = connections.findIndex((service) => {
15
+ if (id) return id === service.serviceId && code === service.projectCode;
16
+ return (
17
+ service.system.connectionData.serviceUrl === url &&
18
+ (code ? service.projectCode === code : true)
19
+ );
20
+ });
21
+ const service = connections[index];
22
+ return { service, index };
23
+ };
24
+
25
+ this.findProject = (projectCode) => {
26
+ const connections = JSON.parse(fs.readFileSync(LOCAL_STORAGE, "utf8"));
27
+ return connections.reduce(
28
+ (sum, service) => (service.projectCode === projectCode ? sum.concat(service) : sum),
29
+ []
30
+ );
31
+ };
32
+ // clear & ensure file existence
33
+ fs.writeFileSync(LOCAL_STORAGE, "[]", "utf8");
34
+
35
+ return this;
36
+ };
@@ -0,0 +1 @@
1
+ []
package/api/index.js ADDED
@@ -0,0 +1,78 @@
1
+ const { HttpClient: http, App } = require("systemlynx");
2
+ const LocalStorage = require("./Connections")();
3
+ const route = "systemview/api";
4
+ const port = 3300;
5
+ const host = "localhost";
6
+ const isUrl = (str) =>
7
+ /^(http:\/\/|https:\/\/)?((localhost|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}))(:[0-9]{1,5})?(\/.*)?$/.test(
8
+ str
9
+ );
10
+
11
+ function connect({ system, projectCode, serviceId, specList }) {
12
+ const { service, index } = LocalStorage.findService(
13
+ system.connectionData.serviceUrl,
14
+ projectCode
15
+ );
16
+
17
+ if (service) {
18
+ service.system = system;
19
+ service.projectCode = projectCode;
20
+ service.serviceId = serviceId;
21
+ service.specList = specList;
22
+ LocalStorage.save(service, index);
23
+ } else LocalStorage.save({ system, projectCode, serviceId, specList });
24
+ }
25
+
26
+ function updateSpecList(specList, projectCode, serviceId) {
27
+ const { service, index } = LocalStorage.findService(undefined, projectCode, serviceId);
28
+ if (service) {
29
+ service.specList = specList;
30
+ LocalStorage.save(service, index);
31
+ this.emit(`spec-list-updated:${projectCode}`, {
32
+ projectCode,
33
+ serviceId,
34
+ specList,
35
+ });
36
+ }
37
+ }
38
+ function getServices(searchText) {
39
+ if (isUrl(searchText)) {
40
+ const { service } = LocalStorage.findService(searchText);
41
+ if (service) {
42
+ const project = { ...service, projectCode: "SystemLynx", serviceId: "Service" };
43
+ connect(project);
44
+ return [project];
45
+ } else {
46
+ return getConnectionData(searchText);
47
+ }
48
+ } else {
49
+ return LocalStorage.findProject(searchText);
50
+ }
51
+ }
52
+
53
+ async function getConnectionData(url) {
54
+ try {
55
+ const connectionData = await http.request({ url });
56
+ const project = {
57
+ system: { connectionData },
58
+ serviceId: "Service",
59
+ projectCode: "SystemLynx",
60
+ specList: { tests: [], docs: [] },
61
+ };
62
+
63
+ connect(project);
64
+ return [project];
65
+ } catch (error) {
66
+ return [];
67
+ }
68
+ }
69
+
70
+ App.startService({
71
+ route,
72
+ port,
73
+ host,
74
+ }).module("SystemView", {
75
+ connect,
76
+ getServices,
77
+ updateSpecList,
78
+ });
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ presets: ["@babel/preset-env", "@babel/preset-react"],
3
+ plugins: [
4
+ "@babel/plugin-transform-runtime",
5
+ ["@babel/plugin-proposal-class-properties", { loose: true }],
6
+ ],
7
+ env: {
8
+ testing: {
9
+ presets: [["@babel/preset-env", { targets: { node: "current" } }]],
10
+ },
11
+ },
12
+ };
package/cli/index.js CHANGED
@@ -7,17 +7,34 @@
7
7
  * @author Odion Edwards <none>
8
8
  */
9
9
 
10
- const init = require('./utils/init');
11
- const cli = require('./utils/cli');
12
- const log = require('./utils/log');
10
+ const init = require("./utils/init");
11
+ const cli = require("./utils/cli");
12
+ const log = require("./utils/log");
13
+ const { spawn } = require("child_process");
13
14
 
14
15
  const input = cli.input;
15
16
  const flags = cli.flags;
16
17
  const { clear, debug } = flags;
17
18
 
18
19
  (async () => {
19
- init({ clear });
20
- input.includes(`help`) && cli.showHelp(0);
20
+ init({ clear });
21
+ if (input.includes(`help`)) {
22
+ cli.showHelp(0);
23
+ }
24
+ if (input.includes("start")) {
25
+ // Start React app
26
+ log("Launching SystemView UI...");
27
+ const reactAppProcess = spawn("npm", ["start"], {
28
+ stdio: ["ignore", "ignore", "ignore"],
29
+ shell: true,
30
+ });
21
31
 
22
- debug && log(flags);
32
+ reactAppProcess.on("close", (code) => {
33
+ console.log(`React app exited with code ${code}`);
34
+ });
35
+ } else if (input.includes("test")) {
36
+ // Run tests
37
+ }
38
+
39
+ debug && log(flags);
23
40
  })();
File without changes
package/cli/runTest.js ADDED
File without changes
@@ -0,0 +1,48 @@
1
+ const meow = require("meow");
2
+ const meowHelp = require("cli-meow-help");
3
+
4
+ const flags = {
5
+ clear: {
6
+ type: `boolean`,
7
+ default: false,
8
+ alias: `c`,
9
+ desc: `Clear the console`,
10
+ },
11
+ noClear: {
12
+ type: `boolean`,
13
+ default: false,
14
+ desc: `Don't clear the console`,
15
+ },
16
+ debug: {
17
+ type: `boolean`,
18
+ default: false,
19
+ alias: `d`,
20
+ desc: `Print debug info`,
21
+ },
22
+ version: {
23
+ type: `boolean`,
24
+ alias: `v`,
25
+ desc: `Print CLI version`,
26
+ },
27
+ };
28
+
29
+ const commands = {
30
+ help: { desc: `Print help info` },
31
+ test: { desc: `Run saved test` },
32
+ start: { desc: `Launch SystemView UI` },
33
+ };
34
+
35
+ const helpText = meowHelp({
36
+ name: `SystemView`,
37
+ flags,
38
+ commands,
39
+ });
40
+
41
+ const options = {
42
+ inferType: true,
43
+ description: false,
44
+ hardRejection: false,
45
+ flags,
46
+ };
47
+
48
+ module.exports = meow(helpText, options);
@@ -0,0 +1,17 @@
1
+ const welcome = require("cli-welcome");
2
+ const pkg = require("../../package.json");
3
+ const unhandled = require("cli-handle-unhandled");
4
+
5
+ module.exports = ({ clear = true }) => {
6
+ unhandled();
7
+ welcome({
8
+ title: `SystemView`,
9
+ tagLine: `by Odion Edwards`,
10
+ description: pkg.description,
11
+ version: pkg.version,
12
+ bgColor: "#36BB09",
13
+ color: "#000000",
14
+ bold: true,
15
+ clear,
16
+ });
17
+ };
@@ -0,0 +1,11 @@
1
+ const alert = require("cli-alerts");
2
+
3
+ module.exports = (info) => {
4
+ alert({
5
+ type: `warning`,
6
+ name: `DEBUG LOG`,
7
+ msg: ``,
8
+ });
9
+
10
+ console.log(info);
11
+ };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "systemview",
3
3
  "description": "A documentation and testing suite for SystemLynx",
4
- "version": "1.0.0",
4
+ "version": "1.1.1",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {
7
- "SystemView": "cli/index.js"
7
+ "systemview": "cli/index.js"
8
8
  },
9
9
  "dependencies": {
10
10
  "@babel/preset-react": "^7.18.6",
@@ -78,7 +78,10 @@
78
78
  "Odion Edwards"
79
79
  ],
80
80
  "files": [
81
- "index.js",
82
- "utils"
81
+ "cli/",
82
+ "api/",
83
+ "src/",
84
+ "plugin/",
85
+ "babel.config.js"
83
86
  ]
84
87
  }
@@ -0,0 +1,97 @@
1
+ const fs = require("fs");
2
+ const getAllTests = require("./getAllTest");
3
+
4
+ module.exports = (specs, projectCode, serviceId, helperMethods = {}) => {
5
+ specs = specs.substr(-1) === "/" ? specs.substr(0, specs.length - 1) : specs;
6
+
7
+ return function SystemViewPlugin() {
8
+ const { SystemView } = this.useService("SystemView");
9
+ Object.assign(this, helperMethods);
10
+
11
+ this.saveDoc = ({ documentation, namespace }) => {
12
+ const fileName = `${specs}/docs/${getName(namespace)}.md`;
13
+ ensureDir(`${specs}/docs/`);
14
+ if (documentation) {
15
+ fs.writeFileSync(fileName, documentation, "utf8");
16
+ } else {
17
+ deleteFile(fileName);
18
+ }
19
+ SystemView.updateSpecList(this.getSpecList(), projectCode, serviceId);
20
+ return { documentation, namespace };
21
+ };
22
+
23
+ this.getDoc = (namespace) => {
24
+ const fileName = `${specs}/docs/${getName(namespace)}.md`;
25
+ const documentation = getFile(fileName) || "";
26
+ return { namespace, documentation };
27
+ };
28
+
29
+ this.getTests = (namespace = {}) => {
30
+ const { moduleName, methodName } = namespace;
31
+ if (methodName) {
32
+ const fileName = `${specs}/tests/${moduleName}.${methodName}.json`;
33
+ const tests = JSON.parse(getFile(fileName) || "[]");
34
+ return tests;
35
+ } else if (moduleName) {
36
+ return getAllTests(`${specs}/tests/`, moduleName);
37
+ } else {
38
+ return getAllTests(`${specs}/tests/`);
39
+ }
40
+ };
41
+ this.saveTest = (test, index) => {
42
+ const fileName = `${specs}/tests/${getName(test.namespace)}.json`;
43
+ const tests = JSON.parse(getFile(fileName) || "[]");
44
+ if (typeof index === "number") {
45
+ tests[index] = test;
46
+ } else {
47
+ tests.push(test);
48
+ }
49
+ fs.writeFileSync(fileName, JSON.stringify(tests), "utf8");
50
+ SystemView.updateSpecList(this.getSpecList(), projectCode, serviceId);
51
+ return index || tests.length - 1;
52
+ };
53
+ this.deleteTest = (namespace, index) => {
54
+ const fileName = `${specs}/tests/${getName(namespace)}.json`;
55
+ const tests = JSON.parse(getFile(fileName) || "[]");
56
+ tests.splice(index, 1);
57
+ console.log(tests.length);
58
+ if (tests.length) {
59
+ fs.writeFileSync(fileName, JSON.stringify(tests), "utf8");
60
+ } else {
61
+ deleteFile(fileName);
62
+ SystemView.updateSpecList(this.getSpecList(), projectCode, serviceId);
63
+ }
64
+ };
65
+ this.getSpecList = () => ({
66
+ docs: fs.readdirSync(`${specs}/docs/`),
67
+ tests: fs.readdirSync(`${specs}/tests/`),
68
+ });
69
+ };
70
+
71
+ function deleteFile(fileName) {
72
+ try {
73
+ console.log(fileName);
74
+ fs.unlinkSync(fileName);
75
+ } catch (err) {
76
+ // console.error(err);
77
+ }
78
+ }
79
+ function getFile(fileName) {
80
+ try {
81
+ return fs.readFileSync(fileName, "utf8");
82
+ } catch (error) {
83
+ // console.log(error);
84
+ }
85
+ }
86
+ function ensureDir(dir) {
87
+ if (!fs.existsSync(dir)) {
88
+ fs.mkdirSync(dir, { recursive: true });
89
+ }
90
+ }
91
+
92
+ function getName({ serviceId, moduleName, methodName }) {
93
+ if (methodName) return `${moduleName}.${methodName}`;
94
+ else if (moduleName) return moduleName;
95
+ else if (serviceId) return serviceId;
96
+ }
97
+ };
@@ -0,0 +1,21 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ module.exports = function getFilesByNamespace(folder, namespace) {
5
+ const files = fs.readdirSync(folder); // read the contents of the current directory
6
+ const namespacePattern = namespace
7
+ ? new RegExp(`^${namespace}\\..+\\.json$`)
8
+ : /\.json$/;
9
+
10
+ return files
11
+ .filter((file) => namespacePattern.test(file))
12
+ .reduce((sum, file) => {
13
+ const filePath = path.join(folder, file);
14
+ const fileContents = fs.readFileSync(filePath, "utf-8");
15
+ const parsedData = JSON.parse(fileContents);
16
+
17
+ return sum.concat(parsedData);
18
+ }, []);
19
+ };
20
+
21
+ // no namespace passed, return all files
@@ -0,0 +1,40 @@
1
+ const SystemViewModule = require("./SystemViewModule");
2
+ const fs = require("fs");
3
+
4
+ function ensureDir(dir) {
5
+ if (!fs.existsSync(dir)) {
6
+ fs.mkdirSync(dir, { recursive: true });
7
+ }
8
+ }
9
+
10
+ const getSpecList = (specs) => {
11
+ ensureDir(`${specs}/docs/`);
12
+ ensureDir(`${specs}/tests/`);
13
+ return {
14
+ docs: fs.readdirSync(`${specs}/docs/`),
15
+ tests: fs.readdirSync(`${specs}/tests/`),
16
+ };
17
+ };
18
+ module.exports = function ({
19
+ connection = "http://localhost:3300/systemview/api",
20
+ specs = "./specs",
21
+ projectCode,
22
+ serviceId,
23
+ helperMethods,
24
+ }) {
25
+ return function (App) {
26
+ App.loadService("SystemView", connection)
27
+ .module("Plugin", SystemViewModule(specs, projectCode, serviceId, helperMethods))
28
+ .on("ready", async function connectSystemView(system) {
29
+ try {
30
+ const { SystemView } = this.useService("SystemView");
31
+ const specList = getSpecList(specs);
32
+ console.log("reconnection");
33
+ await SystemView.connect({ system, projectCode, serviceId, specList });
34
+ // SystemView.on("reconnect", connectSystemView.bind(this, system));
35
+ } catch (error) {
36
+ console.log("SystemView connection failed---->", error);
37
+ }
38
+ });
39
+ };
40
+ };
package/src/App.css ADDED
@@ -0,0 +1,38 @@
1
+ .App {
2
+ text-align: center;
3
+ }
4
+
5
+ .App-logo {
6
+ height: 40vmin;
7
+ pointer-events: none;
8
+ }
9
+
10
+ @media (prefers-reduced-motion: no-preference) {
11
+ .App-logo {
12
+ animation: App-logo-spin infinite 20s linear;
13
+ }
14
+ }
15
+
16
+ .App-header {
17
+ background-color: #282c34;
18
+ min-height: 100vh;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-size: calc(10px + 2vmin);
24
+ color: white;
25
+ }
26
+
27
+ .App-link {
28
+ color: #61dafb;
29
+ }
30
+
31
+ @keyframes App-logo-spin {
32
+ from {
33
+ transform: rotate(0deg);
34
+ }
35
+ to {
36
+ transform: rotate(360deg);
37
+ }
38
+ }
package/src/App.js ADDED
@@ -0,0 +1,30 @@
1
+ import React, { useState } from "react";
2
+ import SystemView from "./pages/SystemView/SystemView";
3
+ import ServiceContext from "./ServiceContext";
4
+ import { BrowserRouter as Router, Route } from "react-router-dom";
5
+
6
+ function App({ SystemViewService }) {
7
+ const [connectedServices, setConnectedServices] = useState([]);
8
+
9
+ return (
10
+ <ServiceContext.Provider
11
+ value={{ SystemViewService, connectedServices, setConnectedServices }}
12
+ >
13
+ <Router>
14
+ <Route
15
+ path={[
16
+ "/:projectCode/:serviceId/:moduleName/:methodName",
17
+ "/:projectCode/:serviceId/:moduleName",
18
+ "/:projectCode/:serviceId",
19
+ "/:projectCode/",
20
+ "/",
21
+ ]}
22
+ >
23
+ <SystemView />
24
+ </Route>
25
+ </Router>
26
+ </ServiceContext.Provider>
27
+ );
28
+ }
29
+
30
+ export default App;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+
3
+ const ServiceContext = React.createContext({
4
+ SystemViewService: {},
5
+ connectedServices: [],
6
+ setConnectedServices: () => {},
7
+ });
8
+
9
+ export default ServiceContext;
Binary file
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 512 512"><path d="M256 32C132.3 32 32 132.3 32 256s100.3 224 224 224 224-100.3 224-224S379.7 32 256 32zm114.9 149.1L231.8 359.6c-1.1 1.1-2.9 3.5-5.1 3.5-2.3 0-3.8-1.6-5.1-2.9-1.3-1.3-78.9-75.9-78.9-75.9l-1.5-1.5c-.6-.9-1.1-2-1.1-3.2 0-1.2.5-2.3 1.1-3.2.4-.4.7-.7 1.1-1.2 7.7-8.1 23.3-24.5 24.3-25.5 1.3-1.3 2.4-3 4.8-3 2.5 0 4.1 2.1 5.3 3.3 1.2 1.2 45 43.3 45 43.3l111.3-143c1-.8 2.2-1.4 3.5-1.4 1.3 0 2.5.5 3.5 1.3l30.6 24.1c.8 1 1.3 2.2 1.3 3.5.1 1.3-.4 2.4-1 3.3z" fill="#4caf50" class="fill-000000"></path></svg>
Binary file
Binary file
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><defs><style>.cls-1{fill:#cf1f25;}.cls-2{fill:#fff;}.cls-3{fill:none;}</style></defs><title/><g data-name="Layer 2" id="Layer_2"><g data-name="Layer 1" id="Layer_1-2"><circle class="cls-1" cx="12" cy="12" r="11"/><path class="cls-2" d="M13.42,12l3.23-3.23a1,1,0,1,0-1.41-1.41L12,10.59,8.78,7.36A1,1,0,1,0,7.36,8.77L10.59,12,7.36,15.23a1,1,0,1,0,1.41,1.41L12,13.42l3.23,3.23a1,1,0,0,0,1.41-1.41Z"/><rect class="cls-3" height="24" width="24"/></g></g></svg>
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="95.994" height="128" viewBox="0 0 95.994 128">
2
+ <g id="_728987_experiment_chemistry_lab_laboratory_research_icon" data-name="728987_experiment_chemistry_lab_laboratory_research_icon" transform="translate(-16.001)">
3
+ <g id="Group_2" data-name="Group 2">
4
+ <g id="Group_1" data-name="Group 1">
5
+ <path id="Path_1" data-name="Path 1" d="M60,32A12,12,0,1,0,48,20,12,12,0,0,0,60,32Zm0-16a4,4,0,1,1-4,4A4,4,0,0,1,60,16ZM76,8a4,4,0,1,0-4-4A4,4,0,0,0,76,8ZM24,120h8v-8H24Zm0-16h8V96Zm8,0v8h8v-8Zm8-16H32v8h8Zm8-8H40v8h8ZM40,96v8h8V96Zm0,24h8v-8H40Zm8-16v8h8v-8Zm8-8V88H48v8Zm8-16H56v8h8ZM56,96v8h8V96Zm0,24h8v-8H56Zm8-16v8h8v-8Zm8-8V88H64v8Zm8-16H72v8h8ZM72,96v8h8V96Zm0,24h8v-8H72Zm8-16v8h8v-8Zm8-8V88H80v8Zm8,8V96H88v8Zm-8,16h8v-8H88Zm8-16v8h8v-8Z" fill="#5655f5" fill-rule="evenodd"/>
6
+ </g>
7
+ </g>
8
+ <path id="Path_2" data-name="Path 2" d="M110.415,110.047,80,58.938V48h4a4,4,0,0,0,0-8H76a4,4,0,0,0-4,4V60a4.016,4.016,0,0,0,.527,1.984l30.645,51.578A4,4,0,0,1,100,120H28a4,4,0,0,1-3.172-6.437L55.473,61.984A4.006,4.006,0,0,0,56,60V44a4,4,0,0,0-4-4H44a4,4,0,0,0,0,8h4V58.938L17.582,110.047A12,12,0,0,0,28,128h72a12,12,0,0,0,10.415-17.953Z" fill="#546e7a"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="306px" height="306px" viewBox="0 0 306 306" style="enable-background:new 0 0 306 306;" xml:space="preserve">
6
+ <g>
7
+ <g id="expand-less">
8
+ <polygon points="153,58.65 0,211.65 35.7,247.35 153,130.05 270.3,247.35 306,211.65 "/>
9
+ </g>
10
+ </g>
11
+ <g>
12
+ </g>
13
+ <g>
14
+ </g>
15
+ <g>
16
+ </g>
17
+ <g>
18
+ </g>
19
+ <g>
20
+ </g>
21
+ <g>
22
+ </g>
23
+ <g>
24
+ </g>
25
+ <g>
26
+ </g>
27
+ <g>
28
+ </g>
29
+ <g>
30
+ </g>
31
+ <g>
32
+ </g>
33
+ <g>
34
+ </g>
35
+ <g>
36
+ </g>
37
+ <g>
38
+ </g>
39
+ <g>
40
+ </g>
41
+ </svg>
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="306px" height="306px" viewBox="0 0 306 306" style="enable-background:new 0 0 306 306;" xml:space="preserve">
6
+ <g>
7
+ <g id="expand-more">
8
+ <polygon points="270.3,58.65 153,175.95 35.7,58.65 0,94.35 153,247.35 306,94.35 "/>
9
+ </g>
10
+ </g>
11
+ <g>
12
+ </g>
13
+ <g>
14
+ </g>
15
+ <g>
16
+ </g>
17
+ <g>
18
+ </g>
19
+ <g>
20
+ </g>
21
+ <g>
22
+ </g>
23
+ <g>
24
+ </g>
25
+ <g>
26
+ </g>
27
+ <g>
28
+ </g>
29
+ <g>
30
+ </g>
31
+ <g>
32
+ </g>
33
+ <g>
34
+ </g>
35
+ <g>
36
+ </g>
37
+ <g>
38
+ </g>
39
+ <g>
40
+ </g>
41
+ </svg>
@@ -0,0 +1,14 @@
1
+ <svg width="64" height="64" xmlns="http://www.w3.org/2000/svg">
2
+
3
+ <g>
4
+ <title>background</title>
5
+ <rect fill="none" id="canvas_background" height="402" width="582" y="-1" x="-1"/>
6
+ </g>
7
+ <g>
8
+ <title>Layer 1</title>
9
+ <path id="svg_2" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" stroke="#2C3E50" fill="#e57070" d="m50,52c0,2.2 -1.8,4 -4,4l-28,0c-2.2,0 -4,-1.8 -4,-4l0,-35l9,-9l23,0c2.2,0 4,1.8 4,4l0,40z"/>
10
+ <line id="svg_5" y2="13" y1="11" x2="24" x1="24" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" stroke="#2C3E50" fill="none"/>
11
+ <path id="svg_6" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" stroke-dasharray="2.7511,2.7511" stroke="#2C3E50" fill="none" d="m23.6,15.7c-0.6,1.2 -1.8,2.1 -3.2,2.3"/>
12
+ <line id="svg_7" y2="18" y1="18" x2="17" x1="19" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" stroke="#2C3E50" fill="none"/>
13
+ </g>
14
+ </svg>
@@ -0,0 +1,14 @@
1
+ <svg width="64" height="64" xmlns="http://www.w3.org/2000/svg">
2
+
3
+ <g>
4
+ <title>background</title>
5
+ <rect fill="none" id="canvas_background" height="402" width="582" y="-1" x="-1"/>
6
+ </g>
7
+ <g>
8
+ <title>Layer 1</title>
9
+ <path id="svg_1" stroke-width="2" stroke-miterlimit="10" stroke-linejoin="round" stroke-linecap="round" stroke="#2C3E50" fill="#ffffff" d="m32,56l-14,0c-2.2,0 -4,-1.8 -4,-4l0,-35l9,-9l23,0c2.2,0 4,1.8 4,4l0,26"/>
10
+ <path id="svg_2" stroke-width="2" stroke-miterlimit="10" stroke-linejoin="round" stroke-linecap="round" stroke="#2C3E50" fill="none" d="m24,11l0,3c0,2.2 -1.9,4 -4.1,4l-2.9,0"/>
11
+ <circle id="svg_3" stroke-width="2" stroke-miterlimit="10" stroke-linejoin="round" stroke-linecap="round" stroke="#2C3E50" r="10" fill="#00bf00" cy="46" cx="40"/>
12
+ <polyline id="svg_4" stroke-width="2" stroke-miterlimit="10" stroke-linejoin="round" stroke-linecap="round" stroke="#2C3E50" points=" 35.7,45.9 39,49.2 44.2,43.8 " fill="none"/>
13
+ </g>
14
+ </svg>