@orchestrator-ui/orchestrator-ui-components 1.3.0 → 1.4.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 +7 -7
- package/CHANGELOG.md +25 -0
- package/dist/index.d.ts +417 -288
- package/dist/index.js +3338 -5612
- package/package.json +1 -3
- package/src/components/WfoForms/UserInputForm.tsx +7 -1
- package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +11 -15
- package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +2 -2
- package/src/components/WfoProcessList/WfoProcessesList.tsx +16 -9
- package/src/components/WfoProcessList/processListObjectMappers.ts +6 -10
- package/src/components/WfoSettings/WfoModifySettings.tsx +29 -13
- package/src/components/WfoSettings/WfoResetTextSearchIndexButton.tsx +22 -0
- package/src/components/WfoSettings/index.ts +1 -0
- package/src/components/{WfoButtonComboBox/WfoButtonComboBox.tsx → WfoStartButton/WfoStartButtonComboBox.tsx} +11 -17
- package/src/components/WfoStartButton/WfoStartTaskComboBox.tsx +47 -0
- package/src/components/WfoStartButton/WfoStartWorkflowComboBox.tsx +49 -0
- package/src/components/WfoStartButton/index.ts +2 -0
- package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +30 -36
- package/src/components/WfoSubscription/WfoSubscription.tsx +17 -20
- package/src/components/WfoSubscription/index.ts +6 -4
- package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +12 -16
- package/src/components/WfoSubscriptionsList/subscriptionResultMappers.ts +10 -12
- package/src/components/index.ts +2 -1
- package/src/configuration/constants.ts +3 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/surf/useGetSubscriptionDropdownOptions.ts +6 -13
- package/src/hooks/surf/useIsTaggedPort.ts +6 -9
- package/src/index.ts +0 -1
- package/src/messages/en-GB.json +3 -1
- package/src/messages/nl-NL.json +3 -1
- package/src/pages/metadata/WfoProductBlocksPage.tsx +27 -37
- package/src/pages/metadata/WfoProductsPage.tsx +11 -16
- package/src/pages/metadata/WfoResourceTypesPage.tsx +33 -35
- package/src/pages/metadata/WfoWorkflowsPage.tsx +42 -40
- package/src/pages/metadata/workflowListObjectMapper.ts +4 -7
- package/src/pages/processes/WfoStartProcessPage.tsx +9 -21
- package/src/pages/startPage/WfoStartPage.tsx +56 -68
- package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +6 -7
- package/src/rtk/api.ts +11 -3
- package/src/rtk/endpoints/index.ts +11 -1
- package/src/rtk/endpoints/metadata/index.ts +3 -0
- package/src/rtk/endpoints/metadata/productBlocks.ts +88 -0
- package/src/rtk/endpoints/metadata/resourceTypes.ts +78 -0
- package/src/rtk/endpoints/metadata/workflows.ts +73 -0
- package/src/rtk/endpoints/processList.ts +2 -1
- package/src/rtk/endpoints/processListSummary.ts +70 -0
- package/src/rtk/endpoints/processSteps.ts +50 -0
- package/src/rtk/endpoints/products.ts +76 -0
- package/src/rtk/endpoints/productsSummary.ts +62 -0
- package/src/rtk/endpoints/relatedSubscriptions.ts +99 -0
- package/src/rtk/endpoints/settings.ts +10 -0
- package/src/rtk/endpoints/startOptions.ts +99 -0
- package/src/{graphqlQueries/subscriptionDetailQuery.ts → rtk/endpoints/subscriptionDetail.ts} +45 -11
- package/src/rtk/endpoints/subscriptionList.ts +86 -0
- package/src/rtk/endpoints/subscriptionListSummary.ts +70 -0
- package/src/rtk/endpoints/subscriptionsDropdownOptions.ts +72 -0
- package/src/types/types.ts +20 -0
- package/src/utils/index.ts +1 -0
- package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +0 -61
- package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +0 -54
- package/src/components/WfoStartTaskButtonComboBox/index.ts +0 -1
- package/src/graphqlQueries/index.ts +0 -8
- package/src/graphqlQueries/processListQuery.ts +0 -101
- package/src/graphqlQueries/processStepsQuery.ts +0 -22
- package/src/graphqlQueries/productBlocksQuery.ts +0 -59
- package/src/graphqlQueries/productsQuery.ts +0 -85
- package/src/graphqlQueries/relatedSubscriptionsQuery.ts +0 -65
- package/src/graphqlQueries/resourceTypesQuery.ts +0 -52
- package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +0 -48
- package/src/graphqlQueries/subscriptionsListQuery.ts +0 -101
- package/src/graphqlQueries/workflows/workflowsQuery.ts +0 -48
- package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +0 -38
- package/src/hooks/useQueryWithGraphql.ts +0 -72
- /package/src/components/{WfoButtonComboBox → WfoStartButton}/styles.ts +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SubscriptionListResponse } from '@/rtk/endpoints/subscriptionList';
|
|
2
|
+
import { Subscription } from '@/types';
|
|
3
|
+
import { parseDate } from '@/utils';
|
|
3
4
|
|
|
4
5
|
export type SubscriptionListItem = Pick<
|
|
5
6
|
Subscription,
|
|
@@ -13,16 +14,14 @@ export type SubscriptionListItem = Pick<
|
|
|
13
14
|
customerShortcode: string;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
export
|
|
17
|
-
graphqlResponse:
|
|
18
|
-
)
|
|
19
|
-
return graphqlResponse.subscriptions.pageInfo;
|
|
20
|
-
}
|
|
17
|
+
export const mapGraphQlSubscriptionsResultToPageInfo = (
|
|
18
|
+
graphqlResponse: SubscriptionListResponse,
|
|
19
|
+
) => graphqlResponse.pageInfo;
|
|
21
20
|
|
|
22
|
-
export
|
|
23
|
-
graphqlResponse:
|
|
24
|
-
): SubscriptionListItem[]
|
|
25
|
-
|
|
21
|
+
export const mapGraphQlSubscriptionsResultToSubscriptionListItems = (
|
|
22
|
+
graphqlResponse: SubscriptionListResponse,
|
|
23
|
+
): SubscriptionListItem[] =>
|
|
24
|
+
graphqlResponse.subscriptions.map((subscription) => {
|
|
26
25
|
const {
|
|
27
26
|
description,
|
|
28
27
|
insync,
|
|
@@ -53,4 +52,3 @@ export function mapGraphQlSubscriptionsResultToSubscriptionListItems(
|
|
|
53
52
|
customerShortcode,
|
|
54
53
|
};
|
|
55
54
|
});
|
|
56
|
-
}
|
package/src/components/index.ts
CHANGED
|
@@ -12,7 +12,6 @@ export * from './WfoTimeline';
|
|
|
12
12
|
export * from './WfoLoading';
|
|
13
13
|
export * from './WfoToastsList';
|
|
14
14
|
export * from './WfoForms';
|
|
15
|
-
export * from './WfoStartTaskButtonComboBox';
|
|
16
15
|
export * from './WfoDateTime';
|
|
17
16
|
export * from './WfoAuth';
|
|
18
17
|
export * from './WfoDropdownButton';
|
|
@@ -25,3 +24,5 @@ export * from './WfoInsyncIcon';
|
|
|
25
24
|
export * from './WfoError';
|
|
26
25
|
export * from './WfoErrorBoundary';
|
|
27
26
|
export * from './WfoWorkflowSteps';
|
|
27
|
+
export * from './WfoNoResults';
|
|
28
|
+
export * from './WfoStartButton';
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { isError } from 'react-query';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { GraphqlFilter, SubscriptionDropdownOption } from '
|
|
5
|
-
import { useQueryWithGraphql } from '../useQueryWithGraphql';
|
|
3
|
+
import { useGetSubscriptionsDropdownOptionsQuery } from '@/rtk';
|
|
4
|
+
import { GraphqlFilter, SubscriptionDropdownOption } from '@/types';
|
|
6
5
|
|
|
7
6
|
export const useGetSubscriptionDropdownOptions = (
|
|
8
7
|
tags: string[] = [],
|
|
@@ -28,18 +27,12 @@ export const useGetSubscriptionDropdownOptions = (
|
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
const { data, isFetching, refetch } =
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
filterBy: filters,
|
|
35
|
-
},
|
|
36
|
-
'subscriptionOptions',
|
|
37
|
-
{ refetchOnWindowFocus: false },
|
|
38
|
-
);
|
|
30
|
+
const { data, isFetching, refetch } =
|
|
31
|
+
useGetSubscriptionsDropdownOptionsQuery({ filterBy: filters });
|
|
39
32
|
|
|
40
33
|
const subscriptions = (() => {
|
|
41
|
-
if (!isFetching && !isError(data) && data
|
|
42
|
-
return data.
|
|
34
|
+
if (!isFetching && !isError(data) && data) {
|
|
35
|
+
return data.subscriptionDropdownOptions;
|
|
43
36
|
}
|
|
44
37
|
return [];
|
|
45
38
|
})();
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
subscriptionHasTaggedPortModeInstanceValue,
|
|
3
3
|
subscriptionHasTaggedProduct,
|
|
4
|
-
} from '
|
|
5
|
-
import {
|
|
6
|
-
import { useQueryWithGraphql } from '../useQueryWithGraphql';
|
|
4
|
+
} from '@/components/WfoForms/formFields/utils';
|
|
5
|
+
import { useGetSubscriptionDetailQuery } from '@/rtk/endpoints/subscriptionDetail';
|
|
7
6
|
|
|
8
7
|
export const useIsTaggedPort = (subscriptionId: string): [boolean, boolean] => {
|
|
9
|
-
const { data,
|
|
10
|
-
GET_SUBSCRIPTION_DETAIL_GRAPHQL_QUERY,
|
|
8
|
+
const { data, isFetching } = useGetSubscriptionDetailQuery(
|
|
11
9
|
{ subscriptionId },
|
|
12
|
-
|
|
13
|
-
{ enabled: !!subscriptionId },
|
|
10
|
+
{ skip: !subscriptionId },
|
|
14
11
|
);
|
|
15
|
-
const subscriptionDetail = data?.
|
|
12
|
+
const subscriptionDetail = data?.subscription;
|
|
16
13
|
|
|
17
14
|
// The ports portMode is tagged (with a vlan) when:
|
|
18
15
|
// - The subscription contains a productBlockInstance with a productBlockInstanceValue with the property port_mode and
|
|
@@ -24,5 +21,5 @@ export const useIsTaggedPort = (subscriptionId: string): [boolean, boolean] => {
|
|
|
24
21
|
subscriptionHasTaggedProduct(subscriptionDetail)
|
|
25
22
|
: false;
|
|
26
23
|
|
|
27
|
-
return [
|
|
24
|
+
return [!isFetching, portIsTagged];
|
|
28
25
|
};
|
package/src/index.ts
CHANGED
package/src/messages/en-GB.json
CHANGED
|
@@ -348,7 +348,9 @@
|
|
|
348
348
|
"pauseEngine": "Pause workflow engine",
|
|
349
349
|
"runningProcesses": "Running processes",
|
|
350
350
|
"selectSettings": "Select cache",
|
|
351
|
-
"startEngine": "Start workflow engine"
|
|
351
|
+
"startEngine": "Start workflow engine",
|
|
352
|
+
"resetTextSearchIndex": "Reset text search index",
|
|
353
|
+
"resetTextSearchIndexButton": "Reset"
|
|
352
354
|
}
|
|
353
355
|
},
|
|
354
356
|
"startPage": {
|
package/src/messages/nl-NL.json
CHANGED
|
@@ -347,7 +347,9 @@
|
|
|
347
347
|
"pauseEngine": "Pauseer workflow engine",
|
|
348
348
|
"runningProcesses": "Lopende processen",
|
|
349
349
|
"selectSettings": "Kies cache",
|
|
350
|
-
"startEngine": "Start workflow engine"
|
|
350
|
+
"startEngine": "Start workflow engine",
|
|
351
|
+
"resetTextSearchIndex": "Reset text search index",
|
|
352
|
+
"resetTextSearchIndexButton": "Reset"
|
|
351
353
|
}
|
|
352
354
|
},
|
|
353
355
|
"startPage": {
|
|
@@ -5,50 +5,43 @@ import { useTranslations } from 'next-intl';
|
|
|
5
5
|
import { EuiBadgeGroup } from '@elastic/eui';
|
|
6
6
|
import type { Pagination } from '@elastic/eui/src/components';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
csvDownloadHandler,
|
|
10
|
-
getCsvFileNameWithDate,
|
|
11
|
-
} from '@/utils/csvDownload';
|
|
12
|
-
|
|
13
8
|
import {
|
|
14
9
|
DEFAULT_PAGE_SIZE,
|
|
15
10
|
DEFAULT_PAGE_SIZES,
|
|
16
11
|
METADATA_PRODUCT_BLOCKS_TABLE_LOCAL_STORAGE_KEY,
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
StoredTableConfig,
|
|
13
|
+
WfoDataSorting,
|
|
14
|
+
WfoDateTime,
|
|
15
|
+
WfoFirstPartUUID,
|
|
19
16
|
WfoProductBlockBadge,
|
|
20
17
|
WfoProductStatusBadge,
|
|
18
|
+
WfoTableColumns,
|
|
21
19
|
WfoTableWithFilter,
|
|
22
|
-
} from '../../components';
|
|
23
|
-
import {
|
|
24
20
|
getDataSortHandler,
|
|
25
21
|
getPageChangeHandler,
|
|
26
22
|
getQueryStringHandler,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
import type { StoredTableConfig } from '../../components';
|
|
30
|
-
import '../../components/WfoBadges/WfoProductStatusBadge';
|
|
31
|
-
import { WfoDateTime } from '../../components/WfoDateTime/WfoDateTime';
|
|
32
|
-
import { WfoFirstPartUUID } from '../../components/WfoTable/WfoFirstPartUUID';
|
|
33
|
-
import { mapSortableAndFilterableValuesToTableColumnConfig } from '../../components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig';
|
|
34
|
-
import { GET_PRODUCTS_BLOCKS_GRAPHQL_QUERY } from '../../graphqlQueries';
|
|
23
|
+
mapSortableAndFilterableValuesToTableColumnConfig,
|
|
24
|
+
} from '@/components';
|
|
35
25
|
import {
|
|
36
26
|
useDataDisplayParams,
|
|
37
|
-
useQueryWithGraphql,
|
|
38
|
-
useQueryWithGraphqlLazy,
|
|
39
27
|
useShowToastMessage,
|
|
40
28
|
useStoredTableConfig,
|
|
41
|
-
} from '
|
|
42
|
-
import
|
|
29
|
+
} from '@/hooks';
|
|
30
|
+
import { useGetProductBlocksQuery, useLazyGetProductBlocksQuery } from '@/rtk';
|
|
31
|
+
import {
|
|
32
|
+
BadgeType,
|
|
43
33
|
GraphqlQueryVariables,
|
|
44
34
|
ProductBlockDefinition,
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
SortOrder,
|
|
36
|
+
} from '@/types';
|
|
47
37
|
import {
|
|
38
|
+
csvDownloadHandler,
|
|
39
|
+
getCsvFileNameWithDate,
|
|
48
40
|
getQueryVariablesForExport,
|
|
49
41
|
parseDateToLocaleDateTimeString,
|
|
50
42
|
parseIsoString,
|
|
51
|
-
} from '
|
|
43
|
+
} from '@/utils';
|
|
44
|
+
|
|
52
45
|
import { WfoMetadataPageLayout } from './WfoMetadataPageLayout';
|
|
53
46
|
|
|
54
47
|
const PRODUCT_BLOCK_FIELD_ID: keyof ProductBlockDefinition = 'productBlockId';
|
|
@@ -201,25 +194,22 @@ export const WfoProductBlocksPage = () => {
|
|
|
201
194
|
sortBy: sortBy,
|
|
202
195
|
query: queryString || undefined,
|
|
203
196
|
};
|
|
204
|
-
const { data, isFetching, isError } =
|
|
205
|
-
GET_PRODUCTS_BLOCKS_GRAPHQL_QUERY,
|
|
197
|
+
const { data, isFetching, isError } = useGetProductBlocksQuery(
|
|
206
198
|
graphqlQueryVariables,
|
|
207
|
-
['productBlocks', 'listPage'],
|
|
208
199
|
);
|
|
209
|
-
const {
|
|
210
|
-
|
|
211
|
-
|
|
200
|
+
const [getProductBlocksTrigger, { isFetching: isFetchingCsv }] =
|
|
201
|
+
useLazyGetProductBlocksQuery();
|
|
202
|
+
const getProductBlocksForExport = () =>
|
|
203
|
+
getProductBlocksTrigger(
|
|
212
204
|
getQueryVariablesForExport(graphqlQueryVariables),
|
|
213
|
-
|
|
214
|
-
);
|
|
205
|
+
).unwrap();
|
|
215
206
|
|
|
216
207
|
const dataSorting: WfoDataSorting<ProductBlockDefinition> = {
|
|
217
208
|
field: sortBy?.field ?? PRODUCT_BLOCK_FIELD_NAME,
|
|
218
209
|
sortOrder: sortBy?.order ?? SortOrder.ASC,
|
|
219
210
|
};
|
|
220
211
|
|
|
221
|
-
const { totalItems, sortFields, filterFields } =
|
|
222
|
-
data?.productBlocks?.pageInfo ?? {};
|
|
212
|
+
const { totalItems, sortFields, filterFields } = data?.pageInfo ?? {};
|
|
223
213
|
|
|
224
214
|
const pagination: Pagination = {
|
|
225
215
|
pageSize: pageSize,
|
|
@@ -231,7 +221,7 @@ export const WfoProductBlocksPage = () => {
|
|
|
231
221
|
return (
|
|
232
222
|
<WfoMetadataPageLayout>
|
|
233
223
|
<WfoTableWithFilter<ProductBlockDefinition>
|
|
234
|
-
data={data?.productBlocks
|
|
224
|
+
data={data?.productBlocks || []}
|
|
235
225
|
tableColumns={mapSortableAndFilterableValuesToTableColumnConfig(
|
|
236
226
|
tableColumns,
|
|
237
227
|
sortFields,
|
|
@@ -257,8 +247,8 @@ export const WfoProductBlocksPage = () => {
|
|
|
257
247
|
}
|
|
258
248
|
onExportData={csvDownloadHandler(
|
|
259
249
|
getProductBlocksForExport,
|
|
260
|
-
(data) => data.productBlocks
|
|
261
|
-
(data) => data.
|
|
250
|
+
(data) => data.productBlocks,
|
|
251
|
+
(data) => data.pageInfo,
|
|
262
252
|
Object.keys(tableColumns),
|
|
263
253
|
getCsvFileNameWithDate('ProductBlocks'),
|
|
264
254
|
showToastMessage,
|
|
@@ -20,14 +20,12 @@ import {
|
|
|
20
20
|
} from '@/components';
|
|
21
21
|
import { WfoFirstPartUUID } from '@/components/WfoTable/WfoFirstPartUUID';
|
|
22
22
|
import { mapSortableAndFilterableValuesToTableColumnConfig } from '@/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig';
|
|
23
|
-
import { getProductsQuery } from '@/graphqlQueries';
|
|
24
23
|
import {
|
|
25
24
|
useDataDisplayParams,
|
|
26
|
-
useQueryWithGraphql,
|
|
27
|
-
useQueryWithGraphqlLazy,
|
|
28
25
|
useShowToastMessage,
|
|
29
26
|
useStoredTableConfig,
|
|
30
27
|
} from '@/hooks';
|
|
28
|
+
import { useGetProductsQuery, useLazyGetProductsQuery } from '@/rtk';
|
|
31
29
|
import type { GraphqlQueryVariables, ProductDefinition } from '@/types';
|
|
32
30
|
import { BadgeType, SortOrder } from '@/types';
|
|
33
31
|
import {
|
|
@@ -170,20 +168,17 @@ export const WfoProductsPage = () => {
|
|
|
170
168
|
sortBy: sortBy,
|
|
171
169
|
query: queryString || undefined,
|
|
172
170
|
};
|
|
173
|
-
const { data, isFetching, isError } =
|
|
174
|
-
getProductsQuery(),
|
|
171
|
+
const { data, isFetching, isError } = useGetProductsQuery(
|
|
175
172
|
graphqlQueryVariables,
|
|
176
|
-
['products', 'listPage'],
|
|
177
173
|
);
|
|
178
|
-
const {
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
const [getProductsTrigger, { isFetching: isFetchingCsv }] =
|
|
175
|
+
useLazyGetProductsQuery();
|
|
176
|
+
const getProductsForExport = () =>
|
|
177
|
+
getProductsTrigger(
|
|
181
178
|
getQueryVariablesForExport(graphqlQueryVariables),
|
|
182
|
-
|
|
183
|
-
);
|
|
179
|
+
).unwrap();
|
|
184
180
|
|
|
185
|
-
const { totalItems, sortFields, filterFields } =
|
|
186
|
-
data?.products?.pageInfo ?? {};
|
|
181
|
+
const { totalItems, sortFields, filterFields } = data?.pageInfo ?? {};
|
|
187
182
|
|
|
188
183
|
const pagination: Pagination = {
|
|
189
184
|
pageSize: pageSize,
|
|
@@ -200,7 +195,7 @@ export const WfoProductsPage = () => {
|
|
|
200
195
|
return (
|
|
201
196
|
<WfoMetadataPageLayout>
|
|
202
197
|
<WfoTableWithFilter<ProductDefinition>
|
|
203
|
-
data={data
|
|
198
|
+
data={data?.products ?? []}
|
|
204
199
|
tableColumns={mapSortableAndFilterableValuesToTableColumnConfig(
|
|
205
200
|
tableColumns,
|
|
206
201
|
sortFields,
|
|
@@ -224,8 +219,8 @@ export const WfoProductsPage = () => {
|
|
|
224
219
|
localStorageKey={METADATA_PRODUCT_TABLE_LOCAL_STORAGE_KEY}
|
|
225
220
|
onExportData={csvDownloadHandler(
|
|
226
221
|
getProductsForExport,
|
|
227
|
-
(data) => data
|
|
228
|
-
(data) => data
|
|
222
|
+
(data) => data?.products ?? [],
|
|
223
|
+
(data) => data?.pageInfo || {},
|
|
229
224
|
Object.keys(tableColumns),
|
|
230
225
|
getCsvFileNameWithDate('Products'),
|
|
231
226
|
showToastMessage,
|
|
@@ -5,41 +5,41 @@ import { useTranslations } from 'next-intl';
|
|
|
5
5
|
import { EuiBadgeGroup } from '@elastic/eui';
|
|
6
6
|
import type { Pagination } from '@elastic/eui/src/components';
|
|
7
7
|
|
|
8
|
-
import { getQueryVariablesForExport } from '@/utils';
|
|
9
|
-
import {
|
|
10
|
-
csvDownloadHandler,
|
|
11
|
-
getCsvFileNameWithDate,
|
|
12
|
-
} from '@/utils/csvDownload';
|
|
13
|
-
|
|
14
8
|
import {
|
|
15
9
|
DEFAULT_PAGE_SIZE,
|
|
16
10
|
DEFAULT_PAGE_SIZES,
|
|
17
11
|
METADATA_RESOURCE_TYPES_TABLE_LOCAL_STORAGE_KEY,
|
|
18
12
|
WfoProductBlockBadge,
|
|
19
|
-
|
|
20
|
-
import type { WfoDataSorting, WfoTableColumns } from '../../components';
|
|
21
|
-
import { WfoTableWithFilter } from '../../components';
|
|
22
|
-
import {
|
|
13
|
+
WfoTableWithFilter,
|
|
23
14
|
getDataSortHandler,
|
|
24
15
|
getPageChangeHandler,
|
|
25
16
|
getQueryStringHandler,
|
|
26
|
-
} from '
|
|
27
|
-
import type {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
} from '@/components';
|
|
18
|
+
import type {
|
|
19
|
+
StoredTableConfig,
|
|
20
|
+
WfoDataSorting,
|
|
21
|
+
WfoTableColumns,
|
|
22
|
+
} from '@/components';
|
|
31
23
|
import {
|
|
32
24
|
useDataDisplayParams,
|
|
33
|
-
useQueryWithGraphql,
|
|
34
|
-
useQueryWithGraphqlLazy,
|
|
35
25
|
useShowToastMessage,
|
|
36
26
|
useStoredTableConfig,
|
|
37
|
-
} from '
|
|
38
|
-
import
|
|
27
|
+
} from '@/hooks';
|
|
28
|
+
import { useGetResourceTypesQuery, useLazyGetResourceTypesQuery } from '@/rtk';
|
|
29
|
+
import {
|
|
30
|
+
BadgeType,
|
|
39
31
|
GraphqlQueryVariables,
|
|
40
32
|
ResourceTypeDefinition,
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
SortOrder,
|
|
34
|
+
} from '@/types';
|
|
35
|
+
import { getQueryVariablesForExport } from '@/utils';
|
|
36
|
+
import {
|
|
37
|
+
csvDownloadHandler,
|
|
38
|
+
getCsvFileNameWithDate,
|
|
39
|
+
} from '@/utils/csvDownload';
|
|
40
|
+
|
|
41
|
+
import { WfoFirstPartUUID } from '../../components/WfoTable/WfoFirstPartUUID';
|
|
42
|
+
import { mapSortableAndFilterableValuesToTableColumnConfig } from '../../components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig';
|
|
43
43
|
import { WfoMetadataPageLayout } from './WfoMetadataPageLayout';
|
|
44
44
|
|
|
45
45
|
export const RESOURCE_TYPE_FIELD_ID: keyof ResourceTypeDefinition =
|
|
@@ -55,7 +55,6 @@ export const WfoResourceTypesPage = () => {
|
|
|
55
55
|
const t = useTranslations('metadata.resourceTypes');
|
|
56
56
|
const tError = useTranslations('errors');
|
|
57
57
|
const { showToastMessage } = useShowToastMessage();
|
|
58
|
-
|
|
59
58
|
const [tableDefaults, setTableDefaults] =
|
|
60
59
|
useState<StoredTableConfig<ResourceTypeDefinition>>();
|
|
61
60
|
|
|
@@ -144,25 +143,24 @@ export const WfoResourceTypesPage = () => {
|
|
|
144
143
|
sortBy: sortBy,
|
|
145
144
|
query: queryString || undefined,
|
|
146
145
|
};
|
|
147
|
-
const { data, isFetching, isError } =
|
|
148
|
-
GET_RESOURCE_TYPES_GRAPHQL_QUERY,
|
|
146
|
+
const { data, isFetching, isError } = useGetResourceTypesQuery(
|
|
149
147
|
graphqlQueryVariables,
|
|
150
|
-
['resourceTypes', 'listPage'],
|
|
151
148
|
);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
|
|
150
|
+
const [getResourceTypesTrigger, { isFetching: isFetchingCsv }] =
|
|
151
|
+
useLazyGetResourceTypesQuery();
|
|
152
|
+
|
|
153
|
+
const getResourceTypesForExport = () =>
|
|
154
|
+
getResourceTypesTrigger(
|
|
155
155
|
getQueryVariablesForExport(graphqlQueryVariables),
|
|
156
|
-
|
|
157
|
-
);
|
|
156
|
+
).unwrap();
|
|
158
157
|
|
|
159
158
|
const dataSorting: WfoDataSorting<ResourceTypeDefinition> = {
|
|
160
159
|
field: sortBy?.field ?? RESOURCE_TYPE_FIELD_TYPE,
|
|
161
160
|
sortOrder: sortBy?.order ?? SortOrder.ASC,
|
|
162
161
|
};
|
|
163
162
|
|
|
164
|
-
const { totalItems, sortFields, filterFields } =
|
|
165
|
-
data?.resourceTypes?.pageInfo || {};
|
|
163
|
+
const { totalItems, sortFields, filterFields } = data?.pageInfo || {};
|
|
166
164
|
|
|
167
165
|
const pagination: Pagination = {
|
|
168
166
|
pageSize: pageSize,
|
|
@@ -174,7 +172,7 @@ export const WfoResourceTypesPage = () => {
|
|
|
174
172
|
return (
|
|
175
173
|
<WfoMetadataPageLayout>
|
|
176
174
|
<WfoTableWithFilter<ResourceTypeDefinition>
|
|
177
|
-
data={data ? data.resourceTypes
|
|
175
|
+
data={data ? data.resourceTypes : []}
|
|
178
176
|
tableColumns={mapSortableAndFilterableValuesToTableColumnConfig(
|
|
179
177
|
tableColumns,
|
|
180
178
|
sortFields,
|
|
@@ -200,8 +198,8 @@ export const WfoResourceTypesPage = () => {
|
|
|
200
198
|
}
|
|
201
199
|
onExportData={csvDownloadHandler(
|
|
202
200
|
getResourceTypesForExport,
|
|
203
|
-
(data) => data.resourceTypes
|
|
204
|
-
(data) => data.
|
|
201
|
+
(data) => data.resourceTypes,
|
|
202
|
+
(data) => data.pageInfo,
|
|
205
203
|
Object.keys(tableColumns),
|
|
206
204
|
getCsvFileNameWithDate('ResourceTypes'),
|
|
207
205
|
showToastMessage,
|
|
@@ -5,13 +5,26 @@ import { useTranslations } from 'next-intl';
|
|
|
5
5
|
import { EuiBadgeGroup } from '@elastic/eui';
|
|
6
6
|
import type { Pagination } from '@elastic/eui/src/components';
|
|
7
7
|
|
|
8
|
+
import type { WfoDataSorting, WfoTableColumns } from '@/components';
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_PAGE_SIZE,
|
|
11
|
+
DEFAULT_PAGE_SIZES,
|
|
12
|
+
METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY,
|
|
13
|
+
StoredTableConfig,
|
|
14
|
+
WfoDateTime,
|
|
15
|
+
WfoProductBlockBadge,
|
|
16
|
+
WfoTableWithFilter,
|
|
17
|
+
WfoWorkflowTargetBadge,
|
|
18
|
+
getDataSortHandler,
|
|
19
|
+
getPageChangeHandler,
|
|
20
|
+
getQueryStringHandler,
|
|
21
|
+
} from '@/components';
|
|
8
22
|
import {
|
|
9
23
|
useDataDisplayParams,
|
|
10
|
-
useQueryWithGraphql,
|
|
11
|
-
useQueryWithGraphqlLazy,
|
|
12
24
|
useShowToastMessage,
|
|
13
25
|
useStoredTableConfig,
|
|
14
26
|
} from '@/hooks';
|
|
27
|
+
import { useGetWorkflowsQuery, useLazyGetWorkflowsQuery } from '@/rtk';
|
|
15
28
|
import type { GraphqlQueryVariables, WorkflowDefinition } from '@/types';
|
|
16
29
|
import { BadgeType, SortOrder } from '@/types';
|
|
17
30
|
import {
|
|
@@ -25,24 +38,7 @@ import {
|
|
|
25
38
|
getCsvFileNameWithDate,
|
|
26
39
|
} from '@/utils/csvDownload';
|
|
27
40
|
|
|
28
|
-
import {
|
|
29
|
-
DEFAULT_PAGE_SIZE,
|
|
30
|
-
DEFAULT_PAGE_SIZES,
|
|
31
|
-
METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY,
|
|
32
|
-
WfoProductBlockBadge,
|
|
33
|
-
} from '../../components';
|
|
34
|
-
import { WfoTableWithFilter } from '../../components';
|
|
35
|
-
import {
|
|
36
|
-
getDataSortHandler,
|
|
37
|
-
getPageChangeHandler,
|
|
38
|
-
getQueryStringHandler,
|
|
39
|
-
} from '../../components';
|
|
40
|
-
import type { WfoDataSorting, WfoTableColumns } from '../../components';
|
|
41
|
-
import { StoredTableConfig } from '../../components';
|
|
42
|
-
import { WfoWorkflowTargetBadge } from '../../components/WfoBadges/WfoWorkflowTargetBadge';
|
|
43
|
-
import { WfoDateTime } from '../../components/WfoDateTime/WfoDateTime';
|
|
44
41
|
import { mapSortableAndFilterableValuesToTableColumnConfig } from '../../components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig';
|
|
45
|
-
import { GET_WORKFLOWS_GRAPHQL_QUERY } from '../../graphqlQueries/workflows/workflowsQuery';
|
|
46
42
|
import { WfoMetadataPageLayout } from './WfoMetadataPageLayout';
|
|
47
43
|
import {
|
|
48
44
|
graphQlWorkflowListMapper,
|
|
@@ -155,31 +151,31 @@ export const WfoWorkflowsPage = () => {
|
|
|
155
151
|
|
|
156
152
|
const { pageSize, pageIndex, sortBy, queryString } = dataDisplayParams;
|
|
157
153
|
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
['workflows', 'listPage'],
|
|
154
|
+
const workflowListQueryVariables: GraphqlQueryVariables<WorkflowDefinition> =
|
|
155
|
+
{
|
|
156
|
+
first: pageSize,
|
|
157
|
+
after: pageIndex * pageSize,
|
|
158
|
+
sortBy: graphQlWorkflowListMapper(sortBy),
|
|
159
|
+
query: queryString || undefined,
|
|
160
|
+
};
|
|
161
|
+
const { data, isFetching, isError } = useGetWorkflowsQuery(
|
|
162
|
+
workflowListQueryVariables,
|
|
168
163
|
);
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
164
|
+
|
|
165
|
+
const [getWorkflowsTrigger, { isFetching: isFetchingCsv }] =
|
|
166
|
+
useLazyGetWorkflowsQuery();
|
|
167
|
+
|
|
168
|
+
const getWorkflowsForExport = () =>
|
|
169
|
+
getWorkflowsTrigger(
|
|
170
|
+
getQueryVariablesForExport(workflowListQueryVariables),
|
|
171
|
+
).unwrap();
|
|
175
172
|
|
|
176
173
|
const dataSorting: WfoDataSorting<WorkflowListItem> = {
|
|
177
174
|
field: sortBy?.field ?? 'name',
|
|
178
175
|
sortOrder: sortBy?.order ?? SortOrder.ASC,
|
|
179
176
|
};
|
|
180
177
|
|
|
181
|
-
const { totalItems, sortFields, filterFields } =
|
|
182
|
-
data?.workflows?.pageInfo || {};
|
|
178
|
+
const { totalItems, sortFields, filterFields } = data?.pageInfo || {};
|
|
183
179
|
|
|
184
180
|
const pagination: Pagination = {
|
|
185
181
|
pageSize: pageSize,
|
|
@@ -191,7 +187,13 @@ export const WfoWorkflowsPage = () => {
|
|
|
191
187
|
return (
|
|
192
188
|
<WfoMetadataPageLayout>
|
|
193
189
|
<WfoTableWithFilter<WorkflowListItem>
|
|
194
|
-
data={
|
|
190
|
+
data={
|
|
191
|
+
data
|
|
192
|
+
? mapWorkflowDefinitionToWorkflowListItem(
|
|
193
|
+
data.workflows,
|
|
194
|
+
)
|
|
195
|
+
: []
|
|
196
|
+
}
|
|
195
197
|
tableColumns={mapSortableAndFilterableValuesToTableColumnConfig(
|
|
196
198
|
tableColumns,
|
|
197
199
|
sortFields,
|
|
@@ -215,8 +217,8 @@ export const WfoWorkflowsPage = () => {
|
|
|
215
217
|
localStorageKey={METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY}
|
|
216
218
|
onExportData={csvDownloadHandler(
|
|
217
219
|
getWorkflowsForExport,
|
|
218
|
-
(data) => data.workflows
|
|
219
|
-
(data) => data.
|
|
220
|
+
(data) => data.workflows,
|
|
221
|
+
(data) => data.pageInfo,
|
|
220
222
|
Object.keys(tableColumns),
|
|
221
223
|
getCsvFileNameWithDate('Workflows'),
|
|
222
224
|
showToastMessage,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
WorkflowDefinition,
|
|
4
|
-
WorkflowDefinitionsResult,
|
|
5
|
-
} from '../../types';
|
|
1
|
+
import { GraphQLSort, WorkflowDefinition } from '@/types';
|
|
2
|
+
|
|
6
3
|
import { WorkflowListItem } from './WfoWorkflowsPage';
|
|
7
4
|
|
|
8
5
|
export const mapWorkflowDefinitionToWorkflowListItem = (
|
|
9
|
-
|
|
6
|
+
workflows: WorkflowDefinition[],
|
|
10
7
|
): WorkflowListItem[] =>
|
|
11
|
-
|
|
8
|
+
workflows.map((workflowDefinition) => {
|
|
12
9
|
const { name, target, description, createdAt, products } =
|
|
13
10
|
workflowDefinition;
|
|
14
11
|
|