@orchestrator-ui/orchestrator-ui-components 1.9.0 → 1.11.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.
- package/.turbo/turbo-build.log +5 -5
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +12 -11
- package/CHANGELOG.md +17 -0
- package/dist/index.d.ts +70 -17
- package/dist/index.js +1063 -809
- package/package.json +1 -1
- package/src/components/WfoForms/CreateForm.tsx +2 -2
- package/src/components/WfoForms/UserInputFormWizard.tsx +14 -18
- package/src/components/WfoForms/UserInputFormWizardDeprecated.tsx +125 -0
- package/src/components/WfoForms/formFields/SubscriptionField.tsx +1 -1
- package/src/components/WfoForms/formFields/utils.spec.ts +1 -0
- package/src/components/WfoForms/index.ts +1 -0
- package/src/components/WfoSubscription/WfoCustomerDescriptionsField.tsx +54 -0
- package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +6 -0
- package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +71 -25
- package/src/components/WfoSubscription/overrides/useSubscriptionDetailGeneralSectionConfigurationOverride.ts +13 -0
- package/src/components/WfoSubscription/utils/utils.ts +1 -1
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +2 -2
- package/src/hooks/DataFetchHooks.ts +4 -0
- package/src/messages/en-GB.json +1 -0
- package/src/messages/nl-NL.json +1 -0
- package/src/pages/metadata/WfoProductsPage.tsx +29 -15
- package/src/pages/metadata/WfoTasksPage.tsx +26 -2
- package/src/pages/metadata/WfoWorkflowsPage.tsx +9 -7
- package/src/pages/processes/WfoStartProcessPage.tsx +2 -2
- package/src/rtk/api.ts +20 -0
- package/src/rtk/endpoints/customers.ts +37 -12
- package/src/rtk/endpoints/subscriptionDetail.ts +6 -1
- package/src/rtk/slices/orchestratorComponentOverride.ts +10 -1
- package/src/types/types.ts +9 -1
- package/src/utils/index.ts +5 -4
- package/src/utils/toOptionalArrayEntry.spec.ts +17 -0
- package/src/utils/toOptionalArrayEntry.ts +4 -0
|
@@ -198,13 +198,15 @@ export const WfoWorkflowsPage = () => {
|
|
|
198
198
|
workflowsResponse: WorkflowsResponse,
|
|
199
199
|
): WorkflowListExportItem[] => {
|
|
200
200
|
const { workflows } = workflowsResponse;
|
|
201
|
-
return workflows.map(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
201
|
+
return workflows.map(
|
|
202
|
+
({ name, target, description, createdAt, products }) => ({
|
|
203
|
+
name,
|
|
204
|
+
target,
|
|
205
|
+
description,
|
|
206
|
+
createdAt,
|
|
207
|
+
productTags: getConcatenatedResult(products, ['tag']),
|
|
208
|
+
}),
|
|
209
|
+
);
|
|
208
210
|
};
|
|
209
211
|
|
|
210
212
|
return (
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from '@/types';
|
|
29
29
|
import { FormNotCompleteResponse } from '@/types/forms';
|
|
30
30
|
|
|
31
|
-
import
|
|
31
|
+
import UserInputFormWizardDeprecated from '../../components/WfoForms/UserInputFormWizardDeprecated';
|
|
32
32
|
import { WfoProcessDetail } from './WfoProcessDetail';
|
|
33
33
|
|
|
34
34
|
type StartCreateWorkflowPayload = {
|
|
@@ -215,7 +215,7 @@ export const WfoStartProcessPage = ({
|
|
|
215
215
|
<EuiHorizontalRule />
|
|
216
216
|
{(hasError && <WfoError />) ||
|
|
217
217
|
(stepUserInput && (
|
|
218
|
-
<
|
|
218
|
+
<UserInputFormWizardDeprecated
|
|
219
219
|
stepUserInput={stepUserInput}
|
|
220
220
|
validSubmit={submit}
|
|
221
221
|
cancel={() =>
|
package/src/rtk/api.ts
CHANGED
|
@@ -21,6 +21,12 @@ export enum CacheTags {
|
|
|
21
21
|
subscriptionList = 'subscriptionList',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export enum HttpStatus {
|
|
25
|
+
FormNotComplete = 510,
|
|
26
|
+
BadGateway = 502,
|
|
27
|
+
BadRequest = 400,
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
type ExtraOptions = {
|
|
25
31
|
baseQueryType?: BaseQueryTypes;
|
|
26
32
|
apiName?: string;
|
|
@@ -34,6 +40,20 @@ export const prepareHeaders = async (headers: Headers) => {
|
|
|
34
40
|
return headers;
|
|
35
41
|
};
|
|
36
42
|
|
|
43
|
+
export const handlePromiseErrorWithCallback = <T>(
|
|
44
|
+
promise: Promise<unknown>,
|
|
45
|
+
status: number,
|
|
46
|
+
callbackAction: (json: T) => void,
|
|
47
|
+
) => {
|
|
48
|
+
return promise.catch((err) => {
|
|
49
|
+
if (err.data && err.status === status) {
|
|
50
|
+
callbackAction(err.data);
|
|
51
|
+
} else {
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
37
57
|
export const orchestratorApi = createApi({
|
|
38
58
|
reducerPath: 'orchestratorApi',
|
|
39
59
|
baseQuery: (args, api, extraOptions: ExtraOptions) => {
|
|
@@ -3,25 +3,50 @@ import { Customer, CustomersResult } from '@/types';
|
|
|
3
3
|
import { orchestratorApi } from '../api';
|
|
4
4
|
|
|
5
5
|
const customersQuery = `query Customers {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
customers(first: 1000000, after: 0) {
|
|
7
|
+
page {
|
|
8
|
+
fullname
|
|
9
|
+
customerId
|
|
10
|
+
shortcode
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}`;
|
|
14
|
+
|
|
15
|
+
const customerQuery = `query Customer(
|
|
16
|
+
$customerId: String!
|
|
17
|
+
$first: Int!
|
|
18
|
+
) {
|
|
19
|
+
customers(
|
|
20
|
+
first: $first
|
|
21
|
+
filterBy: [{field: "customerId", value: $customerId}]
|
|
22
|
+
) {
|
|
23
|
+
page {
|
|
24
|
+
customerId
|
|
25
|
+
fullname
|
|
26
|
+
shortcode
|
|
27
|
+
}
|
|
28
|
+
}
|
|
13
29
|
}`;
|
|
14
30
|
|
|
15
31
|
const customersApi = orchestratorApi.injectEndpoints({
|
|
16
32
|
endpoints: (build) => ({
|
|
17
33
|
getCustomers: build.query<Customer[], void>({
|
|
18
34
|
query: () => ({ document: customersQuery }),
|
|
19
|
-
transformResponse: (response: CustomersResult): Customer[] =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
35
|
+
transformResponse: (response: CustomersResult): Customer[] =>
|
|
36
|
+
response?.customers?.page || [],
|
|
37
|
+
}),
|
|
38
|
+
getCustomer: build.query<Customer[], { customerIds: string[] }>({
|
|
39
|
+
query: ({ customerIds }) => ({
|
|
40
|
+
document: customerQuery,
|
|
41
|
+
variables: {
|
|
42
|
+
customerId: customerIds.join('|'),
|
|
43
|
+
first: customerIds.length,
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
transformResponse: (response: CustomersResult): Customer[] =>
|
|
47
|
+
response?.customers?.page || [],
|
|
23
48
|
}),
|
|
24
49
|
}),
|
|
25
50
|
});
|
|
26
51
|
|
|
27
|
-
export const { useGetCustomersQuery } = customersApi;
|
|
52
|
+
export const { useGetCustomersQuery, useGetCustomerQuery } = customersApi;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
export const subscriptionDetailQuery = `
|
|
9
9
|
query SubscriptionDetail($subscriptionId: String!) {
|
|
10
10
|
subscriptions(
|
|
11
|
-
filterBy: {
|
|
11
|
+
filterBy: { field: "subscriptionId", value: $subscriptionId }
|
|
12
12
|
) {
|
|
13
13
|
page {
|
|
14
14
|
subscriptionId
|
|
@@ -36,6 +36,11 @@ export const subscriptionDetailQuery = `
|
|
|
36
36
|
customerId
|
|
37
37
|
shortcode
|
|
38
38
|
}
|
|
39
|
+
customerDescriptions {
|
|
40
|
+
subscriptionId
|
|
41
|
+
description
|
|
42
|
+
customerId
|
|
43
|
+
}
|
|
39
44
|
productBlockInstances {
|
|
40
45
|
id
|
|
41
46
|
ownerSubscriptionId
|
|
@@ -2,14 +2,23 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Slice, createSlice } from '@reduxjs/toolkit';
|
|
4
4
|
|
|
5
|
-
import { FieldValue } from '@/types';
|
|
5
|
+
import { FieldValue, SubscriptionDetail } from '@/types';
|
|
6
6
|
|
|
7
7
|
export type ValueOverrideFunction = (fieldValue: FieldValue) => ReactNode;
|
|
8
8
|
export type ValueOverrideConfiguration = Record<string, ValueOverrideFunction>;
|
|
9
9
|
|
|
10
|
+
export type WfoSubscriptionDetailGeneralConfiguration = {
|
|
11
|
+
id: string;
|
|
12
|
+
node: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
|
|
10
15
|
export type OrchestratorComponentOverride = {
|
|
11
16
|
subscriptionDetail?: {
|
|
12
17
|
valueOverrides?: ValueOverrideConfiguration;
|
|
18
|
+
generalSectionConfigurationOverride?: (
|
|
19
|
+
defaultSections: WfoSubscriptionDetailGeneralConfiguration[],
|
|
20
|
+
subscriptionDetail: SubscriptionDetail,
|
|
21
|
+
) => WfoSubscriptionDetailGeneralConfiguration[];
|
|
13
22
|
};
|
|
14
23
|
};
|
|
15
24
|
|
package/src/types/types.ts
CHANGED
|
@@ -8,7 +8,7 @@ type GenericResponse = { [key: string]: unknown };
|
|
|
8
8
|
|
|
9
9
|
export type FieldValue = {
|
|
10
10
|
field: string;
|
|
11
|
-
value: string | number | boolean;
|
|
11
|
+
value: string | number | boolean | null;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export enum EngineStatus {
|
|
@@ -421,6 +421,12 @@ export type SubscriptionDropdownOption = {
|
|
|
421
421
|
status: SubscriptionStatus;
|
|
422
422
|
};
|
|
423
423
|
|
|
424
|
+
export type CustomerDescriptions = {
|
|
425
|
+
subscriptionId: string;
|
|
426
|
+
description: string;
|
|
427
|
+
customerId: string;
|
|
428
|
+
};
|
|
429
|
+
|
|
424
430
|
export type SubscriptionDetail = {
|
|
425
431
|
subscriptionId: string;
|
|
426
432
|
description: string;
|
|
@@ -447,6 +453,8 @@ export type SubscriptionDetail = {
|
|
|
447
453
|
|
|
448
454
|
customerId?: string | null;
|
|
449
455
|
customer?: Customer;
|
|
456
|
+
customerDescriptions: CustomerDescriptions[];
|
|
457
|
+
|
|
450
458
|
externalServices?: ExternalService[];
|
|
451
459
|
|
|
452
460
|
processes: GraphQlSinglePage<SubscriptionDetailProcess>;
|
package/src/utils/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export * from './csvDownload';
|
|
2
2
|
export * from './date';
|
|
3
3
|
export * from './environmentVariables';
|
|
4
|
-
export * from './getStatusBadgeColor';
|
|
5
|
-
export * from './getTypedFieldFromObject';
|
|
6
|
-
export * from './uuid';
|
|
7
|
-
export * from './strings';
|
|
8
4
|
export * from './getProductNamesFromProcess';
|
|
9
5
|
export * from './getQueryVariablesForExport';
|
|
6
|
+
export * from './getStatusBadgeColor';
|
|
7
|
+
export * from './getTypedFieldFromObject';
|
|
10
8
|
export * from './onlyUnique';
|
|
9
|
+
export * from './uuid';
|
|
11
10
|
export * from './resultFlattener';
|
|
11
|
+
export * from './strings';
|
|
12
|
+
export * from './toOptionalArrayEntry';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toOptionalArrayEntry } from './toOptionalArrayEntry';
|
|
2
|
+
|
|
3
|
+
describe('toOptionalArrayEntry', () => {
|
|
4
|
+
const testInput = { testField: 'testValue' };
|
|
5
|
+
|
|
6
|
+
it('returns an array with the data if ', () => {
|
|
7
|
+
const result = toOptionalArrayEntry(testInput, true);
|
|
8
|
+
|
|
9
|
+
expect(result).toEqual([testInput]);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('returns an empty array if the condition is false', () => {
|
|
13
|
+
const result = toOptionalArrayEntry(testInput, false);
|
|
14
|
+
|
|
15
|
+
expect(result).toEqual([]);
|
|
16
|
+
});
|
|
17
|
+
});
|