@orchestrator-ui/orchestrator-ui-components 1.3.1 → 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.
Files changed (72) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +6 -6
  4. package/CHANGELOG.md +18 -0
  5. package/dist/index.d.ts +402 -287
  6. package/dist/index.js +3253 -5543
  7. package/package.json +1 -3
  8. package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +11 -15
  9. package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +2 -2
  10. package/src/components/WfoProcessList/WfoProcessesList.tsx +16 -9
  11. package/src/components/WfoProcessList/processListObjectMappers.ts +6 -10
  12. package/src/components/WfoSettings/WfoModifySettings.tsx +29 -13
  13. package/src/components/WfoSettings/WfoResetTextSearchIndexButton.tsx +22 -0
  14. package/src/components/WfoSettings/index.ts +1 -0
  15. package/src/components/{WfoButtonComboBox/WfoButtonComboBox.tsx → WfoStartButton/WfoStartButtonComboBox.tsx} +11 -17
  16. package/src/components/WfoStartButton/WfoStartTaskComboBox.tsx +47 -0
  17. package/src/components/WfoStartButton/WfoStartWorkflowComboBox.tsx +49 -0
  18. package/src/components/WfoStartButton/index.ts +2 -0
  19. package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +30 -36
  20. package/src/components/WfoSubscription/WfoSubscription.tsx +17 -20
  21. package/src/components/WfoSubscription/index.ts +6 -4
  22. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +12 -16
  23. package/src/components/WfoSubscriptionsList/subscriptionResultMappers.ts +10 -12
  24. package/src/components/index.ts +2 -1
  25. package/src/configuration/constants.ts +3 -0
  26. package/src/hooks/index.ts +0 -1
  27. package/src/hooks/surf/useGetSubscriptionDropdownOptions.ts +6 -13
  28. package/src/hooks/surf/useIsTaggedPort.ts +6 -9
  29. package/src/index.ts +0 -1
  30. package/src/messages/en-GB.json +3 -1
  31. package/src/messages/nl-NL.json +3 -1
  32. package/src/pages/metadata/WfoProductBlocksPage.tsx +27 -37
  33. package/src/pages/metadata/WfoProductsPage.tsx +11 -16
  34. package/src/pages/metadata/WfoResourceTypesPage.tsx +33 -35
  35. package/src/pages/metadata/WfoWorkflowsPage.tsx +42 -40
  36. package/src/pages/metadata/workflowListObjectMapper.ts +4 -7
  37. package/src/pages/startPage/WfoStartPage.tsx +56 -68
  38. package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +6 -7
  39. package/src/rtk/api.ts +11 -3
  40. package/src/rtk/endpoints/index.ts +11 -2
  41. package/src/rtk/endpoints/metadata/index.ts +3 -0
  42. package/src/rtk/endpoints/metadata/productBlocks.ts +88 -0
  43. package/src/rtk/endpoints/metadata/resourceTypes.ts +78 -0
  44. package/src/rtk/endpoints/metadata/workflows.ts +73 -0
  45. package/src/rtk/endpoints/processList.ts +2 -1
  46. package/src/rtk/endpoints/processListSummary.ts +70 -0
  47. package/src/rtk/endpoints/products.ts +76 -0
  48. package/src/rtk/endpoints/productsSummary.ts +62 -0
  49. package/src/rtk/endpoints/relatedSubscriptions.ts +99 -0
  50. package/src/rtk/endpoints/settings.ts +10 -0
  51. package/src/rtk/endpoints/startOptions.ts +99 -0
  52. package/src/{graphqlQueries/subscriptionDetailQuery.ts → rtk/endpoints/subscriptionDetail.ts} +45 -11
  53. package/src/rtk/endpoints/subscriptionList.ts +86 -0
  54. package/src/rtk/endpoints/subscriptionListSummary.ts +70 -0
  55. package/src/rtk/endpoints/subscriptionsDropdownOptions.ts +72 -0
  56. package/src/types/types.ts +20 -0
  57. package/src/utils/index.ts +1 -0
  58. package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +0 -61
  59. package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +0 -54
  60. package/src/components/WfoStartTaskButtonComboBox/index.ts +0 -1
  61. package/src/graphqlQueries/index.ts +0 -7
  62. package/src/graphqlQueries/processListQuery.ts +0 -101
  63. package/src/graphqlQueries/productBlocksQuery.ts +0 -59
  64. package/src/graphqlQueries/productsQuery.ts +0 -85
  65. package/src/graphqlQueries/relatedSubscriptionsQuery.ts +0 -65
  66. package/src/graphqlQueries/resourceTypesQuery.ts +0 -52
  67. package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +0 -48
  68. package/src/graphqlQueries/subscriptionsListQuery.ts +0 -101
  69. package/src/graphqlQueries/workflows/workflowsQuery.ts +0 -48
  70. package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +0 -38
  71. package/src/hooks/useQueryWithGraphql.ts +0 -72
  72. /package/src/components/{WfoButtonComboBox → WfoStartButton}/styles.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestrator-ui/orchestrator-ui-components",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -14,10 +14,8 @@
14
14
  "dependencies": {
15
15
  "@emotion/css": "^11.11.2",
16
16
  "@emotion/react": "^11.11.1",
17
- "@graphql-typed-document-node/core": "3.2.0",
18
17
  "@rtk-query/graphql-request-base-query": "^2.3.1",
19
18
  "axios": "^1.6.5",
20
- "graphql-request": "^6.1.0",
21
19
  "invariant": "^2.2.4",
22
20
  "moment": "^2.29.4",
23
21
  "moment-timezone": "^0.5.43",
@@ -18,10 +18,9 @@ import { connectField, filterDOMProps } from 'uniforms';
18
18
 
19
19
  import { EuiFormRow, EuiText } from '@elastic/eui';
20
20
 
21
- import { GET_SUBSCRIPTION_DETAIL_GRAPHQL_QUERY } from '../../../graphqlQueries';
22
- import { useQueryWithGraphql } from '../../../hooks';
23
- import { WfoLoading } from '../../WfoLoading';
24
- import { WfoSubscriptionGeneral } from '../../WfoSubscription';
21
+ import { WfoLoading, WfoSubscriptionGeneral } from '@/components';
22
+ import { useGetSubscriptionDetailQuery } from '@/rtk';
23
+
25
24
  import { FieldProps } from './types';
26
25
 
27
26
  export type SubscriptionSummaryFieldProps = FieldProps<string>;
@@ -33,18 +32,15 @@ interface SubscriptionSummaryDisplayProps {
33
32
  const SubscriptionSummaryDisplay = ({
34
33
  subscriptionId,
35
34
  }: SubscriptionSummaryDisplayProps) => {
36
- const { data } = useQueryWithGraphql(
37
- GET_SUBSCRIPTION_DETAIL_GRAPHQL_QUERY,
38
- { subscriptionId },
39
- `subscription-${subscriptionId}`,
40
- );
41
- const subscriptionDetail = data?.subscriptions.page[0];
35
+ const { data } = useGetSubscriptionDetailQuery({
36
+ subscriptionId,
37
+ });
42
38
 
43
- return (
44
- (subscriptionDetail && (
45
- <WfoSubscriptionGeneral subscriptionDetail={subscriptionDetail} />
46
- )) || <WfoLoading />
47
- );
39
+ if (!data) {
40
+ return <WfoLoading />;
41
+ }
42
+
43
+ return <WfoSubscriptionGeneral subscriptionDetail={data.subscription} />;
48
44
  };
49
45
 
50
46
  const SubscriptionSummary = ({
@@ -7,6 +7,7 @@ import { EuiSideNav, EuiSpacer } from '@elastic/eui';
7
7
  import { EuiSideNavItemType } from '@elastic/eui/src/components/side_nav/side_nav_types';
8
8
 
9
9
  import { WfoIsAllowedToRender } from '@/components';
10
+ import { WfoStartWorkflowButtonComboBox } from '@/components/WfoStartButton/WfoStartWorkflowComboBox';
10
11
  import { PolicyResource } from '@/configuration/policy-resources';
11
12
  import { usePolicy } from '@/hooks';
12
13
 
@@ -23,7 +24,6 @@ import {
23
24
  PATH_WORKFLOWS,
24
25
  } from '../paths';
25
26
  import { WfoCopyright } from './WfoCopyright';
26
- import { WfoStartCreateWorkflowButtonComboBox } from './WfoStartCreateWorkflowButtonComboBox';
27
27
 
28
28
  export const renderEmptyElementWhenNotAllowedByPolicy = (isAllowed: boolean) =>
29
29
  isAllowed ? undefined : () => <></>;
@@ -171,7 +171,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
171
171
  <WfoIsAllowedToRender
172
172
  resource={PolicyResource.SUBSCRIPTION_CREATE}
173
173
  >
174
- <WfoStartCreateWorkflowButtonComboBox />
174
+ <WfoStartWorkflowButtonComboBox />
175
175
  </WfoIsAllowedToRender>
176
176
  <EuiSpacer size="m" />
177
177
  <WfoCopyright />
@@ -24,11 +24,14 @@ import {
24
24
  getQueryStringHandler,
25
25
  mapSortableAndFilterableValuesToTableColumnConfig,
26
26
  } from '@/components/WfoTable';
27
- import { getProcessListGraphQlQuery } from '@/graphqlQueries';
28
- import { useQueryWithGraphqlLazy, useShowToastMessage } from '@/hooks';
27
+ import { useShowToastMessage } from '@/hooks';
29
28
  import { DataDisplayParams } from '@/hooks';
30
29
  import { WfoProcessListSubscriptionsCell } from '@/pages';
31
- import { useGetProcessListQuery } from '@/rtk';
30
+ import {
31
+ ProcessListResponse,
32
+ useGetProcessListQuery,
33
+ useLazyGetProcessListQuery,
34
+ } from '@/rtk';
32
35
  import { GraphqlQueryVariables, Process, SortOrder } from '@/types';
33
36
  import { parseDateToLocaleDateTimeString } from '@/utils';
34
37
  import { getQueryVariablesForExport } from '@/utils';
@@ -213,6 +216,9 @@ export const WfoProcessesList = ({
213
216
  const { data, isFetching, isError } =
214
217
  useGetProcessListQuery(processListQueryVars);
215
218
 
219
+ const [getProcessListTrigger, { isFetching: isFetchingCsv }] =
220
+ useLazyGetProcessListQuery();
221
+
216
222
  const { processes, pageInfo } = data || {};
217
223
 
218
224
  const pagination: Pagination = {
@@ -226,12 +232,10 @@ export const WfoProcessesList = ({
226
232
  sortOrder: sortBy?.order ?? SortOrder.ASC,
227
233
  };
228
234
 
229
- const { getData: getProcessListForExport, isFetching: isFetchingCsv } =
230
- useQueryWithGraphqlLazy(
231
- getProcessListGraphQlQuery(),
235
+ const getProcessListForExport = () =>
236
+ getProcessListTrigger(
232
237
  getQueryVariablesForExport(processListQueryVars),
233
- ['processes', 'export'],
234
- );
238
+ ).unwrap();
235
239
 
236
240
  return (
237
241
  <WfoTableWithFilter<ProcessListItem>
@@ -258,7 +262,10 @@ export const WfoProcessesList = ({
258
262
  onUpdateQueryString={getQueryStringHandler(setDataDisplayParam)}
259
263
  onUpdatePage={getPageChangeHandler(setDataDisplayParam)}
260
264
  onUpdateDataSort={getDataSortHandler(setDataDisplayParam)}
261
- onExportData={csvDownloadHandler(
265
+ onExportData={csvDownloadHandler<
266
+ ProcessListResponse,
267
+ ProcessListItem
268
+ >(
262
269
  getProcessListForExport,
263
270
  mapGraphQlProcessListExportResultToProcessListItems,
264
271
  mapGraphQlProcessListResultToPageInfo,
@@ -1,15 +1,11 @@
1
- import {
2
- GraphQLSort,
3
- GraphqlFilter,
4
- Process,
5
- ProcessListResult,
6
- } from '@/types';
1
+ import { ProcessListResponse } from '@/rtk';
2
+ import { GraphQLSort, GraphqlFilter, Process } from '@/types';
7
3
 
8
4
  import { ProcessListItem } from './WfoProcessesList';
9
5
 
10
6
  export const mapGraphQlProcessListResultToPageInfo = (
11
- processesResult: ProcessListResult,
12
- ) => processesResult.processes.pageInfo;
7
+ processesResponse: ProcessListResponse,
8
+ ) => processesResponse.pageInfo;
13
9
 
14
10
  export const mapGraphQlProcessListResultToProcessListItems = (
15
11
  processes: Process[],
@@ -51,9 +47,9 @@ export const mapGraphQlProcessListResultToProcessListItems = (
51
47
  });
52
48
 
53
49
  export const mapGraphQlProcessListExportResultToProcessListItems = (
54
- processesResult: ProcessListResult,
50
+ processesResponse: ProcessListResponse,
55
51
  ): ProcessListItem[] =>
56
- processesResult.processes.page.map((process) => {
52
+ processesResponse.processes.map((process) => {
57
53
  const {
58
54
  workflowName,
59
55
  lastStep,
@@ -2,24 +2,40 @@ import React from 'react';
2
2
 
3
3
  import { useTranslations } from 'next-intl';
4
4
 
5
- import { EuiPanel, EuiSpacer, EuiText } from '@elastic/eui';
5
+ import { EuiFlexItem, EuiPanel, EuiSpacer, EuiText } from '@elastic/eui';
6
6
 
7
7
  import { WfoEngineStatusButton } from './WfoEngineStatusButton';
8
+ import { WfoResetTextSearchIndexButton } from './WfoResetTextSearchIndexButton';
8
9
 
9
10
  export const WfoModifySettings = () => {
10
11
  const t = useTranslations('settings.page');
11
12
  return (
12
- <EuiPanel
13
- hasShadow={false}
14
- color="subdued"
15
- paddingSize="l"
16
- css={{ width: '50%' }}
17
- >
18
- <EuiText size="s">
19
- <h4>{t('modifyEngine')}</h4>
20
- </EuiText>
21
- <EuiSpacer size="m"></EuiSpacer>
22
- <WfoEngineStatusButton />
23
- </EuiPanel>
13
+ <EuiFlexItem>
14
+ <EuiPanel
15
+ hasShadow={false}
16
+ color="subdued"
17
+ paddingSize="l"
18
+ css={{ width: '50%' }}
19
+ >
20
+ <EuiText size="s">
21
+ <h4>{t('resetTextSearchIndex')}</h4>
22
+ </EuiText>
23
+ <EuiSpacer size="m"></EuiSpacer>
24
+ <WfoResetTextSearchIndexButton />
25
+ </EuiPanel>
26
+ <EuiSpacer />
27
+ <EuiPanel
28
+ hasShadow={false}
29
+ color="subdued"
30
+ paddingSize="l"
31
+ css={{ width: '50%' }}
32
+ >
33
+ <EuiText size="s">
34
+ <h4>{t('modifyEngine')}</h4>
35
+ </EuiText>
36
+ <EuiSpacer size="m"></EuiSpacer>
37
+ <WfoEngineStatusButton />
38
+ </EuiPanel>
39
+ </EuiFlexItem>
24
40
  );
25
41
  };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+
3
+ import { useTranslations } from 'next-intl';
4
+
5
+ import { EuiButton } from '@elastic/eui';
6
+
7
+ import { useResetTextSearchIndexMutation } from '@/rtk';
8
+
9
+ export const WfoResetTextSearchIndexButton = () => {
10
+ const [resetTextSearchIndex] = useResetTextSearchIndexMutation();
11
+
12
+ const t = useTranslations('settings.page');
13
+
14
+ return (
15
+ <EuiButton
16
+ onClick={() => resetTextSearchIndex(null)}
17
+ iconType="refresh"
18
+ >
19
+ {t('resetTextSearchIndexButton')}
20
+ </EuiButton>
21
+ );
22
+ };
@@ -2,3 +2,4 @@ export * from './WfoFlushSettings';
2
2
  export * from './WfoEngineStatusButton';
3
3
  export * from './WfoModifySettings';
4
4
  export * from './WfoStatus';
5
+ export * from './WfoResetTextSearchIndexButton';
@@ -1,32 +1,26 @@
1
- import React, { FC, useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
 
3
3
  import { EuiButton, EuiPopover, EuiSelectable, EuiSpacer } from '@elastic/eui';
4
4
 
5
- import { useOrchestratorTheme } from '../../hooks';
6
- import { WfoPlusCircleFill } from '../../icons';
7
- import { getStyles } from './styles';
5
+ import { useOrchestratorTheme } from '@/hooks';
6
+ import { WfoPlusCircleFill } from '@/icons';
7
+ import { StartComboBoxOption } from '@/types';
8
8
 
9
- export type WorkflowComboBoxOption = {
10
- data: {
11
- workflowName: string;
12
- productId?: string;
13
- };
14
- label: string;
15
- };
9
+ import { getStyles } from './styles';
16
10
 
17
- export type WfoButtonComboBoxProps = {
11
+ export type WfoStartButtonComboBoxProps = {
18
12
  buttonText: string;
19
- options: WorkflowComboBoxOption[];
20
- onOptionChange: (selectedOption: WorkflowComboBoxOption) => void;
13
+ options: StartComboBoxOption[];
14
+ onOptionChange: (selectedOption: StartComboBoxOption) => void;
21
15
  isProcess: boolean;
22
16
  };
23
17
 
24
- export const WfoButtonComboBox: FC<WfoButtonComboBoxProps> = ({
18
+ export const WfoStartButtonComboBox = ({
25
19
  buttonText,
26
20
  options,
27
21
  onOptionChange,
28
22
  isProcess,
29
- }) => {
23
+ }: WfoStartButtonComboBoxProps) => {
30
24
  const [isPopoverOpen, setPopoverOpen] = useState(false);
31
25
  const { selectableStyle } = getStyles();
32
26
  const { theme } = useOrchestratorTheme();
@@ -55,7 +49,7 @@ export const WfoButtonComboBox: FC<WfoButtonComboBoxProps> = ({
55
49
  isOpen={isPopoverOpen}
56
50
  closePopover={() => setPopoverOpen(false)}
57
51
  >
58
- <EuiSelectable<WorkflowComboBoxOption>
52
+ <EuiSelectable<StartComboBoxOption>
59
53
  css={selectableStyle}
60
54
  searchable
61
55
  options={options}
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+
3
+ import { useTranslations } from 'next-intl';
4
+ import { useRouter } from 'next/router';
5
+
6
+ import { PATH_START_NEW_TASK } from '@/components';
7
+ import { useCheckEngineStatus } from '@/hooks';
8
+ import { useGetTaskOptionsQuery } from '@/rtk';
9
+ import { StartComboBoxOption } from '@/types';
10
+
11
+ import { WfoStartButtonComboBox } from './WfoStartButtonComboBox';
12
+
13
+ export const WfoStartTaskButtonComboBox = () => {
14
+ const router = useRouter();
15
+ const t = useTranslations('common');
16
+ const { isEngineRunningNow } = useCheckEngineStatus();
17
+
18
+ const { data } = useGetTaskOptionsQuery();
19
+ const taskOptions = data?.startOptions || [];
20
+
21
+ const comboBoxOptions: StartComboBoxOption[] = taskOptions.map(
22
+ (option) => ({
23
+ data: {
24
+ workflowName: option.name,
25
+ },
26
+ label: option.description || '',
27
+ }),
28
+ );
29
+
30
+ const handleOptionChange = async (selectedProduct: StartComboBoxOption) => {
31
+ if (await isEngineRunningNow()) {
32
+ const { workflowName } = selectedProduct.data;
33
+ router.push({
34
+ pathname: `${PATH_START_NEW_TASK}/${workflowName}`,
35
+ });
36
+ }
37
+ };
38
+
39
+ return (
40
+ <WfoStartButtonComboBox
41
+ buttonText={t('newTask')}
42
+ options={comboBoxOptions}
43
+ onOptionChange={handleOptionChange}
44
+ isProcess={false}
45
+ />
46
+ );
47
+ };
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+
3
+ import { useTranslations } from 'next-intl';
4
+ import { useRouter } from 'next/router';
5
+
6
+ import { useCheckEngineStatus } from '@/hooks';
7
+ import { useGetWorkflowOptionsQuery } from '@/rtk';
8
+ import { StartComboBoxOption } from '@/types';
9
+
10
+ import { PATH_START_NEW_WORKFLOW } from '../WfoPageTemplate';
11
+ import { WfoStartButtonComboBox } from './WfoStartButtonComboBox';
12
+
13
+ export const WfoStartWorkflowButtonComboBox = () => {
14
+ const router = useRouter();
15
+ const t = useTranslations('common');
16
+ const { isEngineRunningNow } = useCheckEngineStatus();
17
+
18
+ const { data } = useGetWorkflowOptionsQuery();
19
+ const workflowOptions = data?.startOptions || [];
20
+
21
+ const comboBoxOptions: StartComboBoxOption[] = workflowOptions.map(
22
+ (option) => ({
23
+ data: {
24
+ workflowName: option.workflowName,
25
+ productId: option.productId,
26
+ },
27
+ label: option.productName || '',
28
+ }),
29
+ );
30
+
31
+ const handleOptionChange = async (selectedProduct: StartComboBoxOption) => {
32
+ if (await isEngineRunningNow()) {
33
+ const { workflowName, productId } = selectedProduct.data;
34
+ router.push({
35
+ pathname: `${PATH_START_NEW_WORKFLOW}/${workflowName}`,
36
+ query: { productId },
37
+ });
38
+ }
39
+ };
40
+
41
+ return (
42
+ <WfoStartButtonComboBox
43
+ buttonText={t('newSubscription')}
44
+ options={comboBoxOptions}
45
+ onOptionChange={handleOptionChange}
46
+ isProcess
47
+ />
48
+ );
49
+ };
@@ -0,0 +1,2 @@
1
+ export * from './WfoStartTaskComboBox';
2
+ export * from './WfoStartWorkflowComboBox';
@@ -6,31 +6,29 @@ import Link from 'next/link';
6
6
  import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiSwitch } from '@elastic/eui';
7
7
  import type { Criteria, Pagination } from '@elastic/eui';
8
8
 
9
- import { GET_RELATED_SUBSCRIPTIONS_GRAPHQL_QUERY } from '../../graphqlQueries/relatedSubscriptionsQuery';
10
9
  import {
11
- useDataDisplayParams,
12
- useOrchestratorTheme,
13
- useQueryWithGraphql,
14
- } from '../../hooks';
15
- import { WfoSearchStrikethrough } from '../../icons';
10
+ DEFAULT_PAGE_SIZE,
11
+ DEFAULT_PAGE_SIZES,
12
+ WfoBasicTable,
13
+ WfoDataSorting,
14
+ WfoFirstPartUUID,
15
+ WfoInsyncIcon,
16
+ WfoNoResults,
17
+ WfoSubscriptionStatusBadge,
18
+ WfoTableColumns,
19
+ getDataSortHandler,
20
+ getPageChangeHandler,
21
+ } from '@/components';
22
+ import { useDataDisplayParams, useOrchestratorTheme } from '@/hooks';
23
+ import { WfoSearchStrikethrough } from '@/icons';
24
+ import { useGetRelatedSubscriptionsQuery } from '@/rtk';
16
25
  import {
17
26
  GraphqlFilter,
18
27
  RelatedSubscription,
19
28
  SortOrder,
20
29
  SubscriptionStatus,
21
- } from '../../types';
22
- import { parseDate, parseDateToLocaleDateString } from '../../utils';
23
- import { WfoSubscriptionStatusBadge } from '../WfoBadges';
24
- import { WfoInsyncIcon } from '../WfoInsyncIcon/WfoInsyncIcon';
25
- import { WfoNoResults } from '../WfoNoResults';
26
- import {
27
- WfoTableColumns,
28
- getDataSortHandler,
29
- getPageChangeHandler,
30
- } from '../WfoTable';
31
- import { WfoBasicTable, WfoDataSorting } from '../WfoTable';
32
- import { DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZES } from '../WfoTable';
33
- import { WfoFirstPartUUID } from '../WfoTable/WfoFirstPartUUID';
30
+ } from '@/types';
31
+ import { parseDate, parseDateToLocaleDateString } from '@/utils';
34
32
 
35
33
  interface WfoRelatedSubscriptionsProps {
36
34
  subscriptionId: string;
@@ -58,23 +56,19 @@ export const WfoRelatedSubscriptions = ({
58
56
  },
59
57
  });
60
58
 
61
- const { data, isFetching } = useQueryWithGraphql(
62
- GET_RELATED_SUBSCRIPTIONS_GRAPHQL_QUERY,
63
- {
64
- first: dataDisplayParams.pageSize,
65
- after: dataDisplayParams.pageIndex * dataDisplayParams.pageSize,
66
- subscriptionId: subscriptionId,
67
- sortBy: dataDisplayParams.sortBy,
68
- terminatedSubscriptionFilter: hideTerminatedSubscriptions
69
- ? terminatedSubscriptionsFilter
70
- : undefined,
71
- },
72
- 'relatedSubscriptions',
73
- );
74
- const relatedSubscriptions =
75
- data?.subscriptions.page[0].inUseBySubscriptions.page;
76
- const relatedSubscriptionsPageInfo =
77
- data?.subscriptions.page[0].inUseBySubscriptions.pageInfo;
59
+ const { data, isFetching } = useGetRelatedSubscriptionsQuery({
60
+ first: dataDisplayParams.pageSize,
61
+ after: dataDisplayParams.pageIndex * dataDisplayParams.pageSize,
62
+ subscriptionId: subscriptionId,
63
+ sortBy: dataDisplayParams.sortBy,
64
+ terminatedSubscriptionFilter: hideTerminatedSubscriptions
65
+ ? terminatedSubscriptionsFilter
66
+ : undefined,
67
+ });
68
+
69
+ const relatedSubscriptions = data?.relatedSubscriptions;
70
+ const relatedSubscriptionsPageInfo = data?.pageInfo;
71
+
78
72
  const tableColumns: WfoTableColumns<RelatedSubscription> = {
79
73
  subscriptionId: {
80
74
  field: 'subscriptionId',
@@ -6,22 +6,25 @@ import {
6
6
  EuiBadgeGroup,
7
7
  EuiFlexGroup,
8
8
  EuiFlexItem,
9
+ EuiSpacer,
9
10
  EuiText,
10
11
  } from '@elastic/eui';
11
12
 
12
- import { GET_SUBSCRIPTION_DETAIL_GRAPHQL_QUERY } from '@/graphqlQueries';
13
- import { useOrchestratorTheme, useQueryWithGraphql } from '@/hooks';
13
+ import {
14
+ WfoFilterTabs,
15
+ WfoLoading,
16
+ WfoProcessesTimeline,
17
+ WfoRelatedSubscriptions,
18
+ WfoSubscriptionActions,
19
+ WfoSubscriptionDetailTree,
20
+ WfoSubscriptionGeneral,
21
+ } from '@/components';
22
+ import { useOrchestratorTheme } from '@/hooks';
23
+ import { useGetSubscriptionDetailQuery } from '@/rtk/endpoints/subscriptionDetail';
14
24
 
15
25
  import { WfoSubscriptionStatusBadge } from '../WfoBadges';
16
26
  import { WfoSubscriptionSyncStatusBadge } from '../WfoBadges/WfoSubscriptionSyncStatusBadge';
17
27
  import { WfoError } from '../WfoError';
18
- import { WfoFilterTabs } from '../WfoFilterTabs';
19
- import { WfoLoading } from '../WfoLoading';
20
- import { WfoProcessesTimeline } from './WfoProcessesTimeline';
21
- import { WfoRelatedSubscriptions } from './WfoRelatedSubscriptions';
22
- import { WfoSubscriptionActions } from './WfoSubscriptionActions';
23
- import { WfoSubscriptionDetailTree } from './WfoSubscriptionDetailTree';
24
- import { WfoSubscriptionGeneral } from './WfoSubscriptionGeneral';
25
28
  import { subscriptionDetailTabs } from './subscriptionDetailTabs';
26
29
  import { SubscriptionDetailTab } from './utils';
27
30
 
@@ -47,21 +50,14 @@ export const WfoSubscription = ({ subscriptionId }: WfoSubscriptionProps) => {
47
50
  );
48
51
  })();
49
52
 
50
- const { data, isLoading, isError } = useQueryWithGraphql(
51
- GET_SUBSCRIPTION_DETAIL_GRAPHQL_QUERY,
52
- { subscriptionId },
53
- `subscription-${subscriptionId}`,
54
- );
53
+ const { data, isLoading, isError } = useGetSubscriptionDetailQuery({
54
+ subscriptionId,
55
+ });
55
56
 
56
57
  const onSelectedTabChanged = (tab: SubscriptionDetailTab) => {
57
58
  setActiveTab(tab);
58
59
  };
59
-
60
- const subscriptionResult =
61
- data && data.subscriptions && data.subscriptions.page;
62
- const subscriptionDetail = subscriptionResult
63
- ? subscriptionResult[0]
64
- : null;
60
+ const subscriptionDetail = data?.subscription;
65
61
 
66
62
  return (
67
63
  <>
@@ -77,6 +73,7 @@ export const WfoSubscription = ({ subscriptionId }: WfoSubscriptionProps) => {
77
73
  <EuiText>
78
74
  <h2>{subscriptionDetail.description}</h2>
79
75
  </EuiText>
76
+ <EuiSpacer size="xs" />
80
77
  <EuiBadgeGroup
81
78
  css={{ marginRight: multiplyByBaseUnit(1) }}
82
79
  >
@@ -1,9 +1,11 @@
1
1
  export * from './utils';
2
+
3
+ export * from './SubscriptionKeyValueBlock';
4
+ export * from './WfoInSyncField';
2
5
  export * from './WfoProcessesTimeline';
3
- export * from './WfoSubscriptionProductBlock';
6
+ export * from './WfoRelatedSubscriptions';
7
+ export * from './WfoSubscription';
4
8
  export * from './WfoSubscriptionActions';
5
- export * from './SubscriptionKeyValueBlock';
9
+ export * from './WfoSubscriptionProductBlock';
6
10
  export * from './WfoSubscriptionDetailTree';
7
11
  export * from './WfoSubscriptionGeneral';
8
- export * from './WfoSubscription';
9
- export * from './WfoInSyncField';
@@ -12,13 +12,11 @@ import {
12
12
  WfoInsyncIcon,
13
13
  WfoSubscriptionStatusBadge,
14
14
  } from '@/components';
15
- import { getSubscriptionsListGraphQlQuery } from '@/graphqlQueries';
15
+ import { DataDisplayParams, useShowToastMessage } from '@/hooks';
16
16
  import {
17
- DataDisplayParams,
18
- useQueryWithGraphql,
19
- useQueryWithGraphqlLazy,
20
- useShowToastMessage,
21
- } from '@/hooks';
17
+ useGetSubscriptionListQuery,
18
+ useLazyGetSubscriptionListQuery,
19
+ } from '@/rtk/endpoints/subscriptionList';
22
20
  import { GraphqlQueryVariables, SortOrder } from '@/types';
23
21
  import {
24
22
  getQueryVariablesForExport,
@@ -155,17 +153,16 @@ export const WfoSubscriptionsList: FC<WfoSubscriptionsListProps> = ({
155
153
  filterBy: alwaysOnFilters,
156
154
  query: queryString || undefined,
157
155
  };
158
- const { data, isError, isFetching } = useQueryWithGraphql(
159
- getSubscriptionsListGraphQlQuery<SubscriptionListItem>(),
156
+
157
+ const { data, isFetching, isError } = useGetSubscriptionListQuery(
160
158
  graphqlQueryVariables,
161
- ['subscriptions', 'listPage'],
162
159
  );
163
- const { getData: getSubscriptionListForExport, isFetching: isFetchingCsv } =
164
- useQueryWithGraphqlLazy(
165
- getSubscriptionsListGraphQlQuery<SubscriptionListItem>(),
160
+ const [getSubscriptionListTrigger, { isFetching: isFetchingCsv }] =
161
+ useLazyGetSubscriptionListQuery();
162
+ const getSubscriptionListForExport = () =>
163
+ getSubscriptionListTrigger(
166
164
  getQueryVariablesForExport(graphqlQueryVariables),
167
- ['subscriptions', 'export'],
168
- );
165
+ ).unwrap();
169
166
 
170
167
  const sortedColumnId = getTypedFieldFromObject(sortBy?.field, tableColumns);
171
168
  if (!sortedColumnId) {
@@ -177,8 +174,7 @@ export const WfoSubscriptionsList: FC<WfoSubscriptionsListProps> = ({
177
174
  field: sortedColumnId,
178
175
  sortOrder: dataDisplayParams.sortBy?.order ?? SortOrder.ASC,
179
176
  };
180
- const { totalItems, sortFields, filterFields } =
181
- data?.subscriptions?.pageInfo ?? {};
177
+ const { totalItems, sortFields, filterFields } = data?.pageInfo ?? {};
182
178
  const pagination: Pagination = {
183
179
  pageSize: dataDisplayParams.pageSize,
184
180
  pageIndex: dataDisplayParams.pageIndex,