@orchestrator-ui/orchestrator-ui-components 0.2.7 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/.turbo/turbo-build.log +10 -9
  2. package/.turbo/turbo-lint.log +2 -5
  3. package/.turbo/turbo-test.log +15 -10
  4. package/CHANGELOG.md +17 -0
  5. package/dist/index.d.ts +1464 -337
  6. package/dist/index.js +37266 -8348
  7. package/package.json +38 -31
  8. package/src/api/axios.ts +2 -8
  9. package/src/api/index.ts +59 -4
  10. package/src/components/WfoBadges/WfoBadge/WfoBadge.tsx +4 -1
  11. package/src/components/WfoBadges/index.ts +1 -0
  12. package/src/components/WfoDiff/WfoDiff.tsx +119 -0
  13. package/src/components/WfoDiff/index.ts +1 -0
  14. package/src/components/WfoDiff/unidiff.d.ts +1 -0
  15. package/src/components/WfoError/WfoError.stories.tsx +26 -0
  16. package/src/components/WfoError/WfoError.tsx +19 -0
  17. package/src/components/WfoError/index.ts +1 -0
  18. package/src/components/WfoFilterTabs/WfoFilterTabs.tsx +4 -2
  19. package/src/components/WfoForms/AutoFieldLoader.tsx +5 -1
  20. package/src/components/WfoForms/CreateForm.tsx +1 -0
  21. package/src/components/WfoForms/UserInputForm.tsx +88 -45
  22. package/src/components/WfoForms/UserInputFormWizard.tsx +11 -4
  23. package/src/components/WfoForms/formFields/AcceptField.tsx +8 -5
  24. package/src/components/WfoForms/formFields/BoolField.tsx +1 -1
  25. package/src/components/WfoForms/formFields/ImsNodeIdField.tsx +2 -2
  26. package/src/components/WfoForms/formFields/ImsPortIdField.tsx +238 -0
  27. package/src/components/WfoForms/formFields/ImsPortIdFieldStyling.ts +17 -0
  28. package/src/components/WfoForms/formFields/ListAddField.tsx +1 -1
  29. package/src/components/WfoForms/formFields/ListDelField.tsx +1 -1
  30. package/src/components/WfoForms/formFields/OptGroupField.tsx +1 -1
  31. package/src/components/WfoForms/formFields/SplitPrefix.tsx +2 -1
  32. package/src/components/WfoForms/formFields/SubscriptionField.tsx +10 -4
  33. package/src/components/WfoForms/formFields/SummaryField.tsx +103 -0
  34. package/src/components/WfoForms/formFields/SummaryFieldStyling.ts +46 -0
  35. package/src/components/WfoForms/formFields/VlanField.tsx +10 -10
  36. package/src/components/WfoForms/formFields/index.ts +2 -0
  37. package/src/components/WfoForms/formFields/surf/types.ts +26 -0
  38. package/src/components/WfoForms/formFields/utils.spec.ts +89 -9
  39. package/src/components/WfoJsonCodeBlock/index.ts +1 -0
  40. package/src/components/WfoKeyValueTable/WfoValueCell.tsx +2 -2
  41. package/src/components/WfoOptionalLink/WfoOptionalLink.tsx +20 -0
  42. package/src/components/WfoOptionalLink/index.ts +1 -0
  43. package/src/components/WfoPageTemplate/WfoBreadcrumbs/WfoBreadcrumbs.tsx +5 -2
  44. package/src/components/WfoPageTemplate/WfoPageHeader/WfoAppLogo.tsx +28 -0
  45. package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +23 -19
  46. package/src/components/WfoPageTemplate/WfoPageHeader/styles.ts +29 -0
  47. package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.spec.ts +12 -0
  48. package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.ts +5 -0
  49. package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +14 -14
  50. package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +15 -12
  51. package/src/components/WfoPageTemplate/paths.ts +3 -2
  52. package/src/components/{WfoProcessesList/WfoProcessList.tsx → WfoProcessList/WfoProcessesList.tsx} +46 -38
  53. package/src/components/WfoProcessList/index.ts +1 -0
  54. package/src/components/{WfoProcessesList → WfoProcessList}/processListObjectMappers.ts +5 -3
  55. package/src/components/WfoSearchBar/WfoSearchField.tsx +27 -37
  56. package/src/components/{WfoSettingsPage → WfoSettings}/WfoEngineStatusButton.tsx +7 -4
  57. package/src/components/{WfoSettingsPage → WfoSettings}/WfoFlushSettings.tsx +29 -18
  58. package/src/components/WfoSettings/WfoModifySettings.tsx +38 -0
  59. package/src/components/WfoSettings/WfoSettings.tsx +40 -0
  60. package/src/components/{WfoSettingsPage → WfoSettings}/WfoStatus.tsx +21 -14
  61. package/src/components/WfoSettingsModal/WfoSubmitModal.tsx +61 -0
  62. package/src/components/WfoSettingsModal/index.tsx +1 -0
  63. package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +14 -11
  64. package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +11 -18
  65. package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +4 -1
  66. package/src/components/WfoSubscription/WfoSubscription.tsx +38 -66
  67. package/src/components/WfoSubscription/WfoSubscriptionActions.tsx +41 -33
  68. package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +34 -28
  69. package/src/components/WfoSubscription/WfoSubscriptionProductBlock.tsx +96 -91
  70. package/src/components/WfoSubscription/WfoTargetTypeIcon.tsx +26 -0
  71. package/src/components/WfoSubscription/subscriptionDetailTabs.tsx +29 -0
  72. package/src/components/WfoSubscription/utils/utils.spec.ts +24 -0
  73. package/src/components/WfoSubscription/utils/utils.ts +21 -5
  74. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +42 -48
  75. package/src/components/WfoSubscriptionsList/index.ts +1 -1
  76. package/src/components/WfoSubscriptionsList/{mapGrapghQlSubscriptionsResultToSubscriptionListItems.ts → mapGraphQlSubscriptionsResultToSubscriptionListItems.ts} +8 -1
  77. package/src/components/WfoSubscriptionsList/subscriptionListTabs.ts +8 -30
  78. package/src/components/WfoSummary/WfoSummaryCardHeader/WfoSummaryCardHeader.tsx +55 -0
  79. package/src/components/WfoSummary/WfoSummaryCardHeader/index.ts +1 -0
  80. package/src/components/WfoSummary/WfoSummaryCardHeader/styles.ts +26 -0
  81. package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardList.tsx +86 -0
  82. package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardListItem.tsx +59 -0
  83. package/src/components/WfoSummary/WfoSummaryCardList/index.ts +2 -0
  84. package/src/components/WfoSummary/WfoSummaryCardList/styles.ts +52 -0
  85. package/src/components/WfoSummary/WfoSummaryCards.tsx +111 -0
  86. package/src/components/WfoSummary/getNumberOfColumns.ts +14 -0
  87. package/src/components/WfoSummary/index.ts +4 -0
  88. package/src/components/WfoSummary/styles.ts +13 -0
  89. package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +18 -16
  90. package/src/components/WfoTable/WfoBasicTable/WfoTableHeaderCell.tsx +2 -2
  91. package/src/components/WfoTable/WfoBasicTable/index.ts +1 -0
  92. package/src/components/WfoTable/WfoBasicTable/styles.ts +28 -2
  93. package/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx +12 -3
  94. package/src/components/WfoTable/WfoFirstPartUUID/styles.ts +12 -0
  95. package/src/components/WfoTable/WfoTableWithFilter/WfoTableWithFilter.tsx +32 -23
  96. package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts +95 -0
  97. package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.ts +60 -0
  98. package/src/components/WfoTable/index.ts +2 -0
  99. package/src/components/WfoTable/utils/columns.ts +21 -15
  100. package/src/components/WfoTable/utils/constants.ts +4 -2
  101. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +5 -3
  102. package/src/components/WfoTable/utils/tableUtils.ts +3 -3
  103. package/src/components/WfoTextAnchor/WfoTextAnchor.stories.tsx +18 -0
  104. package/src/components/WfoTextAnchor/WfoTextAnchor.tsx +22 -0
  105. package/src/components/WfoTextAnchor/index.ts +1 -0
  106. package/src/components/WfoTextAnchor/styles.ts +17 -0
  107. package/src/components/WfoTimeline/styles.ts +10 -4
  108. package/src/components/WfoTree/WfoTreeNode.tsx +1 -4
  109. package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +42 -26
  110. package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +48 -0
  111. package/src/components/WfoWorkflowSteps/WfoStepList/WfoStepList.tsx +10 -10
  112. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +22 -23
  113. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.tsx +97 -17
  114. package/src/components/WfoWorkflowSteps/index.ts +1 -0
  115. package/src/components/WfoWorkflowSteps/stepListUtils.ts +1 -28
  116. package/src/components/confirmationDialog/WfoConfirmationDialog.tsx +3 -3
  117. package/src/components/index.ts +9 -2
  118. package/src/contexts/ApiClientContext.tsx +5 -1
  119. package/src/contexts/ConfirmationDialogProvider.tsx +2 -2
  120. package/src/contexts/OrchestratorConfigContext.tsx +0 -3
  121. package/src/contexts/ToastContext.tsx +1 -1
  122. package/src/contexts/TreeContext.tsx +6 -1
  123. package/src/graphqlQueries/customersQuery.ts +2 -1
  124. package/src/graphqlQueries/index.ts +1 -0
  125. package/src/graphqlQueries/processDetailQuery.ts +8 -0
  126. package/src/graphqlQueries/processListQuery.ts +48 -7
  127. package/src/graphqlQueries/processStepsQuery.ts +22 -0
  128. package/src/graphqlQueries/productBlocksQuery.ts +11 -5
  129. package/src/graphqlQueries/productsQuery.ts +42 -7
  130. package/src/graphqlQueries/relatedSubscriptionsQuery.ts +2 -2
  131. package/src/graphqlQueries/resourceTypesQuery.ts +10 -4
  132. package/src/graphqlQueries/subscriptionDetailQuery.ts +5 -1
  133. package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +2 -1
  134. package/src/graphqlQueries/subscriptionsListQuery.ts +46 -7
  135. package/src/graphqlQueries/workflows/workflowsQuery.ts +10 -4
  136. package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +3 -6
  137. package/src/hooks/DataFetchHooks.ts +20 -61
  138. package/src/hooks/index.ts +3 -0
  139. package/src/hooks/surf/useGetSubscriptionDropdownOptions.ts +1 -0
  140. package/src/hooks/surf/useIsTaggedPort.ts +1 -2
  141. package/src/hooks/useCheckEngineStatus.ts +30 -0
  142. package/src/hooks/useDataDisplayParams.ts +3 -3
  143. package/src/hooks/useEngineStatusQuery.ts +9 -7
  144. package/src/hooks/useMutateProcess.ts +96 -0
  145. package/src/hooks/useOrchestratorConfig.ts +0 -3
  146. package/src/hooks/useQueryWithGraphql.ts +25 -13
  147. package/src/hooks/useSessionWithToken.ts +3 -5
  148. package/src/hooks/useSubscriptionActions.ts +8 -2
  149. package/src/icons/WfoBell.tsx +34 -0
  150. package/src/icons/WfoContactEnvelopeFill.tsx +29 -0
  151. package/src/icons/WfoPencil.tsx +21 -0
  152. package/src/icons/WfoSideMenu.stories.tsx +13 -0
  153. package/src/icons/WfoSideMenu.tsx +39 -0
  154. package/src/icons/WfoStatistic.tsx +3 -3
  155. package/src/icons/WfoViewList.tsx +24 -0
  156. package/src/icons/index.ts +6 -0
  157. package/src/messages/{en-US.json → en-GB.json} +117 -39
  158. package/src/messages/getTranslationMessages.spec.ts +25 -40
  159. package/src/messages/index.ts +1 -1
  160. package/src/messages/nl-NL.json +126 -49
  161. package/src/messages/useGetTranslationMessages.ts +51 -0
  162. package/src/pages/index.ts +2 -1
  163. package/src/pages/metadata/WfoProductBlocksPage.tsx +17 -19
  164. package/src/pages/metadata/WfoProductsPage.tsx +30 -34
  165. package/src/pages/metadata/WfoResourceTypesPage.tsx +16 -18
  166. package/src/pages/metadata/WfoWorkflowsPage.tsx +18 -19
  167. package/src/pages/processes/WfoProcessDetail.tsx +101 -80
  168. package/src/pages/processes/WfoProcessDetailPage.tsx +35 -17
  169. package/src/pages/processes/WfoStartProcessPage.tsx +251 -0
  170. package/src/pages/processes/index.ts +1 -3
  171. package/src/pages/settings/WfoSettingsPage.tsx +30 -0
  172. package/src/pages/settings/index.ts +1 -0
  173. package/src/pages/startPage/WfoStartPage.tsx +239 -0
  174. package/src/pages/startPage/index.ts +1 -0
  175. package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +22 -26
  176. package/src/pages/tasks/WfoTasksListPage.tsx +169 -0
  177. package/src/pages/tasks/getTasksListTabTypeFromString.ts +19 -0
  178. package/src/pages/tasks/index.ts +3 -1
  179. package/src/pages/tasks/tabConfig.ts +51 -0
  180. package/src/pages/{processes/WfoProcessListPage.tsx → workflows/WfoWorkflowsListPage.tsx} +30 -32
  181. package/src/pages/workflows/getWorkflowsListTabTypeFromString.ts +19 -0
  182. package/src/pages/workflows/index.ts +1 -0
  183. package/src/pages/{processes → workflows}/tabConfig.ts +9 -9
  184. package/src/theme/defaultOrchestratorTheme.ts +8 -0
  185. package/src/types/types.ts +38 -53
  186. package/src/utils/date.ts +39 -0
  187. package/src/utils/getDefaultTableConfig.ts +19 -9
  188. package/tsconfig.json +4 -4
  189. package/src/components/WfoSettingsPage/WfoModifySettings.tsx +0 -33
  190. package/src/components/WfoSettingsPage/WfoSettings.tsx +0 -40
  191. package/src/components/WfoStartPage/WfoFrequentlyUsed.stories.tsx +0 -16
  192. package/src/components/WfoStartPage/WfoFrequentlyUsed.tsx +0 -21
  193. package/src/components/WfoStartPage/WfoListItemStartPage.stories.tsx +0 -40
  194. package/src/components/WfoStartPage/WfoListItemStartPage.tsx +0 -95
  195. package/src/components/WfoStartPage/WfoListStartPage.stories.tsx +0 -98
  196. package/src/components/WfoStartPage/WfoListStartPage.tsx +0 -45
  197. package/src/components/WfoStartPage/WfoMultiListSection.stories.tsx +0 -90
  198. package/src/components/WfoStartPage/WfoMultiListSection.tsx +0 -25
  199. package/src/components/WfoStartPage/WfoNewProcessPanel.stories.tsx +0 -13
  200. package/src/components/WfoStartPage/WfoNewProcessPanel.tsx +0 -45
  201. package/src/components/WfoStartPage/WfoStatCards.stories.tsx +0 -13
  202. package/src/components/WfoStartPage/WfoStatCards.tsx +0 -75
  203. package/src/components/WfoStartPage/index.ts +0 -6
  204. package/src/hooks/ProcessesHooks/useDeleteProcess.ts +0 -37
  205. package/src/messages/getTranslationMessages.ts +0 -26
  206. package/src/pages/processes/getProcessListTabTypeFromString.ts +0 -19
  207. package/src/pages/tasks/WfoTaskListPage.tsx +0 -120
  208. package/src/pages/workflow/WfoStartWorkflowPage.tsx +0 -177
  209. package/src/pages/workflow/index.ts +0 -1
  210. /package/src/components/{WfoSettingsPage → WfoSettings}/index.ts +0 -0
@@ -12,6 +12,7 @@ export type TreeContextType = {
12
12
  expandAll: () => void;
13
13
  collapseAll: () => void;
14
14
  resetSelection: () => void;
15
+ selectAll: () => void;
15
16
  };
16
17
 
17
18
  export const TreeContext = React.createContext<TreeContextType | null>(null);
@@ -22,7 +23,7 @@ export type TreeProviderProps = {
22
23
 
23
24
  export const TreeProvider: React.FC<TreeProviderProps> = ({ children }) => {
24
25
  const [depths, setDepths] = React.useState<number[]>([]);
25
- const [selectedIds, setSelectedIds] = React.useState<number[]>([]);
26
+ const [selectedIds, setSelectedIds] = React.useState<number[]>([0]);
26
27
  const [expandedIds, setExpandedIds] = React.useState<number[]>([0]);
27
28
 
28
29
  const toggleSelectedId = (id: number) => {
@@ -38,6 +39,9 @@ export const TreeProvider: React.FC<TreeProviderProps> = ({ children }) => {
38
39
  );
39
40
  }
40
41
  };
42
+ const selectAll = () => {
43
+ setSelectedIds(Array.from(Array(depths.length).keys()));
44
+ };
41
45
 
42
46
  const toggleExpandedId = (id: number) => {
43
47
  if (expandedIds.includes(id)) {
@@ -106,6 +110,7 @@ export const TreeProvider: React.FC<TreeProviderProps> = ({ children }) => {
106
110
  expandAll,
107
111
  collapseAll,
108
112
  resetSelection,
113
+ selectAll,
109
114
  }}
110
115
  >
111
116
  {children}
@@ -5,10 +5,11 @@ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
5
 
6
6
  import { CustomersResult } from '../types';
7
7
 
8
+ // Avoiding pagination by passing a large number to first. TODO: Fix this better
8
9
  export const GET_CUSTOMER_GRAPHQL_QUERY: TypedDocumentNode<CustomersResult> =
9
10
  parse(gql`
10
11
  query Customers {
11
- customers {
12
+ customers(first: 1000000, after: 0) {
12
13
  page {
13
14
  fullname
14
15
  identifier
@@ -6,3 +6,4 @@ export * from './subscriptionDetailQuery';
6
6
  export * from './processDetailQuery';
7
7
  export * from './customersQuery';
8
8
  export * from './subscriptionsDropdownOptionsQuery';
9
+ export * from './processStepsQuery';
@@ -20,6 +20,14 @@ export const GET_PROCESS_DETAIL_GRAPHQL_QUERY: TypedDocumentNode<
20
20
  lastStep
21
21
  workflowName
22
22
  isTask
23
+ form {
24
+ additionalProperties
25
+ definitions
26
+ properties
27
+ required
28
+ title
29
+ type
30
+ }
23
31
  steps {
24
32
  name
25
33
  status
@@ -3,23 +3,22 @@ import { gql } from 'graphql-request';
3
3
 
4
4
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
5
 
6
- import { GraphqlQueryVariables, Process, ProcessesResult } from '../types';
6
+ import { GraphqlQueryVariables, Process, ProcessListResult } from '@/types';
7
7
 
8
- export const GET_PROCESS_LIST_GRAPHQL_QUERY: TypedDocumentNode<
9
- ProcessesResult,
10
- GraphqlQueryVariables<Process>
11
- > = parse(gql`
8
+ export const GET_PROCESS_LIST_GRAPHQL_QUERY = parse(gql`
12
9
  query ProcessList(
13
- $first: IntType!
14
- $after: IntType!
10
+ $first: Int!
11
+ $after: Int!
15
12
  $sortBy: [GraphqlSort!]
16
13
  $filterBy: [GraphqlFilter!]
14
+ $query: String
17
15
  ) {
18
16
  processes(
19
17
  first: $first
20
18
  after: $after
21
19
  sortBy: $sortBy
22
20
  filterBy: $filterBy
21
+ query: $query
23
22
  ) {
24
23
  page {
25
24
  workflowName
@@ -39,6 +38,7 @@ export const GET_PROCESS_LIST_GRAPHQL_QUERY: TypedDocumentNode<
39
38
  processId
40
39
  startedAt
41
40
  lastModifiedAt
41
+ isTask
42
42
  subscriptions {
43
43
  page {
44
44
  subscriptionId
@@ -58,3 +58,44 @@ export const GET_PROCESS_LIST_GRAPHQL_QUERY: TypedDocumentNode<
58
58
  }
59
59
  }
60
60
  `);
61
+
62
+ export const GET_PROCESS_LIST_SUMMARY_GRAPHQL_QUERY = parse(gql`
63
+ query ProcessListSummary(
64
+ $first: Int!
65
+ $after: Int!
66
+ $sortBy: [GraphqlSort!]
67
+ $filterBy: [GraphqlFilter!]
68
+ $query: String
69
+ ) {
70
+ processes(
71
+ first: $first
72
+ after: $after
73
+ sortBy: $sortBy
74
+ filterBy: $filterBy
75
+ query: $query
76
+ ) {
77
+ page {
78
+ processId
79
+ workflowName
80
+ startedAt
81
+ }
82
+ pageInfo {
83
+ totalItems
84
+ startCursor
85
+ endCursor
86
+ }
87
+ }
88
+ }
89
+ `);
90
+
91
+ export const getProcessListGraphQlQuery = (): TypedDocumentNode<
92
+ ProcessListResult,
93
+ GraphqlQueryVariables<Process>
94
+ > => GET_PROCESS_LIST_GRAPHQL_QUERY;
95
+
96
+ export const getProcessListSummaryGraphQlQuery = (): TypedDocumentNode<
97
+ ProcessListResult<
98
+ Pick<Process, 'processId' | 'workflowName' | 'startedAt'>
99
+ >,
100
+ GraphqlQueryVariables<Process>
101
+ > => GET_PROCESS_LIST_SUMMARY_GRAPHQL_QUERY;
@@ -0,0 +1,22 @@
1
+ import { parse } from 'graphql';
2
+ import { gql } from 'graphql-request';
3
+
4
+ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
+
6
+ import { ProcessStepsResult } from '@/types';
7
+
8
+ export const GET_PROCESS_STEPS_GRAPHQL_QUERY: TypedDocumentNode<
9
+ ProcessStepsResult,
10
+ { processName: string }
11
+ > = parse(gql`
12
+ query ProcessSteps($processName: String!) {
13
+ workflows(filterBy: { field: "name", value: $processName }) {
14
+ page {
15
+ steps {
16
+ name
17
+ assignee
18
+ }
19
+ }
20
+ }
21
+ }
22
+ `);
@@ -3,19 +3,25 @@ import { gql } from 'graphql-request';
3
3
 
4
4
  import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
5
 
6
- import type { ProductBlockDefinition } from '../types';
7
- import { GraphqlQueryVariables, ProductBlockDefinitionsResult } from '../types';
6
+ import type { ProductBlockDefinition } from '@/types';
7
+ import { GraphqlQueryVariables, ProductBlockDefinitionsResult } from '@/types';
8
8
 
9
9
  export const GET_PRODUCTS_BLOCKS_GRAPHQL_QUERY: TypedDocumentNode<
10
10
  ProductBlockDefinitionsResult,
11
11
  GraphqlQueryVariables<ProductBlockDefinition>
12
12
  > = parse(gql`
13
13
  query MetadataProductBlocks(
14
- $first: IntType!
15
- $after: IntType!
14
+ $first: Int!
15
+ $after: Int!
16
16
  $sortBy: [GraphqlSort!]
17
+ $query: String
17
18
  ) {
18
- productBlocks(first: $first, after: $after, sortBy: $sortBy) {
19
+ productBlocks(
20
+ first: $first
21
+ after: $after
22
+ sortBy: $sortBy
23
+ query: $query
24
+ ) {
19
25
  page {
20
26
  productBlockId
21
27
  name
@@ -7,18 +7,17 @@ import {
7
7
  GraphqlQueryVariables,
8
8
  ProductDefinition,
9
9
  ProductDefinitionsResult,
10
+ SubscriptionsResult,
10
11
  } from '../types';
11
12
 
12
- export const GET_PRODUCTS_GRAPHQL_QUERY: TypedDocumentNode<
13
- ProductDefinitionsResult,
14
- GraphqlQueryVariables<ProductDefinition>
15
- > = parse(gql`
13
+ export const GET_PRODUCTS_GRAPHQL_QUERY = parse(gql`
16
14
  query MetadataProducts(
17
- $first: IntType!
18
- $after: IntType!
15
+ $first: Int!
16
+ $after: Int!
19
17
  $sortBy: [GraphqlSort!]
18
+ $query: String
20
19
  ) {
21
- products(first: $first, after: $after, sortBy: $sortBy) {
20
+ products(first: $first, after: $after, sortBy: $sortBy, query: $query) {
22
21
  page {
23
22
  productId
24
23
  name
@@ -48,3 +47,39 @@ export const GET_PRODUCTS_GRAPHQL_QUERY: TypedDocumentNode<
48
47
  }
49
48
  }
50
49
  `);
50
+
51
+ export const GET_PRODUCTS_SUMMARY_GRAPHQL_QUERY = parse(gql`
52
+ query MetadataProducts(
53
+ $first: Int!
54
+ $after: Int!
55
+ $sortBy: [GraphqlSort!]
56
+ ) {
57
+ products(first: $first, after: $after, sortBy: $sortBy) {
58
+ page {
59
+ name
60
+ subscriptions {
61
+ pageInfo {
62
+ totalItems
63
+ }
64
+ }
65
+ }
66
+ pageInfo {
67
+ totalItems
68
+ startCursor
69
+ endCursor
70
+ }
71
+ }
72
+ }
73
+ `);
74
+
75
+ export const getProductsSummaryQuery = (): TypedDocumentNode<
76
+ ProductDefinitionsResult<
77
+ Pick<ProductDefinition, 'name'> & SubscriptionsResult<never>
78
+ >,
79
+ GraphqlQueryVariables<ProductDefinition>
80
+ > => GET_PRODUCTS_SUMMARY_GRAPHQL_QUERY;
81
+
82
+ export const getProductsQuery = (): TypedDocumentNode<
83
+ ProductDefinitionsResult,
84
+ GraphqlQueryVariables<ProductDefinition>
85
+ > => GET_PRODUCTS_GRAPHQL_QUERY;
@@ -20,8 +20,8 @@ export const GET_RELATED_SUBSCRIPTIONS_GRAPHQL_QUERY: TypedDocumentNode<
20
20
  > = parse(gql`
21
21
  query RelatedSubscriptions(
22
22
  $subscriptionId: String!
23
- $first: IntType!
24
- $after: IntType!
23
+ $first: Int!
24
+ $after: Int!
25
25
  $sortBy: [GraphqlSort!]
26
26
  $terminatedSubscriptionFilter: [GraphqlFilter!]
27
27
  ) {
@@ -7,18 +7,24 @@ import type {
7
7
  GraphqlQueryVariables,
8
8
  ResourceTypeDefinition,
9
9
  ResourceTypeDefinitionsResult,
10
- } from '../types';
10
+ } from '@/types';
11
11
 
12
12
  export const GET_RESOURCE_TYPES_GRAPHQL_QUERY: TypedDocumentNode<
13
13
  ResourceTypeDefinitionsResult,
14
14
  GraphqlQueryVariables<ResourceTypeDefinition>
15
15
  > = parse(gql`
16
16
  query MetadataResourceTypes(
17
- $first: IntType!
18
- $after: IntType!
17
+ $first: Int!
18
+ $after: Int!
19
19
  $sortBy: [GraphqlSort!]
20
+ $query: String
20
21
  ) {
21
- resourceTypes(first: $first, after: $after, sortBy: $sortBy) {
22
+ resourceTypes(
23
+ first: $first
24
+ after: $after
25
+ sortBy: $sortBy
26
+ query: $query
27
+ ) {
22
28
  page {
23
29
  resourceTypeId
24
30
  resourceType
@@ -46,7 +46,10 @@ export const GET_SUBSCRIPTION_DETAIL_GRAPHQL_QUERY: TypedDocumentNode<
46
46
  subscriptionInstanceId
47
47
  inUseByRelations
48
48
  }
49
- processes(sortBy: { field: "startedAt", order: ASC }) {
49
+ processes(
50
+ sortBy: { field: "startedAt", order: ASC }
51
+ filterBy: { field: "isTask", value: "false" }
52
+ ) {
50
53
  page {
51
54
  processId
52
55
  lastStatus
@@ -54,6 +57,7 @@ export const GET_SUBSCRIPTION_DETAIL_GRAPHQL_QUERY: TypedDocumentNode<
54
57
  createdBy
55
58
  workflowTarget
56
59
  workflowName
60
+ isTask
57
61
  }
58
62
  }
59
63
  }
@@ -9,9 +9,10 @@ import {
9
9
  SubscriptionDropdownOptionsResult,
10
10
  } from '../types';
11
11
 
12
+ // Avoiding pagination by passing a large number to first. TODO: Fix this better
12
13
  export const GET_SUBSCRIPTION_DROPDOWN_OPTIONS_GRAPHQL_QUERY = parse(gql`
13
14
  query SubscriptionDropdownOptions($filterBy: [GraphqlFilter!]) {
14
- subscriptions(filterBy: $filterBy) {
15
+ subscriptions(filterBy: $filterBy, first: 1000000, after: 0) {
15
16
  page {
16
17
  description
17
18
  subscriptionId
@@ -7,20 +7,22 @@ import {
7
7
  GraphqlQueryVariables,
8
8
  Subscription,
9
9
  SubscriptionsResult,
10
- } from '../types';
10
+ } from '@/types';
11
11
 
12
12
  export const GET_SUBSCRIPTIONS_LIST_GRAPHQL_QUERY = parse(gql`
13
13
  query SubscriptionsList(
14
- $first: IntType!
15
- $after: IntType!
14
+ $first: Int!
15
+ $after: Int!
16
16
  $sortBy: [GraphqlSort!]
17
17
  $filterBy: [GraphqlFilter!]
18
+ $query: String
18
19
  ) {
19
20
  subscriptions(
20
21
  first: $first
21
22
  after: $after
22
23
  sortBy: $sortBy
23
24
  filterBy: $filterBy
25
+ query: $query
24
26
  ) {
25
27
  page {
26
28
  note
@@ -35,6 +37,10 @@ export const GET_SUBSCRIPTIONS_LIST_GRAPHQL_QUERY = parse(gql`
35
37
  tag
36
38
  productType
37
39
  }
40
+ customer {
41
+ fullname
42
+ shortcode
43
+ }
38
44
  }
39
45
  pageInfo {
40
46
  totalItems
@@ -49,11 +55,44 @@ export const GET_SUBSCRIPTIONS_LIST_GRAPHQL_QUERY = parse(gql`
49
55
  }
50
56
  `);
51
57
 
52
- export function getSubscriptionsListGraphQlQuery<
58
+ export const GET_SUBSCRIPTIONS_LIST_SUMMARY_GRAPHQL_QUERY = parse(gql`
59
+ query SubscriptionsList(
60
+ $first: Int!
61
+ $after: Int!
62
+ $sortBy: [GraphqlSort!]
63
+ $filterBy: [GraphqlFilter!]
64
+ $query: String
65
+ ) {
66
+ subscriptions(
67
+ first: $first
68
+ after: $after
69
+ sortBy: $sortBy
70
+ filterBy: $filterBy
71
+ query: $query
72
+ ) {
73
+ page {
74
+ description
75
+ subscriptionId
76
+ }
77
+ pageInfo {
78
+ totalItems
79
+ startCursor
80
+ endCursor
81
+ }
82
+ }
83
+ }
84
+ `);
85
+
86
+ export const getSubscriptionsListGraphQlQuery = <
53
87
  QueryVariablesType = Subscription,
54
88
  >(): TypedDocumentNode<
55
89
  SubscriptionsResult,
56
90
  GraphqlQueryVariables<QueryVariablesType>
57
- > {
58
- return GET_SUBSCRIPTIONS_LIST_GRAPHQL_QUERY;
59
- }
91
+ > => GET_SUBSCRIPTIONS_LIST_GRAPHQL_QUERY;
92
+
93
+ export const getSubscriptionsListSummaryGraphQlQuery = <
94
+ QueryVariablesType = Subscription,
95
+ >(): TypedDocumentNode<
96
+ SubscriptionsResult<Pick<Subscription, 'subscriptionId' | 'description'>>,
97
+ GraphqlQueryVariables<QueryVariablesType>
98
+ > => GET_SUBSCRIPTIONS_LIST_SUMMARY_GRAPHQL_QUERY;
@@ -7,18 +7,24 @@ import {
7
7
  GraphqlQueryVariables,
8
8
  WorkflowDefinition,
9
9
  WorkflowDefinitionsResult,
10
- } from '../../types';
10
+ } from '@/types';
11
11
 
12
12
  export const GET_WORKFLOWS_GRAPHQL_QUERY: TypedDocumentNode<
13
13
  WorkflowDefinitionsResult,
14
14
  GraphqlQueryVariables<WorkflowDefinition>
15
15
  > = parse(gql`
16
16
  query MetadataWorkflows(
17
- $first: IntType!
18
- $after: IntType!
17
+ $first: Int!
18
+ $after: Int!
19
19
  $sortBy: [GraphqlSort!]
20
+ $query: String
20
21
  ) {
21
- workflows(first: $first, after: $after, sortBy: $sortBy) {
22
+ workflows(
23
+ first: $first
24
+ after: $after
25
+ sortBy: $sortBy
26
+ query: $query
27
+ ) {
22
28
  page {
23
29
  name
24
30
  description
@@ -9,16 +9,13 @@ import {
9
9
  WorkflowDefinitionsResult,
10
10
  } from '../../types';
11
11
 
12
+ // Avoiding pagination by passing a large number to first. TODO: Fix this better
12
13
  export const GET_WORKFLOWS_FOR_DROPDOWN_LIST_GRAPHQL_QUERY: TypedDocumentNode<
13
14
  WorkflowDefinitionsResult<WorkflowDefinition>,
14
15
  GraphqlQueryVariables<WorkflowDefinition>
15
16
  > = parse(gql`
16
- query StartWorkflows(
17
- $first: IntType!
18
- $after: IntType!
19
- $filterBy: [GraphqlFilter!]
20
- ) {
21
- workflows(first: $first, after: $after, filterBy: $filterBy) {
17
+ query StartWorkflows($filterBy: [GraphqlFilter!]) {
18
+ workflows(first: 1000000, after: 0, filterBy: $filterBy) {
22
19
  page {
23
20
  name
24
21
  description
@@ -1,70 +1,21 @@
1
1
  import { useContext } from 'react';
2
2
  import { useQuery } from 'react-query';
3
3
 
4
- import { OrchestratorConfigContext } from '../contexts/OrchestratorConfigContext';
5
- import { GraphqlFilter, ItemsList, ProcessFromRestApi } from '../types';
4
+ import { OrchestratorConfigContext } from '@/contexts';
5
+ import { GraphqlFilter, ProcessDetailResultRaw } from '@/types';
6
+
6
7
  import { useQueryWithFetch } from './useQueryWithFetch';
8
+ import { useSessionWithToken } from './useSessionWithToken';
7
9
 
8
10
  export type CacheNames = { [key: string]: string };
9
11
 
10
- export const useFavouriteSubscriptions = () => {
11
- const { orchestratorApiBaseUrl } = useContext(OrchestratorConfigContext);
12
- const url = `${orchestratorApiBaseUrl}/subscriptions/?range=10%2C15`;
13
- const initialData: ItemsList = {
14
- buttonName: 'Show all favourites',
15
- items: [],
16
- title: 'Favourite Subscriptions',
17
- type: 'subscription',
18
- };
19
-
20
- const { data, isLoading } = useQueryWithFetch<
21
- ProcessFromRestApi[],
22
- Record<string, never>
23
- >(url, {}, 'favouriteSubscriptions');
24
- return isLoading ? initialData : { ...initialData, items: data || [] };
25
- };
26
-
27
- export const useProcessesAttention = () => {
28
- const { orchestratorApiBaseUrl } = useContext(OrchestratorConfigContext);
29
- const url = `${orchestratorApiBaseUrl}/processes/?range=100%2C105`;
30
- const initialData: ItemsList = {
31
- type: 'process',
32
- title: 'Processes that need attention',
33
- items: [],
34
- buttonName: 'Show all active processes',
35
- };
36
-
37
- const { data, isLoading } = useQueryWithFetch<
38
- ProcessFromRestApi[],
39
- Record<string, never>
40
- >(url, {}, 'processesAttention');
41
- return isLoading ? initialData : { ...initialData, items: data || [] };
42
- };
43
-
44
- export const useRecentProcesses = () => {
45
- const { orchestratorApiBaseUrl } = useContext(OrchestratorConfigContext);
46
- const url = `${orchestratorApiBaseUrl}/processes/?range=106%2C111`;
47
- const initialData: ItemsList = {
48
- type: 'process',
49
- title: 'Recently completed processes',
50
- items: [],
51
- buttonName: 'Show all completed processes',
52
- };
53
-
54
- const { data, isLoading } = useQueryWithFetch<
55
- ProcessFromRestApi[],
56
- Record<string, never>
57
- >(url, {}, 'recentProcesses');
58
- return isLoading ? initialData : { ...initialData, items: data || [] };
59
- };
60
-
61
12
  export const useRawProcessDetails = (processId: string) => {
62
13
  const { orchestratorApiBaseUrl } = useContext(OrchestratorConfigContext);
63
14
  const url = `${orchestratorApiBaseUrl}/processes/${processId}`;
64
- return useQueryWithFetch<object, Record<string, never>>(
15
+ return useQueryWithFetch<ProcessDetailResultRaw, Record<string, never>>(
65
16
  url,
66
17
  {},
67
- 'RawProcessDetails',
18
+ `RawProcessDetails-${processId}`,
68
19
  );
69
20
  };
70
21
 
@@ -74,7 +25,7 @@ export const useCacheNames = () => {
74
25
  return useQueryWithFetch<CacheNames, Record<string, never>>(
75
26
  url,
76
27
  {},
77
- 'recentProcesses',
28
+ 'cacheNames',
78
29
  );
79
30
  };
80
31
 
@@ -82,23 +33,31 @@ const filterDataByCriteria = <Type>(
82
33
  data: Type[],
83
34
  filterCriteria: GraphqlFilter<Type>[],
84
35
  ): Type[] => {
85
- return data.filter((item) => {
36
+ return data.filter((dataItem) => {
86
37
  return filterCriteria.some((filter) => {
87
- return item[filter.field] === filter.value;
38
+ const dataValue = dataItem[filter.field] as unknown as string;
39
+ const filterValue = filter.value;
40
+ return dataValue === filterValue;
88
41
  });
89
42
  });
90
43
  };
91
44
 
92
45
  export const useFilterQueryWithRest = <Type>(
93
- endpoint: string,
46
+ url: string,
94
47
  queryKey: string[],
95
48
  filters?: GraphqlFilter<Type>[],
96
49
  refetchInterval?: number,
97
50
  ) => {
98
- const { orchestratorApiBaseUrl } = useContext(OrchestratorConfigContext);
51
+ const { session } = useSessionWithToken();
99
52
 
100
53
  const fetchFromApi = async () => {
101
- const response = await fetch(orchestratorApiBaseUrl + endpoint);
54
+ const response = await fetch(url, {
55
+ headers: {
56
+ Authorization: session?.accessToken
57
+ ? `Bearer ${session.accessToken}`
58
+ : '',
59
+ },
60
+ });
102
61
  const data = await response.json();
103
62
  return filters ? filterDataByCriteria(data, filters) : data;
104
63
  };
@@ -1,5 +1,7 @@
1
+ export * from './useCheckEngineStatus';
1
2
  export * from './useQueryWithGraphql';
2
3
  export * from './useEngineStatusQuery';
4
+ export * from './useMutateProcess';
3
5
  export * from './useOrchestratorConfig';
4
6
  export * from './useOrchestratorTheme';
5
7
  export * from './useProcessStatusCountsQuery';
@@ -10,3 +12,4 @@ export * from './useToastMessage';
10
12
  export * from './useStoredTableConfig';
11
13
  export * from './useWithOrchestratorTheme';
12
14
  export * from './useSessionWithToken';
15
+ export * from './useQueryWithFetch';
@@ -34,6 +34,7 @@ export const useGetSubscriptionDropdownOptions = (
34
34
  filterBy: filters,
35
35
  },
36
36
  'subscriptionOptions',
37
+ { refetchOnWindowFocus: false },
37
38
  );
38
39
 
39
40
  const subscriptions = (() => {
@@ -10,8 +10,7 @@ export const useIsTaggedPort = (subscriptionId: string): [boolean, boolean] => {
10
10
  GET_SUBSCRIPTION_DETAIL_GRAPHQL_QUERY,
11
11
  { subscriptionId },
12
12
  `subscription-${subscriptionId}`,
13
- false,
14
- !!subscriptionId,
13
+ { enabled: !!subscriptionId },
15
14
  );
16
15
  const subscriptionDetail = data?.subscriptions.page[0];
17
16
 
@@ -0,0 +1,30 @@
1
+ import { useTranslations } from 'next-intl';
2
+
3
+ import { ToastTypes } from '@/contexts';
4
+ import { useEngineStatusQuery } from '@/hooks/useEngineStatusQuery';
5
+ import { useToastMessage } from '@/hooks/useToastMessage';
6
+
7
+ export const useCheckEngineStatus = () => {
8
+ const tErrors = useTranslations('errors');
9
+ const toastMessage = useToastMessage();
10
+ const { refetch } = useEngineStatusQuery();
11
+
12
+ const isEngineRunningNow = async () => {
13
+ const result = await refetch();
14
+ const isEngineRunning = result.data?.global_status === 'RUNNING';
15
+
16
+ if (!isEngineRunning) {
17
+ toastMessage.addToast(
18
+ ToastTypes.ERROR,
19
+ tErrors('notAllowedWhenEngineIsNotRunningMessage'),
20
+ tErrors('notAllowedWhenEngineIsNotRunningTitle'),
21
+ );
22
+ }
23
+
24
+ return isEngineRunning;
25
+ };
26
+
27
+ return {
28
+ isEngineRunningNow,
29
+ };
30
+ };