@orchestrator-ui/orchestrator-ui-components 0.2.0 → 0.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 (215) hide show
  1. package/.storybook/main.js +28 -0
  2. package/.storybook/preview.js +14 -0
  3. package/.turbo/turbo-build.log +4 -4
  4. package/.turbo/turbo-lint.log +5 -10
  5. package/.turbo/turbo-test.log +9 -11
  6. package/CHANGELOG.md +12 -0
  7. package/dist/index.d.ts +683 -562
  8. package/dist/index.js +4088 -525
  9. package/package.json +19 -5
  10. package/src/components/{Badges/Badge/Badge.stories.tsx → WFOBadges/WFOBadge/WFOBadge.stories.tsx} +4 -4
  11. package/src/components/{Badges/Badge/Badge.tsx → WFOBadges/WFOBadge/WFOBadge.tsx} +2 -2
  12. package/src/components/WFOBadges/WFOBadge/index.ts +1 -0
  13. package/src/components/{Badges/EngineStatusBadge/EngineStatusBadge.stories.tsx → WFOBadges/WFOEngineStatusBadge/WFOEngineStatusBadge.stories.tsx} +4 -4
  14. package/src/components/{Badges/EngineStatusBadge/EngineStatusBadge.tsx → WFOBadges/WFOEngineStatusBadge/WFOEngineStatusBadge.tsx} +6 -6
  15. package/src/components/WFOBadges/WFOEngineStatusBadge/index.ts +1 -0
  16. package/src/components/{Badges/EnvironmentBadge/EnvironmentBadge.stories.tsx → WFOBadges/WFOEnvironmentBadge/WFOEnvironmentBadge.stories.tsx} +4 -4
  17. package/src/components/{Badges/EnvironmentBadge/EnvironmentBadge.tsx → WFOBadges/WFOEnvironmentBadge/WFOEnvironmentBadge.tsx} +6 -6
  18. package/src/components/WFOBadges/WFOEnvironmentBadge/index.ts +1 -0
  19. package/src/components/WFOBadges/WFOFailedTasksBadge/WFOFailedTasksBadge.stories.tsx +12 -0
  20. package/src/components/{Badges/FailedTasksBadge/FailedTasksBadge.tsx → WFOBadges/WFOFailedTasksBadge/WFOFailedTasksBadge.tsx} +6 -6
  21. package/src/components/WFOBadges/WFOFailedTasksBadge/index.ts +1 -0
  22. package/src/components/{Badges/HeaderBadge/HeaderBadge.stories.tsx → WFOBadges/WFOHeaderBadge/WFOHeaderBadge.stories.tsx} +4 -4
  23. package/src/components/{Badges/HeaderBadge/HeaderBadge.tsx → WFOBadges/WFOHeaderBadge/WFOHeaderBadge.tsx} +4 -4
  24. package/src/components/WFOBadges/WFOHeaderBadge/index.ts +1 -0
  25. package/src/components/WFOBadges/WFOProcessStatusBadge/WFOProcessStatusBadge.tsx +71 -0
  26. package/src/components/WFOBadges/WFOProcessStatusBadge/index.ts +1 -0
  27. package/src/components/{Badges → WFOBadges}/WFOProductBlockBadge/WFOProductBlockBadge.stories.tsx +1 -1
  28. package/src/components/{Badges → WFOBadges}/WFOProductBlockBadge/WFOProductBlockBadge.tsx +3 -3
  29. package/src/components/{Badges → WFOBadges}/WFOStatusBadge/WFOStatusBadge.stories.tsx +1 -1
  30. package/src/components/{Badges → WFOBadges}/WFOStatusBadge/WFOStatusBadge.tsx +3 -3
  31. package/src/components/WFOBadges/index.ts +8 -0
  32. package/src/components/{Breadcrumbs/Breadcrumbs.tsx → WFOBreadcrumbs/WFOBreadcrumbs.tsx} +1 -1
  33. package/src/components/WFOBreadcrumbs/index.ts +1 -0
  34. package/src/components/WFOFilterTabs/WFOFilterTabs.tsx +43 -0
  35. package/src/components/WFOFilterTabs/index.ts +1 -0
  36. package/src/components/WFOLoading/WFOLoading.tsx +2 -0
  37. package/src/components/WFOLoading/index.ts +1 -0
  38. package/src/components/{OrchestratorPageTemplate/OrchestratorPageHeader/OrchestratorPageHeader.stories.tsx → WFOPageTemplate/WFOPageHeader/WFOPageHeader.stories.tsx} +5 -13
  39. package/src/components/{OrchestratorPageTemplate/OrchestratorPageHeader/OrchestratorPageHeader.tsx → WFOPageTemplate/WFOPageHeader/WFOPageHeader.tsx} +10 -10
  40. package/src/components/WFOPageTemplate/WFOPageHeader/index.ts +1 -0
  41. package/src/components/WFOPageTemplate/WFOPageTemplate/WFOPageTemplate.stories.tsx +24 -0
  42. package/src/components/{OrchestratorPageTemplate/OrchestratorPageTemplate/OrchestratorPageTemplate.tsx → WFOPageTemplate/WFOPageTemplate/WFOPageTemplate.tsx} +6 -6
  43. package/src/components/WFOPageTemplate/WFOPageTemplate/index.ts +1 -0
  44. package/src/components/{OrchestratorPageTemplate/OrchestratorSidebar/OrchestratorSidebar.stories.tsx → WFOPageTemplate/WFOSidebar/WFOSidebar.stories.tsx} +4 -4
  45. package/src/components/{OrchestratorPageTemplate/OrchestratorSidebar/OrchestratorSidebar.tsx → WFOPageTemplate/WFOSidebar/WFOSidebar.tsx} +2 -14
  46. package/src/components/WFOPageTemplate/WFOSidebar/index.ts +1 -0
  47. package/src/components/WFOPageTemplate/index.ts +3 -0
  48. package/src/components/{SearchBar/SearchField.tsx → WFOSearchBar/WFOSearchField.tsx} +3 -3
  49. package/src/components/WFOSearchBar/index.ts +1 -0
  50. package/src/components/WFOSettingsModal/index.tsx +1 -0
  51. package/src/components/{SettingsPage/EngineStatusButton.tsx → WFOSettingsPage/WFOEngineStatusButton.tsx} +2 -2
  52. package/src/components/{SettingsPage/FlushSettings.tsx → WFOSettingsPage/WFOFlushSettings.tsx} +1 -1
  53. package/src/components/{SettingsPage/ModifySettings.tsx → WFOSettingsPage/WFOModifySettings.tsx} +4 -4
  54. package/src/components/{SettingsPage/Settings.tsx → WFOSettingsPage/WFOSettings.tsx} +7 -7
  55. package/src/components/{SettingsPage/Status.tsx → WFOSettingsPage/WFOStatus.tsx} +4 -4
  56. package/src/components/WFOSettingsPage/index.ts +1 -0
  57. package/src/components/{StartPage/FrequentlyUsed.stories.tsx → WFOStartPage/WFOFrequentlyUsed.stories.tsx} +4 -4
  58. package/src/components/{StartPage/FrequentlyUsed.tsx → WFOStartPage/WFOFrequentlyUsed.tsx} +2 -2
  59. package/src/components/{StartPage/ListItemStartPage.stories.tsx → WFOStartPage/WFOListItemStartPage.stories.tsx} +4 -4
  60. package/src/components/{StartPage/ListItemStartPage.tsx → WFOStartPage/WFOListItemStartPage.tsx} +10 -7
  61. package/src/components/{StartPage/ListStartPage.stories.tsx → WFOStartPage/WFOListStartPage.stories.tsx} +4 -4
  62. package/src/components/{StartPage/ListStartPage.tsx → WFOStartPage/WFOListStartPage.tsx} +9 -4
  63. package/src/components/{StartPage/MultiListSection.stories.tsx → WFOStartPage/WFOMultiListSection.stories.tsx} +4 -4
  64. package/src/components/{StartPage/MultiListSection.tsx → WFOStartPage/WFOMultiListSection.tsx} +5 -5
  65. package/src/components/WFOStartPage/WFONewProcessPanel.stories.tsx +12 -0
  66. package/src/components/{StartPage/NewProcessPanel.tsx → WFOStartPage/WFONewProcessPanel.tsx} +3 -3
  67. package/src/components/WFOStartPage/WFOStatCards.stories.tsx +12 -0
  68. package/src/components/{StartPage/StatCards.tsx → WFOStartPage/WFOStatCards.tsx} +1 -1
  69. package/src/components/WFOStartPage/index.ts +6 -0
  70. package/src/components/{Subscription/FixedInputBlock.tsx → WFOSubscription/WFOFixedInputBlock.tsx} +2 -2
  71. package/src/components/{Subscription/ProcessesTimeline.tsx → WFOSubscription/WFOProcessesTimeline.tsx} +4 -4
  72. package/src/components/{Subscription/ProductBlock.tsx → WFOSubscription/WFOProductBlock.tsx} +5 -1
  73. package/src/components/{Subscription/SubscriptionActions.tsx → WFOSubscription/WFOSubscriptionActions.tsx} +1 -1
  74. package/src/components/{Subscription/SubscriptionBlock.tsx → WFOSubscription/WFOSubscriptionBlock.tsx} +5 -5
  75. package/src/components/{Subscription/SubscriptionDetailTree.tsx → WFOSubscription/WFOSubscriptionDetailTree.tsx} +5 -5
  76. package/src/components/{Subscription/SubscriptionGeneral.tsx → WFOSubscription/WFOSubscriptionGeneral.tsx} +9 -6
  77. package/src/components/WFOSubscription/index.ts +7 -0
  78. package/src/components/{Table/DataGridTable/DataGridTable.stories.tsx → WFOTable/WFODataGridTable/WFODataGridTable.stories.tsx} +6 -6
  79. package/src/components/{Table/DataGridTable/DataGridTable.tsx → WFOTable/WFODataGridTable/WFODataGridTable.tsx} +14 -14
  80. package/src/components/{Table/DataGridTable/dataGridColumns.spec.ts → WFOTable/WFODataGridTable/WFOdataGridColumns.spec.ts} +6 -6
  81. package/src/components/{Table/DataGridTable/dataGridColumns.ts → WFOTable/WFODataGridTable/WFOdataGridColumns.ts} +6 -6
  82. package/src/components/{Table/SortDirectionIcon.tsx → WFOTable/WFOSortDirectionIcon.tsx} +6 -6
  83. package/src/components/{Table/Table.tsx → WFOTable/WFOTable.tsx} +13 -13
  84. package/src/components/{Table/TableHeaderCell.tsx → WFOTable/WFOTableHeaderCell.tsx} +4 -4
  85. package/src/components/{Table/TableSettingsModal/TableSettingsModal.tsx → WFOTable/WFOTableSettingsModal/WFOTableSettingsModal.tsx} +1 -1
  86. package/src/components/WFOTable/WFOTableSettingsModal/index.ts +1 -0
  87. package/src/components/{Table/TableWithFilter/TableWithFilter.tsx → WFOTable/WFOTableWithFilter/WFOTableWithFilter.tsx} +31 -24
  88. package/src/components/WFOTable/WFOTableWithFilter/index.ts +1 -0
  89. package/src/components/WFOTable/index.ts +14 -0
  90. package/src/components/{Table → WFOTable}/utils/columns.ts +10 -10
  91. package/src/components/WFOTable/utils/constants.ts +15 -0
  92. package/src/components/{Tree/Tree.tsx → WFOTree/WFOTree.tsx} +4 -4
  93. package/src/components/{Tree/TreeBranch.tsx → WFOTree/WFOTreeBranch.tsx} +9 -5
  94. package/src/components/{Tree/TreeNode.tsx → WFOTree/WFOTreeNode.tsx} +6 -2
  95. package/src/components/index.ts +11 -11
  96. package/src/graphqlQueries/index.ts +3 -0
  97. package/src/graphqlQueries/processListQuery.ts +53 -0
  98. package/src/graphqlQueries/productBlocksQuery.ts +41 -0
  99. package/src/graphqlQueries/productsQuery.ts +47 -0
  100. package/src/graphqlQueries/resourceTypesQuery.ts +35 -0
  101. package/src/graphqlQueries/workflowsQuery.ts +37 -0
  102. package/src/hooks/useDataDisplayParams.ts +1 -1
  103. package/src/hooks/useProcessStatusCountsQuery.ts +1 -0
  104. package/src/hooks/useSubscriptionProcesses.ts +2 -1
  105. package/src/icons/{ArrowNarrowDown.tsx → WFOArrowNarrowDown.tsx} +2 -2
  106. package/src/icons/{ArrowNarrowUp.tsx → WFOArrowNarrowUp.tsx} +2 -2
  107. package/src/icons/WFOCheckmarkCircleFill.stories.tsx +12 -0
  108. package/src/icons/{CheckmarkCircleFill.tsx → WFOCheckmarkCircleFill.tsx} +2 -2
  109. package/src/icons/{ChevronDown.tsx → WFOChevronDown.tsx} +2 -2
  110. package/src/icons/{IconProps.ts → WFOIconProps.ts} +1 -1
  111. package/src/icons/WFOLogoutIcon.stories.tsx +12 -0
  112. package/src/icons/{LogoutIcon.tsx → WFOLogoutIcon.tsx} +2 -2
  113. package/src/icons/WFOMinusCircleOutline.stories.tsx +12 -0
  114. package/src/icons/{MinusCircleOutline.tsx → WFOMinusCircleOutline.tsx} +2 -2
  115. package/src/icons/WFOPlusCircleFill.stories.tsx +12 -0
  116. package/src/icons/{PlusCircleFill.tsx → WFOPlusCircleFill.tsx} +2 -2
  117. package/src/icons/WFOStatusDotIcon.stories.tsx +12 -0
  118. package/src/icons/{StatusDotIcon.tsx → WFOStatusDotIcon.tsx} +2 -2
  119. package/src/icons/WFOXCircleFill.stories.tsx +12 -0
  120. package/src/icons/{XCircleFill.tsx → WFOXCircleFill.tsx} +2 -2
  121. package/src/icons/index.ts +10 -10
  122. package/src/index.ts +1 -0
  123. package/src/messages/en-US.json +48 -4
  124. package/src/messages/nl-NL.json +67 -3
  125. package/src/pages/index.ts +3 -0
  126. package/src/pages/metadata/WFOMetadataPageLayout.tsx +70 -0
  127. package/src/pages/metadata/WFOProductBlocksPage.tsx +164 -0
  128. package/src/pages/metadata/WFOProductsPage.tsx +169 -0
  129. package/src/pages/metadata/WFOResourceTypesPage.tsx +120 -0
  130. package/src/pages/metadata/WFOWorkflowsPage.tsx +251 -0
  131. package/src/pages/metadata/index.ts +4 -0
  132. package/src/pages/processes/WFOProcessListPage.tsx +204 -0
  133. package/src/pages/processes/WFOProcessesListSubscriptionsCell.tsx +28 -0
  134. package/src/pages/processes/getProcessListTabTypeFromString.ts +19 -0
  135. package/src/pages/processes/index.ts +4 -0
  136. package/src/pages/processes/tabConfig.ts +33 -0
  137. package/src/pages/processes/tableConfig.ts +22 -0
  138. package/src/pages/subscriptions/index.ts +2 -0
  139. package/src/pages/subscriptions/subscriptionListTabs.ts +71 -0
  140. package/src/pages/subscriptions/types.ts +13 -0
  141. package/src/stories/Button.jsx +54 -0
  142. package/src/stories/Button.stories.js +45 -0
  143. package/src/stories/Configure.mdx +446 -0
  144. package/src/stories/Header.jsx +59 -0
  145. package/src/stories/Header.stories.js +23 -0
  146. package/src/stories/Page.jsx +68 -0
  147. package/src/stories/Page.stories.js +24 -0
  148. package/src/stories/assets/accessibility.png +0 -0
  149. package/src/stories/assets/accessibility.svg +5 -0
  150. package/src/stories/assets/addon-library.png +0 -0
  151. package/src/stories/assets/assets.png +0 -0
  152. package/src/stories/assets/context.png +0 -0
  153. package/src/stories/assets/discord.svg +15 -0
  154. package/src/stories/assets/docs.png +0 -0
  155. package/src/stories/assets/figma-plugin.png +0 -0
  156. package/src/stories/assets/github.svg +3 -0
  157. package/src/stories/assets/share.png +0 -0
  158. package/src/stories/assets/styling.png +0 -0
  159. package/src/stories/assets/testing.png +0 -0
  160. package/src/stories/assets/theming.png +0 -0
  161. package/src/stories/assets/tutorials.svg +12 -0
  162. package/src/stories/assets/youtube.svg +4 -0
  163. package/src/stories/button.css +30 -0
  164. package/src/stories/header.css +32 -0
  165. package/src/stories/page.css +69 -0
  166. package/src/types.ts +107 -9
  167. package/.turbo/turbo-tsc.log +0 -1
  168. package/src/components/Badges/Badge/index.ts +0 -1
  169. package/src/components/Badges/EngineStatusBadge/index.ts +0 -1
  170. package/src/components/Badges/EnvironmentBadge/index.ts +0 -1
  171. package/src/components/Badges/FailedTasksBadge/FailedTasksBadge.stories.tsx +0 -12
  172. package/src/components/Badges/FailedTasksBadge/index.ts +0 -1
  173. package/src/components/Badges/HeaderBadge/index.ts +0 -1
  174. package/src/components/Badges/ProcessStatusBadge/ProcessStatusBadge.tsx +0 -46
  175. package/src/components/Badges/ProcessStatusBadge/index.ts +0 -1
  176. package/src/components/Badges/index.ts +0 -8
  177. package/src/components/Breadcrumbs/index.ts +0 -1
  178. package/src/components/Loading/Loading.tsx +0 -2
  179. package/src/components/Loading/index.ts +0 -1
  180. package/src/components/OrchestratorPageTemplate/OrchestratorPageHeader/index.ts +0 -1
  181. package/src/components/OrchestratorPageTemplate/OrchestratorPageTemplate/OrchestratorPageTemplate.stories.tsx +0 -32
  182. package/src/components/OrchestratorPageTemplate/OrchestratorPageTemplate/index.ts +0 -1
  183. package/src/components/OrchestratorPageTemplate/OrchestratorSidebar/index.ts +0 -1
  184. package/src/components/OrchestratorPageTemplate/index.ts +0 -3
  185. package/src/components/SearchBar/index.ts +0 -1
  186. package/src/components/SettingsModal/index.tsx +0 -1
  187. package/src/components/SettingsPage/index.ts +0 -1
  188. package/src/components/StartPage/NewProcessPanel.stories.tsx +0 -12
  189. package/src/components/StartPage/StatCards.stories.tsx +0 -12
  190. package/src/components/StartPage/index.ts +0 -6
  191. package/src/components/Subscription/index.ts +0 -7
  192. package/src/components/SubscriptionsTabs/SubscriptionsTabs.tsx +0 -90
  193. package/src/components/SubscriptionsTabs/getSubscriptionsTabTypeFromString.spec.ts +0 -34
  194. package/src/components/SubscriptionsTabs/getSubscriptionsTabTypeFromString.ts +0 -23
  195. package/src/components/SubscriptionsTabs/index.ts +0 -2
  196. package/src/components/Table/TableSettingsModal/index.ts +0 -1
  197. package/src/components/Table/TableWithFilter/index.ts +0 -1
  198. package/src/components/Table/index.ts +0 -14
  199. package/src/components/Table/utils/constants.ts +0 -2
  200. package/src/icons/CheckmarkCircleFill.stories.tsx +0 -12
  201. package/src/icons/LogoutIcon.stories.tsx +0 -12
  202. package/src/icons/MinusCircleOutline.stories.tsx +0 -12
  203. package/src/icons/PlusCircleFill.stories.tsx +0 -12
  204. package/src/icons/StatusDotIcon.stories.tsx +0 -12
  205. package/src/icons/XCircleFill.stories.tsx +0 -12
  206. package/tsconfig.tsbuildinfo +0 -1
  207. /package/src/components/{Badges → WFOBadges}/WFOProductBlockBadge/index.ts +0 -0
  208. /package/src/components/{Badges → WFOBadges}/WFOStatusBadge/index.ts +0 -0
  209. /package/src/components/{SettingsModal/SettingsModal.tsx → WFOSettingsModal/WFOSettingsModal.tsx} +0 -0
  210. /package/src/components/{Subscription → WFOSubscription}/styles.ts +0 -0
  211. /package/src/components/{Table → WFOTable}/utils/columns.spec.ts +0 -0
  212. /package/src/components/{Table → WFOTable}/utils/tableConfigPersistence.spec.ts +0 -0
  213. /package/src/components/{Table → WFOTable}/utils/tableConfigPersistence.ts +0 -0
  214. /package/src/components/{Table → WFOTable}/utils/tableUtils.spec.ts +0 -0
  215. /package/src/components/{Table → WFOTable}/utils/tableUtils.ts +0 -0
@@ -0,0 +1,251 @@
1
+ import React from 'react';
2
+ import { useTranslations } from 'next-intl';
3
+ import type { Pagination } from '@elastic/eui/src/components';
4
+
5
+ import {
6
+ DEFAULT_PAGE_SIZE,
7
+ DEFAULT_PAGE_SIZES,
8
+ METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY,
9
+ WFOProductBlockBadge,
10
+ } from '../../components';
11
+ import { WFOTableWithFilter } from '../../components';
12
+ import {
13
+ getTableConfigFromLocalStorage,
14
+ getDataSortHandler,
15
+ getPageChangeHandler,
16
+ getEsQueryStringHandler,
17
+ } from '../../components';
18
+ import type { WFOTableColumns, WFODataSorting } from '../../components';
19
+
20
+ import type { WorkflowDefinition } from '../../types';
21
+ import { SortOrder } from '../../types';
22
+
23
+ import { useDataDisplayParams } from '../../hooks';
24
+ import { WFOMetadataPageLayout } from './WFOMetadataPageLayout';
25
+
26
+ const WORKFLOW_FIELD_NAME: keyof WorkflowDefinition = 'name';
27
+ const WORKFLOW_FIELD_DESCRIPTION: keyof WorkflowDefinition = 'description';
28
+ const WORKFLOW_FIELD_TARGET: keyof WorkflowDefinition = 'target';
29
+ const WORKFLOW_FIELD_PRODUCT_TAGS: keyof WorkflowDefinition = 'productTags';
30
+ const WORKFLOW_FIELD_CREATED_AT: keyof WorkflowDefinition = 'createdAt';
31
+
32
+ export const WFOWorkflowsPage = () => {
33
+ //TODO: Delete when backend is implemented - see issue #219
34
+
35
+ const isFetching = false;
36
+ const data = {
37
+ workflows: {
38
+ page: [
39
+ {
40
+ name: 'modify_note',
41
+ target: 'MODIFY',
42
+ description: 'Modify Note',
43
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
44
+ productTags: [
45
+ 'Wireless',
46
+ 'SPNL',
47
+ 'Node',
48
+ 'IPP',
49
+ 'L2VPN',
50
+ 'SP',
51
+ 'LP',
52
+ 'L3VPN',
53
+ 'LR',
54
+ 'MSCNL',
55
+ 'MSC',
56
+ 'IPBGP',
57
+ 'IRBSP',
58
+ 'IPS',
59
+ 'AGGSP',
60
+ 'IPPG',
61
+ 'Corelink',
62
+ 'NSILP',
63
+ 'NSISTPNL',
64
+ 'DCC',
65
+ 'FW',
66
+ 'NSISTP',
67
+ 'IP_PREFIX',
68
+ 'AGGSPNL',
69
+ 'IPPP',
70
+ ],
71
+ },
72
+ {
73
+ name: 'task_clean_up_tasks',
74
+ target: 'SYSTEM',
75
+ description: 'Clean up old tasks',
76
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
77
+ productTags: [],
78
+ },
79
+ {
80
+ name: 'task_resume_workflows',
81
+ target: 'SYSTEM',
82
+ description:
83
+ "Resume all workflows that are stuck on tasks with the status 'waiting'",
84
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
85
+ productTags: [],
86
+ },
87
+ {
88
+ name: 'task_validate_products',
89
+ target: 'SYSTEM',
90
+ description: 'Validate products',
91
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
92
+ productTags: [],
93
+ },
94
+ {
95
+ name: 'create_core_link',
96
+ target: 'CREATE',
97
+ description: 'Create Core Link',
98
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
99
+ productTags: ['Corelink'],
100
+ },
101
+ {
102
+ name: 'create_node',
103
+ target: 'CREATE',
104
+ description: 'Create Node',
105
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
106
+ productTags: ['Node'],
107
+ },
108
+ {
109
+ name: 'create_ip_prefix',
110
+ target: 'CREATE',
111
+ description: 'Create IP Prefix',
112
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
113
+ productTags: ['IP_PREFIX'],
114
+ },
115
+ {
116
+ name: 'create_sn8_service_port',
117
+ target: 'CREATE',
118
+ description: 'Create SN8 Service Port',
119
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
120
+ productTags: ['SP', 'SPNL'],
121
+ },
122
+ {
123
+ name: 'modify_sn8_ip_bgp',
124
+ target: 'MODIFY',
125
+ description: 'Change a SN8 IP BGP subscription',
126
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
127
+ productTags: ['IPBGP'],
128
+ },
129
+ {
130
+ name: 'create_sn8_ip_bgp',
131
+ target: 'CREATE',
132
+ description: 'Create SN8 IP BGP',
133
+ createdAt: '2022-11-30T15:35:36.057665+00:00',
134
+ productTags: ['IPBGP'],
135
+ },
136
+ ],
137
+ pageInfo: {
138
+ endCursor: 9,
139
+ hasNextPage: true,
140
+ hasPreviousPage: false,
141
+ startCursor: 0,
142
+ totalItems: 10,
143
+ },
144
+ },
145
+ };
146
+
147
+ const t = useTranslations('metadata.workflows');
148
+
149
+ const initialPageSize =
150
+ getTableConfigFromLocalStorage(
151
+ METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY,
152
+ )?.selectedPageSize ?? DEFAULT_PAGE_SIZE;
153
+
154
+ const { dataDisplayParams, setDataDisplayParam } =
155
+ useDataDisplayParams<WorkflowDefinition>({
156
+ pageSize: initialPageSize,
157
+ sortBy: {
158
+ field: WORKFLOW_FIELD_NAME,
159
+ order: SortOrder.ASC,
160
+ },
161
+ });
162
+
163
+ const tableColumns: WFOTableColumns<WorkflowDefinition> = {
164
+ name: {
165
+ field: WORKFLOW_FIELD_NAME,
166
+ name: t('name'),
167
+ width: '110',
168
+ },
169
+ description: {
170
+ field: WORKFLOW_FIELD_DESCRIPTION,
171
+ name: t('description'),
172
+ width: '220',
173
+ },
174
+ target: {
175
+ field: WORKFLOW_FIELD_TARGET,
176
+ name: t('target'),
177
+ width: '50',
178
+ },
179
+ productTags: {
180
+ field: WORKFLOW_FIELD_PRODUCT_TAGS,
181
+ name: t('productTags'),
182
+ width: '200',
183
+ render: (productTags) => (
184
+ <>
185
+ {productTags &&
186
+ productTags.map((productTag, index) => (
187
+ <WFOProductBlockBadge key={index}>
188
+ {productTag}
189
+ </WFOProductBlockBadge>
190
+ ))}
191
+ </>
192
+ ),
193
+ },
194
+ createdAt: {
195
+ field: WORKFLOW_FIELD_CREATED_AT,
196
+ name: t('createdAt'),
197
+ width: '110',
198
+ },
199
+ };
200
+
201
+ //TODO: uncomment when backend is done
202
+
203
+ // const { data, isFetching } = useQueryWithGraphql(
204
+ // GET_WORKFLOWS_GRAPHQL_QUERY,
205
+ // {
206
+ // first: dataDisplayParams.pageSize,
207
+ // after: dataDisplayParams.pageIndex * dataDisplayParams.pageSize,
208
+ // sortBy: dataDisplayParams.sortBy,
209
+ // },
210
+ // 'workflows',
211
+ // true,
212
+ // );
213
+
214
+ const dataSorting: WFODataSorting<WorkflowDefinition> = {
215
+ field: dataDisplayParams.sortBy?.field ?? WORKFLOW_FIELD_NAME,
216
+ sortOrder: dataDisplayParams.sortBy?.order ?? SortOrder.ASC,
217
+ };
218
+
219
+ const totalItems = data?.workflows.pageInfo.totalItems;
220
+
221
+ const pagination: Pagination = {
222
+ pageSize: dataDisplayParams.pageSize,
223
+ pageIndex: dataDisplayParams.pageIndex,
224
+ pageSizeOptions: DEFAULT_PAGE_SIZES,
225
+ totalItemCount: totalItems ? totalItems : 0,
226
+ };
227
+
228
+ return (
229
+ <WFOMetadataPageLayout>
230
+ <WFOTableWithFilter<WorkflowDefinition>
231
+ data={data ? data.workflows.page : []}
232
+ tableColumns={tableColumns}
233
+ dataSorting={dataSorting}
234
+ onUpdateDataSort={getDataSortHandler<WorkflowDefinition>(
235
+ dataDisplayParams,
236
+ setDataDisplayParam,
237
+ )}
238
+ onUpdatePage={getPageChangeHandler<WorkflowDefinition>(
239
+ setDataDisplayParam,
240
+ )}
241
+ onUpdateEsQueryString={getEsQueryStringHandler<WorkflowDefinition>(
242
+ setDataDisplayParam,
243
+ )}
244
+ pagination={pagination}
245
+ isLoading={isFetching}
246
+ esQueryString={dataDisplayParams.esQueryString}
247
+ localStorageKey={METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY}
248
+ />
249
+ </WFOMetadataPageLayout>
250
+ );
251
+ };
@@ -0,0 +1,4 @@
1
+ export * from './WFOProductBlocksPage';
2
+ export * from './WFOResourceTypesPage';
3
+ export * from './WFOProductsPage';
4
+ export * from './WFOWorkflowsPage';
@@ -0,0 +1,204 @@
1
+ import React from 'react';
2
+ import {
3
+ ACTIVE_PROCESSES_LIST_TABLE_LOCAL_STORAGE_KEY,
4
+ WFODataSorting,
5
+ DEFAULT_PAGE_SIZE,
6
+ DEFAULT_PAGE_SIZES,
7
+ getDataSortHandler,
8
+ getEsQueryStringHandler,
9
+ getPageChangeHandler,
10
+ getTableConfigFromLocalStorage,
11
+ WFOLoading,
12
+ WFOTableColumns,
13
+ WFOTableWithFilter,
14
+ WFOFilterTabs,
15
+ COMPLETED_PROCESSES_LIST_TABLE_LOCAL_STORAGE_KEY,
16
+ WFOProcessStatusBadge,
17
+ } from '../../components';
18
+ import { Process, SortOrder } from '../../types';
19
+ import { useDataDisplayParams, useQueryWithGraphql } from '../../hooks';
20
+ import { GET_PROCESS_LIST_GRAPHQL_QUERY } from '../../graphqlQueries/processListQuery';
21
+ import { Pagination } from '@elastic/eui/src/components';
22
+ import { WFOProcessesListSubscriptionsCell } from './WFOProcessesListSubscriptionsCell';
23
+ import { StringParam, useQueryParam, withDefault } from 'use-query-params';
24
+ import { useRouter } from 'next/router';
25
+ import { EuiSpacer } from '@elastic/eui';
26
+ import { defaultProcessListTabs, WFOProcessListTabType } from './tabConfig';
27
+ import { getProcessListTabTypeFromString } from './getProcessListTabTypeFromString';
28
+ import {
29
+ defaultHiddenColumnsActiveProcesses,
30
+ defaultHiddenColumnsCompletedProcesses,
31
+ } from './tableConfig';
32
+ import { useTranslations } from 'next-intl';
33
+
34
+ export const WFOProcessListPage = () => {
35
+ const router = useRouter();
36
+ const t = useTranslations('processes.index'); // todo
37
+
38
+ const [activeTab, setActiveTab] = useQueryParam(
39
+ 'activeTab',
40
+ withDefault(StringParam, WFOProcessListTabType.ACTIVE),
41
+ );
42
+
43
+ const initialPageSize =
44
+ getTableConfigFromLocalStorage(
45
+ ACTIVE_PROCESSES_LIST_TABLE_LOCAL_STORAGE_KEY,
46
+ )?.selectedPageSize ?? DEFAULT_PAGE_SIZE;
47
+
48
+ const { dataDisplayParams, setDataDisplayParam } =
49
+ useDataDisplayParams<Process>({
50
+ pageSize: initialPageSize,
51
+ sortBy: {
52
+ field: 'lastModified',
53
+ order: SortOrder.DESC,
54
+ },
55
+ });
56
+
57
+ const selectedProcessListTab = getProcessListTabTypeFromString(activeTab);
58
+
59
+ const handleChangeProcessListTab = (
60
+ updatedProcessListTab: WFOProcessListTabType,
61
+ ) => {
62
+ setActiveTab(updatedProcessListTab);
63
+ setDataDisplayParam('pageIndex', 0);
64
+ };
65
+
66
+ const alwaysOnFilters = defaultProcessListTabs.find(
67
+ ({ id }) => id === selectedProcessListTab,
68
+ )?.alwaysOnFilters;
69
+
70
+ const tableColumns: WFOTableColumns<Process> = {
71
+ workflowName: {
72
+ field: 'workflowName',
73
+ name: t('workflowName'),
74
+ },
75
+ lastStep: {
76
+ field: 'lastStep',
77
+ name: t('lastStep'),
78
+ },
79
+
80
+ status: {
81
+ field: 'status',
82
+ name: t('status'),
83
+ render: (cellValue) => (
84
+ <WFOProcessStatusBadge processStatus={cellValue} />
85
+ ),
86
+ },
87
+ product: {
88
+ field: 'product',
89
+ name: t('product'),
90
+ },
91
+ customer: {
92
+ field: 'customer',
93
+ name: t('customer'),
94
+ },
95
+ subscriptions: {
96
+ field: 'subscriptions',
97
+ name: t('subscriptions'),
98
+ width: '400',
99
+ render: ({ page }) => (
100
+ <WFOProcessesListSubscriptionsCell subscriptions={page} />
101
+ ),
102
+ },
103
+ createdBy: {
104
+ field: 'createdBy',
105
+ name: t('createdBy'),
106
+ },
107
+ assignee: {
108
+ field: 'assignee',
109
+ name: t('assignee'),
110
+ },
111
+ id: {
112
+ field: 'id',
113
+ name: t('id'),
114
+ },
115
+ started: {
116
+ field: 'started',
117
+ name: t('started'),
118
+ },
119
+ lastModified: {
120
+ field: 'lastModified',
121
+ name: t('lastModified'),
122
+ },
123
+ };
124
+
125
+ const { data, isFetching } = useQueryWithGraphql(
126
+ GET_PROCESS_LIST_GRAPHQL_QUERY,
127
+ {
128
+ first: dataDisplayParams.pageSize,
129
+ after: dataDisplayParams.pageIndex * dataDisplayParams.pageSize,
130
+ // Todo: waiting for fix in backend -- currently the sortBy field id's are not matching with the returned data
131
+ // sortBy: { field: 'lastModified', order: SortOrder.DESC },
132
+ // @ts-ignore
133
+ sortBy: { field: 'modified', order: SortOrder.DESC },
134
+ filterBy: alwaysOnFilters,
135
+ },
136
+ 'processList',
137
+ true,
138
+ );
139
+
140
+ if (!data) {
141
+ return <WFOLoading />;
142
+ }
143
+
144
+ if (!selectedProcessListTab) {
145
+ router.replace('/processes');
146
+ return null;
147
+ }
148
+
149
+ const dataSorting: WFODataSorting<Process> = {
150
+ field: dataDisplayParams.sortBy?.field ?? 'lastModified',
151
+ sortOrder: dataDisplayParams.sortBy?.order ?? SortOrder.ASC,
152
+ };
153
+
154
+ const { totalItems } = data.processes.pageInfo;
155
+
156
+ const pagination: Pagination = {
157
+ pageSize: dataDisplayParams.pageSize,
158
+ pageIndex: dataDisplayParams.pageIndex,
159
+ pageSizeOptions: DEFAULT_PAGE_SIZES,
160
+ totalItemCount: totalItems ? totalItems : 0,
161
+ };
162
+
163
+ const defaultHiddenColumns =
164
+ selectedProcessListTab === WFOProcessListTabType.ACTIVE
165
+ ? defaultHiddenColumnsActiveProcesses
166
+ : defaultHiddenColumnsCompletedProcesses;
167
+
168
+ const localStorageKey =
169
+ selectedProcessListTab === WFOProcessListTabType.ACTIVE
170
+ ? ACTIVE_PROCESSES_LIST_TABLE_LOCAL_STORAGE_KEY
171
+ : COMPLETED_PROCESSES_LIST_TABLE_LOCAL_STORAGE_KEY;
172
+
173
+ return (
174
+ <>
175
+ <WFOFilterTabs
176
+ tabs={defaultProcessListTabs}
177
+ translationNamespace="processes.tabs"
178
+ selectedTab={selectedProcessListTab}
179
+ onChangeTab={handleChangeProcessListTab}
180
+ />
181
+ <EuiSpacer size="xxl" />
182
+
183
+ <WFOTableWithFilter
184
+ data={data.processes.page}
185
+ tableColumns={tableColumns}
186
+ dataSorting={dataSorting}
187
+ pagination={pagination}
188
+ isLoading={isFetching}
189
+ defaultHiddenColumns={defaultHiddenColumns}
190
+ localStorageKey={localStorageKey}
191
+ onUpdateEsQueryString={getEsQueryStringHandler<Process>(
192
+ setDataDisplayParam,
193
+ )}
194
+ onUpdatePage={getPageChangeHandler<Process>(
195
+ setDataDisplayParam,
196
+ )}
197
+ onUpdateDataSort={getDataSortHandler<Process>(
198
+ dataDisplayParams,
199
+ setDataDisplayParam,
200
+ )}
201
+ />
202
+ </>
203
+ );
204
+ };
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { Subscription } from '../../types';
3
+ import Link from 'next/link';
4
+ import { FC } from 'react';
5
+
6
+ export type WFOProcessesListSubscriptionsCellProps = {
7
+ subscriptions: Pick<Subscription, 'subscriptionId' | 'description'>[];
8
+ };
9
+
10
+ export const WFOProcessesListSubscriptionsCell: FC<
11
+ WFOProcessesListSubscriptionsCellProps
12
+ > = ({ subscriptions }) => {
13
+ const { length } = subscriptions;
14
+
15
+ if (length === 0) {
16
+ return null;
17
+ }
18
+
19
+ const firstSubscription = subscriptions[0];
20
+ return (
21
+ <>
22
+ <Link href={`/subscriptions/${firstSubscription.subscriptionId}`}>
23
+ {firstSubscription.description}
24
+ </Link>
25
+ {length > 1 && <span>{` (+${length - 1})`}</span>}
26
+ </>
27
+ );
28
+ };
@@ -0,0 +1,19 @@
1
+ import { WFOProcessListTabType } from './tabConfig';
2
+
3
+ export const getProcessListTabTypeFromString = (
4
+ tabId?: string,
5
+ ): WFOProcessListTabType | undefined => {
6
+ if (!tabId) {
7
+ return undefined;
8
+ }
9
+
10
+ switch (tabId.toUpperCase()) {
11
+ case WFOProcessListTabType.ACTIVE.toString():
12
+ return WFOProcessListTabType.ACTIVE;
13
+ case WFOProcessListTabType.COMPLETED.toString():
14
+ return WFOProcessListTabType.COMPLETED;
15
+
16
+ default:
17
+ return undefined;
18
+ }
19
+ };
@@ -0,0 +1,4 @@
1
+ export * from './getProcessListTabTypeFromString';
2
+ export * from './tabConfig';
3
+ export * from './WFOProcessListPage';
4
+ export * from './WFOProcessesListSubscriptionsCell';
@@ -0,0 +1,33 @@
1
+ import { Process } from '../../types';
2
+ import { WFOFilterTab } from '../../components';
3
+
4
+ export enum WFOProcessListTabType {
5
+ ACTIVE = 'ACTIVE',
6
+ COMPLETED = 'COMPLETED',
7
+ }
8
+
9
+ export const defaultProcessListTabs: WFOFilterTab<
10
+ WFOProcessListTabType,
11
+ Process
12
+ >[] = [
13
+ {
14
+ id: WFOProcessListTabType.ACTIVE,
15
+ translationKey: 'active',
16
+ alwaysOnFilters: [
17
+ {
18
+ field: 'status',
19
+ value: 'created-running-suspended-waiting-failed-resumed',
20
+ },
21
+ ],
22
+ },
23
+ {
24
+ id: WFOProcessListTabType.COMPLETED,
25
+ translationKey: 'completed',
26
+ alwaysOnFilters: [
27
+ {
28
+ field: 'status',
29
+ value: 'completed',
30
+ },
31
+ ],
32
+ },
33
+ ];
@@ -0,0 +1,22 @@
1
+ import { TableColumnKeys } from '../../components';
2
+ import { Process } from '../../types';
3
+
4
+ export const defaultHiddenColumnsActiveProcesses: TableColumnKeys<Process> = [
5
+ 'product',
6
+ 'customer',
7
+ 'createdBy',
8
+ 'assignee',
9
+ 'id',
10
+ ];
11
+
12
+ export const defaultHiddenColumnsCompletedProcesses: TableColumnKeys<Process> =
13
+ [
14
+ 'lastStep',
15
+ 'status',
16
+ 'product',
17
+ 'customer',
18
+ 'createdBy',
19
+ 'assignee',
20
+ 'id',
21
+ 'started',
22
+ ];
@@ -0,0 +1,2 @@
1
+ export * from './subscriptionListTabs';
2
+ export * from './types';
@@ -0,0 +1,71 @@
1
+ import { WFOFilterTab } from '../../components';
2
+ import { SubscriptionListItem } from './types';
3
+
4
+ export enum WFOSubscriptionsTabType {
5
+ ACTIVE = 'ACTIVE',
6
+ TERMINATED = 'TERMINATED',
7
+ TRANSIENT = 'TRANSIENT',
8
+ ALL = 'ALL',
9
+ }
10
+
11
+ export const defaultSubscriptionsTabs: WFOFilterTab<
12
+ WFOSubscriptionsTabType,
13
+ SubscriptionListItem
14
+ >[] = [
15
+ {
16
+ id: WFOSubscriptionsTabType.ACTIVE,
17
+ translationKey: 'active',
18
+ alwaysOnFilters: [
19
+ {
20
+ field: 'status',
21
+ value: 'active',
22
+ },
23
+ ],
24
+ },
25
+ {
26
+ id: WFOSubscriptionsTabType.TERMINATED,
27
+ translationKey: 'terminated',
28
+ alwaysOnFilters: [
29
+ {
30
+ field: 'status',
31
+ value: 'terminated',
32
+ },
33
+ ],
34
+ },
35
+ {
36
+ id: WFOSubscriptionsTabType.TRANSIENT,
37
+ translationKey: 'transient',
38
+ alwaysOnFilters: [
39
+ {
40
+ field: 'status',
41
+ value: 'initial-provisioning-migrating',
42
+ },
43
+ ],
44
+ },
45
+ {
46
+ id: WFOSubscriptionsTabType.ALL,
47
+ translationKey: 'all',
48
+ },
49
+ ];
50
+
51
+ export const getSubscriptionsTabTypeFromString = (
52
+ tabId?: string,
53
+ ): WFOSubscriptionsTabType | undefined => {
54
+ if (!tabId) {
55
+ return undefined;
56
+ }
57
+
58
+ switch (tabId.toUpperCase()) {
59
+ case WFOSubscriptionsTabType.ACTIVE.toString():
60
+ return WFOSubscriptionsTabType.ACTIVE;
61
+ case WFOSubscriptionsTabType.TERMINATED.toString():
62
+ return WFOSubscriptionsTabType.TERMINATED;
63
+ case WFOSubscriptionsTabType.TRANSIENT.toString():
64
+ return WFOSubscriptionsTabType.TRANSIENT;
65
+ case WFOSubscriptionsTabType.ALL.toString():
66
+ return WFOSubscriptionsTabType.ALL;
67
+
68
+ default:
69
+ return undefined;
70
+ }
71
+ };
@@ -0,0 +1,13 @@
1
+ // Todo: preparation for moving the Subscriptions component (table) to the lib
2
+ // https://github.com/workfloworchestrator/orchestrator-ui/issues/149
3
+ export type SubscriptionListItem = {
4
+ subscriptionId: string;
5
+ description: string;
6
+ status: string;
7
+ insync: boolean;
8
+ startDate: Date | null;
9
+ endDate: Date | null;
10
+ productName: string;
11
+ tag: string | null;
12
+ note: string | null;
13
+ };