@orchestrator-ui/orchestrator-ui-components 1.14.0 → 1.14.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 (32) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +9 -9
  4. package/CHANGELOG.md +13 -0
  5. package/dist/index.d.ts +186 -51
  6. package/dist/index.js +2232 -1952
  7. package/package.json +1 -1
  8. package/src/components/WfoSubscription/WfoInUseByRelations.tsx +92 -0
  9. package/src/components/WfoSubscription/WfoSubscriptionProductBlock/WfoSubscriptionProductBlock.tsx +10 -9
  10. package/src/components/WfoSubscription/styles.ts +9 -0
  11. package/src/components/WfoSummary/WfoActiveWorkflowsSummaryCard.tsx +39 -0
  12. package/src/components/WfoSummary/WfoFailedTasksSummaryCard.tsx +33 -0
  13. package/src/components/WfoSummary/WfoLatestActiveSubscriptionsSummaryCard.tsx +39 -0
  14. package/src/components/WfoSummary/WfoLatestOutOfSyncSubscriptionSummaryCard.tsx +44 -0
  15. package/src/components/WfoSummary/WfoMyWorkflowsSummaryCard.tsx +48 -0
  16. package/src/components/WfoSummary/WfoProductsSummaryCard.tsx +55 -0
  17. package/src/components/WfoSummary/WfoSummaryCard.tsx +82 -0
  18. package/src/components/WfoSummary/WfoSummaryCards.tsx +5 -93
  19. package/src/components/WfoSummary/index.ts +8 -0
  20. package/src/components/WfoWorkflowSteps/WfoStepStatusIcon/WfoStepStatusIcon.tsx +1 -1
  21. package/src/components/index.ts +1 -1
  22. package/src/icons/WfoBoltFill.tsx +36 -0
  23. package/src/icons/WfoBoltSlashFill.tsx +36 -0
  24. package/src/icons/index.ts +2 -0
  25. package/src/pages/index.ts +1 -0
  26. package/src/pages/processes/WfoProcessDetail.tsx +1 -0
  27. package/src/pages/startPage/WfoStartPage.tsx +22 -188
  28. package/src/pages/startPage/index.ts +1 -0
  29. package/src/rtk/endpoints/index.ts +4 -2
  30. package/src/rtk/endpoints/subscriptionInUseByRelationsList.ts +67 -0
  31. package/src/rtk/slices/orchestratorComponentOverride.ts +5 -7
  32. package/src/types/types.ts +11 -0
@@ -0,0 +1,36 @@
1
+ import React, { FC } from 'react';
2
+
3
+ import { WfoIconProps } from './WfoIconProps';
4
+
5
+ export const WfoBoltFill: FC<WfoIconProps> = ({
6
+ width = 20,
7
+ height = 20,
8
+ color = '#000000',
9
+ }) => {
10
+ return (
11
+ <svg
12
+ width={width}
13
+ height={height}
14
+ viewBox="0 0 24 24"
15
+ version="1.1"
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ >
18
+ <title>icon/bolt-fill</title>
19
+ <g
20
+ id="Symbols"
21
+ stroke="none"
22
+ strokeWidth="1"
23
+ fill="none"
24
+ fillRule="evenodd"
25
+ >
26
+ <g id="icon/bolt-fill" fill={color}>
27
+ <path
28
+ fill-rule="evenodd"
29
+ d="M14.615 1.595a.75.75 0 0 1 .359.852L12.982 9.75h7.268a.75.75 0 0 1 .548 1.262l-10.5 11.25a.75.75 0 0 1-1.272-.71l1.992-7.302H3.75a.75.75 0 0 1-.548-1.262l10.5-11.25a.75.75 0 0 1 .913-.143Z"
30
+ clip-rule="evenodd"
31
+ />
32
+ </g>
33
+ </g>
34
+ </svg>
35
+ );
36
+ };
@@ -0,0 +1,36 @@
1
+ import React, { FC } from 'react';
2
+
3
+ import { WfoIconProps } from './WfoIconProps';
4
+
5
+ export const WfoBoltSlashFill: FC<WfoIconProps> = ({
6
+ width = 20,
7
+ height = 20,
8
+ color = '#000000',
9
+ }) => {
10
+ return (
11
+ <svg
12
+ width={width}
13
+ height={height}
14
+ viewBox="0 0 24 24"
15
+ version="1.1"
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ >
18
+ <title>icon/bolt-fill</title>
19
+ <g
20
+ id="Symbols"
21
+ stroke="none"
22
+ strokeWidth="1"
23
+ fill="none"
24
+ fillRule="evenodd"
25
+ >
26
+ <g id="icon/bolt-slash-fill" fill={color}>
27
+ <path
28
+ stroke-linecap="round"
29
+ stroke-linejoin="round"
30
+ d="M11.412 15.655 9.75 21.75l3.745-4.012M9.257 13.5H3.75l2.659-2.849m2.048-2.194L14.25 2.25 12 10.5h8.25l-4.707 5.043M8.457 8.457 3 3m5.457 5.457 7.086 7.086m0 0L21 21"
31
+ />
32
+ </g>
33
+ </g>
34
+ </svg>
35
+ );
36
+ };
@@ -8,6 +8,8 @@ export * from './WfoMinusCircleOutline';
8
8
  export * from './WfoPlusCircleFill';
9
9
  export * from './WfoChevronDown';
10
10
  export * from './WfoChevronUp';
11
+ export * from './WfoBoltFill';
12
+ export * from './WfoBoltSlashFill';
11
13
  export * from './WfoCubeSolid';
12
14
  export * from './WfoArrowNarrowDown';
13
15
  export * from './WfoRefresh';
@@ -1,5 +1,6 @@
1
1
  export * from './metadata';
2
2
  export * from './processes';
3
+ export * from './settings';
3
4
  export * from './startPage';
4
5
  export * from './subscriptions';
5
6
  export * from './tasks';
@@ -123,6 +123,7 @@ export const WfoProcessDetail = ({
123
123
  ProcessStatus.FAILED,
124
124
  ProcessStatus.API_UNAVAILABLE,
125
125
  ProcessStatus.INCONSISTENT_DATA,
126
+ ProcessStatus.WAITING,
126
127
  ],
127
128
  processDetail?.lastStatus,
128
129
  );
@@ -1,212 +1,46 @@
1
- import React from 'react';
1
+ import React, { ReactElement } from 'react';
2
2
 
3
- import { useTranslations } from 'next-intl';
4
-
5
- import { EuiFlexItem } from '@elastic/eui';
6
-
7
- import { PATH_SUBSCRIPTIONS, PATH_TASKS, PATH_WORKFLOWS } from '@/components';
8
3
  import {
9
- SummaryCard,
10
- SummaryCardStatus,
4
+ WfoActiveWorkflowsSummaryCard,
5
+ WfoFailedTasksSummaryCard,
6
+ WfoLatestActiveSubscriptionsSummaryCard,
7
+ WfoLatestOutOfSyncSubscriptionSummaryCard,
8
+ WfoMyWorkflowsSummaryCard,
9
+ WfoProductsSummaryCard,
11
10
  WfoSummaryCards,
12
- } from '@/components/WfoSummary/WfoSummaryCards';
11
+ } from '@/components';
13
12
  import { PolicyResource } from '@/configuration';
14
13
  import { usePolicy, useWfoSession } from '@/hooks';
15
- import {
16
- useGetProcessListSummaryQuery,
17
- useGetProductsSummaryQuery,
18
- } from '@/rtk';
19
- import { useGetSubscriptionSummaryListQuery } from '@/rtk/endpoints/subscriptionListSummary';
20
- import { optionalArrayMapper, toOptionalArrayEntry } from '@/utils';
14
+ import { toOptionalArrayEntry } from '@/utils';
21
15
 
22
- import {
23
- mapProcessSummaryToSummaryCardListItem,
24
- mapSubscriptionSummaryToSummaryCardListItem,
25
- } from './mappers';
26
- import {
27
- activeWorkflowsListSummaryQueryVariables,
28
- getMyWorkflowListSummaryQueryVariables,
29
- outOfSyncSubscriptionsListSummaryQueryVariables,
30
- productsSummaryQueryVariables,
31
- subscriptionsListSummaryQueryVariables,
32
- taskListSummaryQueryVariables,
33
- } from './queryVariables';
34
16
  import { useStartPageSummaryCardConfigurationOverride } from './useStartPageSummaryCardConfigurationOverride';
35
17
 
36
18
  export const WfoStartPage = () => {
37
- const t = useTranslations('startPage');
38
19
  const { overrideSummaryCards } =
39
20
  useStartPageSummaryCardConfigurationOverride();
21
+
40
22
  const { isAllowed } = usePolicy();
41
23
  const { session } = useWfoSession();
42
24
  const username = session?.user?.name ?? '';
43
25
 
44
- const {
45
- data: subscriptionsSummaryResult,
46
- isLoading: subscriptionsSummaryIsFetching,
47
- } = useGetSubscriptionSummaryListQuery(
48
- subscriptionsListSummaryQueryVariables,
49
- );
50
- const {
51
- data: outOfSyncSubscriptionsSummaryResult,
52
- isLoading: outOfSyncsubscriptionsSummaryIsFetching,
53
- } = useGetSubscriptionSummaryListQuery(
54
- outOfSyncSubscriptionsListSummaryQueryVariables,
55
- );
56
- const {
57
- data: activeWorkflowsSummaryResponse,
58
- isFetching: activeWorkflowsSummaryIsFetching,
59
- } = useGetProcessListSummaryQuery(activeWorkflowsListSummaryQueryVariables);
60
-
61
- const {
62
- data: myWorkflowsSummaryResponse,
63
- isFetching: myWorkflowsSummaryIsFetching,
64
- } = useGetProcessListSummaryQuery(
65
- getMyWorkflowListSummaryQueryVariables(username),
66
- );
67
-
68
- const {
69
- data: failedTasksSummaryResponse,
70
- isFetching: failedTasksSummaryIsFetching,
71
- } = useGetProcessListSummaryQuery(taskListSummaryQueryVariables);
72
-
73
- const {
74
- data: productsSummaryResult,
75
- isLoading: productsSummaryIsFetching,
76
- } = useGetProductsSummaryQuery(productsSummaryQueryVariables);
77
-
78
- const latestActiveSubscriptionsSummaryCard: SummaryCard = {
79
- headerTitle: t('activeSubscriptions.headerTitle'),
80
- headerValue: subscriptionsSummaryResult?.pageInfo.totalItems ?? 0,
81
- headerStatus: SummaryCardStatus.Neutral,
82
- listTitle: t('activeSubscriptions.listTitle'),
83
- listItems: optionalArrayMapper(
84
- subscriptionsSummaryResult?.subscriptions,
85
- mapSubscriptionSummaryToSummaryCardListItem,
86
- ),
87
- button: {
88
- name: t('activeSubscriptions.buttonText'),
89
- url: PATH_SUBSCRIPTIONS,
90
- },
91
- isLoading: subscriptionsSummaryIsFetching,
92
- };
93
-
94
- const latestOutOfSyncSubscriptionsSummaryCard: SummaryCard = {
95
- headerTitle: t('outOfSyncSubscriptions.headerTitle'),
96
- headerValue:
97
- outOfSyncSubscriptionsSummaryResult?.pageInfo.totalItems ?? 0,
98
- headerStatus: SummaryCardStatus.Error,
99
- listTitle: t('outOfSyncSubscriptions.listTitle'),
100
- listItems: optionalArrayMapper(
101
- outOfSyncSubscriptionsSummaryResult?.subscriptions,
102
- mapSubscriptionSummaryToSummaryCardListItem,
103
- ),
104
- button: {
105
- name: t('outOfSyncSubscriptions.buttonText'),
106
- url: `${PATH_SUBSCRIPTIONS}?activeTab=ALL&sortBy=field-startDate_order-ASC&queryString=status%3A%28provisioning%7Cactive%29+insync%3Afalse`,
107
- },
108
- isLoading: outOfSyncsubscriptionsSummaryIsFetching,
109
- };
110
-
111
- const activeWorkflowsSummaryCard: SummaryCard = {
112
- headerTitle: t('activeWorkflows.headerTitle'),
113
- headerValue: activeWorkflowsSummaryResponse?.pageInfo.totalItems ?? 0,
114
- headerStatus: SummaryCardStatus.Success,
115
- listTitle: t('activeWorkflows.listTitle'),
116
- listItems: optionalArrayMapper(
117
- activeWorkflowsSummaryResponse?.processes,
118
- mapProcessSummaryToSummaryCardListItem,
119
- ),
120
- button: {
121
- name: t('activeWorkflows.buttonText'),
122
- url: PATH_WORKFLOWS,
123
- },
124
- isLoading: activeWorkflowsSummaryIsFetching,
125
- };
126
-
127
- const myWorkflowsSummaryCard: SummaryCard = {
128
- headerTitle: t('myWorkflows.headerTitle'),
129
- headerValue: myWorkflowsSummaryResponse?.pageInfo.totalItems ?? 0,
130
- headerStatus: SummaryCardStatus.Success,
131
- listTitle: t('myWorkflows.listTitle'),
132
- listItems: optionalArrayMapper(
133
- myWorkflowsSummaryResponse?.processes,
134
- mapProcessSummaryToSummaryCardListItem,
135
- ),
136
- button: username
137
- ? {
138
- name: t('myWorkflows.buttonText'),
139
- url: `${PATH_WORKFLOWS}?activeTab=COMPLETED&sortBy=field-lastModifiedAt_order-DESC&queryString=createdBy%3A${username}`,
140
- }
141
- : undefined,
142
- isLoading: myWorkflowsSummaryIsFetching,
143
- };
144
-
145
- const failedTasksSummaryCard: SummaryCard = {
146
- headerTitle: t('failedTasks.headerTitle'),
147
- headerValue: failedTasksSummaryResponse?.pageInfo.totalItems ?? 0,
148
- headerStatus: SummaryCardStatus.Error,
149
- listTitle: t('failedTasks.listTitle'),
150
- listItems: optionalArrayMapper(
151
- failedTasksSummaryResponse?.processes,
152
- mapProcessSummaryToSummaryCardListItem,
26
+ // The key can be used to filter or sort on when overriding the cards in the app
27
+ const defaultSummaryCards: ReactElement[] = [
28
+ ...toOptionalArrayEntry(
29
+ <WfoMyWorkflowsSummaryCard key="myWorkflows" username="Todo" />,
30
+ !!username,
153
31
  ),
154
- button: {
155
- name: t('failedTasks.buttonText'),
156
- url: PATH_TASKS,
157
- },
158
- isLoading: failedTasksSummaryIsFetching,
159
- };
160
-
161
- const productsSummaryCard: SummaryCard = {
162
- headerTitle: t('products.headerTitle'),
163
- headerValue: productsSummaryResult?.pageInfo.totalItems ?? 0,
164
- headerStatus: SummaryCardStatus.Neutral,
165
- listTitle: t('products.listTitle'),
166
- listItems:
167
- [...(productsSummaryResult?.products ?? [])]
168
- .sort(
169
- (left, right) =>
170
- (right.subscriptions.pageInfo.totalItems ?? 0) -
171
- (left.subscriptions.pageInfo.totalItems ?? 0),
172
- )
173
- .map((product) => ({
174
- title: '',
175
- value: (
176
- <div
177
- css={{
178
- display: 'flex',
179
- justifyContent: 'space-between',
180
- }}
181
- >
182
- <div>{product.name}</div>
183
- <div>
184
- {product.subscriptions.pageInfo.totalItems || 0}
185
- </div>
186
- </div>
187
- ),
188
- })) ?? [],
189
- isLoading: productsSummaryIsFetching,
190
- };
191
-
192
- const allowedSummaryCards = [
193
- ...toOptionalArrayEntry(myWorkflowsSummaryCard, !!username),
194
- activeWorkflowsSummaryCard,
32
+ <WfoActiveWorkflowsSummaryCard key="activeWorkflows" />,
195
33
  ...toOptionalArrayEntry(
196
- failedTasksSummaryCard,
34
+ <WfoFailedTasksSummaryCard key="failedTasks" />,
197
35
  isAllowed(PolicyResource.NAVIGATION_TASKS),
198
36
  ),
199
- latestOutOfSyncSubscriptionsSummaryCard,
200
- latestActiveSubscriptionsSummaryCard,
201
- productsSummaryCard,
37
+ <WfoLatestOutOfSyncSubscriptionSummaryCard key="latestOutOfSyncSubscription" />,
38
+ <WfoLatestActiveSubscriptionsSummaryCard key="latestActiveSubscriptions" />,
39
+ <WfoProductsSummaryCard key="products" />,
202
40
  ];
203
41
 
204
42
  const summaryCards =
205
- overrideSummaryCards?.(allowedSummaryCards) || allowedSummaryCards;
43
+ overrideSummaryCards?.(defaultSummaryCards) || defaultSummaryCards;
206
44
 
207
- return (
208
- <EuiFlexItem>
209
- <WfoSummaryCards summaryCards={summaryCards} />
210
- </EuiFlexItem>
211
- );
45
+ return <WfoSummaryCards>{summaryCards}</WfoSummaryCards>;
212
46
  };
@@ -1 +1,2 @@
1
1
  export * from './WfoStartPage';
2
+ export * from './mappers';
@@ -8,8 +8,10 @@ export * from './products';
8
8
  export * from './productsSummary';
9
9
  export * from './relatedSubscriptions';
10
10
  export * from './settings';
11
+ export * from './startOptions';
11
12
  export * from './streamMessages';
12
13
  export * from './subscriptionDetail';
14
+ export * from './subscriptionInUseByRelationsList';
15
+ export * from './subscriptionList';
16
+ export * from './subscriptionListSummary';
13
17
  export * from './subscriptionsDropdownOptions';
14
- export * from './relatedSubscriptions';
15
- export * from './startOptions';
@@ -0,0 +1,67 @@
1
+ import { NUMBER_OF_ITEMS_REPRESENTING_ALL_ITEMS } from '@/configuration';
2
+ import { CacheTags, orchestratorApi } from '@/rtk';
3
+ import {
4
+ InUseByRelationDetail,
5
+ InUseByRelationsDetailResult,
6
+ SubscriptionStatus,
7
+ } from '@/types';
8
+
9
+ const nonTerminalSubscriptionStatuses = [
10
+ SubscriptionStatus.INITIAL,
11
+ SubscriptionStatus.ACTIVE,
12
+ SubscriptionStatus.MIGRATING,
13
+ SubscriptionStatus.DISABLED,
14
+ SubscriptionStatus.PROVISIONING,
15
+ ].join('|');
16
+
17
+ export const subscriptionInUseByRelationQuery = `
18
+ query SubscriptionsInUseByRelationsDetails(
19
+ $subscriptionIds: String!
20
+ ) {
21
+ subscriptions(
22
+ first: ${NUMBER_OF_ITEMS_REPRESENTING_ALL_ITEMS}
23
+ after: 0
24
+ filterBy: [{field: "subscriptionId", value: $subscriptionIds},{field: "status", value: ${nonTerminalSubscriptionStatuses}}]
25
+ ) {
26
+ page {
27
+ product {
28
+ name
29
+ }
30
+ description
31
+ subscriptionId
32
+ status
33
+ }
34
+ }
35
+ }
36
+ `;
37
+
38
+ export type InUseByRelationsDetailResponse = {
39
+ inUseByRelationDetails: InUseByRelationDetail[];
40
+ };
41
+
42
+ const subscriptionInUseByRelationsListApi = orchestratorApi.injectEndpoints({
43
+ endpoints: (builder) => ({
44
+ getInUseByRelationDetails: builder.query<
45
+ InUseByRelationsDetailResponse,
46
+ { subscriptionIds: string }
47
+ >({
48
+ query: (variables) => ({
49
+ document: subscriptionInUseByRelationQuery,
50
+ variables,
51
+ }),
52
+ transformResponse: (
53
+ response: InUseByRelationsDetailResult,
54
+ ): InUseByRelationsDetailResponse => {
55
+ const subscriptions = response.subscriptions.page || [];
56
+
57
+ return {
58
+ inUseByRelationDetails: subscriptions,
59
+ };
60
+ },
61
+ providesTags: [CacheTags.subscriptionList],
62
+ }),
63
+ }),
64
+ });
65
+
66
+ export const { useGetInUseByRelationDetailsQuery } =
67
+ subscriptionInUseByRelationsListApi;
@@ -1,8 +1,7 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactElement, ReactNode } from 'react';
2
2
 
3
3
  import { Slice, createSlice } from '@reduxjs/toolkit';
4
4
 
5
- import { SummaryCard } from '@/components/WfoSummary';
6
5
  import { FieldValue, SubscriptionDetail } from '@/types';
7
6
 
8
7
  export type ValueOverrideFunction = (fieldValue: FieldValue) => ReactNode;
@@ -16,8 +15,8 @@ export type WfoSubscriptionDetailGeneralConfiguration = {
16
15
  export type OrchestratorComponentOverride = {
17
16
  startPage?: {
18
17
  summaryCardConfigurationOverride?: (
19
- defaultItems: SummaryCard[],
20
- ) => SummaryCard[];
18
+ defaultItems: ReactElement[],
19
+ ) => ReactElement[];
21
20
  };
22
21
  subscriptionDetail?: {
23
22
  valueOverrides?: ValueOverrideConfiguration;
@@ -32,10 +31,9 @@ type OrchestratorComponentOverrideSlice = Slice<OrchestratorComponentOverride>;
32
31
 
33
32
  export const getOrchestratorComponentOverrideSlice = (
34
33
  config: OrchestratorComponentOverride,
35
- ): OrchestratorComponentOverrideSlice => {
36
- return createSlice({
34
+ ): OrchestratorComponentOverrideSlice =>
35
+ createSlice({
37
36
  name: 'orchestratorComponentOverride',
38
37
  initialState: config,
39
38
  reducers: {},
40
39
  });
41
- };
@@ -356,6 +356,10 @@ export interface RelatedSubscriptionsResult {
356
356
  >;
357
357
  }
358
358
 
359
+ export interface InUseByRelationsDetailResult {
360
+ subscriptions: GraphQlSinglePage<InUseByRelationDetail>;
361
+ }
362
+
359
363
  export type StartComboBoxOption = {
360
364
  data: {
361
365
  workflowName: string;
@@ -480,6 +484,13 @@ export type RelatedSubscription = Pick<
480
484
  customer: Pick<Customer, 'fullname'>;
481
485
  };
482
486
 
487
+ export type InUseByRelationDetail = Pick<
488
+ Subscription,
489
+ 'subscriptionId' | 'description'
490
+ > & {
491
+ product: Pick<ProductDefinition, 'name'>;
492
+ };
493
+
483
494
  export type ExternalService = {
484
495
  externalServiceKey: string;
485
496
  externalServiceId: string;