@orchestrator-ui/orchestrator-ui-components 0.2.4 → 0.2.6

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 (444) hide show
  1. package/.storybook/main.js +1 -1
  2. package/.turbo/turbo-build.log +9 -7
  3. package/.turbo/turbo-lint.log +3 -6
  4. package/.turbo/turbo-test.log +17 -9
  5. package/CHANGELOG.md +12 -0
  6. package/dist/index.d.ts +1092 -358
  7. package/dist/index.js +22934 -6399
  8. package/jest.config.cjs +0 -1
  9. package/package.json +24 -8
  10. package/src/api/axios.ts +34 -0
  11. package/src/api/index.ts +170 -0
  12. package/src/components/WfoAuth/WfoAuth.tsx +22 -0
  13. package/src/components/WfoAuth/index.ts +1 -0
  14. package/src/components/{WFOBadges/WFOBadge/WFOBadge.stories.tsx → WfoBadges/WfoBadge/WfoBadge.stories.tsx} +5 -4
  15. package/src/components/{WFOBadges/WFOBadge/WFOBadge.tsx → WfoBadges/WfoBadge/WfoBadge.tsx} +4 -3
  16. package/src/components/WfoBadges/WfoBadge/index.ts +1 -0
  17. package/src/components/{WFOBadges/WFOEngineStatusBadge/WFOEngineStatusBadge.stories.tsx → WfoBadges/WfoEngineStatusBadge/WfoEngineStatusBadge.stories.tsx} +6 -4
  18. package/src/components/{WFOBadges/WFOEngineStatusBadge/WFOEngineStatusBadge.tsx → WfoBadges/WfoEngineStatusBadge/WfoEngineStatusBadge.tsx} +13 -7
  19. package/src/components/WfoBadges/WfoEngineStatusBadge/index.ts +1 -0
  20. package/src/components/{WFOBadges/WFOEnvironmentBadge/WFOEnvironmentBadge.stories.tsx → WfoBadges/WfoEnvironmentBadge/WfoEnvironmentBadge.stories.tsx} +6 -4
  21. package/src/components/{WFOBadges/WFOEnvironmentBadge/WFOEnvironmentBadge.tsx → WfoBadges/WfoEnvironmentBadge/WfoEnvironmentBadge.tsx} +8 -7
  22. package/src/components/WfoBadges/WfoEnvironmentBadge/index.ts +1 -0
  23. package/src/components/WfoBadges/WfoFailedTasksBadge/WfoFailedTasksBadge.stories.tsx +13 -0
  24. package/src/components/WfoBadges/WfoFailedTasksBadge/WfoFailedTasksBadge.tsx +95 -0
  25. package/src/components/WfoBadges/WfoFailedTasksBadge/index.ts +1 -0
  26. package/src/components/{WFOBadges/WFOHeaderBadge/WFOHeaderBadge.stories.tsx → WfoBadges/WfoHeaderBadge/WfoHeaderBadge.stories.tsx} +6 -4
  27. package/src/components/{WFOBadges/WFOHeaderBadge/WFOHeaderBadge.tsx → WfoBadges/WfoHeaderBadge/WfoHeaderBadge.tsx} +6 -4
  28. package/src/components/WfoBadges/WfoHeaderBadge/index.ts +1 -0
  29. package/src/components/{WFOBadges/WFOProcessStatusBadge/WFOProcessStatusBadge.tsx → WfoBadges/WfoProcessStatusBadge/WfoProcessStatusBadge.tsx} +8 -6
  30. package/src/components/WfoBadges/WfoProcessStatusBadge/index.ts +1 -0
  31. package/src/components/WfoBadges/WfoProductBlockBadge/WfoProductBlockBadge.stories.tsx +16 -0
  32. package/src/components/WfoBadges/WfoProductBlockBadge/WfoProductBlockBadge.tsx +70 -0
  33. package/src/components/WfoBadges/WfoProductBlockBadge/index.ts +1 -0
  34. package/src/components/WfoBadges/WfoProductStatusBadge/WfoProductStatusBadge.stories.tsx +22 -0
  35. package/src/components/WfoBadges/WfoProductStatusBadge/WfoProductStatusBadge.tsx +53 -0
  36. package/src/components/WfoBadges/WfoProductStatusBadge/index.ts +1 -0
  37. package/src/components/{WFOBadges/WFOSubscriptionStatusBadge/WFOSubscriptionStatusBadge.stories.tsx → WfoBadges/WfoSubscriptionStatusBadge/WfoSubscriptionStatusBadge.stories.tsx} +5 -4
  38. package/src/components/{WFOBadges/WFOSubscriptionStatusBadge/WFOSubscriptionStatusBadge.tsx → WfoBadges/WfoSubscriptionStatusBadge/WfoSubscriptionStatusBadge.tsx} +12 -10
  39. package/src/components/WfoBadges/WfoSubscriptionStatusBadge/index.ts +1 -0
  40. package/src/components/WfoBadges/WfoWorkflowTargetBadge/WfoWorkflowTargetBadge.tsx +65 -0
  41. package/src/components/WfoBadges/WfoWorkflowTargetBadge/index.ts +1 -0
  42. package/src/components/WfoBadges/index.ts +9 -0
  43. package/src/components/WfoButtonComboBox/WfoButtonComboBox.tsx +76 -0
  44. package/src/components/WfoButtonComboBox/styles.ts +13 -0
  45. package/src/components/WfoDateTime/WfoDateTime.tsx +28 -0
  46. package/src/components/WfoDateTime/index.ts +1 -0
  47. package/src/components/WfoDropdownButton/WfoDropdownButton.tsx +67 -0
  48. package/src/components/WfoDropdownButton/index.ts +1 -0
  49. package/src/components/{WFOFilterTabs/WFOFilterTabs.tsx → WfoFilterTabs/WfoFilterTabs.tsx} +8 -6
  50. package/src/components/WfoFilterTabs/index.ts +1 -0
  51. package/src/components/WfoForms/AutoFieldLoader.tsx +110 -0
  52. package/src/components/WfoForms/AutoFields.tsx +49 -0
  53. package/src/components/WfoForms/CreateForm.tsx +71 -0
  54. package/src/components/WfoForms/UserInputForm.tsx +607 -0
  55. package/src/components/WfoForms/UserInputFormStyling.ts +80 -0
  56. package/src/components/WfoForms/UserInputFormWizard.tsx +120 -0
  57. package/src/components/WfoForms/formFields/AcceptField.tsx +239 -0
  58. package/src/components/WfoForms/formFields/AcceptFieldStyling.ts +29 -0
  59. package/src/components/WfoForms/formFields/BoolField.tsx +71 -0
  60. package/src/components/WfoForms/formFields/BoolFieldStyling.ts +68 -0
  61. package/src/components/WfoForms/formFields/ContactPersonAutocomplete.tsx +97 -0
  62. package/src/components/WfoForms/formFields/ContactPersonAutocompleteStyles.ts +40 -0
  63. package/src/components/WfoForms/formFields/ContactPersonNameField.tsx +253 -0
  64. package/src/components/WfoForms/formFields/DateField.tsx +72 -0
  65. package/src/components/WfoForms/formFields/DividerField.tsx +29 -0
  66. package/src/components/WfoForms/formFields/ErrorField.tsx +40 -0
  67. package/src/components/WfoForms/formFields/ErrorsField.tsx +34 -0
  68. package/src/components/WfoForms/formFields/ImsNodeIdField.tsx +110 -0
  69. package/src/components/WfoForms/formFields/IpNetworkField.tsx +128 -0
  70. package/src/components/WfoForms/formFields/IpPrefixTableField.tsx +454 -0
  71. package/src/components/WfoForms/formFields/IpPrefixTableFieldStyling.ts +117 -0
  72. package/src/components/WfoForms/formFields/LabelField.tsx +39 -0
  73. package/src/components/WfoForms/formFields/ListAddField.tsx +98 -0
  74. package/src/components/WfoForms/formFields/ListDelField.tsx +95 -0
  75. package/src/components/WfoForms/formFields/ListField.tsx +113 -0
  76. package/src/components/WfoForms/formFields/ListItemField.tsx +40 -0
  77. package/src/components/WfoForms/formFields/ListSelectField.tsx +92 -0
  78. package/src/components/WfoForms/formFields/LocationCodeField.tsx +66 -0
  79. package/src/components/WfoForms/formFields/LongTextField.tsx +68 -0
  80. package/src/components/WfoForms/formFields/NestField.tsx +107 -0
  81. package/src/components/WfoForms/formFields/NumField.tsx +75 -0
  82. package/src/components/WfoForms/formFields/OptGroupField.tsx +74 -0
  83. package/src/components/WfoForms/formFields/OrganisationField.tsx +57 -0
  84. package/src/components/WfoForms/formFields/ProductField.tsx +78 -0
  85. package/src/components/WfoForms/formFields/RadioField.tsx +87 -0
  86. package/src/components/WfoForms/formFields/SelectField.tsx +152 -0
  87. package/src/components/WfoForms/formFields/SplitPrefix.tsx +163 -0
  88. package/src/components/WfoForms/formFields/SplitPrefixStyling.ts +11 -0
  89. package/src/components/WfoForms/formFields/SubmitField.tsx +50 -0
  90. package/src/components/WfoForms/formFields/SubscriptionField.tsx +351 -0
  91. package/src/components/WfoForms/formFields/SubscriptionFieldStyling.ts +33 -0
  92. package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +75 -0
  93. package/src/components/WfoForms/formFields/TextField.tsx +71 -0
  94. package/src/components/WfoForms/formFields/TimestampField.tsx +103 -0
  95. package/src/components/WfoForms/formFields/VlanField.tsx +297 -0
  96. package/src/components/WfoForms/formFields/index.ts +29 -0
  97. package/src/components/WfoForms/formFields/listFieldStyling.ts +86 -0
  98. package/src/components/WfoForms/formFields/reactSelectStyles.ts +45 -0
  99. package/src/components/WfoForms/formFields/surf/types.ts +53 -0
  100. package/src/components/WfoForms/formFields/surf/utils.ts +1 -0
  101. package/src/components/WfoForms/formFields/types.ts +50 -0
  102. package/src/components/WfoForms/formFields/utils.spec.ts +196 -0
  103. package/src/components/WfoForms/formFields/utils.ts +65 -0
  104. package/src/components/WfoForms/index.ts +5 -0
  105. package/src/components/WfoForms/useAxiosApiClient.ts +8 -0
  106. package/src/components/WfoInsyncIcon/WfoInsyncIcon.stories.tsx +21 -0
  107. package/src/components/WfoInsyncIcon/WfoInsyncIcon.tsx +26 -0
  108. package/src/components/WfoInsyncIcon/index.ts +1 -0
  109. package/src/components/WfoJsonCodeBlock/WfoJsonCodeBlock.tsx +27 -0
  110. package/src/components/WfoJsonCodeBlock/styles.ts +13 -0
  111. package/src/components/WfoKeyValueTable/WfoKeyCell.tsx +25 -0
  112. package/src/components/WfoKeyValueTable/WfoKeyValueTable.tsx +41 -0
  113. package/src/components/WfoKeyValueTable/WfoValueCell.tsx +53 -0
  114. package/src/components/WfoKeyValueTable/index.ts +3 -0
  115. package/src/components/WfoKeyValueTable/styles.ts +77 -0
  116. package/src/components/WfoLoading/WfoLoading.tsx +3 -0
  117. package/src/components/WfoLoading/index.ts +1 -0
  118. package/src/components/WfoNoResults/WfoNoResults.stories.tsx +19 -0
  119. package/src/components/WfoNoResults/WfoNoResults.tsx +22 -0
  120. package/src/components/WfoNoResults/index.ts +1 -0
  121. package/src/components/WfoNoResults/styles.ts +22 -0
  122. package/src/components/WfoPageHeader/WfoPageHeader.tsx +25 -0
  123. package/src/components/{WFOPageTemplate/WFOBreadcrumbs/WFOBreadcrumbs.tsx → WfoPageTemplate/WfoBreadcrumbs/WfoBreadcrumbs.tsx} +5 -2
  124. package/src/components/WfoPageTemplate/WfoBreadcrumbs/index.ts +1 -0
  125. package/src/components/{WFOPageTemplate/WFOPageHeader/WFOPageHeader.stories.tsx → WfoPageTemplate/WfoPageHeader/WfoPageHeader.stories.tsx} +7 -5
  126. package/src/components/{WFOPageTemplate/WFOPageHeader/WFOPageHeader.tsx → WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx} +26 -11
  127. package/src/components/WfoPageTemplate/WfoPageHeader/index.ts +1 -0
  128. package/src/components/{WFOPageTemplate/WFOPageTemplate/WFOPageTemplate.stories.tsx → WfoPageTemplate/WfoPageTemplate/WfoPageTemplate.stories.tsx} +8 -6
  129. package/src/components/{WFOPageTemplate/WFOPageTemplate/WFOPageTemplate.tsx → WfoPageTemplate/WfoPageTemplate/WfoPageTemplate.tsx} +20 -10
  130. package/src/components/WfoPageTemplate/WfoPageTemplate/index.ts +1 -0
  131. package/src/components/{WFOPageTemplate/WFOSidebar/WFOSidebar.stories.tsx → WfoPageTemplate/WfoSidebar/WfoSidebar.stories.tsx} +6 -4
  132. package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +161 -0
  133. package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +58 -0
  134. package/src/components/WfoPageTemplate/WfoSidebar/index.ts +1 -0
  135. package/src/components/WfoPageTemplate/index.ts +4 -0
  136. package/src/components/{WFOPageTemplate → WfoPageTemplate}/paths.ts +1 -1
  137. package/src/components/WfoProcessesList/WfoProcessList.tsx +227 -0
  138. package/src/components/WfoProcessesList/processListObjectMappers.ts +79 -0
  139. package/src/components/{WFOSearchBar/WFOSearchField.tsx → WfoSearchBar/WfoSearchField.tsx} +4 -3
  140. package/src/components/WfoSearchBar/index.ts +1 -0
  141. package/src/components/WfoSettingsModal/WfoInformationModal.tsx +41 -0
  142. package/src/components/{WFOSettingsModal/WFOSettingsModal.tsx → WfoSettingsModal/WfoSettingsModal.tsx} +3 -2
  143. package/src/components/WfoSettingsModal/index.tsx +2 -0
  144. package/src/components/{WFOSettingsPage/WFOEngineStatusButton.tsx → WfoSettingsPage/WfoEngineStatusButton.tsx} +5 -3
  145. package/src/components/{WFOSettingsPage/WFOFlushSettings.tsx → WfoSettingsPage/WfoFlushSettings.tsx} +19 -30
  146. package/src/components/{WFOSettingsPage/WFOModifySettings.tsx → WfoSettingsPage/WfoModifySettings.tsx} +7 -5
  147. package/src/components/{WFOSettingsPage/WFOSettings.tsx → WfoSettingsPage/WfoSettings.tsx} +12 -8
  148. package/src/components/{WFOSettingsPage/WFOStatus.tsx → WfoSettingsPage/WfoStatus.tsx} +8 -6
  149. package/src/components/WfoSettingsPage/index.ts +1 -0
  150. package/src/components/{WFOStartPage/WFOFrequentlyUsed.stories.tsx → WfoStartPage/WfoFrequentlyUsed.stories.tsx} +5 -4
  151. package/src/components/{WFOStartPage/WFOFrequentlyUsed.tsx → WfoStartPage/WfoFrequentlyUsed.tsx} +4 -3
  152. package/src/components/{WFOStartPage/WFOListItemStartPage.stories.tsx → WfoStartPage/WfoListItemStartPage.stories.tsx} +6 -4
  153. package/src/components/{WFOStartPage/WFOListItemStartPage.tsx → WfoStartPage/WfoListItemStartPage.tsx} +9 -6
  154. package/src/components/{WFOStartPage/WFOListStartPage.stories.tsx → WfoStartPage/WfoListStartPage.stories.tsx} +6 -4
  155. package/src/components/{WFOStartPage/WFOListStartPage.tsx → WfoStartPage/WfoListStartPage.tsx} +9 -6
  156. package/src/components/{WFOStartPage/WFOMultiListSection.stories.tsx → WfoStartPage/WfoMultiListSection.stories.tsx} +5 -4
  157. package/src/components/{WFOStartPage/WFOMultiListSection.tsx → WfoStartPage/WfoMultiListSection.tsx} +9 -6
  158. package/src/components/WfoStartPage/WfoNewProcessPanel.stories.tsx +13 -0
  159. package/src/components/{WFOStartPage/WFONewProcessPanel.tsx → WfoStartPage/WfoNewProcessPanel.tsx} +5 -3
  160. package/src/components/WfoStartPage/WfoStatCards.stories.tsx +13 -0
  161. package/src/components/{WFOStartPage/WFOStatCards.tsx → WfoStartPage/WfoStatCards.tsx} +6 -4
  162. package/src/components/WfoStartPage/index.ts +6 -0
  163. package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +51 -0
  164. package/src/components/WfoStartTaskButtonComboBox/index.ts +1 -0
  165. package/src/components/WfoSubscription/SubscriptionKeyValueBlock.tsx +46 -0
  166. package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +158 -0
  167. package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +192 -0
  168. package/src/components/WfoSubscription/WfoSubscription.tsx +145 -0
  169. package/src/components/WfoSubscription/WfoSubscriptionActions.tsx +236 -0
  170. package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +161 -0
  171. package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +147 -0
  172. package/src/components/WfoSubscription/WfoSubscriptionProductBlock.tsx +207 -0
  173. package/src/components/WfoSubscription/index.ts +8 -0
  174. package/src/components/WfoSubscription/styles.ts +104 -0
  175. package/src/components/WfoSubscription/utils/index.ts +1 -0
  176. package/src/components/WfoSubscription/utils/utils.spec.ts +168 -0
  177. package/src/components/WfoSubscription/utils/utils.ts +76 -0
  178. package/src/components/{WFOSubscriptionsList/WFOSubscriptionsList.tsx → WfoSubscriptionsList/WfoSubscriptionsList.tsx} +63 -57
  179. package/src/components/{WFOSubscriptionsList → WfoSubscriptionsList}/index.ts +1 -2
  180. package/src/components/{WFOSubscriptionsList → WfoSubscriptionsList}/mapGrapghQlSubscriptionsResultToSubscriptionListItems.ts +16 -7
  181. package/src/components/{WFOSubscriptionsList → WfoSubscriptionsList}/subscriptionListTabs.ts +18 -18
  182. package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +178 -0
  183. package/src/components/{WFOTable/WFOSortDirectionIcon.tsx → WfoTable/WfoBasicTable/WfoSortDirectionIcon.tsx} +8 -8
  184. package/src/components/WfoTable/WfoBasicTable/WfoStatusColorField.tsx +21 -0
  185. package/src/components/WfoTable/WfoBasicTable/WfoTableHeaderCell.tsx +120 -0
  186. package/src/components/WfoTable/WfoBasicTable/index.ts +4 -0
  187. package/src/components/WfoTable/WfoBasicTable/styles.ts +73 -0
  188. package/src/components/{WFOTable/WFODataGridTable/WFODataGridTable.stories.tsx → WfoTable/WfoDataGridTable/WfoDataGridTable.stories.tsx} +9 -7
  189. package/src/components/{WFOTable/WFODataGridTable/WFODataGridTable.tsx → WfoTable/WfoDataGridTable/WfoDataGridTable.tsx} +23 -21
  190. package/src/components/{WFOTable/WFODataGridTable/WFOdataGridColumns.spec.ts → WfoTable/WfoDataGridTable/WfodataGridColumns.spec.ts} +7 -7
  191. package/src/components/{WFOTable/WFODataGridTable/WFOdataGridColumns.ts → WfoTable/WfoDataGridTable/WfodataGridColumns.ts} +8 -7
  192. package/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx +11 -0
  193. package/src/components/WfoTable/WfoFirstPartUUID/index.ts +1 -0
  194. package/src/components/WfoTable/WfoSortButtons/WfoSortButton.tsx +31 -0
  195. package/src/components/WfoTable/WfoSortButtons/WfoSortButtons.tsx +33 -0
  196. package/src/components/WfoTable/WfoSortButtons/index.ts +2 -0
  197. package/src/components/WfoTable/WfoSortButtons/styles.ts +20 -0
  198. package/src/components/{WFOTable/WFOTableSettingsModal/WFOTableSettingsModal.tsx → WfoTable/WfoTableSettingsModal/WfoTableSettingsModal.tsx} +5 -3
  199. package/src/components/WfoTable/WfoTableSettingsModal/index.ts +1 -0
  200. package/src/components/WfoTable/WfoTableWithFilter/WfoTableWithFilter.tsx +253 -0
  201. package/src/components/WfoTable/WfoTableWithFilter/index.ts +1 -0
  202. package/src/components/WfoTable/index.ts +15 -0
  203. package/src/components/{WFOTable → WfoTable}/utils/columns.ts +27 -16
  204. package/src/components/{WFOTable → WfoTable}/utils/constants.ts +3 -1
  205. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.spec.ts +52 -0
  206. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +21 -0
  207. package/src/components/{WFOTable → WfoTable}/utils/tableConfigPersistence.spec.ts +4 -4
  208. package/src/components/{WFOTable → WfoTable}/utils/tableConfigPersistence.ts +12 -16
  209. package/src/components/{WFOTable → WfoTable}/utils/tableUtils.spec.ts +1 -1
  210. package/src/components/{WFOTable → WfoTable}/utils/tableUtils.ts +6 -25
  211. package/src/components/WfoTimeline/WfoTimeline.tsx +69 -0
  212. package/src/components/WfoTimeline/WfoTimelineStep.tsx +57 -0
  213. package/src/components/WfoTimeline/index.ts +1 -0
  214. package/src/components/WfoTimeline/mapProcessStepStatusToEuiStepStatus.ts +23 -0
  215. package/src/components/WfoTimeline/styles.ts +165 -0
  216. package/src/components/WfoTimeline/timelineUtils.ts +14 -0
  217. package/src/components/WfoToastsList/WfoToastsList.tsx +22 -0
  218. package/src/components/WfoToastsList/index.ts +1 -0
  219. package/src/components/WfoTree/WfoTree.tsx +27 -0
  220. package/src/components/{WFOTree/WFOTreeBranch.tsx → WfoTree/WfoTreeBranch.tsx} +7 -6
  221. package/src/components/{WFOTree/WFOTreeNode.tsx → WfoTree/WfoTreeNode.tsx} +28 -13
  222. package/src/components/WfoTree/index.ts +4 -0
  223. package/src/components/WfoTree/styles.ts +18 -0
  224. package/src/components/WfoTree/treeUtils.spec.ts +100 -0
  225. package/src/components/WfoTree/treeUtils.ts +21 -0
  226. package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.stories.tsx +13 -0
  227. package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +167 -0
  228. package/src/components/WfoWorkflowSteps/WfoStep/index.ts +1 -0
  229. package/src/components/WfoWorkflowSteps/WfoStepList/WfoStepList.tsx +107 -0
  230. package/src/components/WfoWorkflowSteps/WfoStepList/index.ts +1 -0
  231. package/src/components/WfoWorkflowSteps/WfoStepStatusIcon/WfoStepStatusIcon.stories.tsx +16 -0
  232. package/src/components/WfoWorkflowSteps/WfoStepStatusIcon/WfoStepStatusIcon.tsx +114 -0
  233. package/src/components/WfoWorkflowSteps/WfoStepStatusIcon/index.ts +1 -0
  234. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +139 -0
  235. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.stories.tsx +56 -0
  236. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.tsx +121 -0
  237. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/index.ts +2 -0
  238. package/src/components/WfoWorkflowSteps/index.ts +4 -0
  239. package/src/components/WfoWorkflowSteps/stepListUtils.spec.ts +26 -0
  240. package/src/components/WfoWorkflowSteps/stepListUtils.ts +56 -0
  241. package/src/components/WfoWorkflowSteps/styles.ts +121 -0
  242. package/src/components/confirmationDialog/ConfirmationDialogStyling.ts +12 -0
  243. package/src/components/confirmationDialog/WfoConfirmationDialog.tsx +112 -0
  244. package/src/components/confirmationDialog/index.ts +1 -0
  245. package/src/components/index.ts +19 -11
  246. package/src/contexts/ApiClientContext.tsx +30 -0
  247. package/src/contexts/ConfirmationDialogProvider.tsx +99 -0
  248. package/src/contexts/OrchestratorConfigContext.tsx +8 -3
  249. package/src/contexts/ToastContext.tsx +136 -0
  250. package/src/contexts/TreeContext.tsx +53 -32
  251. package/src/contexts/index.ts +3 -1
  252. package/src/graphqlQueries/customersQuery.ts +19 -0
  253. package/src/graphqlQueries/index.ts +4 -0
  254. package/src/graphqlQueries/processDetailQuery.ts +45 -0
  255. package/src/graphqlQueries/processListQuery.ts +17 -7
  256. package/src/graphqlQueries/productBlocksQuery.ts +13 -1
  257. package/src/graphqlQueries/productsQuery.ts +5 -1
  258. package/src/graphqlQueries/relatedSubscriptionsQuery.ts +65 -0
  259. package/src/graphqlQueries/resourceTypesQuery.ts +13 -2
  260. package/src/graphqlQueries/subscriptionDetailQuery.ts +62 -0
  261. package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +47 -0
  262. package/src/graphqlQueries/subscriptionsListQuery.ts +4 -0
  263. package/src/graphqlQueries/{workflowsQuery.ts → workflows/workflowsQuery.ts} +9 -3
  264. package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +41 -0
  265. package/src/hooks/DataFetchHooks.ts +72 -49
  266. package/src/hooks/ProcessesHooks/useDeleteProcess.ts +37 -0
  267. package/src/hooks/index.ts +4 -1
  268. package/src/hooks/surf/useGetSubscriptionDropdownOptions.ts +47 -0
  269. package/src/hooks/surf/useIsTaggedPort.ts +29 -0
  270. package/src/hooks/useDataDisplayParams.ts +1 -1
  271. package/src/hooks/useEngineStatusQuery.ts +20 -10
  272. package/src/hooks/useOrchestratorConfig.ts +6 -2
  273. package/src/hooks/useProcessStatusCountsQuery.ts +8 -23
  274. package/src/hooks/useQueryWithFetch.ts +33 -0
  275. package/src/hooks/useQueryWithGraphql.ts +18 -13
  276. package/src/hooks/useSessionWithToken.ts +14 -0
  277. package/src/hooks/useStoredTableConfig.ts +43 -0
  278. package/src/hooks/useSubscriptionActions.ts +3 -3
  279. package/src/hooks/useToastMessage.ts +5 -0
  280. package/src/hooks/useWithOrchestratorTheme.ts +10 -0
  281. package/src/icons/WfoArrowNarrowDown.stories.tsx +13 -0
  282. package/src/icons/{WFOArrowNarrowDown.tsx → WfoArrowNarrowDown.tsx} +4 -2
  283. package/src/icons/WfoArrowNarrowUp.stories.tsx +13 -0
  284. package/src/icons/{WFOArrowNarrowUp.tsx → WfoArrowNarrowUp.tsx} +4 -2
  285. package/src/icons/WfoArrowsExpand.stories.tsx +13 -0
  286. package/src/icons/WfoArrowsExpand.tsx +33 -0
  287. package/src/icons/WfoCheckmarkCircleFill.stories.tsx +13 -0
  288. package/src/icons/{WFOCheckmarkCircleFill.tsx → WfoCheckmarkCircleFill.tsx} +3 -2
  289. package/src/icons/WfoChevronDown.stories.tsx +13 -0
  290. package/src/icons/{WFOChevronDown.tsx → WfoChevronDown.tsx} +3 -2
  291. package/src/icons/WfoChevronUp.stories.tsx +13 -0
  292. package/src/icons/WfoChevronUp.tsx +33 -0
  293. package/src/icons/WfoClipboardCopy.stories.tsx +13 -0
  294. package/src/icons/WfoClipboardCopy.tsx +33 -0
  295. package/src/icons/WfoCode.stories.tsx +13 -0
  296. package/src/icons/WfoCode.tsx +35 -0
  297. package/src/icons/WfoCogFill.stories.tsx +13 -0
  298. package/src/icons/WfoCogFill.tsx +35 -0
  299. package/src/icons/WfoEyeFill.stories.tsx +13 -0
  300. package/src/icons/WfoEyeFill.tsx +35 -0
  301. package/src/icons/{WFOIconProps.ts → WfoIconProps.ts} +1 -1
  302. package/src/icons/WfoLogoutIcon.stories.tsx +13 -0
  303. package/src/icons/{WFOLogoutIcon.tsx → WfoLogoutIcon.tsx} +3 -2
  304. package/src/icons/WfoMinusCircleFill.stories.tsx +13 -0
  305. package/src/icons/WfoMinusCircleFill.tsx +33 -0
  306. package/src/icons/WfoMinusCircleOutline.stories.tsx +13 -0
  307. package/src/icons/{WFOMinusCircleOutline.tsx → WfoMinusCircleOutline.tsx} +3 -2
  308. package/src/icons/WfoPencilAlt.stories.tsx +13 -0
  309. package/src/icons/WfoPencilAlt.tsx +33 -0
  310. package/src/icons/WfoPlayFill.stories.tsx +13 -0
  311. package/src/icons/WfoPlayFill.tsx +35 -0
  312. package/src/icons/WfoPlusCircleFill.stories.tsx +13 -0
  313. package/src/icons/{WFOPlusCircleFill.tsx → WfoPlusCircleFill.tsx} +3 -2
  314. package/src/icons/WfoRefresh.stories.tsx +13 -0
  315. package/src/icons/WfoRefresh.tsx +35 -0
  316. package/src/icons/WfoSearchStrikethrough.stories.tsx +13 -0
  317. package/src/icons/WfoSearchStrikethrough.tsx +33 -0
  318. package/src/icons/WfoSortAsc.stories.tsx +13 -0
  319. package/src/icons/WfoSortAsc.tsx +33 -0
  320. package/src/icons/WfoSortDesc.stories.tsx +13 -0
  321. package/src/icons/WfoSortDesc.tsx +33 -0
  322. package/src/icons/WfoStatistic.tsx +41 -0
  323. package/src/icons/WfoStatusDotIcon.stories.tsx +13 -0
  324. package/src/icons/{WFOStatusDotIcon.tsx → WfoStatusDotIcon.tsx} +3 -2
  325. package/src/icons/WfoXCircleFill.stories.tsx +13 -0
  326. package/src/icons/{WFOXCircleFill.tsx → WfoXCircleFill.tsx} +3 -2
  327. package/src/icons/index.ts +22 -10
  328. package/src/index.ts +1 -0
  329. package/src/messages/en-US.json +173 -20
  330. package/src/messages/getTranslationMessages.spec.ts +1 -1
  331. package/src/messages/getTranslationMessages.ts +1 -1
  332. package/src/messages/nl-NL.json +177 -22
  333. package/src/pages/index.ts +2 -0
  334. package/src/pages/metadata/{WFOMetadataPageLayout.tsx → WfoMetadataPageLayout.tsx} +5 -3
  335. package/src/pages/metadata/WfoProductBlocksPage.tsx +239 -0
  336. package/src/pages/metadata/{WFOProductsPage.tsx → WfoProductsPage.tsx} +96 -54
  337. package/src/pages/metadata/WfoResourceTypesPage.tsx +185 -0
  338. package/src/pages/metadata/WfoWorkflowsPage.tsx +194 -0
  339. package/src/pages/metadata/index.ts +4 -4
  340. package/src/pages/metadata/workflowListObjectMapper.ts +43 -0
  341. package/src/pages/processes/WfoProcessDetail.tsx +327 -0
  342. package/src/pages/processes/WfoProcessDetailPage.tsx +88 -0
  343. package/src/pages/processes/WfoProcessListPage.tsx +106 -0
  344. package/src/pages/processes/WfoProcessListSubscriptionsCell.tsx +72 -0
  345. package/src/pages/processes/getProcessListTabTypeFromString.ts +6 -6
  346. package/src/pages/processes/index.ts +3 -2
  347. package/src/pages/processes/tabConfig.ts +28 -10
  348. package/src/pages/processes/timelineUtils.spec.ts +202 -0
  349. package/src/pages/processes/timelineUtils.ts +113 -0
  350. package/src/pages/subscriptions/WfoSubscriptionDetailPage.tsx +19 -0
  351. package/src/pages/subscriptions/{WFOSubscriptionsListPage.tsx → WfoSubscriptionsListPage.tsx} +40 -20
  352. package/src/pages/subscriptions/index.ts +2 -1
  353. package/src/pages/tasks/WfoTaskListPage.tsx +120 -0
  354. package/src/pages/tasks/index.ts +1 -0
  355. package/src/pages/workflow/WfoStartWorkflowPage.tsx +176 -0
  356. package/src/pages/workflow/index.ts +1 -0
  357. package/src/stories/Button.jsx +45 -39
  358. package/src/stories/Configure.mdx +48 -43
  359. package/src/stories/Header.jsx +59 -45
  360. package/src/stories/Page.jsx +81 -60
  361. package/src/stories/Page.stories.js +2 -1
  362. package/src/stories/button.css +18 -18
  363. package/src/stories/colors.mdx +12 -0
  364. package/src/stories/colors.tsx +27 -0
  365. package/src/stories/header.css +18 -18
  366. package/src/stories/page.css +40 -40
  367. package/src/theme/defaultOrchestratorTheme.ts +16 -0
  368. package/src/types/forms.ts +40 -0
  369. package/src/types/index.ts +0 -1
  370. package/src/types/types.ts +283 -73
  371. package/src/utils/date.spec.ts +157 -5
  372. package/src/utils/date.ts +66 -5
  373. package/src/utils/environmentVariables.spec.ts +17 -0
  374. package/src/utils/environmentVariables.ts +12 -0
  375. package/src/utils/getDefaultTableConfig.ts +101 -0
  376. package/src/utils/getProductNamesFromProcess.spec.ts +133 -0
  377. package/src/utils/getProductNamesFromProcess.ts +16 -0
  378. package/src/utils/getTokenName.ts +2 -1
  379. package/src/utils/index.ts +2 -0
  380. package/src/utils/string.spec.ts +24 -1
  381. package/src/utils/strings.ts +5 -0
  382. package/tsconfig.build.json +18 -0
  383. package/tsconfig.json +8 -2
  384. package/src/components/WFOBadges/WFOBadge/index.ts +0 -1
  385. package/src/components/WFOBadges/WFOEngineStatusBadge/index.ts +0 -1
  386. package/src/components/WFOBadges/WFOEnvironmentBadge/index.ts +0 -1
  387. package/src/components/WFOBadges/WFOFailedTasksBadge/WFOFailedTasksBadge.stories.tsx +0 -12
  388. package/src/components/WFOBadges/WFOFailedTasksBadge/WFOFailedTasksBadge.tsx +0 -63
  389. package/src/components/WFOBadges/WFOFailedTasksBadge/index.ts +0 -1
  390. package/src/components/WFOBadges/WFOHeaderBadge/index.ts +0 -1
  391. package/src/components/WFOBadges/WFOProcessStatusBadge/index.ts +0 -1
  392. package/src/components/WFOBadges/WFOProductBlockBadge/WFOProductBlockBadge.stories.tsx +0 -15
  393. package/src/components/WFOBadges/WFOProductBlockBadge/WFOProductBlockBadge.tsx +0 -22
  394. package/src/components/WFOBadges/WFOProductBlockBadge/index.ts +0 -1
  395. package/src/components/WFOBadges/WFOSubscriptionStatusBadge/index.ts +0 -1
  396. package/src/components/WFOBadges/index.ts +0 -8
  397. package/src/components/WFOFilterTabs/index.ts +0 -1
  398. package/src/components/WFOLoading/WFOLoading.tsx +0 -2
  399. package/src/components/WFOLoading/index.ts +0 -1
  400. package/src/components/WFOPageTemplate/WFOBreadcrumbs/index.ts +0 -1
  401. package/src/components/WFOPageTemplate/WFOPageHeader/index.ts +0 -1
  402. package/src/components/WFOPageTemplate/WFOPageTemplate/index.ts +0 -1
  403. package/src/components/WFOPageTemplate/WFOSidebar/WFOSidebar.tsx +0 -161
  404. package/src/components/WFOPageTemplate/WFOSidebar/index.ts +0 -1
  405. package/src/components/WFOPageTemplate/index.ts +0 -4
  406. package/src/components/WFOSearchBar/index.ts +0 -1
  407. package/src/components/WFOSettingsModal/index.tsx +0 -1
  408. package/src/components/WFOSettingsPage/index.ts +0 -1
  409. package/src/components/WFOStartPage/WFONewProcessPanel.stories.tsx +0 -12
  410. package/src/components/WFOStartPage/WFOStatCards.stories.tsx +0 -12
  411. package/src/components/WFOStartPage/index.ts +0 -6
  412. package/src/components/WFOSubscription/WFOFixedInputBlock.tsx +0 -58
  413. package/src/components/WFOSubscription/WFOProcessesTimeline.tsx +0 -105
  414. package/src/components/WFOSubscription/WFOProductBlock.tsx +0 -186
  415. package/src/components/WFOSubscription/WFOSubscriptionActions.tsx +0 -138
  416. package/src/components/WFOSubscription/WFOSubscriptionBlock.tsx +0 -109
  417. package/src/components/WFOSubscription/WFOSubscriptionDetailTree.tsx +0 -184
  418. package/src/components/WFOSubscription/WFOSubscriptionGeneral.tsx +0 -53
  419. package/src/components/WFOSubscription/index.ts +0 -7
  420. package/src/components/WFOSubscription/styles.ts +0 -18
  421. package/src/components/WFOSubscriptionsList/types.ts +0 -11
  422. package/src/components/WFOTable/WFOTable.tsx +0 -85
  423. package/src/components/WFOTable/WFOTableHeaderCell.tsx +0 -30
  424. package/src/components/WFOTable/WFOTableSettingsModal/index.ts +0 -1
  425. package/src/components/WFOTable/WFOTableWithFilter/WFOTableWithFilter.tsx +0 -174
  426. package/src/components/WFOTable/WFOTableWithFilter/index.ts +0 -1
  427. package/src/components/WFOTable/index.ts +0 -14
  428. package/src/components/WFOTree/WFOTree.tsx +0 -16
  429. package/src/contexts/SubscriptionContext.tsx +0 -72
  430. package/src/hooks/useSubscriptionProcesses.ts +0 -45
  431. package/src/icons/WFOCheckmarkCircleFill.stories.tsx +0 -12
  432. package/src/icons/WFOLogoutIcon.stories.tsx +0 -12
  433. package/src/icons/WFOMinusCircleOutline.stories.tsx +0 -12
  434. package/src/icons/WFOPlusCircleFill.stories.tsx +0 -12
  435. package/src/icons/WFOStatusDotIcon.stories.tsx +0 -12
  436. package/src/icons/WFOXCircleFill.stories.tsx +0 -12
  437. package/src/pages/metadata/WFOProductBlocksPage.tsx +0 -166
  438. package/src/pages/metadata/WFOResourceTypesPage.tsx +0 -120
  439. package/src/pages/metadata/WFOWorkflowsPage.tsx +0 -251
  440. package/src/pages/processes/WFOProcessListPage.tsx +0 -213
  441. package/src/pages/processes/WFOProcessesListSubscriptionsCell.tsx +0 -28
  442. package/src/pages/processes/tableConfig.ts +0 -22
  443. package/src/types/subscription.ts +0 -21
  444. package/src/components/{WFOTable → WfoTable}/utils/columns.spec.ts +1 -1
@@ -0,0 +1,454 @@
1
+ /*
2
+ * Copyright 2019-2023 SURF.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS,
10
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ * See the License for the specific language governing permissions and
12
+ * limitations under the License.
13
+ *
14
+ */
15
+ import React from 'react';
16
+ import ReactSelect, { SingleValue } from 'react-select';
17
+
18
+ import {
19
+ EuiBadge,
20
+ EuiButton,
21
+ EuiButtonIcon,
22
+ EuiCheckbox,
23
+ EuiFieldText,
24
+ EuiFlexGroup,
25
+ EuiFlexItem,
26
+ EuiFormRow,
27
+ EuiInMemoryTable,
28
+ EuiPanel,
29
+ EuiText,
30
+ } from '@elastic/eui';
31
+
32
+ import { ApiClientContext } from '../../../contexts';
33
+ import { ipPrefixTableFieldStyling } from './IpPrefixTableFieldStyling';
34
+ import { IpBlock, IpPrefix, SortOption } from './surf/types';
35
+ import { ipamStates } from './surf/utils';
36
+ import { Option, prop } from './types';
37
+
38
+ type SortKeys = 'id' | 'prefix' | 'description' | 'state_repr';
39
+
40
+ interface IProps {
41
+ id: string;
42
+ name: string;
43
+ onChange: (prefix: IpBlock) => void;
44
+ onManualOverride: (prefixString: string) => void;
45
+ selected_prefix_id?: number;
46
+ }
47
+
48
+ interface IState {
49
+ ipBlocks: IpBlock[];
50
+ loading: boolean;
51
+ filteredIpBlocks: IpBlock[];
52
+ filteredPrefixes: IpPrefix[];
53
+ filter: { state: number[]; prefix?: IpPrefix };
54
+ sorted: SortOption<SortKeys>;
55
+ manualOverrideVisible: boolean;
56
+ manualOverrideValue: string;
57
+ selectionDone: boolean;
58
+ }
59
+
60
+ export default class IpPrefixTableField extends React.PureComponent<IProps> {
61
+ static contextType = ApiClientContext;
62
+ context!: React.ContextType<typeof ApiClientContext>;
63
+ state: IState = {
64
+ ipBlocks: [],
65
+ loading: true,
66
+ filteredIpBlocks: [],
67
+ filteredPrefixes: [],
68
+ selectionDone: false,
69
+ filter: {
70
+ state: [
71
+ ipamStates.indexOf('Free'),
72
+ ipamStates.indexOf('Allocated'),
73
+ ipamStates.indexOf('Planned'),
74
+ ipamStates.indexOf('Subnet'),
75
+ ],
76
+ prefix: undefined,
77
+ },
78
+ sorted: {
79
+ name: 'prefix',
80
+ descending: false,
81
+ },
82
+ manualOverrideVisible: false,
83
+ manualOverrideValue: '',
84
+ };
85
+
86
+ componentDidMount() {
87
+ this.context.apiClient.prefix_filters().then((result: IpPrefix[]) => {
88
+ const { filter } = this.state;
89
+ filter.prefix = result[0];
90
+ this.setState({
91
+ filteredPrefixes: result,
92
+ filter: filter,
93
+ filteredIpBlocks: this.filterAndSortBlocks(),
94
+ });
95
+ });
96
+ this.context.apiClient.ip_blocks(1).then((result: IpBlock[]) => {
97
+ this.setState({ ipBlocks: result, loading: false });
98
+ });
99
+ }
100
+
101
+ sort = (name: SortKeys) => (e: React.SyntheticEvent) => {
102
+ if (e !== undefined && e !== null) {
103
+ e.preventDefault();
104
+ e.stopPropagation();
105
+ }
106
+ const sorted = { ...this.state.sorted };
107
+
108
+ sorted.descending = sorted.name === name ? !sorted.descending : false;
109
+ sorted.name = name;
110
+ this.setState({
111
+ sorted: sorted,
112
+ filteredIpBlocks: this.filterAndSortBlocks(),
113
+ });
114
+ };
115
+
116
+ sortBy =
117
+ (name: SortKeys) =>
118
+ (a: IpBlock, b: IpBlock): number => {
119
+ const aVal = prop(a, name);
120
+ const bVal = prop(b, name);
121
+ try {
122
+ return typeof aVal === 'string' && typeof bVal === 'string'
123
+ ? aVal.toLowerCase().localeCompare(bVal.toLowerCase())
124
+ : (aVal as number) - (bVal as number);
125
+ } catch (e) {
126
+ console.log(e);
127
+ }
128
+ return 0;
129
+ };
130
+
131
+ sortColumnIcon = (name: string, sorted: SortOption) => {
132
+ if (sorted.name === name) {
133
+ return (
134
+ <i
135
+ className={
136
+ sorted.descending
137
+ ? 'fas fa-sort-down'
138
+ : 'fas fa-sort-up'
139
+ }
140
+ />
141
+ );
142
+ }
143
+ return <i />;
144
+ };
145
+
146
+ filterState = (e: React.ChangeEvent<HTMLInputElement>) => {
147
+ const target = e.target as HTMLInputElement;
148
+ const state_filter = parseInt(target.value, 10);
149
+ const { filter } = this.state;
150
+ if (target.checked) {
151
+ filter.state.push(state_filter);
152
+ } else {
153
+ filter.state = filter.state.filter((e) => e !== state_filter);
154
+ }
155
+ this.setState({
156
+ filter: filter,
157
+ filteredIpBlocks: this.filterAndSortBlocks(),
158
+ });
159
+ };
160
+
161
+ filterParentPrefix = (e: SingleValue<Option>) => {
162
+ this.setState({ loading: true });
163
+ const parentPrefix = parseInt(e!.value, 10);
164
+ const { filter, filteredPrefixes } = this.state;
165
+ let the_prefix: IpPrefix | undefined = undefined;
166
+ filteredPrefixes.forEach(
167
+ (prefix) =>
168
+ (the_prefix =
169
+ prefix['id'] === parentPrefix ? prefix : the_prefix),
170
+ );
171
+ filter.prefix = the_prefix;
172
+ this.context.apiClient
173
+ .ip_blocks(parentPrefix)
174
+ .then((result: IpBlock[]) => {
175
+ this.setState({
176
+ ipBlocks: result,
177
+ filteredIpBlocks: this.filterAndSortBlocks(),
178
+ loading: false,
179
+ filter: filter,
180
+ });
181
+ });
182
+ };
183
+
184
+ filterAndSortBlocks() {
185
+ const { filter, sorted, ipBlocks } = this.state;
186
+ let filteredIpBlocks = ipBlocks;
187
+ const keys = Object.keys(filter) as ('state' | 'prefix')[];
188
+ keys.map((key) => {
189
+ if (key === 'state') {
190
+ filteredIpBlocks = filteredIpBlocks.filter((i) =>
191
+ filter[key].includes(i[key]),
192
+ );
193
+ } else if (key === 'prefix' && filter.prefix !== undefined) {
194
+ filteredIpBlocks = filteredIpBlocks.filter(
195
+ (i) => i.parent === filter.prefix!.id,
196
+ );
197
+ } else if (key !== 'prefix') {
198
+ filteredIpBlocks = filteredIpBlocks.filter(
199
+ (i) => prop(i, key) === prop(filter, key),
200
+ );
201
+ }
202
+ return key;
203
+ });
204
+ filteredIpBlocks.sort(this.sortBy(sorted.name));
205
+ return sorted.descending
206
+ ? filteredIpBlocks.reverse()
207
+ : filteredIpBlocks;
208
+ }
209
+
210
+ selectPrefix = (prefix: IpBlock) => () => {
211
+ if (prefix.state === 0 || prefix.state === 1) {
212
+ this.setState({ selectionDone: true });
213
+ this.props.onChange(prefix);
214
+ }
215
+ };
216
+
217
+ render() {
218
+ const { id, name, selected_prefix_id } = this.props;
219
+ const {
220
+ filteredPrefixes,
221
+ manualOverrideVisible,
222
+ selectionDone,
223
+ loading,
224
+ manualOverrideValue,
225
+ } = this.state;
226
+ const ipBlocks = this.filterAndSortBlocks();
227
+
228
+ const columns = [
229
+ {
230
+ field: 'id',
231
+ name: 'ID',
232
+ sortable: true,
233
+ truncateText: true,
234
+ },
235
+ {
236
+ field: 'prefix',
237
+ name: 'Prefix',
238
+ sortable: true,
239
+ },
240
+ {
241
+ field: 'description',
242
+ name: 'Description',
243
+ truncateText: true,
244
+ sortable: true,
245
+ },
246
+ {
247
+ field: 'state',
248
+ name: 'Status',
249
+ sortable: true,
250
+ render: (prefixState: number) => (
251
+ <EuiBadge color={prefixState === 3 ? 'danger' : 'success'}>
252
+ {ipamStates[prefixState]}
253
+ </EuiBadge>
254
+ ),
255
+ },
256
+ {
257
+ field: 'Action',
258
+ name: '',
259
+ render: (id: string, record: IpBlock) =>
260
+ record.state !== 3 ? (
261
+ <EuiButton
262
+ onClick={this.selectPrefix(record)}
263
+ id={`select-prefix-${id}-button`}
264
+ >
265
+ Select
266
+ </EuiButton>
267
+ ) : null,
268
+ },
269
+ ];
270
+
271
+ const { state, prefix } = { ...this.state.filter };
272
+ const parentPrefix = prefix?.id;
273
+
274
+ const options: Option[] = filteredPrefixes.map((fp) => ({
275
+ value: fp.id.toString(),
276
+ label: fp.prefix,
277
+ }));
278
+ const value = options.find(
279
+ (option) => option.value === parentPrefix?.toString(),
280
+ );
281
+
282
+ const pagination = {
283
+ initialPageSize: 25,
284
+ pageSizeOptions: [25, 50, 100, 250],
285
+ };
286
+
287
+ if (selected_prefix_id && selectionDone) {
288
+ return (
289
+ <EuiButton
290
+ id="undo-parent-prefix-choice-button"
291
+ iconType="editorUndo"
292
+ onClick={() => this.setState({ selectionDone: false })}
293
+ >
294
+ Reset parent prefix choice
295
+ </EuiButton>
296
+ );
297
+ }
298
+ // Todo 482: re-implement when this component is refactored to function based
299
+ // const customStyles = getReactSelectTheme(this.context.theme);
300
+
301
+ return (
302
+ <EuiFlexItem css={ipPrefixTableFieldStyling}>
303
+ <div>
304
+ <EuiFlexGroup
305
+ gutterSize="s"
306
+ style={{ marginTop: '5px', marginBottom: '10px' }}
307
+ >
308
+ <EuiFlexItem grow={false}>
309
+ <EuiText>
310
+ <h4>Manual override?</h4>
311
+ </EuiText>
312
+ </EuiFlexItem>
313
+ <EuiFlexItem grow={false}>
314
+ <EuiButtonIcon
315
+ iconType={
316
+ manualOverrideVisible
317
+ ? 'arrowDown'
318
+ : 'arrowRight'
319
+ }
320
+ aria-label="Toggle manual override"
321
+ onClick={() =>
322
+ this.setState({
323
+ manualOverrideVisible:
324
+ !manualOverrideVisible,
325
+ })
326
+ }
327
+ />
328
+ </EuiFlexItem>
329
+ <EuiFlexItem></EuiFlexItem>
330
+ </EuiFlexGroup>
331
+ {manualOverrideVisible && (
332
+ <EuiPanel style={{ marginBottom: '20px' }}>
333
+ <EuiFormRow
334
+ style={{ marginTop: '15px' }}
335
+ label="Manually enter a prefix"
336
+ labelAppend={
337
+ <EuiText size="m">
338
+ Generating free spaces for a big IPv6
339
+ root prefix could yield an enormous
340
+ list. If you know the address of a free
341
+ subnet you can provide it here. The
342
+ prefix will be created in the biggest
343
+ existing prefix above it in one of the
344
+ root prefixes.
345
+ </EuiText>
346
+ }
347
+ helpText="Example: 145.145.10/17"
348
+ >
349
+ <EuiFieldText
350
+ value={manualOverrideValue}
351
+ onChange={(e) =>
352
+ this.setState({
353
+ manualOverrideValue: e.target.value,
354
+ })
355
+ }
356
+ ></EuiFieldText>
357
+ </EuiFormRow>
358
+ <EuiButton
359
+ onClick={() =>
360
+ this.props.onManualOverride(
361
+ manualOverrideValue,
362
+ )
363
+ }
364
+ >
365
+ Confirm
366
+ </EuiButton>
367
+ </EuiPanel>
368
+ )}
369
+ </div>
370
+ {!manualOverrideVisible && (
371
+ <>
372
+ <div>
373
+ <EuiFlexGroup gutterSize="s">
374
+ <EuiFlexItem
375
+ grow={false}
376
+ style={{ marginTop: '6px' }}
377
+ >
378
+ State:
379
+ </EuiFlexItem>
380
+ <EuiFlexItem grow={false}>
381
+ <EuiCheckbox
382
+ id="checkbox-allocated"
383
+ label="Allocated"
384
+ name="checkbox-allocated"
385
+ onChange={this.filterState}
386
+ value={ipamStates.indexOf('Allocated')}
387
+ checked={state.includes(
388
+ ipamStates.indexOf('Allocated'),
389
+ )}
390
+ />
391
+ </EuiFlexItem>
392
+ <EuiFlexItem grow={false}>
393
+ <EuiCheckbox
394
+ id="checkbox-planned"
395
+ label="Planned"
396
+ name="checkbox-planned"
397
+ onChange={this.filterState}
398
+ value={ipamStates.indexOf('Planned')}
399
+ checked={state.includes(
400
+ ipamStates.indexOf('Planned'),
401
+ )}
402
+ />
403
+ </EuiFlexItem>
404
+ <EuiFlexItem grow={false}>
405
+ <EuiCheckbox
406
+ id="checkbox-free"
407
+ label="Free"
408
+ name="checkbox-free"
409
+ onChange={this.filterState}
410
+ value={ipamStates.indexOf('Free')}
411
+ checked={state.includes(
412
+ ipamStates.indexOf('Free'),
413
+ )}
414
+ />
415
+ </EuiFlexItem>
416
+ </EuiFlexGroup>
417
+ <div
418
+ style={{
419
+ marginTop: '4px',
420
+ marginBottom: '4px',
421
+ }}
422
+ >
423
+ Root filter
424
+ </div>
425
+ <span>
426
+ <ReactSelect
427
+ id={`${id}.root-filter`}
428
+ // Todo 482: re-implement when this component is refactored to function based
429
+ // styles={customStyles}
430
+ inputId={`${id}.root-filter.search`}
431
+ name={`${name}.root-filter`}
432
+ options={options}
433
+ onChange={this.filterParentPrefix}
434
+ value={value}
435
+ />
436
+ </span>
437
+ </div>
438
+ <EuiInMemoryTable
439
+ id="test"
440
+ style={{ marginTop: '6px' }}
441
+ itemId="id"
442
+ tableCaption="Prefix table"
443
+ loading={loading}
444
+ items={ipBlocks}
445
+ columns={columns}
446
+ pagination={pagination}
447
+ sorting={true}
448
+ />
449
+ </>
450
+ )}
451
+ </EuiFlexItem>
452
+ );
453
+ }
454
+ }
@@ -0,0 +1,117 @@
1
+ import { css } from '@emotion/react';
2
+
3
+ const DARK_GREY_COLOR = '#333333';
4
+ const LIGHTER_GREY_COLOR = '#999999';
5
+ const LIGHT_GOLD_COLOR = '#fca456';
6
+ const LIGHT_PRIMARY_COLOR = '#0da3f5';
7
+ const LIGHT_SUCCESS_COLOR = '#68ff1d';
8
+
9
+ function shadeColor(color: string, percent: number) {
10
+ let R = parseInt(color.substring(1, 3), 16);
11
+ let G = parseInt(color.substring(3, 5), 16);
12
+ let B = parseInt(color.substring(5, 7), 16);
13
+
14
+ R = parseInt(String((R * (100 + percent)) / 100));
15
+ G = parseInt(String((G * (100 + percent)) / 100));
16
+ B = parseInt(String((B * (100 + percent)) / 100));
17
+
18
+ R = R < 255 ? R : 255;
19
+ G = G < 255 ? G : 255;
20
+ B = B < 255 ? B : 255;
21
+
22
+ const RR =
23
+ R.toString(16).length === 1 ? '0' + R.toString(16) : R.toString(16);
24
+ const GG =
25
+ G.toString(16).length === 1 ? '0' + G.toString(16) : G.toString(16);
26
+ const BB =
27
+ B.toString(16).length === 1 ? '0' + B.toString(16) : B.toString(16);
28
+
29
+ return '#' + RR + GG + BB;
30
+ }
31
+
32
+ export const ipPrefixTableFieldStyling = css`
33
+ table.ip-blocks {
34
+ word-break: break-all;
35
+ margin-bottom: 20px;
36
+
37
+ td,
38
+ th {
39
+ text-align: left;
40
+ }
41
+ tr {
42
+ border-bottom: 1px solid ${LIGHTER_GREY_COLOR};
43
+ }
44
+ tr.Allocated {
45
+ cursor: pointer;
46
+ background-color: ${LIGHT_PRIMARY_COLOR};
47
+ &:hover {
48
+ background-color: ${shadeColor(LIGHT_PRIMARY_COLOR, -10)};
49
+ }
50
+ }
51
+ tr.Planned {
52
+ cursor: default;
53
+ background-color: ${LIGHT_GOLD_COLOR};
54
+ }
55
+ tr.Free {
56
+ cursor: pointer;
57
+ background-color: ${LIGHT_SUCCESS_COLOR};
58
+ &:hover {
59
+ background-color: ${shadeColor(LIGHT_SUCCESS_COLOR, -10)};
60
+ }
61
+ }
62
+ tr.Subnet {
63
+ background-color: ${shadeColor(LIGHT_PRIMARY_COLOR, -30)};
64
+ cursor: default;
65
+ }
66
+ tr.selected {
67
+ background-color: ${DARK_GREY_COLOR};
68
+ color: white;
69
+ &:hover {
70
+ background-color: black;
71
+ }
72
+ }
73
+ thead {
74
+ display: block;
75
+ th {
76
+ cursor: pointer;
77
+ padding: 5px 5px 10px 5px;
78
+ }
79
+ th.id {
80
+ min-width: 8em;
81
+ }
82
+ th.prefix {
83
+ min-width: 15em;
84
+ }
85
+ th.description {
86
+ width: 30em;
87
+ }
88
+ th.state {
89
+ min-width: 25em;
90
+ }
91
+ }
92
+
93
+ tbody {
94
+ min-width: 1000px;
95
+ height: 240px;
96
+ display: block;
97
+ overflow: auto;
98
+ td {
99
+ word-break: break-word;
100
+ word-wrap: break-word;
101
+ padding: 15px 5px;
102
+ }
103
+ td.id {
104
+ min-width: 8em;
105
+ }
106
+ td.prefix {
107
+ min-width: 15em;
108
+ }
109
+ td.description {
110
+ width: 30em;
111
+ }
112
+ td.state {
113
+ min-width: 25em;
114
+ }
115
+ }
116
+ }
117
+ `;
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright 2019-2023 SURF.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS,
10
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ * See the License for the specific language governing permissions and
12
+ * limitations under the License.
13
+ *
14
+ */
15
+ import React from 'react';
16
+
17
+ import { connectField, filterDOMProps } from 'uniforms';
18
+
19
+ import { FieldProps } from '../../../types/forms';
20
+
21
+ export type LabelFieldProps = FieldProps<null, object, null, HTMLDivElement>;
22
+
23
+ // onChange not used on purpose
24
+ function Label({ id, value, label, ...props }: LabelFieldProps) {
25
+ return (
26
+ <section {...filterDOMProps(props)}>
27
+ <label
28
+ id={id}
29
+ className={`euiFormLabel euiFormRow__label${
30
+ value ? '__large' : ''
31
+ }`}
32
+ >
33
+ {value ? value : label}
34
+ </label>
35
+ </section>
36
+ );
37
+ }
38
+
39
+ export const LabelField = connectField(Label, { kind: 'leaf' });