systemview 1.1.1 → 1.2.2

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 (256) hide show
  1. package/api/connections.txt +1 -1
  2. package/cli/index.js +8 -3
  3. package/cli/utils/log.js +2 -2
  4. package/package.json +3 -3
  5. package/server.js +19 -0
  6. package/babel.config.js +0 -12
  7. package/src/App.css +0 -38
  8. package/src/App.js +0 -30
  9. package/src/ServiceContext.js +0 -9
  10. package/src/assets/arrow.png +0 -0
  11. package/src/assets/check.svg +0 -1
  12. package/src/assets/clear.png +0 -0
  13. package/src/assets/edit.png +0 -0
  14. package/src/assets/error.svg +0 -1
  15. package/src/assets/eval-icon.svg +0 -10
  16. package/src/assets/expand-arrow.svg +0 -41
  17. package/src/assets/expand-button.svg +0 -41
  18. package/src/assets/fonts/FontsFree-Net-SFMono-Regular.ttf +0 -0
  19. package/src/assets/fonts/Malkor-Regular.ttf +0 -0
  20. package/src/assets/iconfinder-icon (1).svg +0 -14
  21. package/src/assets/iconfinder-icon.svg +0 -14
  22. package/src/assets/icons-save-60.png +0 -0
  23. package/src/assets/loading.gif +0 -0
  24. package/src/assets/missing-doc.png +0 -0
  25. package/src/assets/saved-doc.png +0 -0
  26. package/src/assets/sysly.png +0 -0
  27. package/src/assets/test-icon.svg +0 -10
  28. package/src/assets/test-missing.png +0 -0
  29. package/src/assets/test-saved.png +0 -0
  30. package/src/assets/x.svg +0 -1
  31. package/src/atoms/Button/Button.js +0 -20
  32. package/src/atoms/Button/Button.test.js +0 -27
  33. package/src/atoms/Button/__snapshots__/Button.test.js.snap +0 -9
  34. package/src/atoms/Button/styles.scss +0 -35
  35. package/src/atoms/Count/index.js +0 -10
  36. package/src/atoms/Count/styles.scss +0 -25
  37. package/src/atoms/DataTable/DataTable.js +0 -27
  38. package/src/atoms/DataTable/DataTable.test.js +0 -55
  39. package/src/atoms/DataTable/__snapshots__/DataTable.test.js.snap +0 -36
  40. package/src/atoms/DataTable/styles.scss +0 -28
  41. package/src/atoms/DescriptionBox/DescriptionBox.js +0 -24
  42. package/src/atoms/DescriptionBox/DescriptionBox.test.js +0 -36
  43. package/src/atoms/DescriptionBox/__snapshots__/DescriptionBox.test.js.snap +0 -14
  44. package/src/atoms/DescriptionBox/styles.scss +0 -24
  45. package/src/atoms/DescriptionText/DescriptionText.js +0 -12
  46. package/src/atoms/DescriptionText/DescriptionText.test.js +0 -22
  47. package/src/atoms/DescriptionText/styles.scss +0 -10
  48. package/src/atoms/DocsIcon/DocsIcon.js +0 -20
  49. package/src/atoms/DocsIcon/DocsIcon.test.js +0 -23
  50. package/src/atoms/DocsIcon/styles.scss +0 -7
  51. package/src/atoms/ExpandableIcon/ExpandableIcon.js +0 -30
  52. package/src/atoms/ExpandableIcon/ExpandableIcon.test.js +0 -18
  53. package/src/atoms/ExpandableIcon/styles.scss +0 -5
  54. package/src/atoms/JsonTextBox/JsonTextBox.js +0 -61
  55. package/src/atoms/JsonTextBox/JsonTextBox.test.js +0 -0
  56. package/src/atoms/JsonTextBox/styles.scss +0 -41
  57. package/src/atoms/Link/Link.js +0 -17
  58. package/src/atoms/Link/Link.test.js +0 -33
  59. package/src/atoms/Link/styles.scss +0 -8
  60. package/src/atoms/List/List.js +0 -8
  61. package/src/atoms/List/List.test.js +0 -26
  62. package/src/atoms/List/styles.scss +0 -9
  63. package/src/atoms/Markdown/Markdown.js +0 -48
  64. package/src/atoms/Markdown/styles.scss +0 -414
  65. package/src/atoms/RunTestIcon/index.js +0 -41
  66. package/src/atoms/RunTestIcon/styles.scss +0 -16
  67. package/src/atoms/SaveIcon/SaveIcon.js +0 -6
  68. package/src/atoms/SaveIcon/styles.scss +0 -3
  69. package/src/atoms/Selector/Selector.js +0 -28
  70. package/src/atoms/Selector/Selector.test.js +0 -0
  71. package/src/atoms/Selector/styles.scss +0 -1
  72. package/src/atoms/StatusIndicator/StatusIndicator.js +0 -16
  73. package/src/atoms/StatusIndicator/styles.scss +0 -33
  74. package/src/atoms/TestsIcon/TestsIcon.js +0 -17
  75. package/src/atoms/TestsIcon/TestsIcon.test.js +0 -18
  76. package/src/atoms/TestsIcon/styles.scss +0 -0
  77. package/src/atoms/Text/Text.js +0 -8
  78. package/src/atoms/Text/Text.test.js +0 -21
  79. package/src/atoms/Text/styles.scss +0 -0
  80. package/src/atoms/Textbox/Textbox.js +0 -33
  81. package/src/atoms/Textbox/Textbox.test.js +0 -23
  82. package/src/atoms/Textbox/styles.scss +0 -14
  83. package/src/atoms/Title/Title.js +0 -12
  84. package/src/atoms/Title/Title.test.js +0 -0
  85. package/src/atoms/Title/styles.scss +0 -6
  86. package/src/atoms/Toggle/Toggle.js +0 -13
  87. package/src/atoms/Toggle/Toggle.test.js +0 -0
  88. package/src/atoms/Toggle/styles.scss +0 -62
  89. package/src/atoms/TypeSelector/TypeSelector.js +0 -28
  90. package/src/atoms/TypeSelector/TypeSelector.test.js +0 -0
  91. package/src/atoms/TypeSelector/styles.scss +0 -9
  92. package/src/index.css +0 -20
  93. package/src/index.js +0 -24
  94. package/src/logo.svg +0 -7
  95. package/src/molecules/Args/Args.js +0 -302
  96. package/src/molecules/Args/Args.test.js +0 -0
  97. package/src/molecules/Args/styles.scss +0 -166
  98. package/src/molecules/AutoCompleteBox/AutoCompleteBox.js +0 -101
  99. package/src/molecules/AutoCompleteBox/AutoCompleteBox.test.js +0 -0
  100. package/src/molecules/AutoCompleteBox/styles.scss +0 -35
  101. package/src/molecules/DataTableForm/DataTableForm.js +0 -167
  102. package/src/molecules/DataTableForm/DataTableForm.test.js +0 -0
  103. package/src/molecules/DataTableForm/styles.scss +0 -51
  104. package/src/molecules/EditBox/EditBox.js +0 -49
  105. package/src/molecules/EditBox/EditBox.test.js +0 -0
  106. package/src/molecules/EditBox/styles.scss +0 -38
  107. package/src/molecules/ExpandableList/ExpandableList.js +0 -26
  108. package/src/molecules/ExpandableList/ExpandableList.test.js +0 -33
  109. package/src/molecules/ExpandableList/styles.scss +0 -18
  110. package/src/molecules/ExpandableSection/ExpandableSection.js +0 -36
  111. package/src/molecules/ExpandableSection/ExpandableSection.test.js +0 -0
  112. package/src/molecules/ExpandableSection/styles.scss +0 -22
  113. package/src/molecules/ServerModulesList/ServerModulesList.js +0 -75
  114. package/src/molecules/ServerModulesList/styles.scss +0 -28
  115. package/src/molecules/TargetSelector/TargetSelector.js +0 -34
  116. package/src/molecules/TargetSelector/TargetSelector.test.js +0 -0
  117. package/src/molecules/TargetSelector/styles.scss +0 -0
  118. package/src/molecules/TestCaption/TestCaption.js +0 -26
  119. package/src/molecules/TestCaption/TestCaption.test.js +0 -0
  120. package/src/molecules/TestCaption/styles.scss +0 -40
  121. package/src/molecules/TestSummary/index.js +0 -212
  122. package/src/molecules/TestSummary/styles.scss +0 -83
  123. package/src/molecules/TextWith2Links/TextWith2Links.js +0 -10
  124. package/src/molecules/TextWith2Links/styles.scss +0 -0
  125. package/src/molecules/ValidationInput/ValidationInput.js +0 -64
  126. package/src/molecules/ValidationInput/ValidationInput.test.js +0 -0
  127. package/src/molecules/ValidationInput/ValidationMessages.js +0 -178
  128. package/src/molecules/ValidationInput/ValidationOptions.js +0 -113
  129. package/src/molecules/ValidationInput/styles.scss +0 -74
  130. package/src/molecules/ValidationInput/validator.js +0 -244
  131. package/src/organisms/Documentation/Documentation.js +0 -128
  132. package/src/organisms/Documentation/Documentation.test.js +0 -0
  133. package/src/organisms/Documentation/styles.scss +0 -22
  134. package/src/organisms/MultiTestSection/MultiTestSection.js +0 -85
  135. package/src/organisms/MultiTestSection/MultiTestSection.test.js +0 -0
  136. package/src/organisms/MultiTestSection/styles.scss +0 -22
  137. package/src/organisms/SavedTests/SavedTests.js +0 -209
  138. package/src/organisms/SavedTests/SavedTests.test.js +0 -0
  139. package/src/organisms/SavedTests/styles.scss +0 -76
  140. package/src/organisms/SavedTests/transformTests.js +0 -51
  141. package/src/organisms/ScratchPad/ScratchPad.js +0 -128
  142. package/src/organisms/ScratchPad/ScratchPad.test.js +0 -0
  143. package/src/organisms/ScratchPad/styles.scss +0 -100
  144. package/src/organisms/SystemNavigator/SystemNavigator.js +0 -148
  145. package/src/organisms/SystemNavigator/SystemNavigator.test.js +0 -24
  146. package/src/organisms/SystemNavigator/styles.scss +0 -38
  147. package/src/organisms/TestContainer/TestContainer.js +0 -72
  148. package/src/organisms/TestContainer/TestContainer.test.js +0 -0
  149. package/src/organisms/TestContainer/styles.scss +0 -20
  150. package/src/organisms/TestPanel/AfterTest/AfterTest.js +0 -16
  151. package/src/organisms/TestPanel/AfterTest/AfterTest.test.js +0 -0
  152. package/src/organisms/TestPanel/AfterTest/styles.scss +0 -0
  153. package/src/organisms/TestPanel/BeforeTest/BeforeTest.js +0 -16
  154. package/src/organisms/TestPanel/BeforeTest/BeforeTest.test.js +0 -0
  155. package/src/organisms/TestPanel/BeforeTest/styles.scss +0 -0
  156. package/src/organisms/TestPanel/Evaluations.js +0 -369
  157. package/src/organisms/TestPanel/EventsTest/EventsTest.js +0 -19
  158. package/src/organisms/TestPanel/EventsTest/styles.scss +0 -0
  159. package/src/organisms/TestPanel/MainTest/MainTest.js +0 -20
  160. package/src/organisms/TestPanel/MainTest/MainTest.test.js +0 -0
  161. package/src/organisms/TestPanel/MainTest/styles.scss +0 -143
  162. package/src/organisms/TestPanel/TestPanel.js +0 -170
  163. package/src/organisms/TestPanel/TestPanel.test.js +0 -0
  164. package/src/organisms/TestPanel/components/Argument.class.js +0 -94
  165. package/src/organisms/TestPanel/components/FullTestController.js +0 -78
  166. package/src/organisms/TestPanel/components/Test.class.js +0 -162
  167. package/src/organisms/TestPanel/components/TestController.class.js +0 -135
  168. package/src/organisms/TestPanel/components/test-helpers.js +0 -109
  169. package/src/organisms/TestPanel/styles.scss +0 -45
  170. package/src/pages/SystemView/SystemView.js +0 -68
  171. package/src/pages/SystemView/styles.scss +0 -81
  172. package/src/reportWebVitals.js +0 -13
  173. package/src/sass/bootstrap/_alert.scss +0 -51
  174. package/src/sass/bootstrap/_badge.scss +0 -47
  175. package/src/sass/bootstrap/_breadcrumb.scss +0 -38
  176. package/src/sass/bootstrap/_button-group.scss +0 -166
  177. package/src/sass/bootstrap/_buttons.scss +0 -143
  178. package/src/sass/bootstrap/_card.scss +0 -270
  179. package/src/sass/bootstrap/_carousel.scss +0 -191
  180. package/src/sass/bootstrap/_close.scss +0 -34
  181. package/src/sass/bootstrap/_code.scss +0 -56
  182. package/src/sass/bootstrap/_custom-forms.scss +0 -297
  183. package/src/sass/bootstrap/_dropdown.scss +0 -131
  184. package/src/sass/bootstrap/_forms.scss +0 -333
  185. package/src/sass/bootstrap/_functions.scss +0 -86
  186. package/src/sass/bootstrap/_grid.scss +0 -52
  187. package/src/sass/bootstrap/_images.scss +0 -42
  188. package/src/sass/bootstrap/_input-group.scss +0 -159
  189. package/src/sass/bootstrap/_jumbotron.scss +0 -16
  190. package/src/sass/bootstrap/_list-group.scss +0 -115
  191. package/src/sass/bootstrap/_media.scss +0 -8
  192. package/src/sass/bootstrap/_mixins.scss +0 -42
  193. package/src/sass/bootstrap/_modal.scss +0 -168
  194. package/src/sass/bootstrap/_nav.scss +0 -118
  195. package/src/sass/bootstrap/_navbar.scss +0 -311
  196. package/src/sass/bootstrap/_pagination.scss +0 -77
  197. package/src/sass/bootstrap/_popover.scss +0 -183
  198. package/src/sass/bootstrap/_print.scss +0 -124
  199. package/src/sass/bootstrap/_progress.scss +0 -33
  200. package/src/sass/bootstrap/_reboot.scss +0 -482
  201. package/src/sass/bootstrap/_root.scss +0 -19
  202. package/src/sass/bootstrap/_tables.scss +0 -180
  203. package/src/sass/bootstrap/_tooltip.scss +0 -115
  204. package/src/sass/bootstrap/_transitions.scss +0 -36
  205. package/src/sass/bootstrap/_type.scss +0 -125
  206. package/src/sass/bootstrap/_utilities.scss +0 -14
  207. package/src/sass/bootstrap/_variables.scss +0 -894
  208. package/src/sass/bootstrap/bootstrap-grid.scss +0 -32
  209. package/src/sass/bootstrap/bootstrap-reboot.scss +0 -12
  210. package/src/sass/bootstrap/bootstrap.scss +0 -42
  211. package/src/sass/bootstrap/mixins/_alert.scss +0 -13
  212. package/src/sass/bootstrap/mixins/_background-variant.scss +0 -21
  213. package/src/sass/bootstrap/mixins/_badge.scss +0 -12
  214. package/src/sass/bootstrap/mixins/_border-radius.scss +0 -35
  215. package/src/sass/bootstrap/mixins/_box-shadow.scss +0 -5
  216. package/src/sass/bootstrap/mixins/_breakpoints.scss +0 -123
  217. package/src/sass/bootstrap/mixins/_buttons.scss +0 -109
  218. package/src/sass/bootstrap/mixins/_caret.scss +0 -65
  219. package/src/sass/bootstrap/mixins/_clearfix.scss +0 -7
  220. package/src/sass/bootstrap/mixins/_float.scss +0 -11
  221. package/src/sass/bootstrap/mixins/_forms.scss +0 -137
  222. package/src/sass/bootstrap/mixins/_gradients.scss +0 -45
  223. package/src/sass/bootstrap/mixins/_grid-framework.scss +0 -67
  224. package/src/sass/bootstrap/mixins/_grid.scss +0 -52
  225. package/src/sass/bootstrap/mixins/_hover.scss +0 -39
  226. package/src/sass/bootstrap/mixins/_image.scss +0 -36
  227. package/src/sass/bootstrap/mixins/_list-group.scss +0 -21
  228. package/src/sass/bootstrap/mixins/_lists.scss +0 -7
  229. package/src/sass/bootstrap/mixins/_nav-divider.scss +0 -10
  230. package/src/sass/bootstrap/mixins/_navbar-align.scss +0 -10
  231. package/src/sass/bootstrap/mixins/_pagination.scss +0 -22
  232. package/src/sass/bootstrap/mixins/_reset-text.scss +0 -17
  233. package/src/sass/bootstrap/mixins/_resize.scss +0 -6
  234. package/src/sass/bootstrap/mixins/_screen-reader.scss +0 -35
  235. package/src/sass/bootstrap/mixins/_size.scss +0 -6
  236. package/src/sass/bootstrap/mixins/_table-row.scss +0 -30
  237. package/src/sass/bootstrap/mixins/_text-emphasis.scss +0 -14
  238. package/src/sass/bootstrap/mixins/_text-hide.scss +0 -9
  239. package/src/sass/bootstrap/mixins/_text-truncate.scss +0 -8
  240. package/src/sass/bootstrap/mixins/_transition.scss +0 -9
  241. package/src/sass/bootstrap/mixins/_visibility.scss +0 -7
  242. package/src/sass/bootstrap/utilities/_align.scss +0 -8
  243. package/src/sass/bootstrap/utilities/_background.scss +0 -19
  244. package/src/sass/bootstrap/utilities/_borders.scss +0 -59
  245. package/src/sass/bootstrap/utilities/_clearfix.scss +0 -3
  246. package/src/sass/bootstrap/utilities/_display.scss +0 -38
  247. package/src/sass/bootstrap/utilities/_embed.scss +0 -52
  248. package/src/sass/bootstrap/utilities/_flex.scss +0 -46
  249. package/src/sass/bootstrap/utilities/_float.scss +0 -9
  250. package/src/sass/bootstrap/utilities/_position.scss +0 -36
  251. package/src/sass/bootstrap/utilities/_screenreaders.scss +0 -11
  252. package/src/sass/bootstrap/utilities/_sizing.scss +0 -12
  253. package/src/sass/bootstrap/utilities/_spacing.scss +0 -51
  254. package/src/sass/bootstrap/utilities/_text.scss +0 -52
  255. package/src/sass/bootstrap/utilities/_visibility.scss +0 -11
  256. package/src/setupTests.js +0 -5
@@ -1,113 +0,0 @@
1
- const string = {
2
- options: [
3
- "Equals:",
4
- "Min Length:",
5
- "Max Length:",
6
- "Length Equals:",
7
- "Is Like:",
8
- "Is One Of:",
9
- ],
10
- values: ["strEquals", "minLength", "maxLength", "lengthEquals", "isLike", "isOneOf"],
11
- inputs: ["text", "number", "number", "number", "text", "text"],
12
- };
13
- const number = {
14
- options: ["Equals:", "Min:", "Max:", "Is One Of:"],
15
- values: ["numEquals", "min", "max", "isOneOf"],
16
- inputs: ["number", "number", "number", "text"],
17
- };
18
- const array = {
19
- options: ["Min Length:", "Max Length:", "Length Equals:", "Includes:"],
20
- values: ["minLength", "maxLength", "lengthEquals", "includes"],
21
- inputs: ["number", "number", "number", "text"],
22
- };
23
- const date = {
24
- options: ["Equals:", "Min:", "Max:"],
25
- values: ["dateEquals", "minDate", "maxDate"],
26
- inputs: ["datetime-local", "datetime-local", "datetime-local"],
27
- };
28
- const boolean = { options: ["Equals:"], values: ["boolEquals"], inputs: ["checkbox"] };
29
- const object = { options: [], values: [], inputs: [] };
30
- const target = {
31
- options: [
32
- //string
33
- "Equals (str):",
34
- "Min Length (str):",
35
- "Max Length (str):",
36
- "Length Equals (str):",
37
- "Is Like:",
38
- "Is One Of (str):",
39
- //number
40
- "Equals (num):",
41
- "Min (num):",
42
- "Max (num):",
43
- "Is One Of (num):",
44
- //array
45
- "Min Length (arr):",
46
- "Max Length (arr):",
47
- "Length Equals (arr):",
48
- "Includes:",
49
- //date
50
- "Date Equals:",
51
- "Min Date:",
52
- "Max Date:",
53
- //boolean
54
- "Equals (bool)",
55
- ],
56
- values: [
57
- //string
58
- "strEquals",
59
- "minLength",
60
- "maxLength",
61
- "lengthEquals",
62
- "isLike",
63
- "isOneOf",
64
- //number
65
- "numEquals",
66
- "min",
67
- "max",
68
- "isOneOf",
69
- //array
70
- "minLength",
71
- "maxLength",
72
- "lengthEquals",
73
- "includes",
74
- //date
75
- "dateEquals",
76
- "minDate",
77
- "maxDate",
78
- //boolean
79
- "boolEquals",
80
- ],
81
- inputs: [
82
- //string
83
- "text",
84
- "number",
85
- "number",
86
- "number",
87
- //number
88
- "text",
89
- "text",
90
- "number",
91
- "number",
92
- "number",
93
- "text",
94
- //array
95
- "number",
96
- "number",
97
- "number",
98
- "text",
99
- //date
100
- "datetime-local",
101
- "datetime-local",
102
- "datetime-local",
103
- "checkbox",
104
- ],
105
- };
106
- const options = { array, number, date, boolean, string, object, target };
107
- export default options;
108
- export const inputToTypes = {
109
- text: "string",
110
- number: "number",
111
- "datetime-local": "date",
112
- checkbox: "boolean",
113
- };
@@ -1,74 +0,0 @@
1
- .error-message {
2
- padding: 4px 25px;
3
- color: #ff5722;
4
- word-break: break-word;
5
- font-family: monospace;
6
- &__message-container {
7
- background: #ededed;
8
- }
9
- &__message {
10
- padding: 6px 23px;
11
- background: #ededed;
12
- border-radius: 5px;
13
- }
14
- &__namespace {
15
- color: #b136c6;
16
- font-weight: 600;
17
- }
18
- &__expected {
19
- color: #0b8b22;
20
- font-weight: 700;
21
- }
22
- }
23
-
24
- .validation-input {
25
- margin: 3px 0;
26
- display: flex;
27
- &__input,
28
- &__selector {
29
- background: none;
30
- border: none;
31
- font-family: monospace;
32
- font-size: 14px;
33
- }
34
- &__selector {
35
- padding: 3px;
36
- outline: none;
37
- border-right: none;
38
- appearance: none;
39
- cursor: pointer;
40
- font-weight: bold;
41
- color: #009688;
42
- text-indent: 5px;
43
- &:hover {
44
- background: #b3c1e8;
45
- border-radius: 33px;
46
- // color: #f1f1f1;
47
- }
48
- }
49
-
50
- &__input {
51
- padding: 4px;
52
- outline: none;
53
- color: #0d8065;
54
- }
55
- &__value {
56
- &--boolean {
57
- &--true {
58
- color: #207844;
59
- }
60
- &--false {
61
- color: #cf1515;
62
- }
63
- position: relative;
64
- top: 7px;
65
- font-weight: bold;
66
- }
67
- }
68
- }
69
- input:-webkit-autofill {
70
- border: 3px solid blue;
71
- }
72
- input:autofill {
73
- border: 3px solid blue;
74
- }
@@ -1,244 +0,0 @@
1
- import moment from "moment";
2
- import {
3
- arr,
4
- obj,
5
- parseIndex,
6
- mapNamespace,
7
- replaceLastIndex,
8
- switchArrayIndices,
9
- } from "../../organisms/TestPanel/components/test-helpers";
10
-
11
- export function evaluate(value, namespace, savedEval = {}, shouldSave) {
12
- const type = getType(value);
13
- const validations = savedEval.validations || [];
14
- const expected_type = savedEval.expected_type || type;
15
- const save = shouldSave || !!savedEval.save;
16
- const indexed = savedEval.indexed;
17
- const errors = getErrors({ type, value, validations, expected_type });
18
- return {
19
- namespace,
20
- expected_type,
21
- validations,
22
- save,
23
- indexed,
24
- type,
25
- value,
26
- errors,
27
- };
28
- }
29
-
30
- export function validateResults() {
31
- const { results, response_type, savedEvaluations, editMode } = this;
32
- const savedEvalClone = [...savedEvaluations];
33
- const shouldSave = !savedEvaluations.length;
34
- const evaluations = [];
35
- const errors = [];
36
-
37
- function getSavedIndices(data, nsp) {
38
- const randomIndex = () => {
39
- // get all matching indices and rename them
40
- // so they can be found later during getSavedEval
41
- const index = arr(data).randomIndex();
42
- const new_nsp = replaceLastIndex(nsp, index);
43
- savedEvalClone.forEach((e) => {
44
- if (!e.indexed) e.namespace = switchArrayIndices(e.namespace, new_nsp);
45
- });
46
- return index;
47
- };
48
- const savedIndices = savedEvalClone
49
- .filter(({ namespace }) => {
50
- return replaceLastIndex(namespace) === nsp;
51
- })
52
- .map((e) => {
53
- if (e.indexed) {
54
- return parseIndex(e.namespace);
55
- } else {
56
- return randomIndex();
57
- }
58
- });
59
- return savedIndices.length ? savedIndices : [randomIndex()];
60
- }
61
- const getSavedEval = (nsp) => {
62
- const i = savedEvalClone.findIndex(({ namespace }) => {
63
- return replaceLastIndex(namespace) === replaceLastIndex(nsp);
64
- });
65
- return i > -1 ? savedEvalClone.splice(i, 1)[0] : {};
66
- };
67
- const addEvaluation = (evaluation) => {
68
- evaluation.errors.forEach(
69
- (e) => evaluation.save && errors.push({ ...e, namespace: evaluation.namespace })
70
- );
71
- evaluations.push(evaluation);
72
- };
73
-
74
- //evaluate based on the result only in edit mode
75
- if (editMode)
76
- (function recursiveEval(data, namespace) {
77
- const evaluation = evaluate(data, namespace, getSavedEval(namespace), shouldSave);
78
- addEvaluation(evaluation);
79
- if (evaluation.type === "object") {
80
- Object.getOwnPropertyNames(data).forEach((prop) => {
81
- recursiveEval(data[prop], `${namespace}.${prop}`);
82
- });
83
- } else if (evaluation.type === "array") {
84
- const indices = getSavedIndices(data, `${namespace}[0]`);
85
- indices.forEach((index) => recursiveEval(data[index], `${namespace}[${index}]`));
86
- }
87
- })(results, response_type);
88
-
89
- //evaluate based on the saved evaluations
90
-
91
- // if (!editMode) {
92
- const objParser = new obj({ [response_type]: results });
93
- savedEvalClone.forEach(({ namespace, ...e }) => {
94
- const value = objParser.valueAtNsp(namespace);
95
- if (e.save) addEvaluation(evaluate(value, namespace, e));
96
- });
97
- // }
98
-
99
- Object.assign(this, {
100
- evaluations: evaluations.sort((e1, e2) => e1.namespace.localeCompare(e2.namespace)),
101
- errors,
102
- });
103
- }
104
-
105
- export function getErrors({ type, value, validations, expected_type }) {
106
- if (type !== expected_type && expected_type !== "mixed")
107
- return [{ name: "typeError", expected: expected_type, received: type }];
108
-
109
- switch (type) {
110
- case "number":
111
- return validateNumber(value, validations);
112
- case "date":
113
- return validateDate(value, validations);
114
- case "string":
115
- return validateString(value, validations);
116
- case "array":
117
- return validateArray(value, validations);
118
- case "boolean":
119
- return validateBoolean(value, validations);
120
- case "null":
121
- case "undefined":
122
- default:
123
- return [];
124
- }
125
- }
126
-
127
- export function getType(value) {
128
- switch (true) {
129
- case typeof value === "object":
130
- if (!value) return "null";
131
- else if (Array.isArray(value)) return "array";
132
- else return "object";
133
- case typeof value === "string":
134
- if (moment(value).isValid()) return "date";
135
- else return "string";
136
- case typeof value === "number":
137
- return "number";
138
- case typeof value === "boolean":
139
- return "boolean";
140
- case typeof value === "undefined":
141
- return "undefined";
142
- default:
143
- return "?";
144
- }
145
- }
146
-
147
- export const defaultValue = (data_type) => {
148
- switch (data_type) {
149
- case "string":
150
- return "";
151
- case "number":
152
- return 0;
153
- case "date":
154
- return moment().toJSON();
155
- case "boolean":
156
- return false;
157
- case "array":
158
- return [];
159
- case "object":
160
- return {};
161
- case "null":
162
- return null;
163
- case "target":
164
- return "";
165
- case "undefined":
166
- default:
167
- return undefined;
168
- }
169
- };
170
-
171
- const validateLength = (item, validations) =>
172
- validations.reduce((errors, { name, value }) => {
173
- if (name === "lengthEquals" && item.length !== value)
174
- return errors.concat({ name, expected: value, received: item.length });
175
- if (name === "maxLength" && item.length > value)
176
- return errors.concat({ name, expected: value, received: item.length });
177
- if (name === "minLength" && item.length < value)
178
- return errors.concat({ name, expected: value, received: item.length });
179
- return errors;
180
- }, []);
181
-
182
- const validateArray = (arr, validations) =>
183
- validations.reduce((errors, { name, value }) => {
184
- if (name === "includes" && !arr.includes(value))
185
- return errors.concat({ name, expected: value, received: arr });
186
- return errors;
187
- }, validateLength(arr, validations));
188
-
189
- const validateString = (str, validations) =>
190
- validations.reduce((errors, { name, value }) => {
191
- if (name === "strEquals" && str !== value)
192
- return errors.concat({ name, expected: value, received: str });
193
- //str.match() returns null when there is no match
194
- if ((name === "isLike") & !str.match(new RegExp(value, "gi")))
195
- return errors.concat({ name, expected: value, received: str });
196
- if (
197
- name === "isOneOf" &&
198
- typeof value === "string" &&
199
- !value
200
- .split(",")
201
- .map((v) => v.trim())
202
- .includes(str)
203
- )
204
- return errors.concat({ name, expected: value, received: str });
205
- return errors;
206
- }, validateLength(str, validations));
207
-
208
- const validateNumber = (num, validations) =>
209
- validations.reduce((errors, { name, value }) => {
210
- if (name === "numEquals" && num !== value)
211
- return errors.concat({ name, expected: value, received: num });
212
- if (name === "max" && num > value)
213
- return errors.concat({ name, expected: value, received: num });
214
- if (name === "min" && num < value)
215
- return errors.concat({ name, expected: value, received: num });
216
- if (
217
- name === "isOneOf" &&
218
- typeof value === "string" &&
219
- !value
220
- .split(",")
221
- .map((v) => parseInt(v))
222
- .includes(num)
223
- )
224
- return errors.concat({ name, expected: value, received: num });
225
- return errors;
226
- }, []);
227
-
228
- const validateBoolean = (bool, validations) =>
229
- validations.reduce((errors, { name, value }) => {
230
- if (name === "boolEquals" && bool !== value)
231
- return errors.concat({ name, expected: value, received: bool });
232
- return errors;
233
- }, []);
234
-
235
- const validateDate = (datetime, validations) =>
236
- validations.reduce((errors, { name, value }) => {
237
- if (name === "dateEquals" && !moment(datetime).isSame(value))
238
- return errors.concat({ name, expected: value, received: datetime });
239
- if (name === "maxDate" && moment(datetime).isAfter(value))
240
- return errors.concat({ name, expected: value, received: datetime });
241
- if (name === "minDate" && moment(datetime).isBefore(value))
242
- return errors.concat({ name, expected: value, received: datetime });
243
- return errors;
244
- }, []);
@@ -1,128 +0,0 @@
1
- import React, { useState, useContext, useEffect } from "react";
2
- import "./styles.scss";
3
- import DescriptionBox from "../../atoms/DescriptionBox/DescriptionBox";
4
- import EditBox from "../../molecules/EditBox/EditBox";
5
- import Title from "../../atoms/Title/Title";
6
- import Markdown from "../../atoms/Markdown/Markdown";
7
- import ServiceContext from "../../ServiceContext";
8
- import { Client } from "systemlynx";
9
-
10
- export default function Documentation({
11
- projectCode,
12
- serviceId,
13
- moduleName,
14
- methodName,
15
- }) {
16
- const { connectedServices } = useContext(ServiceContext);
17
-
18
- const service = connectedServices.find(
19
- (service) => service.serviceId === serviceId && service.projectCode === projectCode
20
- );
21
- const { Plugin } = service ? Client.createService(service.system.connectionData) : {};
22
-
23
- const [doc, setDocument] = useState({
24
- documentation: "",
25
- namespace: { serviceId, moduleName, methodName },
26
- });
27
-
28
- const fetchDocument = async (Plugin) => {
29
- setDocument({
30
- documentation: "",
31
- namespace: { serviceId, moduleName, methodName },
32
- });
33
- try {
34
- if (Plugin) {
35
- const results = await Plugin.getDoc({
36
- serviceId,
37
- moduleName,
38
- methodName,
39
- });
40
- setDocument(results);
41
- }
42
- } catch (error) {
43
- console.error(error);
44
- }
45
- };
46
-
47
- useEffect(() => {
48
- fetchDocument(Plugin);
49
- }, [methodName, moduleName, serviceId, Plugin]);
50
-
51
- useEffect(() => {
52
- // if (Plugin) Plugin.on(`reconnect`, fetchDocument.bind({}, Plugin));
53
- }, [Plugin]);
54
- return (
55
- <section className="documentation">
56
- <div className="documentation-view">
57
- <div className="row">
58
- <DocTitle
59
- serviceId={serviceId}
60
- moduleName={moduleName}
61
- methodName={methodName}
62
- />
63
- </div>
64
- <div className="row documentation-view__data-table">
65
- <DocDescription doc={doc} setDocument={setDocument} Plugin={Plugin} />
66
- </div>
67
- </div>
68
- </section>
69
- );
70
- }
71
-
72
- const DocTitle = ({ serviceId, moduleName, methodName, variable_name = "..." }) => {
73
- return (
74
- <Title
75
- style={{ marginBottom: "5px" }}
76
- text={
77
- <span className="documentation-view__title">
78
- {methodName && moduleName && serviceId ? (
79
- <>
80
- {`${serviceId}.${moduleName}.${methodName}`}
81
- <span className="documentation-view__parentheses">(</span>
82
- <span className="documentation-view__parameter btn">{variable_name}</span>
83
- <span className="documentation-view__parentheses">)</span>
84
- </>
85
- ) : moduleName && serviceId ? (
86
- <>{`${serviceId}.${moduleName}`}</>
87
- ) : (
88
- serviceId && <>{`${serviceId}`}</>
89
- )}
90
- </span>
91
- }
92
- />
93
- );
94
- };
95
-
96
- const DocDescription = ({ doc, setDocument, Plugin }) => {
97
- const { serviceId, methodName, moduleName } = doc;
98
- const [text, setText] = useState(doc.documentation);
99
- const saveDocument = async (setFormDisplay) => {
100
- if (Plugin) {
101
- try {
102
- const results = await Plugin.saveDoc({ ...doc, documentation: text });
103
- setDocument(results);
104
- setFormDisplay(false);
105
- } catch (error) {
106
- console.error(error);
107
- }
108
- }
109
- };
110
-
111
- const updateDoc = (documentation) => setText(documentation);
112
- const cancel = () => setText(doc.documentation);
113
-
114
- useEffect(() => {
115
- setText(doc.documentation);
116
- }, [doc]);
117
- return (
118
- <EditBox
119
- mainObject={
120
- <Markdown children={text || "Use markdown to create your documentation here"} />
121
- }
122
- hiddenForm={<DescriptionBox text={text || ""} setValue={updateDoc} />}
123
- formSubmit={saveDocument}
124
- stateChange={[serviceId, methodName, moduleName]}
125
- onCancel={cancel}
126
- />
127
- );
128
- };
File without changes
@@ -1,22 +0,0 @@
1
- .documentation-view {
2
- padding-top: 2rem;
3
- color: black;
4
-
5
- &__parameter {
6
- color: #3dceac;
7
- font-weight: bold;
8
- }
9
-
10
- &__data-table {
11
- margin-bottom: 30px;
12
- }
13
- &__title {
14
- color: #454c69;
15
- display: flex;
16
- align-items: flex-start;
17
- margin-left: 4px;
18
- }
19
- &__parentheses {
20
- font-size: 26px;
21
- }
22
- }
@@ -1,85 +0,0 @@
1
- import React, { useState } from "react";
2
- import ExpandableSection from "../../molecules/ExpandableSection/ExpandableSection";
3
- import TestCaption from "../../molecules/TestCaption/TestCaption";
4
- import TestContainer from "../TestContainer/TestContainer";
5
- import Argument from "../TestPanel/components/Argument.class";
6
-
7
- import "./styles.scss";
8
- import Count from "../../atoms/Count";
9
-
10
- const MultiTestSection = ({
11
- caption,
12
- TestController,
13
- TestSection,
14
- dynamic,
15
- namespace,
16
- arg = {},
17
- staticArguments,
18
- }) => {
19
- const className = "multi-test-section";
20
- const [open, setOpen] = useState(false);
21
-
22
- const toggleExpansion = () => {
23
- setOpen((state) => !state);
24
- };
25
-
26
- const addTest = () => {
27
- TestController.addTest(
28
- namespace,
29
- arg.name && [new Argument(arg.name, arg.FullTest, arg.input_type)]
30
- );
31
- TestSection.length === 1 && setOpen(true);
32
- };
33
- return (
34
- <section className={className}>
35
- <ExpandableSection
36
- toggleExpansion={toggleExpansion}
37
- open={open}
38
- title={
39
- <>
40
- <TestCaption
41
- caption={
42
- <span>
43
- {caption}{" "}
44
- {TestSection.length > 0 && <Count count={TestSection.length} />}
45
- </span>
46
- }
47
- />
48
- <AddButton onClick={addTest} className={className} />
49
- </>
50
- }
51
- title_color="#0d8065"
52
- >
53
- <div className={`${className}__test-data`}>
54
- {TestSection.length > 0 ? (
55
- TestSection.map((test, i) => (
56
- <TestContainer
57
- key={i}
58
- TestController={TestController}
59
- test={test}
60
- testIndex={i}
61
- title={`${i + 1}:`}
62
- title_color={"#4b53b3"}
63
- dynamic={dynamic}
64
- open={true}
65
- staticArguments={staticArguments}
66
- multiTest
67
- />
68
- ))
69
- ) : (
70
- <span>no actions</span>
71
- )}
72
- </div>
73
- </ExpandableSection>
74
- </section>
75
- );
76
- };
77
-
78
- const AddButton = ({ onClick, className }) => {
79
- return (
80
- <span className={`${className}__add-btn btn`} onClick={onClick}>
81
- +
82
- </span>
83
- );
84
- };
85
- export default MultiTestSection;
@@ -1,22 +0,0 @@
1
- .multi-test-section {
2
- width: 100%;
3
- &__test-data {
4
- background: #dadada;
5
- padding: 12px 15px;
6
- width: 100%;
7
- border-radius: 5px;
8
- }
9
- &__add-btn {
10
- padding: 0px 4px;
11
- border-radius: 21px;
12
- font-weight: bold;
13
- color: #5960b6;
14
- font-size: 16px;
15
- background: #cecee3;
16
- font-family: monospace;
17
- }
18
- }
19
-
20
- .react-json-view {
21
- font-size: 14px;
22
- }