@orchestrator-ui/orchestrator-ui-components 1.6.0 → 1.6.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.
- package/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +12 -11
- package/CHANGELOG.md +7 -0
- package/dist/index.d.ts +1205 -1139
- package/dist/index.js +92 -12
- package/package.json +1 -1
- package/src/components/WfoProcessList/WfoProcessesList.tsx +5 -1
- package/src/components/WfoProcessList/processListObjectMappers.ts +7 -4
- package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +10 -6
- package/src/components/index.ts +1 -0
- package/src/messages/en-GB.json +1 -0
- package/src/pages/metadata/WfoMetadataPageLayout.tsx +4 -4
- package/src/pages/metadata/WfoProductBlocksPage.tsx +25 -1
- package/src/pages/metadata/WfoProductsPage.tsx +27 -1
- package/src/pages/metadata/WfoResourceTypesPage.tsx +23 -4
- package/src/pages/metadata/WfoWorkflowsPage.tsx +24 -2
- package/src/pages/metadata/index.ts +2 -0
- package/src/pages/subscriptions/WfoSubscriptionDetailPage.tsx +2 -2
- package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +1 -1
- package/src/pages/workflows/index.ts +2 -0
- package/src/types/types.ts +2 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/resultFlattener.spec.ts +51 -0
- package/src/utils/resultFlattener.ts +25 -0
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
} from '@/components';
|
|
12
12
|
import { WfoFilterTabs } from '@/components';
|
|
13
13
|
import { StoredTableConfig } from '@/components';
|
|
14
|
+
import type { SubscriptionListItem } from '@/components';
|
|
14
15
|
import {
|
|
15
16
|
WfoSubscriptionListTab,
|
|
16
17
|
WfoSubscriptionsList,
|
|
17
18
|
subscriptionListTabs,
|
|
18
19
|
} from '@/components/WfoSubscriptionsList';
|
|
19
|
-
import { SubscriptionListItem } from '@/components/WfoSubscriptionsList';
|
|
20
20
|
import { useDataDisplayParams, useStoredTableConfig } from '@/hooks';
|
|
21
21
|
import { SortOrder } from '@/types';
|
|
22
22
|
|
package/src/types/types.ts
CHANGED
|
@@ -357,12 +357,12 @@ export type StartComboBoxOption = {
|
|
|
357
357
|
label: string;
|
|
358
358
|
};
|
|
359
359
|
|
|
360
|
-
interface GraphQlResultPage<T> {
|
|
360
|
+
export interface GraphQlResultPage<T> {
|
|
361
361
|
page: T[];
|
|
362
362
|
pageInfo: GraphQLPageInfo;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
interface GraphQlSinglePage<T> {
|
|
365
|
+
export interface GraphQlSinglePage<T> {
|
|
366
366
|
page: T[];
|
|
367
367
|
}
|
|
368
368
|
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConcatenatedPagedResult,
|
|
3
|
+
getConcatenatedResult,
|
|
4
|
+
} from './resultFlattener';
|
|
5
|
+
|
|
6
|
+
describe('pagedResultFlattener', () => {
|
|
7
|
+
it('returns an empty string when the paged result is empty', () => {
|
|
8
|
+
const pagedResult = { page: [] };
|
|
9
|
+
const fields = ['name', 'age'];
|
|
10
|
+
|
|
11
|
+
const result = getConcatenatedPagedResult(pagedResult, fields);
|
|
12
|
+
|
|
13
|
+
expect(result).toBe('');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('resultFlattener', () => {
|
|
18
|
+
it('returns a flattened string of the specified fields', () => {
|
|
19
|
+
type TestItem = {
|
|
20
|
+
name: string;
|
|
21
|
+
age: number;
|
|
22
|
+
};
|
|
23
|
+
const results = [
|
|
24
|
+
{ name: 'John', age: 25 },
|
|
25
|
+
{ name: 'Jane', age: 30 },
|
|
26
|
+
{ name: 'Bob', age: 40 },
|
|
27
|
+
];
|
|
28
|
+
const fields: Array<keyof TestItem> = ['name', 'age'];
|
|
29
|
+
const result = getConcatenatedResult<TestItem>(results, fields);
|
|
30
|
+
expect(result).toBe('John: 25 - Jane: 30 - Bob: 40');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('returns a flattened string with selected fields only', () => {
|
|
34
|
+
type TestItem = {
|
|
35
|
+
name: string;
|
|
36
|
+
age: number;
|
|
37
|
+
city: string;
|
|
38
|
+
};
|
|
39
|
+
const results: TestItem[] = [
|
|
40
|
+
{ name: 'John', age: 25, city: 'New York' },
|
|
41
|
+
{ name: 'Jane', age: 30, city: 'London' },
|
|
42
|
+
{ name: 'Bob', age: 40, city: 'Paris' },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const fields: Array<keyof TestItem> = ['name', 'city'];
|
|
46
|
+
|
|
47
|
+
const result = getConcatenatedResult(results, fields);
|
|
48
|
+
|
|
49
|
+
expect(result).toBe('John: New York - Jane: London - Bob: Paris');
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GraphQlSinglePage } from '@/types';
|
|
2
|
+
|
|
3
|
+
export const getConcatenatedPagedResult = <T>(
|
|
4
|
+
pagedResult: GraphQlSinglePage<T>,
|
|
5
|
+
fields: Array<keyof T>,
|
|
6
|
+
): string => {
|
|
7
|
+
const results = pagedResult.page || [];
|
|
8
|
+
return getConcatenatedResult(results, fields);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const getConcatenatedResult = <T>(
|
|
12
|
+
results: T[],
|
|
13
|
+
fields: Array<keyof T>,
|
|
14
|
+
): string => {
|
|
15
|
+
return results.reduce((accumulator, result, index) => {
|
|
16
|
+
const resultFields = fields.reduce((accumulator, field, index) => {
|
|
17
|
+
return (
|
|
18
|
+
accumulator +
|
|
19
|
+
`${result[field]}${index !== fields.length - 1 ? ': ' : ''}`
|
|
20
|
+
);
|
|
21
|
+
}, '');
|
|
22
|
+
|
|
23
|
+
return `${accumulator}${resultFields}${index !== results.length - 1 ? ' - ' : ''}`;
|
|
24
|
+
}, '');
|
|
25
|
+
};
|