@orchestrator-ui/orchestrator-ui-components 1.3.1 → 1.5.0

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 (113) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/.turbo/turbo-lint.log +7 -1
  3. package/.turbo/turbo-test.log +7 -7
  4. package/CHANGELOG.md +31 -2
  5. package/LICENSE.txt +202 -0
  6. package/README.md +22 -0
  7. package/dist/index.d.ts +531 -314
  8. package/dist/index.js +5120 -7384
  9. package/package.json +21 -4
  10. package/src/api/index.ts +4 -3
  11. package/src/api/types.ts +53 -0
  12. package/src/components/WfoDropdownButton/WfoDropdownButton.tsx +2 -0
  13. package/src/components/WfoForms/AutoFieldLoader.tsx +6 -6
  14. package/src/components/WfoForms/formFields/AcceptField.tsx +2 -1
  15. package/src/components/WfoForms/formFields/BoolField.tsx +2 -1
  16. package/src/components/WfoForms/formFields/DividerField.tsx +1 -1
  17. package/src/components/WfoForms/formFields/ErrorField.tsx +1 -1
  18. package/src/components/WfoForms/formFields/LabelField.tsx +1 -1
  19. package/src/components/WfoForms/formFields/ListAddField.tsx +2 -1
  20. package/src/components/WfoForms/formFields/ListDelField.tsx +2 -1
  21. package/src/components/WfoForms/formFields/LongTextField.tsx +1 -1
  22. package/src/components/WfoForms/formFields/NumField.tsx +1 -1
  23. package/src/components/WfoForms/formFields/ProductField.tsx +8 -7
  24. package/src/components/WfoForms/formFields/RadioField.tsx +1 -1
  25. package/src/components/WfoForms/formFields/SelectField.tsx +4 -2
  26. package/src/components/WfoForms/formFields/SubmitField.tsx +1 -1
  27. package/src/components/WfoForms/formFields/SubscriptionField.tsx +5 -4
  28. package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +11 -15
  29. package/src/components/WfoForms/formFields/TextField.tsx +1 -1
  30. package/src/components/WfoForms/formFields/{ContactPersonAutocomplete.tsx → deprecated/ContactPersonAutocomplete.tsx} +4 -3
  31. package/src/components/WfoForms/formFields/{ContactPersonNameField.tsx → deprecated/ContactPersonNameField.tsx} +3 -2
  32. package/src/components/WfoForms/formFields/{ImsNodeIdField.tsx → deprecated/ImsNodeIdField.tsx} +4 -3
  33. package/src/components/WfoForms/formFields/{ImsPortIdField.tsx → deprecated/ImsPortIdField.tsx} +7 -4
  34. package/src/components/WfoForms/formFields/{IpNetworkField.tsx → deprecated/IpNetworkField.tsx} +4 -3
  35. package/src/components/WfoForms/formFields/{IpPrefixTableField.tsx → deprecated/IpPrefixTableField.tsx} +5 -4
  36. package/src/components/WfoForms/formFields/{SplitPrefix.tsx → deprecated/SplitPrefix.tsx} +3 -2
  37. package/src/components/WfoForms/formFields/{TimestampField.tsx → deprecated/TimestampField.tsx} +1 -1
  38. package/src/components/WfoForms/formFields/{VlanField.tsx → deprecated/VlanField.tsx} +5 -4
  39. package/src/components/WfoForms/formFields/deprecated/index.ts +13 -0
  40. package/src/components/WfoForms/formFields/{surf → deprecated}/types.ts +1 -1
  41. package/src/components/WfoForms/formFields/index.ts +1 -6
  42. package/src/components/WfoForms/formFields/utils.spec.ts +1 -1
  43. package/src/components/WfoForms/formFields/utils.ts +3 -2
  44. package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +2 -2
  45. package/src/components/WfoProcessList/WfoProcessesList.tsx +16 -9
  46. package/src/components/WfoProcessList/processListObjectMappers.ts +6 -10
  47. package/src/components/WfoSettings/WfoModifySettings.tsx +29 -13
  48. package/src/components/WfoSettings/WfoResetTextSearchIndexButton.tsx +22 -0
  49. package/src/components/WfoSettings/index.ts +1 -0
  50. package/src/components/{WfoButtonComboBox/WfoButtonComboBox.tsx → WfoStartButton/WfoStartButtonComboBox.tsx} +11 -17
  51. package/src/components/WfoStartButton/WfoStartTaskComboBox.tsx +47 -0
  52. package/src/components/WfoStartButton/WfoStartWorkflowComboBox.tsx +49 -0
  53. package/src/components/WfoStartButton/index.ts +2 -0
  54. package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +30 -36
  55. package/src/components/WfoSubscription/WfoSubscription.tsx +17 -20
  56. package/src/components/WfoSubscription/index.ts +6 -4
  57. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +12 -16
  58. package/src/components/WfoSubscriptionsList/subscriptionResultMappers.ts +10 -12
  59. package/src/components/index.ts +2 -1
  60. package/src/configuration/constants.ts +3 -0
  61. package/src/hooks/{surf → deprecated}/useGetSubscriptionDropdownOptions.ts +6 -13
  62. package/src/hooks/{surf → deprecated}/useIsTaggedPort.ts +6 -9
  63. package/src/hooks/index.ts +0 -1
  64. package/src/index.ts +0 -1
  65. package/src/messages/en-GB.json +3 -1
  66. package/src/messages/nl-NL.json +3 -1
  67. package/src/pages/metadata/WfoProductBlocksPage.tsx +27 -37
  68. package/src/pages/metadata/WfoProductsPage.tsx +11 -16
  69. package/src/pages/metadata/WfoResourceTypesPage.tsx +33 -35
  70. package/src/pages/metadata/WfoWorkflowsPage.tsx +42 -40
  71. package/src/pages/metadata/workflowListObjectMapper.ts +4 -7
  72. package/src/pages/processes/WfoStartProcessPage.tsx +0 -6
  73. package/src/pages/startPage/WfoStartPage.tsx +56 -68
  74. package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +6 -7
  75. package/src/rtk/api.ts +11 -3
  76. package/src/rtk/endpoints/index.ts +11 -2
  77. package/src/rtk/endpoints/metadata/index.ts +3 -0
  78. package/src/rtk/endpoints/metadata/productBlocks.ts +88 -0
  79. package/src/rtk/endpoints/metadata/resourceTypes.ts +78 -0
  80. package/src/rtk/endpoints/metadata/workflows.ts +73 -0
  81. package/src/rtk/endpoints/processList.ts +2 -1
  82. package/src/rtk/endpoints/processListSummary.ts +70 -0
  83. package/src/rtk/endpoints/products.ts +76 -0
  84. package/src/rtk/endpoints/productsSummary.ts +62 -0
  85. package/src/rtk/endpoints/relatedSubscriptions.ts +99 -0
  86. package/src/rtk/endpoints/settings.ts +10 -0
  87. package/src/rtk/endpoints/startOptions.ts +99 -0
  88. package/src/{graphqlQueries/subscriptionDetailQuery.ts → rtk/endpoints/subscriptionDetail.ts} +45 -11
  89. package/src/rtk/endpoints/subscriptionList.ts +86 -0
  90. package/src/rtk/endpoints/subscriptionListSummary.ts +70 -0
  91. package/src/rtk/endpoints/subscriptionsDropdownOptions.ts +72 -0
  92. package/src/types/types.ts +20 -0
  93. package/src/utils/index.ts +1 -0
  94. package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +0 -61
  95. package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +0 -54
  96. package/src/components/WfoStartTaskButtonComboBox/index.ts +0 -1
  97. package/src/graphqlQueries/index.ts +0 -7
  98. package/src/graphqlQueries/processListQuery.ts +0 -101
  99. package/src/graphqlQueries/productBlocksQuery.ts +0 -59
  100. package/src/graphqlQueries/productsQuery.ts +0 -85
  101. package/src/graphqlQueries/relatedSubscriptionsQuery.ts +0 -65
  102. package/src/graphqlQueries/resourceTypesQuery.ts +0 -52
  103. package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +0 -48
  104. package/src/graphqlQueries/subscriptionsListQuery.ts +0 -101
  105. package/src/graphqlQueries/workflows/workflowsQuery.ts +0 -48
  106. package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +0 -38
  107. package/src/hooks/useQueryWithGraphql.ts +0 -72
  108. /package/src/components/WfoForms/formFields/{ContactPersonAutocompleteStyles.ts → deprecated/ContactPersonAutocompleteStyles.ts} +0 -0
  109. /package/src/components/WfoForms/formFields/{ImsPortIdFieldStyling.ts → deprecated/ImsPortIdFieldStyling.ts} +0 -0
  110. /package/src/components/WfoForms/formFields/{IpPrefixTableFieldStyling.ts → deprecated/IpPrefixTableFieldStyling.ts} +0 -0
  111. /package/src/components/WfoForms/formFields/{SplitPrefixStyling.ts → deprecated/SplitPrefixStyling.ts} +0 -0
  112. /package/src/components/WfoForms/formFields/{surf → deprecated}/utils.ts +0 -0
  113. /package/src/components/{WfoButtonComboBox → WfoStartButton}/styles.ts +0 -0
@@ -10,16 +10,17 @@ import {
10
10
  SummaryCardStatus,
11
11
  WfoSummaryCards,
12
12
  } from '@/components/WfoSummary/WfoSummaryCards';
13
+ import { PolicyResource } from '@/configuration';
14
+ import { usePolicy } from '@/hooks';
13
15
  import {
14
- getProductsSummaryQuery,
15
- getSubscriptionsListSummaryGraphQlQuery,
16
- } from '@/graphqlQueries';
17
- import { getProcessListSummaryGraphQlQuery } from '@/graphqlQueries/processListQuery';
18
- import { useQueryWithGraphql } from '@/hooks';
16
+ useGetProcessListSummaryQuery,
17
+ useGetProductsSummaryQuery,
18
+ } from '@/rtk';
19
+ import { useGetSubscriptionSummaryListQuery } from '@/rtk/endpoints/subscriptionListSummary';
19
20
  import {
20
21
  GraphqlQueryVariables,
21
22
  Process,
22
- ProductDefinition,
23
+ ProductsSummary,
23
24
  SortOrder,
24
25
  Subscription,
25
26
  } from '@/types';
@@ -27,62 +28,46 @@ import { formatDate } from '@/utils';
27
28
 
28
29
  export const WfoStartPage = () => {
29
30
  const t = useTranslations('startPage');
31
+ const { isAllowed } = usePolicy();
30
32
 
31
33
  const {
32
34
  data: subscriptionsSummaryResult,
33
35
  isLoading: subscriptionsSummaryIsFetching,
34
- } = useQueryWithGraphql(
35
- getSubscriptionsListSummaryGraphQlQuery(),
36
+ } = useGetSubscriptionSummaryListQuery(
36
37
  subscriptionsListSummaryQueryVariables,
37
- ['subscriptions', 'startPage'],
38
38
  );
39
39
  const {
40
40
  data: outOfSyncSubscriptionsSummaryResult,
41
41
  isLoading: outOfSyncsubscriptionsSummaryIsFetching,
42
- } = useQueryWithGraphql(
43
- getSubscriptionsListSummaryGraphQlQuery(),
42
+ } = useGetSubscriptionSummaryListQuery(
44
43
  outOfSyncSubscriptionsListSummaryQueryVariables,
45
- ['subscriptions', 'startPage'],
46
44
  );
47
45
  const {
48
- data: processesSummaryResult,
49
- isLoading: processesSummaryIsFetching,
50
- } = useQueryWithGraphql(
51
- getProcessListSummaryGraphQlQuery(),
52
- processListSummaryQueryVariables,
53
- ['workflows', 'startPage'],
54
- );
46
+ data: processesSummaryResponse,
47
+ isFetching: processesSummaryIsFetching,
48
+ } = useGetProcessListSummaryQuery(processListSummaryQueryVariables);
49
+
55
50
  const {
56
- data: failedTasksSummaryResult,
57
- isLoading: failedTasksSummaryIsFetching,
58
- } = useQueryWithGraphql(
59
- getProcessListSummaryGraphQlQuery(),
60
- taskListSummaryQueryVariables,
61
- ['tasks', 'startPage'],
62
- );
51
+ data: failedTasksSummaryResponse,
52
+ isFetching: failedTasksSummaryIsFetching,
53
+ } = useGetProcessListSummaryQuery(taskListSummaryQueryVariables);
54
+
63
55
  const {
64
56
  data: productsSummaryResult,
65
57
  isLoading: productsSummaryIsFetching,
66
- } = useQueryWithGraphql(
67
- getProductsSummaryQuery(),
68
- productsSummaryQueryVariables,
69
- 'productSummary',
70
- );
58
+ } = useGetProductsSummaryQuery(productsSummaryQueryVariables);
71
59
 
72
60
  const latestActiveSubscriptionsSummaryCard: SummaryCard = {
73
61
  headerTitle: t('activeSubscriptions.headerTitle'),
74
- headerValue:
75
- subscriptionsSummaryResult?.subscriptions.pageInfo.totalItems ?? 0,
62
+ headerValue: subscriptionsSummaryResult?.pageInfo.totalItems ?? 0,
76
63
  headerStatus: SummaryCardStatus.Neutral,
77
64
  listTitle: t('activeSubscriptions.listTitle'),
78
65
  listItems:
79
- subscriptionsSummaryResult?.subscriptions.page.map(
80
- (subscription) => ({
81
- title: subscription.description,
82
- value: formatDate(subscription.startDate),
83
- url: `${PATH_SUBSCRIPTIONS}/${subscription.subscriptionId}`,
84
- }),
85
- ) ?? [],
66
+ subscriptionsSummaryResult?.subscriptions.map((subscription) => ({
67
+ title: subscription.description,
68
+ value: formatDate(subscription.startDate),
69
+ url: `${PATH_SUBSCRIPTIONS}/${subscription.subscriptionId}`,
70
+ })) ?? [],
86
71
  button: {
87
72
  name: t('activeSubscriptions.buttonText'),
88
73
  url: PATH_SUBSCRIPTIONS,
@@ -93,12 +78,11 @@ export const WfoStartPage = () => {
93
78
  const latestOutOfSyncSubscriptionsSummaryCard: SummaryCard = {
94
79
  headerTitle: t('outOfSyncSubscriptions.headerTitle'),
95
80
  headerValue:
96
- outOfSyncSubscriptionsSummaryResult?.subscriptions.pageInfo
97
- .totalItems ?? 0,
81
+ outOfSyncSubscriptionsSummaryResult?.pageInfo.totalItems ?? 0,
98
82
  headerStatus: SummaryCardStatus.Error,
99
83
  listTitle: t('outOfSyncSubscriptions.listTitle'),
100
84
  listItems:
101
- outOfSyncSubscriptionsSummaryResult?.subscriptions.page.map(
85
+ outOfSyncSubscriptionsSummaryResult?.subscriptions.map(
102
86
  (subscription) => ({
103
87
  title: subscription.description,
104
88
  value: formatDate(subscription.startDate),
@@ -114,11 +98,11 @@ export const WfoStartPage = () => {
114
98
 
115
99
  const latestWorkflowsSummaryCard: SummaryCard = {
116
100
  headerTitle: t('activeWorkflows.headerTitle'),
117
- headerValue: processesSummaryResult?.processes.pageInfo.totalItems ?? 0,
101
+ headerValue: processesSummaryResponse?.pageInfo.totalItems ?? 0,
118
102
  headerStatus: SummaryCardStatus.Success,
119
103
  listTitle: t('activeWorkflows.listTitle'),
120
104
  listItems:
121
- processesSummaryResult?.processes.page.map((workflow) => ({
105
+ processesSummaryResponse?.processes.map((workflow) => ({
122
106
  title: workflow.workflowName,
123
107
  value: formatDate(workflow?.startedAt),
124
108
  url: `${PATH_WORKFLOWS}/${workflow.processId}`,
@@ -132,12 +116,11 @@ export const WfoStartPage = () => {
132
116
 
133
117
  const failedTasksSummaryCard: SummaryCard = {
134
118
  headerTitle: t('failedTasks.headerTitle'),
135
- headerValue:
136
- failedTasksSummaryResult?.processes.pageInfo.totalItems ?? 0,
119
+ headerValue: failedTasksSummaryResponse?.pageInfo.totalItems ?? 0,
137
120
  headerStatus: SummaryCardStatus.Error,
138
121
  listTitle: t('failedTasks.listTitle'),
139
122
  listItems:
140
- failedTasksSummaryResult?.processes.page.map((task) => ({
123
+ failedTasksSummaryResponse?.processes.map((task) => ({
141
124
  title: task.workflowName,
142
125
  value: formatDate(task?.startedAt),
143
126
  url: `${PATH_TASKS}/${task.processId}`,
@@ -151,11 +134,11 @@ export const WfoStartPage = () => {
151
134
 
152
135
  const productsSummaryCard: SummaryCard = {
153
136
  headerTitle: t('products.headerTitle'),
154
- headerValue: productsSummaryResult?.products.pageInfo.totalItems ?? 0,
137
+ headerValue: productsSummaryResult?.pageInfo.totalItems ?? 0,
155
138
  headerStatus: SummaryCardStatus.Neutral,
156
139
  listTitle: t('products.listTitle'),
157
140
  listItems:
158
- productsSummaryResult?.products.page
141
+ [...(productsSummaryResult?.products ?? [])]
159
142
  .sort(
160
143
  (left, right) =>
161
144
  (right.subscriptions.pageInfo.totalItems ?? 0) -
@@ -180,17 +163,23 @@ export const WfoStartPage = () => {
180
163
  isLoading: productsSummaryIsFetching,
181
164
  };
182
165
 
166
+ function getFailedTasksSummarycard() {
167
+ return isAllowed(PolicyResource.NAVIGATION_TASKS)
168
+ ? [failedTasksSummaryCard]
169
+ : [];
170
+ }
171
+
172
+ const allowedSummaryCards = [
173
+ latestWorkflowsSummaryCard,
174
+ ...getFailedTasksSummarycard(),
175
+ latestOutOfSyncSubscriptionsSummaryCard,
176
+ latestActiveSubscriptionsSummaryCard,
177
+ productsSummaryCard,
178
+ ];
179
+
183
180
  return (
184
181
  <EuiFlexItem>
185
- <WfoSummaryCards
186
- summaryCards={[
187
- failedTasksSummaryCard,
188
- latestOutOfSyncSubscriptionsSummaryCard,
189
- latestWorkflowsSummaryCard,
190
- latestActiveSubscriptionsSummaryCard,
191
- productsSummaryCard,
192
- ]}
193
- />
182
+ <WfoSummaryCards summaryCards={allowedSummaryCards} />
194
183
  </EuiFlexItem>
195
184
  );
196
185
  };
@@ -276,12 +265,11 @@ const taskListSummaryQueryVariables: GraphqlQueryVariables<Process> = {
276
265
  ],
277
266
  };
278
267
 
279
- const productsSummaryQueryVariables: GraphqlQueryVariables<ProductDefinition> =
280
- {
281
- first: 1000,
282
- after: 0,
283
- sortBy: {
284
- field: 'name',
285
- order: SortOrder.ASC,
286
- },
287
- };
268
+ const productsSummaryQueryVariables: GraphqlQueryVariables<ProductsSummary> = {
269
+ first: 1000,
270
+ after: 0,
271
+ sortBy: {
272
+ field: 'name',
273
+ order: SortOrder.ASC,
274
+ },
275
+ };
@@ -9,17 +9,16 @@ import {
9
9
  DEFAULT_PAGE_SIZE,
10
10
  SUBSCRIPTIONS_TABLE_LOCAL_STORAGE_KEY,
11
11
  } from '@/components';
12
-
13
- import { WfoFilterTabs } from '../../components';
12
+ import { WfoFilterTabs } from '@/components';
13
+ import { StoredTableConfig } from '@/components';
14
14
  import {
15
15
  WfoSubscriptionListTab,
16
16
  WfoSubscriptionsList,
17
17
  subscriptionListTabs,
18
- } from '../../components/WfoSubscriptionsList';
19
- import { SubscriptionListItem } from '../../components/WfoSubscriptionsList';
20
- import { StoredTableConfig } from '../../components/WfoTable';
21
- import { useDataDisplayParams, useStoredTableConfig } from '../../hooks';
22
- import { SortOrder } from '../../types';
18
+ } from '@/components/WfoSubscriptionsList';
19
+ import { SubscriptionListItem } from '@/components/WfoSubscriptionsList';
20
+ import { useDataDisplayParams, useStoredTableConfig } from '@/hooks';
21
+ import { SortOrder } from '@/types';
23
22
 
24
23
  export const WfoSubscriptionsListPage = () => {
25
24
  const t = useTranslations('subscriptions.detail');
package/src/rtk/api.ts CHANGED
@@ -15,8 +15,10 @@ export enum BaseQueryTypes {
15
15
 
16
16
  export enum CacheTags {
17
17
  engineStatus = 'engineStatus',
18
- // This is a placeholder for now. Having only one messes up the type of the tag in the onCacheEntryAdded function.
19
- testStatus = 'testStatus',
18
+ processList = 'processList',
19
+ processListSummary = 'processListSummary',
20
+ subscription = 'subscription',
21
+ subscriptionList = 'subscriptionList',
20
22
  }
21
23
 
22
24
  type ExtraOptions = {
@@ -63,5 +65,11 @@ export const orchestratorApi = createApi({
63
65
  }
64
66
  },
65
67
  endpoints: () => ({}),
66
- tagTypes: [CacheTags.engineStatus, CacheTags.testStatus],
68
+ tagTypes: [
69
+ CacheTags.engineStatus,
70
+ CacheTags.processList,
71
+ CacheTags.processListSummary,
72
+ CacheTags.subscriptionList,
73
+ CacheTags.subscription,
74
+ ],
67
75
  });
@@ -1,6 +1,15 @@
1
1
  export * from './customers';
2
+ export * from './inSync';
3
+ export * from './metadata';
2
4
  export * from './processList';
5
+ export * from './processListSummary';
6
+ export * from './processSteps';
7
+ export * from './products';
8
+ export * from './productsSummary';
9
+ export * from './relatedSubscriptions';
3
10
  export * from './settings';
4
11
  export * from './streamMessages';
5
- export * from './inSync';
6
- export * from './processSteps';
12
+ export * from './subscriptionDetail';
13
+ export * from './subscriptionsDropdownOptions';
14
+ export * from './relatedSubscriptions';
15
+ export * from './startOptions';
@@ -0,0 +1,3 @@
1
+ export * from './productBlocks';
2
+ export * from './resourceTypes';
3
+ export * from './workflows';
@@ -0,0 +1,88 @@
1
+ import { orchestratorApi } from '@/rtk';
2
+ import {
3
+ BaseGraphQlResult,
4
+ GraphqlQueryVariables,
5
+ ProductBlockDefinition,
6
+ ProductBlockDefinitionsResult,
7
+ } from '@/types';
8
+
9
+ export const productBlocksQuery = `
10
+ query MetadataProductBlocks(
11
+ $first: Int!
12
+ $after: Int!
13
+ $sortBy: [GraphqlSort!]
14
+ $query: String
15
+ ) {
16
+ productBlocks(
17
+ first: $first
18
+ after: $after
19
+ sortBy: $sortBy
20
+ query: $query
21
+ ) {
22
+ page {
23
+ productBlockId
24
+ name
25
+ tag
26
+ description
27
+ status
28
+ createdAt
29
+ endDate
30
+ resourceTypes {
31
+ description
32
+ resourceType
33
+ resourceTypeId
34
+ }
35
+ dependsOn {
36
+ productBlockId
37
+ name
38
+ tag
39
+ description
40
+ status
41
+ createdAt
42
+ endDate
43
+ }
44
+ }
45
+ pageInfo {
46
+ endCursor
47
+ hasNextPage
48
+ hasPreviousPage
49
+ startCursor
50
+ totalItems
51
+ sortFields
52
+ filterFields
53
+ }
54
+ }
55
+ }
56
+ `;
57
+
58
+ export type ProductBlocksResponse = {
59
+ productBlocks: ProductBlockDefinition[];
60
+ } & BaseGraphQlResult;
61
+
62
+ const productBlocksApi = orchestratorApi.injectEndpoints({
63
+ endpoints: (builder) => ({
64
+ getProductBlocks: builder.query<
65
+ ProductBlocksResponse,
66
+ GraphqlQueryVariables<ProductBlockDefinition>
67
+ >({
68
+ query: (variables) => ({
69
+ document: productBlocksQuery,
70
+ variables,
71
+ }),
72
+ transformResponse: (
73
+ response: ProductBlockDefinitionsResult,
74
+ ): ProductBlocksResponse => {
75
+ const productBlocks = response.productBlocks.page || [];
76
+ const pageInfo = response.productBlocks.pageInfo || {};
77
+
78
+ return {
79
+ productBlocks,
80
+ pageInfo,
81
+ };
82
+ },
83
+ }),
84
+ }),
85
+ });
86
+
87
+ export const { useGetProductBlocksQuery, useLazyGetProductBlocksQuery } =
88
+ productBlocksApi;
@@ -0,0 +1,78 @@
1
+ import { orchestratorApi } from '@/rtk';
2
+ import {
3
+ BaseGraphQlResult,
4
+ GraphqlQueryVariables,
5
+ ResourceTypeDefinition,
6
+ ResourceTypeDefinitionsResult,
7
+ } from '@/types';
8
+
9
+ export const resourceTypesQuery = `
10
+ query MetadataResourceTypes(
11
+ $first: Int!
12
+ $after: Int!
13
+ $sortBy: [GraphqlSort!]
14
+ $query: String
15
+ ) {
16
+ resourceTypes(
17
+ first: $first
18
+ after: $after
19
+ sortBy: $sortBy
20
+ query: $query
21
+ ) {
22
+ page {
23
+ resourceTypeId
24
+ resourceType
25
+ description
26
+ productBlocks {
27
+ description
28
+ name
29
+ productBlockId
30
+ status
31
+ createdAt
32
+ endDate
33
+ }
34
+ }
35
+ pageInfo {
36
+ endCursor
37
+ hasNextPage
38
+ hasPreviousPage
39
+ startCursor
40
+ totalItems
41
+ sortFields
42
+ filterFields
43
+ }
44
+ }
45
+ }
46
+ `;
47
+
48
+ export type ResourceTypesResponse = {
49
+ resourceTypes: ResourceTypeDefinition[];
50
+ } & BaseGraphQlResult;
51
+
52
+ const resourceTypesApi = orchestratorApi.injectEndpoints({
53
+ endpoints: (builder) => ({
54
+ getResourceTypes: builder.query<
55
+ ResourceTypesResponse,
56
+ GraphqlQueryVariables<ResourceTypeDefinition>
57
+ >({
58
+ query: (variables) => ({
59
+ document: resourceTypesQuery,
60
+ variables,
61
+ }),
62
+ transformResponse: (
63
+ response: ResourceTypeDefinitionsResult,
64
+ ): ResourceTypesResponse => {
65
+ const resourceTypes = response.resourceTypes.page || [];
66
+ const pageInfo = response.resourceTypes.pageInfo || {};
67
+
68
+ return {
69
+ resourceTypes,
70
+ pageInfo,
71
+ };
72
+ },
73
+ }),
74
+ }),
75
+ });
76
+
77
+ export const { useGetResourceTypesQuery, useLazyGetResourceTypesQuery } =
78
+ resourceTypesApi;
@@ -0,0 +1,73 @@
1
+ import { orchestratorApi } from '@/rtk';
2
+ import {
3
+ BaseGraphQlResult,
4
+ GraphqlQueryVariables,
5
+ WorkflowDefinition,
6
+ WorkflowDefinitionsResult,
7
+ } from '@/types';
8
+
9
+ export const workflowsQuery = `
10
+ query MetadataWorkflows(
11
+ $first: Int!
12
+ $after: Int!
13
+ $sortBy: [GraphqlSort!]
14
+ $query: String
15
+ ) {
16
+ workflows(
17
+ first: $first
18
+ after: $after
19
+ sortBy: $sortBy
20
+ query: $query
21
+ ) {
22
+ page {
23
+ name
24
+ description
25
+ target
26
+ products {
27
+ tag
28
+ }
29
+ createdAt
30
+ }
31
+ pageInfo {
32
+ endCursor
33
+ hasNextPage
34
+ hasPreviousPage
35
+ startCursor
36
+ totalItems
37
+ sortFields
38
+ filterFields
39
+ }
40
+ }
41
+ }
42
+ `;
43
+
44
+ export type WorkflowsResponse = {
45
+ workflows: WorkflowDefinition[];
46
+ } & BaseGraphQlResult;
47
+
48
+ const workflowsApi = orchestratorApi.injectEndpoints({
49
+ endpoints: (builder) => ({
50
+ getWorkflows: builder.query<
51
+ WorkflowsResponse,
52
+ GraphqlQueryVariables<WorkflowDefinition>
53
+ >({
54
+ query: (variables) => ({
55
+ document: workflowsQuery,
56
+ variables,
57
+ }),
58
+ transformResponse: (
59
+ response: WorkflowDefinitionsResult,
60
+ ): WorkflowsResponse => {
61
+ const workflows = response.workflows.page || [];
62
+ const pageInfo = response.workflows.pageInfo || {};
63
+
64
+ return {
65
+ workflows,
66
+ pageInfo,
67
+ };
68
+ },
69
+ }),
70
+ }),
71
+ });
72
+
73
+ export const { useGetWorkflowsQuery, useLazyGetWorkflowsQuery } = workflowsApi;
@@ -86,4 +86,5 @@ const processApi = orchestratorApi.injectEndpoints({
86
86
  }),
87
87
  });
88
88
 
89
- export const { useGetProcessListQuery } = processApi;
89
+ export const { useGetProcessListQuery, useLazyGetProcessListQuery } =
90
+ processApi;
@@ -0,0 +1,70 @@
1
+ import {
2
+ BaseGraphQlResult,
3
+ GraphqlQueryVariables,
4
+ Process,
5
+ ProcessListResult,
6
+ } from '@/types';
7
+
8
+ import { CacheTags, orchestratorApi } from '../api';
9
+
10
+ export const processListSummaryQuery = `
11
+ query ProcessListSummary(
12
+ $first: Int!
13
+ $after: Int!
14
+ $sortBy: [GraphqlSort!]
15
+ $filterBy: [GraphqlFilter!]
16
+ $query: String
17
+ ) {
18
+ processes(
19
+ first: $first
20
+ after: $after
21
+ sortBy: $sortBy
22
+ filterBy: $filterBy
23
+ query: $query
24
+ ) {
25
+ page {
26
+ processId
27
+ workflowName
28
+ startedAt
29
+ }
30
+ pageInfo {
31
+ totalItems
32
+ startCursor
33
+ endCursor
34
+ }
35
+ }
36
+ }
37
+ `;
38
+
39
+ type ProcessSummary = Pick<Process, 'processId' | 'workflowName' | 'startedAt'>;
40
+
41
+ export type ProcessListSummaryResponse = {
42
+ processes: ProcessSummary[];
43
+ } & BaseGraphQlResult;
44
+
45
+ const processApi = orchestratorApi.injectEndpoints({
46
+ endpoints: (build) => ({
47
+ getProcessListSummary: build.query<
48
+ ProcessListSummaryResponse,
49
+ GraphqlQueryVariables<Process>
50
+ >({
51
+ query: (variables) => ({
52
+ document: processListSummaryQuery,
53
+ variables,
54
+ }),
55
+ transformResponse: (
56
+ response: ProcessListResult<ProcessSummary>,
57
+ ): ProcessListSummaryResponse => {
58
+ const processes = response.processes.page || [];
59
+
60
+ return {
61
+ processes,
62
+ pageInfo: response.processes?.pageInfo || {},
63
+ };
64
+ },
65
+ providesTags: [CacheTags.processListSummary],
66
+ }),
67
+ }),
68
+ });
69
+
70
+ export const { useGetProcessListSummaryQuery } = processApi;
@@ -0,0 +1,76 @@
1
+ import { orchestratorApi } from '@/rtk';
2
+ import {
3
+ BaseGraphQlResult,
4
+ GraphqlQueryVariables,
5
+ ProductDefinition,
6
+ ProductDefinitionsResult,
7
+ } from '@/types';
8
+
9
+ export const products = `
10
+ query MetadataProducts(
11
+ $first: Int!
12
+ $after: Int!
13
+ $sortBy: [GraphqlSort!]
14
+ $query: String
15
+ ) {
16
+ products(first: $first, after: $after, sortBy: $sortBy, query: $query) {
17
+ page {
18
+ productId
19
+ name
20
+ description
21
+ tag
22
+ createdAt
23
+ productType
24
+ status
25
+ productBlocks {
26
+ name
27
+ }
28
+ fixedInputs {
29
+ name
30
+ value
31
+ }
32
+ endDate
33
+ }
34
+ pageInfo {
35
+ endCursor
36
+ hasNextPage
37
+ hasPreviousPage
38
+ startCursor
39
+ totalItems
40
+ sortFields
41
+ filterFields
42
+ }
43
+ }
44
+ }
45
+ `;
46
+
47
+ export type ProductsResponse = {
48
+ products: ProductDefinition[];
49
+ } & BaseGraphQlResult;
50
+
51
+ const productsApi = orchestratorApi.injectEndpoints({
52
+ endpoints: (builder) => ({
53
+ getProducts: builder.query<
54
+ ProductsResponse,
55
+ GraphqlQueryVariables<ProductDefinition>
56
+ >({
57
+ query: (variables) => ({
58
+ document: products,
59
+ variables,
60
+ }),
61
+ transformResponse: (
62
+ response: ProductDefinitionsResult,
63
+ ): ProductsResponse => {
64
+ const products = response.products.page || [];
65
+ const pageInfo = response.products.pageInfo || {};
66
+
67
+ return {
68
+ products,
69
+ pageInfo,
70
+ };
71
+ },
72
+ }),
73
+ }),
74
+ });
75
+
76
+ export const { useGetProductsQuery, useLazyGetProductsQuery } = productsApi;