@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/dist/index.js CHANGED
@@ -44098,6 +44098,20 @@ var onlyUnique = (value, index, array) => {
44098
44098
  return array.indexOf(value) === index;
44099
44099
  };
44100
44100
 
44101
+ // src/utils/resultFlattener.ts
44102
+ var getConcatenatedPagedResult = (pagedResult, fields) => {
44103
+ const results = pagedResult.page || [];
44104
+ return getConcatenatedResult(results, fields);
44105
+ };
44106
+ var getConcatenatedResult = (results, fields) => {
44107
+ return results.reduce((accumulator, result, index) => {
44108
+ const resultFields = fields.reduce((accumulator2, field, index2) => {
44109
+ return accumulator2 + `${result[field]}${index2 !== fields.length - 1 ? ": " : ""}`;
44110
+ }, "");
44111
+ return `${accumulator}${resultFields}${index !== results.length - 1 ? " - " : ""}`;
44112
+ }, "");
44113
+ };
44114
+
44101
44115
  // src/components/WfoPageTemplate/WfoBreadcrumbs/WfoBreadcrumbs.tsx
44102
44116
  import { Fragment as Fragment2, jsx as jsx50, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
44103
44117
  var WfoBreadcrumbs = () => {
@@ -46487,6 +46501,7 @@ var WfoSubscriptionGeneral = ({
46487
46501
  }
46488
46502
  ];
46489
46503
  };
46504
+ const hasMetadata = Object.entries(subscriptionDetail.metadata).length > 0;
46490
46505
  return /* @__PURE__ */ jsx86(EuiFlexGrid, { direction: "row", children: /* @__PURE__ */ jsxs60(Fragment16, { children: [
46491
46506
  /* @__PURE__ */ jsx86(EuiFlexItem9, { children: /* @__PURE__ */ jsx86(
46492
46507
  SubscriptionKeyValueBlock,
@@ -46495,7 +46510,7 @@ var WfoSubscriptionGeneral = ({
46495
46510
  keyValues: getSubscriptionDetailBlockData()
46496
46511
  }
46497
46512
  ) }),
46498
- /* @__PURE__ */ jsx86(EuiFlexItem9, { children: /* @__PURE__ */ jsx86(
46513
+ hasMetadata && /* @__PURE__ */ jsx86(EuiFlexItem9, { children: /* @__PURE__ */ jsx86(
46499
46514
  SubscriptionKeyValueBlock,
46500
46515
  {
46501
46516
  title: t("metadata"),
@@ -52203,18 +52218,18 @@ var WfoMetadataPageLayout = ({
52203
52218
  tabs = metaDataTabs
52204
52219
  }) => {
52205
52220
  const router = useRouter8();
52206
- const t = useTranslations40("metadata.tabs");
52221
+ const t = useTranslations40("metadata");
52207
52222
  const currentPath = router.pathname;
52208
52223
  return /* @__PURE__ */ jsxs83(Fragment29, { children: [
52209
52224
  /* @__PURE__ */ jsx146(EuiSpacer15, {}),
52210
- /* @__PURE__ */ jsx146(EuiPageHeader2, { pageTitle: "Metadata" }),
52225
+ /* @__PURE__ */ jsx146(EuiPageHeader2, { pageTitle: t("title") }),
52211
52226
  /* @__PURE__ */ jsx146(EuiSpacer15, { size: "m" }),
52212
52227
  /* @__PURE__ */ jsx146(EuiTabs2, { children: tabs.map(({ id, translationKey: name, path }) => /* @__PURE__ */ jsx146(
52213
52228
  EuiTab2,
52214
52229
  {
52215
52230
  isSelected: path === currentPath,
52216
52231
  onClick: () => router.push(path),
52217
- children: t(name)
52232
+ children: t(`tabs.${name}`)
52218
52233
  },
52219
52234
  id
52220
52235
  )) }),
@@ -52362,6 +52377,16 @@ var WfoProductBlocksPage = () => {
52362
52377
  pageSizeOptions: DEFAULT_PAGE_SIZES,
52363
52378
  totalItemCount: totalItems ? totalItems : 0
52364
52379
  };
52380
+ const mapToExportItems = (productBlocksResponse) => {
52381
+ const { productBlocks } = productBlocksResponse;
52382
+ return productBlocks.map((productBlock) => __spreadProps(__spreadValues({}, productBlock), {
52383
+ resourceTypes: getConcatenatedResult(productBlock.resourceTypes, [
52384
+ "resourceType",
52385
+ "description"
52386
+ ]),
52387
+ dependsOn: getConcatenatedResult(productBlock.dependsOn, ["name"])
52388
+ }));
52389
+ };
52365
52390
  return /* @__PURE__ */ jsx147(WfoMetadataPageLayout, { children: /* @__PURE__ */ jsx147(
52366
52391
  WfoTableWithFilter,
52367
52392
  {
@@ -52389,7 +52414,7 @@ var WfoProductBlocksPage = () => {
52389
52414
  localStorageKey: METADATA_PRODUCT_BLOCKS_TABLE_LOCAL_STORAGE_KEY,
52390
52415
  onExportData: csvDownloadHandler(
52391
52416
  getProductBlocksForExport,
52392
- (data2) => data2.productBlocks,
52417
+ mapToExportItems,
52393
52418
  (data2) => data2.pageInfo,
52394
52419
  Object.keys(tableColumns),
52395
52420
  getCsvFileNameWithDate("ProductBlocks"),
@@ -52500,6 +52525,15 @@ var WfoResourceTypesPage = () => {
52500
52525
  pageSizeOptions: DEFAULT_PAGE_SIZES,
52501
52526
  totalItemCount: totalItems ? totalItems : 0
52502
52527
  };
52528
+ const mapToExportItems = (resourceTypesResponse) => {
52529
+ const { resourceTypes } = resourceTypesResponse;
52530
+ return resourceTypes.map((resourceType) => __spreadProps(__spreadValues({}, resourceType), {
52531
+ productBlocks: getConcatenatedResult(resourceType.productBlocks, [
52532
+ "productBlockId",
52533
+ "name"
52534
+ ])
52535
+ }));
52536
+ };
52503
52537
  return /* @__PURE__ */ jsx148(WfoMetadataPageLayout, { children: /* @__PURE__ */ jsx148(
52504
52538
  WfoTableWithFilter,
52505
52539
  {
@@ -52527,7 +52561,7 @@ var WfoResourceTypesPage = () => {
52527
52561
  localStorageKey: METADATA_RESOURCE_TYPES_TABLE_LOCAL_STORAGE_KEY,
52528
52562
  onExportData: csvDownloadHandler(
52529
52563
  getResourceTypesForExport,
52530
- (data2) => data2.resourceTypes,
52564
+ mapToExportItems,
52531
52565
  (data2) => data2.pageInfo,
52532
52566
  Object.keys(tableColumns),
52533
52567
  getCsvFileNameWithDate("ResourceTypes"),
@@ -52670,6 +52704,18 @@ var WfoProductsPage = () => {
52670
52704
  field: (_b = sortBy == null ? void 0 : sortBy.field) != null ? _b : PRODUCT_FIELD_NAME,
52671
52705
  sortOrder: (_c = sortBy == null ? void 0 : sortBy.order) != null ? _c : "ASC" /* ASC */
52672
52706
  };
52707
+ const mapToExportItems = (productsResponse) => {
52708
+ const { products: products2 } = productsResponse;
52709
+ return products2.map((product) => __spreadProps(__spreadValues({}, product), {
52710
+ fixedInputs: getConcatenatedResult(product.fixedInputs, [
52711
+ "name",
52712
+ "value"
52713
+ ]),
52714
+ productBlocks: getConcatenatedResult(product.productBlocks, [
52715
+ "name"
52716
+ ])
52717
+ }));
52718
+ };
52673
52719
  return /* @__PURE__ */ jsx149(WfoMetadataPageLayout, { children: /* @__PURE__ */ jsx149(
52674
52720
  WfoTableWithFilter,
52675
52721
  {
@@ -52697,10 +52743,7 @@ var WfoProductsPage = () => {
52697
52743
  localStorageKey: METADATA_PRODUCT_TABLE_LOCAL_STORAGE_KEY,
52698
52744
  onExportData: csvDownloadHandler(
52699
52745
  getProductsForExport,
52700
- (data2) => {
52701
- var _a2;
52702
- return (_a2 = data2 == null ? void 0 : data2.products) != null ? _a2 : [];
52703
- },
52746
+ mapToExportItems,
52704
52747
  (data2) => (data2 == null ? void 0 : data2.pageInfo) || {},
52705
52748
  Object.keys(tableColumns),
52706
52749
  getCsvFileNameWithDate("Products"),
@@ -52845,6 +52888,15 @@ var WfoWorkflowsPage = () => {
52845
52888
  pageSizeOptions: DEFAULT_PAGE_SIZES,
52846
52889
  totalItemCount: totalItems ? totalItems : 0
52847
52890
  };
52891
+ const mapToExportItems = (workflowsResponse) => {
52892
+ const { workflows } = workflowsResponse;
52893
+ return workflows.map((workflow) => __spreadProps(__spreadValues({}, workflow), {
52894
+ productTags: getConcatenatedResult(workflow.products, [
52895
+ "tag",
52896
+ "name"
52897
+ ])
52898
+ }));
52899
+ };
52848
52900
  return /* @__PURE__ */ jsx150(WfoMetadataPageLayout, { children: /* @__PURE__ */ jsx150(
52849
52901
  WfoTableWithFilter,
52850
52902
  {
@@ -52874,7 +52926,7 @@ var WfoWorkflowsPage = () => {
52874
52926
  localStorageKey: METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY,
52875
52927
  onExportData: csvDownloadHandler(
52876
52928
  getWorkflowsForExport,
52877
- (data2) => data2.workflows,
52929
+ mapToExportItems,
52878
52930
  (data2) => data2.pageInfo,
52879
52931
  Object.keys(tableColumns),
52880
52932
  getCsvFileNameWithDate("Workflows"),
@@ -55059,6 +55111,13 @@ var mapGraphQlSubscriptionsResultToSubscriptionListItems = (graphqlResponse) =>
55059
55111
  });
55060
55112
 
55061
55113
  // src/components/WfoSubscriptionsList/subscriptionListTabs.ts
55114
+ var WfoSubscriptionListTab = /* @__PURE__ */ ((WfoSubscriptionListTab2) => {
55115
+ WfoSubscriptionListTab2["ACTIVE"] = "ACTIVE";
55116
+ WfoSubscriptionListTab2["TERMINATED"] = "TERMINATED";
55117
+ WfoSubscriptionListTab2["TRANSIENT"] = "TRANSIENT";
55118
+ WfoSubscriptionListTab2["ALL"] = "ALL";
55119
+ return WfoSubscriptionListTab2;
55120
+ })(WfoSubscriptionListTab || {});
55062
55121
  var subscriptionListTabs = [
55063
55122
  {
55064
55123
  id: "ACTIVE" /* ACTIVE */,
@@ -55607,6 +55666,11 @@ import { StringParam as StringParam5, useQueryParam as useQueryParam4, withDefau
55607
55666
  import { EuiPageHeader as EuiPageHeader6, EuiSpacer as EuiSpacer22 } from "@elastic/eui";
55608
55667
 
55609
55668
  // src/pages/workflows/tabConfig.ts
55669
+ var WfoWorkflowsListTabType = /* @__PURE__ */ ((WfoWorkflowsListTabType2) => {
55670
+ WfoWorkflowsListTabType2["ACTIVE"] = "ACTIVE";
55671
+ WfoWorkflowsListTabType2["COMPLETED"] = "COMPLETED";
55672
+ return WfoWorkflowsListTabType2;
55673
+ })(WfoWorkflowsListTabType || {});
55610
55674
  var defaultWorkflowsListTabs = [
55611
55675
  {
55612
55676
  id: "ACTIVE" /* ACTIVE */,
@@ -55793,7 +55857,7 @@ var mapGraphQlProcessListExportResultToProcessListItems = (processesResponse) =>
55793
55857
  isTask,
55794
55858
  startedAt: new Date(startedAt),
55795
55859
  lastModifiedAt: new Date(lastModifiedAt),
55796
- subscriptions,
55860
+ subscriptions: getConcatenatedPagedResult(subscriptions, ["subscriptionId", "description"]),
55797
55861
  productName: product == null ? void 0 : product.name,
55798
55862
  productTag: product == null ? void 0 : product.tag,
55799
55863
  customer: customer.fullname,
@@ -56485,6 +56549,7 @@ var en_GB_default = {
56485
56549
  }
56486
56550
  },
56487
56551
  metadata: {
56552
+ title: "Metadata",
56488
56553
  tabs: {
56489
56554
  products: "Products",
56490
56555
  productBlocks: "Product blocks",
@@ -57396,6 +57461,7 @@ export {
57396
57461
  WfoKeyValueTable,
57397
57462
  WfoLoading,
57398
57463
  WfoLogoutIcon,
57464
+ WfoMetadataPageLayout,
57399
57465
  WfoMinusCircleFill,
57400
57466
  WfoMinusCircleOutline,
57401
57467
  WfoModifySettings,
@@ -57454,8 +57520,10 @@ export {
57454
57520
  WfoSubscriptionDetailPage,
57455
57521
  WfoSubscriptionDetailTree,
57456
57522
  WfoSubscriptionGeneral,
57523
+ WfoSubscriptionListTab,
57457
57524
  WfoSubscriptionProductBlock,
57458
57525
  WfoSubscriptionStatusBadge,
57526
+ WfoSubscriptionsList,
57459
57527
  WfoSubscriptionsListPage,
57460
57528
  WfoTableHeaderCell,
57461
57529
  WfoTableWithFilter,
@@ -57470,6 +57538,7 @@ export {
57470
57538
  WfoWorkflowStepList,
57471
57539
  WfoWorkflowTargetBadge,
57472
57540
  WfoWorkflowsListPage,
57541
+ WfoWorkflowsListTabType,
57473
57542
  WfoWorkflowsPage,
57474
57543
  WfoXCircleFill,
57475
57544
  WorkflowTarget,
@@ -57480,6 +57549,7 @@ export {
57480
57549
  csvDownloadHandler,
57481
57550
  defaultOrchestratorTheme,
57482
57551
  defaultTasksListTabs,
57552
+ defaultWorkflowsListTabs,
57483
57553
  determineNewSortOrder,
57484
57554
  determinePageIndex,
57485
57555
  filterDataByCriteria,
@@ -57487,6 +57557,8 @@ export {
57487
57557
  formatDate,
57488
57558
  formatDateCetWithUtc,
57489
57559
  getApiClient,
57560
+ getConcatenatedPagedResult,
57561
+ getConcatenatedResult,
57490
57562
  getCsvFileNameWithDate,
57491
57563
  getCurrentBrowserLocale,
57492
57564
  getCustomApiSlice,
@@ -57515,6 +57587,8 @@ export {
57515
57587
  getWfoBasicTableStyles,
57516
57588
  getWorkflowTargetColor,
57517
57589
  getWorkflowTargetIconContent,
57590
+ getWorkflowsListTabTypeFromString,
57591
+ graphQlWorkflowListMapper,
57518
57592
  imsPortIdFieldStyling,
57519
57593
  initiateCsvFileDownload,
57520
57594
  ipPrefixTableFieldStyling,
@@ -57524,7 +57598,11 @@ export {
57524
57598
  isValidLocalStorageTableConfig,
57525
57599
  localMomentToUtcTimestamp,
57526
57600
  mapColumnSortToEuiDataGridSorting,
57601
+ mapGraphQlSubscriptionsResultToPageInfo,
57602
+ mapGraphQlSubscriptionsResultToSubscriptionListItems,
57527
57603
  mapSortableAndFilterableValuesToTableColumnConfig,
57604
+ mapWorkflowDefinitionToWorkflowListItem,
57605
+ metaDataTabs,
57528
57606
  onlyUnique,
57529
57607
  orchestratorApi,
57530
57608
  parseDate,
@@ -57551,6 +57629,7 @@ export {
57551
57629
  splitPrefixStyling,
57552
57630
  stop,
57553
57631
  subscriptionDetailQuery,
57632
+ subscriptionListTabs,
57554
57633
  subscriptionsDropdownOptionsQuery,
57555
57634
  toastMessagesReducer,
57556
57635
  toastMessagesSlice,
@@ -57599,6 +57678,7 @@ export {
57599
57678
  useWfoSession,
57600
57679
  useWithOrchestratorTheme,
57601
57680
  utcTimestampToLocalMoment,
57681
+ workflowFieldMapper,
57602
57682
  workflowsQuery
57603
57683
  };
57604
57684
  /*! Bundled license information:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestrator-ui/orchestrator-ui-components",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Library of UI Components used to display the workflow orchestrator frontend",
6
6
  "author": {
@@ -67,6 +67,10 @@ export type ProcessListItem = Pick<
67
67
  customerAbbreviation: string;
68
68
  };
69
69
 
70
+ export type ProcessListExportItem = Omit<ProcessListItem, 'subscriptions'> & {
71
+ subscriptions: string;
72
+ };
73
+
70
74
  export type WfoProcessesListProps = {
71
75
  alwaysOnFilters?: FilterQuery<ProcessListItem>[];
72
76
  defaultHiddenColumns: TableColumnKeys<ProcessListItem> | undefined;
@@ -264,7 +268,7 @@ export const WfoProcessesList = ({
264
268
  onUpdateDataSort={getDataSortHandler(setDataDisplayParam)}
265
269
  onExportData={csvDownloadHandler<
266
270
  ProcessListResponse,
267
- ProcessListItem
271
+ ProcessListExportItem
268
272
  >(
269
273
  getProcessListForExport,
270
274
  mapGraphQlProcessListExportResultToProcessListItems,
@@ -1,7 +1,8 @@
1
1
  import { ProcessListResponse } from '@/rtk';
2
- import { GraphQLSort, GraphqlFilter, Process } from '@/types';
2
+ import { GraphQLSort, GraphqlFilter, Process, Subscription } from '@/types';
3
+ import { getConcatenatedPagedResult } from '@/utils';
3
4
 
4
- import { ProcessListItem } from './WfoProcessesList';
5
+ import { ProcessListExportItem, ProcessListItem } from './WfoProcessesList';
5
6
 
6
7
  export const mapGraphQlProcessListResultToPageInfo = (
7
8
  processesResponse: ProcessListResponse,
@@ -48,7 +49,7 @@ export const mapGraphQlProcessListResultToProcessListItems = (
48
49
 
49
50
  export const mapGraphQlProcessListExportResultToProcessListItems = (
50
51
  processesResponse: ProcessListResponse,
51
- ): ProcessListItem[] =>
52
+ ): ProcessListExportItem[] =>
52
53
  processesResponse.processes.map((process) => {
53
54
  const {
54
55
  workflowName,
@@ -77,7 +78,9 @@ export const mapGraphQlProcessListExportResultToProcessListItems = (
77
78
  isTask,
78
79
  startedAt: new Date(startedAt),
79
80
  lastModifiedAt: new Date(lastModifiedAt),
80
- subscriptions,
81
+ subscriptions: getConcatenatedPagedResult<
82
+ Pick<Subscription, 'subscriptionId' | 'description'>
83
+ >(subscriptions, ['subscriptionId', 'description']),
81
84
  productName: product?.name,
82
85
  productTag: product?.tag,
83
86
  customer: customer.fullname,
@@ -126,6 +126,8 @@ export const WfoSubscriptionGeneral = ({
126
126
  ];
127
127
  };
128
128
 
129
+ const hasMetadata = Object.entries(subscriptionDetail.metadata).length > 0;
130
+
129
131
  return (
130
132
  <EuiFlexGrid direction={'row'}>
131
133
  <>
@@ -135,12 +137,14 @@ export const WfoSubscriptionGeneral = ({
135
137
  keyValues={getSubscriptionDetailBlockData()}
136
138
  />
137
139
  </EuiFlexItem>
138
- <EuiFlexItem>
139
- <SubscriptionKeyValueBlock
140
- title={t('metadata')}
141
- keyValues={getMetadataBlockData()}
142
- />
143
- </EuiFlexItem>
140
+ {hasMetadata && (
141
+ <EuiFlexItem>
142
+ <SubscriptionKeyValueBlock
143
+ title={t('metadata')}
144
+ keyValues={getMetadataBlockData()}
145
+ />
146
+ </EuiFlexItem>
147
+ )}
144
148
  <EuiFlexItem>
145
149
  <SubscriptionKeyValueBlock
146
150
  title={t('blockTitleFixedInputs')}
@@ -26,3 +26,4 @@ export * from './WfoErrorBoundary';
26
26
  export * from './WfoWorkflowSteps';
27
27
  export * from './WfoNoResults';
28
28
  export * from './WfoStartButton';
29
+ export * from './WfoSubscriptionsList';
@@ -121,6 +121,7 @@
121
121
  }
122
122
  },
123
123
  "metadata": {
124
+ "title": "Metadata",
124
125
  "tabs": {
125
126
  "products": "Products",
126
127
  "productBlocks": "Product blocks",
@@ -17,7 +17,7 @@ export interface MetaDataTab {
17
17
  path: string;
18
18
  }
19
19
 
20
- const metaDataTabs: MetaDataTab[] = [
20
+ export const metaDataTabs: MetaDataTab[] = [
21
21
  {
22
22
  id: 1,
23
23
  translationKey: 'products',
@@ -45,14 +45,14 @@ export const WfoMetadataPageLayout = ({
45
45
  tabs = metaDataTabs,
46
46
  }: MetadataLayoutProps) => {
47
47
  const router = useRouter();
48
- const t = useTranslations('metadata.tabs');
48
+ const t = useTranslations('metadata');
49
49
  const currentPath = router.pathname;
50
50
 
51
51
  return (
52
52
  <>
53
53
  <EuiSpacer />
54
54
 
55
- <EuiPageHeader pageTitle="Metadata" />
55
+ <EuiPageHeader pageTitle={t('title')} />
56
56
  <EuiSpacer size="m" />
57
57
  <EuiTabs>
58
58
  {tabs.map(({ id, translationKey: name, path }) => (
@@ -61,7 +61,7 @@ export const WfoMetadataPageLayout = ({
61
61
  isSelected={path === currentPath}
62
62
  onClick={() => router.push(path)}
63
63
  >
64
- {t(name)}
64
+ {t(`tabs.${name}`)}
65
65
  </EuiTab>
66
66
  ))}
67
67
  </EuiTabs>
@@ -28,6 +28,7 @@ import {
28
28
  useStoredTableConfig,
29
29
  } from '@/hooks';
30
30
  import { useGetProductBlocksQuery, useLazyGetProductBlocksQuery } from '@/rtk';
31
+ import type { ProductBlocksResponse } from '@/rtk';
31
32
  import {
32
33
  BadgeType,
33
34
  GraphqlQueryVariables,
@@ -36,6 +37,7 @@ import {
36
37
  } from '@/types';
37
38
  import {
38
39
  csvDownloadHandler,
40
+ getConcatenatedResult,
39
41
  getCsvFileNameWithDate,
40
42
  getQueryVariablesForExport,
41
43
  parseDateToLocaleDateTimeString,
@@ -59,6 +61,14 @@ const PRODUCT_BLOCK_FIELD_RESOURCE_TYPES: keyof ProductBlockDefinition =
59
61
  const PRODUCT_BLOCK_FIELD_PRODUCT_BLOCKS: keyof ProductBlockDefinition =
60
62
  'dependsOn';
61
63
 
64
+ type ProductBlockDefinitionExportItem = Omit<
65
+ ProductBlockDefinition,
66
+ 'resourceTypes' | 'dependsOn'
67
+ > & {
68
+ resourceTypes: string;
69
+ dependsOn: string;
70
+ };
71
+
62
72
  export const WfoProductBlocksPage = () => {
63
73
  const t = useTranslations('metadata.productBlocks');
64
74
  const tError = useTranslations('errors');
@@ -218,6 +228,20 @@ export const WfoProductBlocksPage = () => {
218
228
  totalItemCount: totalItems ? totalItems : 0,
219
229
  };
220
230
 
231
+ const mapToExportItems = (
232
+ productBlocksResponse: ProductBlocksResponse,
233
+ ): ProductBlockDefinitionExportItem[] => {
234
+ const { productBlocks } = productBlocksResponse;
235
+ return productBlocks.map((productBlock) => ({
236
+ ...productBlock,
237
+ resourceTypes: getConcatenatedResult(productBlock.resourceTypes, [
238
+ 'resourceType',
239
+ 'description',
240
+ ]),
241
+ dependsOn: getConcatenatedResult(productBlock.dependsOn, ['name']),
242
+ }));
243
+ };
244
+
221
245
  return (
222
246
  <WfoMetadataPageLayout>
223
247
  <WfoTableWithFilter<ProductBlockDefinition>
@@ -247,7 +271,7 @@ export const WfoProductBlocksPage = () => {
247
271
  }
248
272
  onExportData={csvDownloadHandler(
249
273
  getProductBlocksForExport,
250
- (data) => data.productBlocks,
274
+ mapToExportItems,
251
275
  (data) => data.pageInfo,
252
276
  Object.keys(tableColumns),
253
277
  getCsvFileNameWithDate('ProductBlocks'),
@@ -26,9 +26,11 @@ import {
26
26
  useStoredTableConfig,
27
27
  } from '@/hooks';
28
28
  import { useGetProductsQuery, useLazyGetProductsQuery } from '@/rtk';
29
+ import { ProductsResponse } from '@/rtk';
29
30
  import type { GraphqlQueryVariables, ProductDefinition } from '@/types';
30
31
  import { BadgeType, SortOrder } from '@/types';
31
32
  import {
33
+ getConcatenatedResult,
32
34
  getQueryVariablesForExport,
33
35
  parseDateToLocaleDateTimeString,
34
36
  parseIsoString,
@@ -50,6 +52,14 @@ const PRODUCT_FIELD_PRODUCT_BLOCKS: keyof ProductDefinition = 'productBlocks';
50
52
  const PRODUCT_FIELD_FIXED_INPUTS: keyof ProductDefinition = 'fixedInputs';
51
53
  const PRODUCT_FIELD_CREATED_AT: keyof ProductDefinition = 'createdAt';
52
54
 
55
+ type ProductDefinitionExportItem = Omit<
56
+ ProductDefinition,
57
+ 'fixedInputs' | 'productBlocks'
58
+ > & {
59
+ fixedInputs: string;
60
+ productBlocks: string;
61
+ };
62
+
53
63
  export const WfoProductsPage = () => {
54
64
  const t = useTranslations('metadata.products');
55
65
  const tError = useTranslations('errors');
@@ -197,6 +207,22 @@ export const WfoProductsPage = () => {
197
207
  sortOrder: sortBy?.order ?? SortOrder.ASC,
198
208
  };
199
209
 
210
+ const mapToExportItems = (
211
+ productsResponse: ProductsResponse,
212
+ ): ProductDefinitionExportItem[] => {
213
+ const { products } = productsResponse;
214
+ return products.map((product) => ({
215
+ ...product,
216
+ fixedInputs: getConcatenatedResult(product.fixedInputs, [
217
+ 'name',
218
+ 'value',
219
+ ]),
220
+ productBlocks: getConcatenatedResult(product.productBlocks, [
221
+ 'name',
222
+ ]),
223
+ }));
224
+ };
225
+
200
226
  return (
201
227
  <WfoMetadataPageLayout>
202
228
  <WfoTableWithFilter<ProductDefinition>
@@ -224,7 +250,7 @@ export const WfoProductsPage = () => {
224
250
  localStorageKey={METADATA_PRODUCT_TABLE_LOCAL_STORAGE_KEY}
225
251
  onExportData={csvDownloadHandler(
226
252
  getProductsForExport,
227
- (data) => data?.products ?? [],
253
+ mapToExportItems,
228
254
  (data) => data?.pageInfo || {},
229
255
  Object.keys(tableColumns),
230
256
  getCsvFileNameWithDate('Products'),
@@ -25,14 +25,18 @@ import {
25
25
  useShowToastMessage,
26
26
  useStoredTableConfig,
27
27
  } from '@/hooks';
28
- import { useGetResourceTypesQuery, useLazyGetResourceTypesQuery } from '@/rtk';
28
+ import {
29
+ ResourceTypesResponse,
30
+ useGetResourceTypesQuery,
31
+ useLazyGetResourceTypesQuery,
32
+ } from '@/rtk';
29
33
  import {
30
34
  BadgeType,
31
35
  GraphqlQueryVariables,
32
36
  ResourceTypeDefinition,
33
37
  SortOrder,
34
38
  } from '@/types';
35
- import { getQueryVariablesForExport } from '@/utils';
39
+ import { getConcatenatedResult, getQueryVariablesForExport } from '@/utils';
36
40
  import {
37
41
  csvDownloadHandler,
38
42
  getCsvFileNameWithDate,
@@ -51,6 +55,10 @@ export const RESOURCE_TYPE_FIELD_DESCRIPTION: keyof ResourceTypeDefinition =
51
55
  export const RESOURCE_TYPE_FIELD_PRODUCT_BLOCKS: keyof ResourceTypeDefinition =
52
56
  'productBlocks';
53
57
 
58
+ type ResourceTypeExportItem = Omit<ResourceTypeDefinition, 'productBlocks'> & {
59
+ productBlocks: string;
60
+ };
61
+
54
62
  export const WfoResourceTypesPage = () => {
55
63
  const t = useTranslations('metadata.resourceTypes');
56
64
  const tError = useTranslations('errors');
@@ -168,7 +176,18 @@ export const WfoResourceTypesPage = () => {
168
176
  pageSizeOptions: DEFAULT_PAGE_SIZES,
169
177
  totalItemCount: totalItems ? totalItems : 0,
170
178
  };
171
-
179
+ const mapToExportItems = (
180
+ resourceTypesResponse: ResourceTypesResponse,
181
+ ): ResourceTypeExportItem[] => {
182
+ const { resourceTypes } = resourceTypesResponse;
183
+ return resourceTypes.map((resourceType) => ({
184
+ ...resourceType,
185
+ productBlocks: getConcatenatedResult(resourceType.productBlocks, [
186
+ 'productBlockId',
187
+ 'name',
188
+ ]),
189
+ }));
190
+ };
172
191
  return (
173
192
  <WfoMetadataPageLayout>
174
193
  <WfoTableWithFilter<ResourceTypeDefinition>
@@ -198,7 +217,7 @@ export const WfoResourceTypesPage = () => {
198
217
  }
199
218
  onExportData={csvDownloadHandler(
200
219
  getResourceTypesForExport,
201
- (data) => data.resourceTypes,
220
+ mapToExportItems,
202
221
  (data) => data.pageInfo,
203
222
  Object.keys(tableColumns),
204
223
  getCsvFileNameWithDate('ResourceTypes'),
@@ -24,10 +24,15 @@ import {
24
24
  useShowToastMessage,
25
25
  useStoredTableConfig,
26
26
  } from '@/hooks';
27
- import { useGetWorkflowsQuery, useLazyGetWorkflowsQuery } from '@/rtk';
27
+ import {
28
+ WorkflowsResponse,
29
+ useGetWorkflowsQuery,
30
+ useLazyGetWorkflowsQuery,
31
+ } from '@/rtk';
28
32
  import type { GraphqlQueryVariables, WorkflowDefinition } from '@/types';
29
33
  import { BadgeType, SortOrder } from '@/types';
30
34
  import {
35
+ getConcatenatedResult,
31
36
  getQueryVariablesForExport,
32
37
  onlyUnique,
33
38
  parseDateToLocaleDateTimeString,
@@ -52,6 +57,10 @@ export type WorkflowListItem = Pick<
52
57
  productTags: string[];
53
58
  };
54
59
 
60
+ type WorkflowListExportItem = Omit<WorkflowListItem, 'productTags'> & {
61
+ productTags: string;
62
+ };
63
+
55
64
  export const WfoWorkflowsPage = () => {
56
65
  const t = useTranslations('metadata.workflows');
57
66
  const tError = useTranslations('errors');
@@ -184,6 +193,19 @@ export const WfoWorkflowsPage = () => {
184
193
  totalItemCount: totalItems ? totalItems : 0,
185
194
  };
186
195
 
196
+ const mapToExportItems = (
197
+ workflowsResponse: WorkflowsResponse,
198
+ ): WorkflowListExportItem[] => {
199
+ const { workflows } = workflowsResponse;
200
+ return workflows.map((workflow) => ({
201
+ ...workflow,
202
+ productTags: getConcatenatedResult(workflow.products, [
203
+ 'tag',
204
+ 'name',
205
+ ]),
206
+ }));
207
+ };
208
+
187
209
  return (
188
210
  <WfoMetadataPageLayout>
189
211
  <WfoTableWithFilter<WorkflowListItem>
@@ -217,7 +239,7 @@ export const WfoWorkflowsPage = () => {
217
239
  localStorageKey={METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY}
218
240
  onExportData={csvDownloadHandler(
219
241
  getWorkflowsForExport,
220
- (data) => data.workflows,
242
+ mapToExportItems,
221
243
  (data) => data.pageInfo,
222
244
  Object.keys(tableColumns),
223
245
  getCsvFileNameWithDate('Workflows'),
@@ -2,3 +2,5 @@ export * from './WfoProductBlocksPage';
2
2
  export * from './WfoResourceTypesPage';
3
3
  export * from './WfoProductsPage';
4
4
  export * from './WfoWorkflowsPage';
5
+ export * from './WfoMetadataPageLayout';
6
+ export * from './workflowListObjectMapper';
@@ -2,8 +2,8 @@ import React from 'react';
2
2
 
3
3
  import { useRouter } from 'next/router';
4
4
 
5
- import { WfoSubscription } from '../../components';
6
- import { TreeProvider } from '../../contexts';
5
+ import { WfoSubscription } from '@/components';
6
+ import { TreeProvider } from '@/contexts';
7
7
 
8
8
  export const WfoSubscriptionDetailPage = () => {
9
9
  const router = useRouter();