@orchestrator-ui/orchestrator-ui-components 8.6.0 → 8.7.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 (56) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +15 -12
  4. package/CHANGELOG.md +18 -0
  5. package/dist/index.d.ts +416 -1183
  6. package/dist/index.js +3457 -3072
  7. package/dist/index.js.map +1 -1
  8. package/package.json +3 -1
  9. package/src/components/WfoPydanticForm/fields/WfoCron.spec.ts +88 -0
  10. package/src/components/WfoPydanticForm/fields/WfoCron.tsx +233 -0
  11. package/src/components/WfoPydanticForm/fields/WfoSummary.tsx +42 -7
  12. package/src/components/WfoPydanticForm/fields/index.ts +1 -0
  13. package/src/components/WfoPydanticForm/fields/styles.ts +92 -0
  14. package/src/components/WfoSearchPage/WfoFilterGroup/WfoFilterGroup.tsx +1 -1
  15. package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchResultItem.tsx +2 -1
  16. package/src/components/WfoSearchPage/utils.ts +37 -1
  17. package/src/components/WfoSubscription/WfoInUseByRelations.tsx +6 -2
  18. package/src/components/WfoSubscription/WfoSubscriptionActions/WfoSubscriptionActionExpandableMenuItem.tsx +19 -14
  19. package/src/components/WfoSubscription/WfoSubscriptionActions/WfoSubscriptionActions.tsx +13 -1
  20. package/src/components/WfoSubscription/WfoSubscriptionActions/WfoSubscriptionActionsMenuItem.tsx +3 -0
  21. package/src/components/WfoSubscription/WfoSubscriptionProductBlock/WfoSubscriptionProductBlock.tsx +1 -1
  22. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +5 -0
  23. package/src/components/WfoSubscriptionsList/subscriptionResultMappers.ts +3 -1
  24. package/src/components/WfoTable/WfoAdvancedTable/WfoAdvancedTable.tsx +2 -12
  25. package/src/components/WfoTable/WfoStructuredSearchTable/WfoExpandingSearchRow.tsx +21 -14
  26. package/src/components/WfoTable/WfoStructuredSearchTable/WfoFieldSelector.tsx +27 -1
  27. package/src/components/WfoTable/WfoStructuredSearchTable/WfoFilterBuilder.tsx +97 -91
  28. package/src/components/WfoTable/WfoStructuredSearchTable/WfoOperatorSelector.tsx +32 -7
  29. package/src/components/WfoTable/WfoStructuredSearchTable/WfoRuleGroup.tsx +5 -4
  30. package/src/components/WfoTable/WfoStructuredSearchTable/WfoStructuredSearchTable.tsx +32 -30
  31. package/src/components/WfoTable/WfoStructuredSearchTable/WfoValueEditor.tsx +41 -11
  32. package/src/components/WfoTable/WfoStructuredSearchTable/styles.ts +22 -5
  33. package/src/components/WfoTable/WfoTable/WfoTable.tsx +1 -0
  34. package/src/components/WfoTable/WfoTable/WfoTableDataRows.tsx +16 -4
  35. package/src/components/WfoTable/WfoTable/styles.ts +8 -0
  36. package/src/components/WfoTable/WfoTable/utils.spec.ts +62 -1
  37. package/src/components/WfoTable/WfoTable/utils.ts +4 -1
  38. package/src/components/WfoTable/WfoTableSettingsModal/WfoTableSettingsModal.spec.ts +45 -0
  39. package/src/components/WfoTable/WfoTableSettingsModal/index.ts +1 -0
  40. package/src/components/WfoTable/WfoTableSettingsModal/utils.ts +17 -0
  41. package/src/configuration/version.ts +1 -1
  42. package/src/hooks/index.ts +1 -0
  43. package/src/hooks/useGetPydanticFormsConfig.tsx +12 -0
  44. package/src/hooks/useLanguageCode.ts +11 -0
  45. package/src/messages/en-GB.json +442 -549
  46. package/src/messages/getTranslationMessages.spec.ts +47 -30
  47. package/src/messages/nl-NL.json +450 -411
  48. package/src/pages/WfoSearchPocPage.tsx +14 -5
  49. package/src/rtk/endpoints/subscriptionList.ts +1 -0
  50. package/src/theme/baseStyles/formFieldsBaseStyle.ts +0 -1
  51. package/src/types/search.ts +1 -1
  52. package/src/types/types.ts +1 -1
  53. package/src/utils/getDefaultTableConfig.ts +6 -1
  54. package/src/utils/index.ts +1 -0
  55. package/src/utils/integer.spec.ts +20 -0
  56. package/src/utils/integer.ts +3 -0
@@ -9,7 +9,7 @@ import { StringParam, useQueryParam, withDefault } from 'use-query-params';
9
9
 
10
10
  import { EuiSpacer } from '@elastic/eui';
11
11
 
12
- import { SearchParams, combineSearchFilters } from '@/components';
12
+ import { SearchParams, addStatusFilterFromTab, removeTabStatusMatchingFields } from '@/components';
13
13
  import {
14
14
  DEFAULT_PAGE_SIZE,
15
15
  StoredTableConfig,
@@ -56,6 +56,7 @@ const getDataFromResponse = <T extends object>(
56
56
  data: PaginatedSearchResults,
57
57
  resultColumToPropertyMap: ResultColumToPropertyMap<T>,
58
58
  uniqueRowId: keyof T,
59
+ selectedTab: WfoSubscriptionListTab,
59
60
  ): {
60
61
  items: T[];
61
62
  rowExpandingConfiguration?: WfoTableProps<T>['rowExpandingConfiguration'];
@@ -72,18 +73,23 @@ const getDataFromResponse = <T extends object>(
72
73
  const rowExpandingConfiguration: WfoTableProps<T>['rowExpandingConfiguration'] = {
73
74
  uniqueRowId: uniqueRowId as keyof WfoTableColumnConfig<T>,
74
75
  uniqueRowIdToExpandedRowMap: searchResult.reduce(
75
- (rowMap, { response_columns, score, perfect_match, matching_field }) => {
76
+ (rowMap, { response_columns, score, perfect_match, matching_fields }) => {
76
77
  const idColumnInResponseColumn = getKeyByValueFromMap<T>(resultColumToPropertyMap, uniqueRowId);
77
78
  const rowId = response_columns[idColumnInResponseColumn];
78
79
  if (rowId) {
79
80
  rowMap[rowId] = (
80
- <WfoExpandingSearchRow score={score} matchingField={matching_field} perfectMatch={perfect_match} />
81
+ <WfoExpandingSearchRow
82
+ score={score}
83
+ matchingFields={removeTabStatusMatchingFields(matching_fields, selectedTab, EntityKind.SUBSCRIPTION)}
84
+ perfectMatch={perfect_match}
85
+ />
81
86
  );
82
87
  }
83
88
  return rowMap;
84
89
  },
85
90
  {} as Record<string, ReactNode>,
86
91
  ),
92
+ shouldOnlyShowOnHover: true,
87
93
  };
88
94
 
89
95
  const items: T[] = responseColumns.map((responseColumn) => {
@@ -203,7 +209,7 @@ export const WfoSearchPocPage = () => {
203
209
  // Cursor is stripped from the RTK cache key, so a cursor change appends to the accumulated
204
210
  // result set instead of creating a new cache entry — see search endpoint's merge() logic.
205
211
  const searchPayload: SearchPayload = useMemo(() => {
206
- const filters = combineSearchFilters(committedRuleGroup, selectedTab);
212
+ const filters = addStatusFilterFromTab(committedRuleGroup, selectedTab);
207
213
  const order_by = {
208
214
  element: getKeyByValueFromMap(resultColumToPropertyMap, dataSorting.field),
209
215
  direction: dataSorting.sortOrder.toLowerCase(),
@@ -453,7 +459,9 @@ export const WfoSearchPocPage = () => {
453
459
  };
454
460
 
455
461
  const { items: subscriptionListItems, rowExpandingConfiguration } =
456
- data ? getDataFromResponse<SubscriptionListItem>(data, resultColumToPropertyMap, 'subscriptionId') : { items: [] };
462
+ data ?
463
+ getDataFromResponse<SubscriptionListItem>(data, resultColumToPropertyMap, 'subscriptionId', selectedTab)
464
+ : { items: [] };
457
465
 
458
466
  const totalItems = getTotalItemsFromResponse(data);
459
467
  const hasNextPage = data?.page_info?.has_next_page ?? false;
@@ -465,6 +473,7 @@ export const WfoSearchPocPage = () => {
465
473
  exportResult,
466
474
  resultColumToPropertyMap,
467
475
  'subscriptionId',
476
+ selectedTab,
468
477
  );
469
478
  if (!exportItems.length) {
470
479
  return;
@@ -31,6 +31,7 @@ export const subscriptionListQuery = `query SubscriptionsList(
31
31
  productType
32
32
  }
33
33
  customer {
34
+ customerId
34
35
  fullname
35
36
  shortcode
36
37
  }
@@ -10,7 +10,6 @@ export const getFormFieldsBaseStyle = ({ theme }: WfoThemeHelpers) => {
10
10
  backgroundColor: theme.colors.backgroundBaseNeutral,
11
11
  boxShadow: `0 0 0 1px ${theme.colors.primary}`,
12
12
  },
13
- // boxShadow: `0 0 0 1px ${theme.colors.borderBaseSubdued} !important`,
14
13
  });
15
14
 
16
15
  return {
@@ -24,7 +24,7 @@ export interface SearchResult {
24
24
  entity_title: string;
25
25
  score: number;
26
26
  perfect_match: number;
27
- matching_field?: MatchingField | null;
27
+ matching_fields?: MatchingField[] | null;
28
28
  response_columns: Record<string, string | number | null>;
29
29
  }
30
30
 
@@ -471,7 +471,7 @@ export type Subscription = {
471
471
  status: SubscriptionStatus;
472
472
  product: Pick<ProductDefinition, 'name' | 'tag' | 'productType'>;
473
473
  productBlockInstances: ProductBlockInstance[];
474
- customer: Pick<Customer, 'fullname' | 'shortcode'>;
474
+ customer: Pick<Customer, 'customerId' | 'fullname' | 'shortcode'>;
475
475
  metadata: object;
476
476
  };
477
477
 
@@ -95,7 +95,12 @@ export const getDefaultTableConfig = <T>(storageKey: string) => {
95
95
  return getTableConfig<T>(completedTasksColumns as (keyof T)[]);
96
96
  }
97
97
  case SUBSCRIPTIONS_TABLE_LOCAL_STORAGE_KEY: {
98
- const subscriptionColumns: (keyof SubscriptionListItem)[] = ['productName', 'customerFullname', 'metadata'];
98
+ const subscriptionColumns: (keyof SubscriptionListItem)[] = [
99
+ 'productName',
100
+ 'customerId',
101
+ 'customerFullname',
102
+ 'metadata',
103
+ ];
99
104
  return getTableConfig<T>(subscriptionColumns as (keyof T)[]);
100
105
  }
101
106
  default:
@@ -10,6 +10,7 @@ export * from './getProductNamesFromProcess';
10
10
  export * from './getQueryVariablesForExport';
11
11
  export * from './getStatusBadgeColor';
12
12
  export * from './getTypedFieldFromObject';
13
+ export * from './integer';
13
14
  export * from './onlyUnique';
14
15
  export * from './optionalArray';
15
16
  export * from './resultFlattener';
@@ -0,0 +1,20 @@
1
+ import { toPercentage } from './integer';
2
+
3
+ describe('toPercentage()', () => {
4
+ it('converts a fraction to a percentage string with one decimal', () => {
5
+ expect(toPercentage(0.5)).toEqual('50.0%');
6
+ });
7
+ it('converts 1 to 100.0%', () => {
8
+ expect(toPercentage(1)).toEqual('100.0%');
9
+ });
10
+ it('converts 0 to 0.0%', () => {
11
+ expect(toPercentage(0)).toEqual('0.0%');
12
+ });
13
+ it('rounds to one decimal place', () => {
14
+ expect(toPercentage(0.12345)).toEqual('12.3%');
15
+ expect(toPercentage(0.6789)).toEqual('67.9%');
16
+ });
17
+ it('handles fractions greater than 1', () => {
18
+ expect(toPercentage(1.5)).toEqual('150.0%');
19
+ });
20
+ });
@@ -0,0 +1,3 @@
1
+ export const toPercentage = (fraction: number): string => {
2
+ return `${(fraction * 100).toFixed(1)}%`;
3
+ };