@orchestrator-ui/orchestrator-ui-components 0.3.0 → 0.3.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 (143) hide show
  1. package/.turbo/turbo-build.log +9 -8
  2. package/.turbo/turbo-lint.log +4 -1
  3. package/.turbo/turbo-test.log +13 -9
  4. package/CHANGELOG.md +11 -0
  5. package/dist/index.d.ts +484 -239
  6. package/dist/index.js +4255 -2987
  7. package/package.json +31 -26
  8. package/src/api/axios.ts +2 -8
  9. package/src/api/index.ts +4 -4
  10. package/src/components/WfoBadges/WfoBadge/WfoBadge.tsx +4 -1
  11. package/src/components/WfoBadges/index.ts +1 -0
  12. package/src/components/WfoError/WfoError.stories.tsx +26 -0
  13. package/src/components/WfoError/WfoError.tsx +19 -0
  14. package/src/components/WfoError/index.ts +1 -0
  15. package/src/components/WfoFilterTabs/WfoFilterTabs.tsx +4 -2
  16. package/src/components/WfoForms/UserInputForm.tsx +14 -2
  17. package/src/components/WfoForms/formFields/SplitPrefix.tsx +2 -1
  18. package/src/components/WfoForms/formFields/SubscriptionField.tsx +8 -3
  19. package/src/components/WfoForms/formFields/utils.spec.ts +88 -9
  20. package/src/components/WfoKeyValueTable/WfoValueCell.tsx +2 -2
  21. package/src/components/WfoOptionalLink/WfoOptionalLink.tsx +20 -0
  22. package/src/components/WfoOptionalLink/index.ts +1 -0
  23. package/src/components/WfoPageTemplate/WfoBreadcrumbs/WfoBreadcrumbs.tsx +5 -2
  24. package/src/components/WfoPageTemplate/WfoPageHeader/WfoAppLogo.tsx +28 -0
  25. package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +19 -16
  26. package/src/components/WfoPageTemplate/WfoPageHeader/styles.ts +29 -0
  27. package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.spec.ts +12 -0
  28. package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.ts +5 -0
  29. package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +0 -3
  30. package/src/components/WfoProcessList/{WfoProcessList.tsx → WfoProcessesList.tsx} +32 -28
  31. package/src/components/WfoProcessList/index.ts +1 -1
  32. package/src/components/WfoProcessList/processListObjectMappers.ts +1 -1
  33. package/src/components/WfoSettings/WfoFlushSettings.tsx +16 -6
  34. package/src/components/WfoSettings/WfoModifySettings.tsx +1 -1
  35. package/src/components/WfoSettingsModal/WfoSubmitModal.tsx +61 -0
  36. package/src/components/WfoSettingsModal/index.tsx +1 -0
  37. package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +0 -3
  38. package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +4 -1
  39. package/src/components/WfoSubscription/WfoSubscription.tsx +38 -66
  40. package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +2 -6
  41. package/src/components/WfoSubscription/WfoSubscriptionProductBlock.tsx +2 -1
  42. package/src/components/WfoSubscription/subscriptionDetailTabs.tsx +29 -0
  43. package/src/components/WfoSubscription/utils/utils.ts +5 -5
  44. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +28 -14
  45. package/src/components/WfoSubscriptionsList/index.ts +1 -1
  46. package/src/components/WfoSubscriptionsList/{mapGrapghQlSubscriptionsResultToSubscriptionListItems.ts → mapGraphQlSubscriptionsResultToSubscriptionListItems.ts} +8 -1
  47. package/src/components/WfoSubscriptionsList/subscriptionListTabs.ts +8 -30
  48. package/src/components/WfoSummary/WfoSummaryCardHeader/WfoSummaryCardHeader.tsx +55 -0
  49. package/src/components/WfoSummary/WfoSummaryCardHeader/index.ts +1 -0
  50. package/src/components/WfoSummary/WfoSummaryCardHeader/styles.ts +26 -0
  51. package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardList.tsx +86 -0
  52. package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardListItem.tsx +59 -0
  53. package/src/components/WfoSummary/WfoSummaryCardList/index.ts +2 -0
  54. package/src/components/WfoSummary/WfoSummaryCardList/styles.ts +52 -0
  55. package/src/components/WfoSummary/WfoSummaryCards.tsx +111 -0
  56. package/src/components/WfoSummary/getNumberOfColumns.ts +14 -0
  57. package/src/components/WfoSummary/index.ts +4 -0
  58. package/src/components/WfoSummary/styles.ts +13 -0
  59. package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +18 -16
  60. package/src/components/WfoTable/WfoBasicTable/WfoTableHeaderCell.tsx +2 -2
  61. package/src/components/WfoTable/WfoBasicTable/index.ts +1 -0
  62. package/src/components/WfoTable/WfoBasicTable/styles.ts +28 -2
  63. package/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx +12 -3
  64. package/src/components/WfoTable/WfoFirstPartUUID/styles.ts +12 -0
  65. package/src/components/WfoTable/WfoTableWithFilter/WfoTableWithFilter.tsx +12 -4
  66. package/src/components/WfoTable/index.ts +2 -0
  67. package/src/components/WfoTable/utils/columns.ts +21 -15
  68. package/src/components/WfoTable/utils/constants.ts +4 -2
  69. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +5 -3
  70. package/src/components/WfoTree/WfoTreeNode.tsx +1 -4
  71. package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +4 -3
  72. package/src/components/WfoWorkflowSteps/index.ts +1 -0
  73. package/src/components/index.ts +3 -1
  74. package/src/contexts/ApiClientContext.tsx +5 -1
  75. package/src/contexts/OrchestratorConfigContext.tsx +0 -3
  76. package/src/contexts/ToastContext.tsx +1 -1
  77. package/src/contexts/TreeContext.tsx +1 -1
  78. package/src/graphqlQueries/customersQuery.ts +2 -1
  79. package/src/graphqlQueries/processListQuery.ts +46 -6
  80. package/src/graphqlQueries/productBlocksQuery.ts +3 -1
  81. package/src/graphqlQueries/productsQuery.ts +40 -9
  82. package/src/graphqlQueries/resourceTypesQuery.ts +3 -1
  83. package/src/graphqlQueries/subscriptionDetailQuery.ts +4 -1
  84. package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +2 -1
  85. package/src/graphqlQueries/subscriptionsListQuery.ts +41 -4
  86. package/src/graphqlQueries/workflows/workflowsQuery.ts +3 -1
  87. package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +3 -6
  88. package/src/hooks/DataFetchHooks.ts +17 -63
  89. package/src/hooks/surf/useGetSubscriptionDropdownOptions.ts +1 -0
  90. package/src/hooks/surf/useIsTaggedPort.ts +1 -2
  91. package/src/hooks/useOrchestratorConfig.ts +0 -3
  92. package/src/hooks/useQueryWithGraphql.ts +25 -13
  93. package/src/hooks/useSessionWithToken.ts +3 -5
  94. package/src/hooks/useSubscriptionActions.ts +8 -2
  95. package/src/icons/WfoBell.tsx +34 -0
  96. package/src/icons/WfoContactEnvelopeFill.tsx +29 -0
  97. package/src/icons/WfoPencil.tsx +21 -0
  98. package/src/icons/WfoSideMenu.stories.tsx +13 -0
  99. package/src/icons/WfoSideMenu.tsx +39 -0
  100. package/src/icons/WfoStatistic.tsx +3 -3
  101. package/src/icons/WfoViewList.tsx +24 -0
  102. package/src/icons/index.ts +6 -0
  103. package/src/messages/en-GB.json +32 -2
  104. package/src/messages/nl-NL.json +34 -4
  105. package/src/pages/index.ts +2 -1
  106. package/src/pages/metadata/WfoProductBlocksPage.tsx +6 -10
  107. package/src/pages/metadata/WfoProductsPage.tsx +7 -10
  108. package/src/pages/metadata/WfoResourceTypesPage.tsx +5 -9
  109. package/src/pages/metadata/WfoWorkflowsPage.tsx +7 -10
  110. package/src/pages/processes/WfoProcessDetail.tsx +5 -1
  111. package/src/pages/processes/WfoProcessDetailPage.tsx +31 -15
  112. package/src/pages/processes/WfoStartProcessPage.tsx +41 -17
  113. package/src/pages/startPage/WfoStartPage.tsx +239 -0
  114. package/src/pages/startPage/index.ts +1 -0
  115. package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +22 -26
  116. package/src/pages/tasks/{WfoTaskListPage.tsx → WfoTasksListPage.tsx} +67 -44
  117. package/src/pages/tasks/getTasksListTabTypeFromString.ts +19 -0
  118. package/src/pages/tasks/index.ts +3 -1
  119. package/src/pages/tasks/tabConfig.ts +51 -0
  120. package/src/pages/{workflow/WfoWorkflowListPage.tsx → workflows/WfoWorkflowsListPage.tsx} +18 -19
  121. package/src/pages/workflows/getWorkflowsListTabTypeFromString.ts +19 -0
  122. package/src/pages/workflows/index.ts +1 -0
  123. package/src/pages/{workflow → workflows}/tabConfig.ts +9 -9
  124. package/src/theme/defaultOrchestratorTheme.ts +8 -0
  125. package/src/types/types.ts +8 -53
  126. package/src/utils/date.ts +39 -0
  127. package/src/utils/getDefaultTableConfig.ts +19 -9
  128. package/tsconfig.json +4 -4
  129. package/src/components/WfoStartPage/WfoFrequentlyUsed.stories.tsx +0 -16
  130. package/src/components/WfoStartPage/WfoFrequentlyUsed.tsx +0 -21
  131. package/src/components/WfoStartPage/WfoListItemStartPage.stories.tsx +0 -40
  132. package/src/components/WfoStartPage/WfoListItemStartPage.tsx +0 -95
  133. package/src/components/WfoStartPage/WfoListStartPage.stories.tsx +0 -98
  134. package/src/components/WfoStartPage/WfoListStartPage.tsx +0 -45
  135. package/src/components/WfoStartPage/WfoMultiListSection.stories.tsx +0 -90
  136. package/src/components/WfoStartPage/WfoMultiListSection.tsx +0 -25
  137. package/src/components/WfoStartPage/WfoNewProcessPanel.stories.tsx +0 -13
  138. package/src/components/WfoStartPage/WfoNewProcessPanel.tsx +0 -45
  139. package/src/components/WfoStartPage/WfoStatCards.stories.tsx +0 -13
  140. package/src/components/WfoStartPage/WfoStatCards.tsx +0 -75
  141. package/src/components/WfoStartPage/index.ts +0 -6
  142. package/src/pages/workflow/getWorkflowListTabTypeFromString.ts +0 -19
  143. package/src/pages/workflow/index.ts +0 -1
@@ -1,3 +1,3 @@
1
- export * from './mapGrapghQlSubscriptionsResultToSubscriptionListItems';
1
+ export * from './mapGraphQlSubscriptionsResultToSubscriptionListItems';
2
2
  export * from './subscriptionListTabs';
3
3
  export * from './WfoSubscriptionsList';
@@ -9,9 +9,11 @@ export type SubscriptionListItem = Pick<
9
9
  endDate: Date | null;
10
10
  productName: string;
11
11
  tag: string | null;
12
+ customerFullname: string;
13
+ customerShortcode: string;
12
14
  };
13
15
 
14
- export function mapGrapghQlSubscriptionsResultToSubscriptionListItems(
16
+ export function mapGraphQlSubscriptionsResultToSubscriptionListItems(
15
17
  graphqlResponse: SubscriptionsResult,
16
18
  ): SubscriptionListItem[] {
17
19
  return graphqlResponse.subscriptions.page.map((subscription) => {
@@ -24,9 +26,12 @@ export function mapGrapghQlSubscriptionsResultToSubscriptionListItems(
24
26
  status,
25
27
  subscriptionId,
26
28
  note,
29
+ customer,
27
30
  } = subscription;
28
31
 
29
32
  const { name: productName, tag } = product;
33
+ const { fullname: customerFullname, shortcode: customerShortcode } =
34
+ customer;
30
35
 
31
36
  return {
32
37
  subscriptionId,
@@ -38,6 +43,8 @@ export function mapGrapghQlSubscriptionsResultToSubscriptionListItems(
38
43
  note,
39
44
  productName,
40
45
  tag,
46
+ customerFullname,
47
+ customerShortcode,
41
48
  };
42
49
  });
43
50
  }
@@ -1,19 +1,19 @@
1
1
  import { WfoFilterTab } from '../../components';
2
- import { SubscriptionListItem } from './mapGrapghQlSubscriptionsResultToSubscriptionListItems';
2
+ import { SubscriptionListItem } from './mapGraphQlSubscriptionsResultToSubscriptionListItems';
3
3
 
4
- export enum WfoSubscriptionsTabType {
4
+ export enum WfoSubscriptionListTab {
5
5
  ACTIVE = 'ACTIVE',
6
6
  TERMINATED = 'TERMINATED',
7
7
  TRANSIENT = 'TRANSIENT',
8
8
  ALL = 'ALL',
9
9
  }
10
10
 
11
- export const defaultSubscriptionsTabs: WfoFilterTab<
12
- WfoSubscriptionsTabType,
11
+ export const subscriptionListTabs: WfoFilterTab<
12
+ WfoSubscriptionListTab,
13
13
  SubscriptionListItem
14
14
  >[] = [
15
15
  {
16
- id: WfoSubscriptionsTabType.ACTIVE,
16
+ id: WfoSubscriptionListTab.ACTIVE,
17
17
  translationKey: 'active',
18
18
  alwaysOnFilters: [
19
19
  {
@@ -23,7 +23,7 @@ export const defaultSubscriptionsTabs: WfoFilterTab<
23
23
  ],
24
24
  },
25
25
  {
26
- id: WfoSubscriptionsTabType.TERMINATED,
26
+ id: WfoSubscriptionListTab.TERMINATED,
27
27
  translationKey: 'terminated',
28
28
  alwaysOnFilters: [
29
29
  {
@@ -33,7 +33,7 @@ export const defaultSubscriptionsTabs: WfoFilterTab<
33
33
  ],
34
34
  },
35
35
  {
36
- id: WfoSubscriptionsTabType.TRANSIENT,
36
+ id: WfoSubscriptionListTab.TRANSIENT,
37
37
  translationKey: 'transient',
38
38
  alwaysOnFilters: [
39
39
  {
@@ -43,29 +43,7 @@ export const defaultSubscriptionsTabs: WfoFilterTab<
43
43
  ],
44
44
  },
45
45
  {
46
- id: WfoSubscriptionsTabType.ALL,
46
+ id: WfoSubscriptionListTab.ALL,
47
47
  translationKey: 'all',
48
48
  },
49
49
  ];
50
-
51
- export const getSubscriptionsTabTypeFromString = (
52
- tabId?: string,
53
- ): WfoSubscriptionsTabType | undefined => {
54
- if (!tabId) {
55
- return undefined;
56
- }
57
-
58
- switch (tabId.toUpperCase()) {
59
- case WfoSubscriptionsTabType.ACTIVE.toString():
60
- return WfoSubscriptionsTabType.ACTIVE;
61
- case WfoSubscriptionsTabType.TERMINATED.toString():
62
- return WfoSubscriptionsTabType.TERMINATED;
63
- case WfoSubscriptionsTabType.TRANSIENT.toString():
64
- return WfoSubscriptionsTabType.TRANSIENT;
65
- case WfoSubscriptionsTabType.ALL.toString():
66
- return WfoSubscriptionsTabType.ALL;
67
-
68
- default:
69
- return undefined;
70
- }
71
- };
@@ -0,0 +1,55 @@
1
+ import React, { FC } from 'react';
2
+
3
+ import {
4
+ EuiAvatar,
5
+ EuiFlexGroup,
6
+ EuiFlexItem,
7
+ EuiPanel,
8
+ EuiText,
9
+ } from '@elastic/eui';
10
+ import { IconType } from '@elastic/eui/src/components/icon';
11
+
12
+ import { useOrchestratorTheme } from '@/hooks';
13
+
14
+ import { getWfoSummaryCardHeaderStyles } from './styles';
15
+
16
+ export type WfoSummaryCardHeaderProps = {
17
+ text: string;
18
+ value: number | string;
19
+ iconType: IconType;
20
+ iconColor: string | undefined;
21
+ };
22
+
23
+ export const WfoSummaryCardHeader: FC<WfoSummaryCardHeaderProps> = ({
24
+ text,
25
+ value,
26
+ iconType,
27
+ iconColor,
28
+ }) => {
29
+ const { theme } = useOrchestratorTheme();
30
+ const { avatarStyle, totalSectionStyle, valueStyle } =
31
+ getWfoSummaryCardHeaderStyles(theme);
32
+
33
+ return (
34
+ <EuiFlexItem grow={0}>
35
+ <EuiPanel hasShadow={false} color="subdued" paddingSize="l">
36
+ <EuiFlexGroup>
37
+ <EuiAvatar
38
+ iconSize="l"
39
+ size="xl"
40
+ type="space"
41
+ name={text}
42
+ css={avatarStyle}
43
+ iconType={iconType}
44
+ iconColor={theme.colors.ghost}
45
+ color={iconColor}
46
+ />
47
+ <div css={totalSectionStyle}>
48
+ <EuiText color="subdued">{text}</EuiText>
49
+ <EuiText css={valueStyle}>{value}</EuiText>
50
+ </div>
51
+ </EuiFlexGroup>
52
+ </EuiPanel>
53
+ </EuiFlexItem>
54
+ );
55
+ };
@@ -0,0 +1 @@
1
+ export * from './WfoSummaryCardHeader';
@@ -0,0 +1,26 @@
1
+ import { EuiThemeComputed } from '@elastic/eui';
2
+ import { css } from '@emotion/react';
3
+
4
+ export const getWfoSummaryCardHeaderStyles = (theme: EuiThemeComputed) => {
5
+ const avatarStyle = css({
6
+ maxHeight: theme.base * 3,
7
+ maxWidth: theme.base * 3,
8
+ });
9
+
10
+ const totalSectionStyle = css({
11
+ display: 'flex',
12
+ flexDirection: 'column',
13
+ justifyContent: 'space-between',
14
+ });
15
+
16
+ const valueStyle = css({
17
+ fontSize: theme.size.l,
18
+ fontWeight: theme.font.weight.semiBold,
19
+ });
20
+
21
+ return {
22
+ avatarStyle,
23
+ totalSectionStyle,
24
+ valueStyle,
25
+ };
26
+ };
@@ -0,0 +1,86 @@
1
+ import React, { FC } from 'react';
2
+
3
+ import { useRouter } from 'next/router';
4
+
5
+ import {
6
+ EuiButton,
7
+ EuiFlexItem,
8
+ EuiHorizontalRule,
9
+ EuiPanel,
10
+ EuiSkeletonText,
11
+ EuiSpacer,
12
+ useEuiScrollBar,
13
+ } from '@elastic/eui';
14
+
15
+ import { useWithOrchestratorTheme } from '@/hooks';
16
+
17
+ import {
18
+ SummaryCardListItem,
19
+ WfoSummaryCardListItem,
20
+ } from './WfoSummaryCardListItem';
21
+ import { getWfoSummaryCardListStyles } from './styles';
22
+
23
+ export type SummaryCardButtonConfig = {
24
+ name: string;
25
+ url: string;
26
+ };
27
+
28
+ export type WfoSummaryCardListProps = {
29
+ title: string;
30
+ items: SummaryCardListItem[];
31
+ button?: SummaryCardButtonConfig;
32
+ isLoading?: boolean;
33
+ };
34
+
35
+ export const WfoSummaryCardList: FC<WfoSummaryCardListProps> = ({
36
+ title,
37
+ items,
38
+ button,
39
+ isLoading = false,
40
+ }) => {
41
+ const router = useRouter();
42
+ const euiScrollBarStyle = useEuiScrollBar();
43
+ const { listContainerStyle, listHeaderStyle, listStyle } =
44
+ useWithOrchestratorTheme(getWfoSummaryCardListStyles);
45
+
46
+ return (
47
+ <EuiFlexItem>
48
+ <EuiPanel
49
+ css={listContainerStyle}
50
+ hasShadow={false}
51
+ hasBorder={true}
52
+ paddingSize="l"
53
+ >
54
+ <div>
55
+ <p css={listHeaderStyle}>{title}</p>
56
+ <EuiSpacer size="m" />
57
+ <EuiSkeletonText isLoading={isLoading} lines={10}>
58
+ <div css={[listStyle, euiScrollBarStyle]}>
59
+ {items?.map((item, index) => (
60
+ <div key={index}>
61
+ <WfoSummaryCardListItem
62
+ title={item.title}
63
+ value={item.value}
64
+ url={item.url}
65
+ />
66
+ {index === items.length - 1 ? null : (
67
+ <EuiHorizontalRule margin="none" />
68
+ )}
69
+ </div>
70
+ ))}
71
+ </div>
72
+ </EuiSkeletonText>
73
+ </div>
74
+ <EuiSpacer size="m" />
75
+ {button && (
76
+ <EuiButton
77
+ fullWidth
78
+ onClick={() => router.push(button.url)}
79
+ >
80
+ {button.name}
81
+ </EuiButton>
82
+ )}
83
+ </EuiPanel>
84
+ </EuiFlexItem>
85
+ );
86
+ };
@@ -0,0 +1,59 @@
1
+ import React, { FC, ReactNode } from 'react';
2
+
3
+ import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiTextColor } from '@elastic/eui';
4
+
5
+ import { WfoOptionalLink } from '@/components/WfoOptionalLink';
6
+ import { useOrchestratorTheme } from '@/hooks';
7
+
8
+ import { getWfoSummaryCardListStyles } from './styles';
9
+
10
+ export type SummaryCardListItem = {
11
+ title: string;
12
+ value: ReactNode;
13
+ url?: string;
14
+ };
15
+
16
+ export type WfoSummaryCardListItemProps = {
17
+ title: string;
18
+ value: ReactNode;
19
+ url?: string;
20
+ };
21
+
22
+ export const WfoSummaryCardListItem: FC<WfoSummaryCardListItemProps> = ({
23
+ title,
24
+ value,
25
+ url,
26
+ }) => {
27
+ const { theme } = useOrchestratorTheme();
28
+ const {
29
+ listItemContainerStyle,
30
+ listItemTitleStyle,
31
+ listItemSubtitleStyle,
32
+ listItemHighlightIconStyle,
33
+ } = getWfoSummaryCardListStyles(theme);
34
+
35
+ return (
36
+ <WfoOptionalLink href={url}>
37
+ <EuiFlexGroup css={listItemContainerStyle} gutterSize="none">
38
+ <EuiFlexItem>
39
+ <EuiTextColor
40
+ color={url ? theme.colors.link : theme.colors.title}
41
+ css={listItemTitleStyle}
42
+ >
43
+ {title}
44
+ </EuiTextColor>
45
+ <EuiTextColor css={listItemSubtitleStyle}>
46
+ {value}
47
+ </EuiTextColor>
48
+ </EuiFlexItem>
49
+ <EuiFlexItem
50
+ className={url ? 'highlight-icon' : undefined}
51
+ grow={false}
52
+ css={listItemHighlightIconStyle}
53
+ >
54
+ <EuiIcon type="sortRight" color="primary" />
55
+ </EuiFlexItem>
56
+ </EuiFlexGroup>
57
+ </WfoOptionalLink>
58
+ );
59
+ };
@@ -0,0 +1,2 @@
1
+ export * from './WfoSummaryCardList';
2
+ export * from './WfoSummaryCardListItem';
@@ -0,0 +1,52 @@
1
+ import { EuiThemeComputed } from '@elastic/eui';
2
+ import { css } from '@emotion/react';
3
+
4
+ export const getWfoSummaryCardListStyles = (theme: EuiThemeComputed) => {
5
+ const listContainerStyle = css({
6
+ display: 'flex',
7
+ flexDirection: 'column',
8
+ justifyContent: 'space-between',
9
+ flexGrow: 1,
10
+ });
11
+
12
+ const listHeaderStyle = css({
13
+ fontWeight: theme.font.weight.semiBold,
14
+ });
15
+
16
+ const listStyle = css({
17
+ height: theme.base * 20,
18
+ overflow: 'auto',
19
+ });
20
+
21
+ const listItemContainerStyle = css({
22
+ paddingBlock: theme.size.m,
23
+ '.highlight-icon': {
24
+ visibility: 'hidden',
25
+ },
26
+ '&:hover .highlight-icon': {
27
+ visibility: 'visible',
28
+ },
29
+ });
30
+
31
+ const listItemTitleStyle = css({
32
+ fontWeight: theme.font.weight.medium,
33
+ });
34
+
35
+ const listItemSubtitleStyle = css({
36
+ fontWeight: theme.font.weight.regular,
37
+ });
38
+
39
+ const listItemHighlightIconStyle = css({
40
+ visibility: 'hidden',
41
+ });
42
+
43
+ return {
44
+ listContainerStyle,
45
+ listHeaderStyle,
46
+ listStyle,
47
+ listItemContainerStyle,
48
+ listItemTitleStyle,
49
+ listItemSubtitleStyle,
50
+ listItemHighlightIconStyle,
51
+ };
52
+ };
@@ -0,0 +1,111 @@
1
+ import React, { FC } from 'react';
2
+
3
+ import {
4
+ EuiFlexGrid,
5
+ EuiFlexItem,
6
+ EuiSpacer,
7
+ useCurrentEuiBreakpoint,
8
+ } from '@elastic/eui';
9
+
10
+ import {
11
+ SummaryCardListItem,
12
+ WfoSummaryCardHeader,
13
+ WfoSummaryCardHeaderProps,
14
+ } from '@/components/WfoSummary/';
15
+ import { getWfoSummaryCardsStyles } from '@/components/WfoSummary/styles';
16
+ import { useOrchestratorTheme } from '@/hooks';
17
+
18
+ import {
19
+ SummaryCardButtonConfig,
20
+ WfoSummaryCardList,
21
+ } from './WfoSummaryCardList/WfoSummaryCardList';
22
+ import { getNumberOfColumns } from './getNumberOfColumns';
23
+
24
+ export enum SummaryCardStatus {
25
+ Success = 'Success',
26
+ Error = 'Error',
27
+ Neutral = 'Neutral',
28
+ }
29
+
30
+ export type SummaryCard = {
31
+ headerTitle: string;
32
+ headerValue: string | number;
33
+ headerStatus: SummaryCardStatus;
34
+ listTitle: string;
35
+ listItems: SummaryCardListItem[];
36
+ button?: SummaryCardButtonConfig;
37
+ isLoading?: boolean;
38
+ };
39
+
40
+ export type WfoSummaryCardsProps = {
41
+ summaryCards: SummaryCard[];
42
+ };
43
+
44
+ export const WfoSummaryCards: FC<WfoSummaryCardsProps> = ({ summaryCards }) => {
45
+ const { theme } = useOrchestratorTheme();
46
+ const { cardContainerStyle } = getWfoSummaryCardsStyles(theme);
47
+ const currentBreakpoint = useCurrentEuiBreakpoint();
48
+
49
+ const getIconTypeAndColorForHeaderStatus = (
50
+ status: SummaryCardStatus,
51
+ ): Pick<WfoSummaryCardHeaderProps, 'iconType' | 'iconColor'> => {
52
+ switch (status) {
53
+ case SummaryCardStatus.Success:
54
+ return {
55
+ iconType: 'checkInCircleFilled',
56
+ iconColor: theme.colors.success,
57
+ };
58
+ case SummaryCardStatus.Error:
59
+ return {
60
+ iconType: 'error',
61
+ iconColor: theme.colors.danger,
62
+ };
63
+ case SummaryCardStatus.Neutral:
64
+ default:
65
+ return {
66
+ iconType: 'kubernetesPod',
67
+ iconColor: theme.colors.primary,
68
+ };
69
+ }
70
+ };
71
+
72
+ return (
73
+ <EuiFlexGrid
74
+ responsive={false}
75
+ columns={getNumberOfColumns(currentBreakpoint)}
76
+ gutterSize="xl"
77
+ >
78
+ {summaryCards.map(
79
+ (
80
+ {
81
+ headerTitle,
82
+ headerValue,
83
+ headerStatus,
84
+ listTitle,
85
+ listItems,
86
+ button,
87
+ isLoading,
88
+ },
89
+ index,
90
+ ) => (
91
+ <EuiFlexItem key={index} css={cardContainerStyle}>
92
+ <WfoSummaryCardHeader
93
+ text={headerTitle}
94
+ value={headerValue}
95
+ {...getIconTypeAndColorForHeaderStatus(
96
+ headerStatus,
97
+ )}
98
+ />
99
+ <EuiSpacer size="m" />
100
+ <WfoSummaryCardList
101
+ title={listTitle}
102
+ items={listItems}
103
+ button={button}
104
+ isLoading={isLoading}
105
+ />
106
+ </EuiFlexItem>
107
+ ),
108
+ )}
109
+ </EuiFlexGrid>
110
+ );
111
+ };
@@ -0,0 +1,14 @@
1
+ export const getNumberOfColumns = (currentBreakpoint: string | undefined) => {
2
+ switch (currentBreakpoint) {
3
+ case 'xxl':
4
+ return 3;
5
+ case 'xl':
6
+ return 2;
7
+ case 'l':
8
+ case 'm':
9
+ case 's':
10
+ case 'xs':
11
+ default:
12
+ return 1;
13
+ }
14
+ };
@@ -0,0 +1,4 @@
1
+ export * from './getNumberOfColumns';
2
+ export * from './WfoSummaryCardHeader';
3
+ export * from './WfoSummaryCardList';
4
+ export * from './WfoSummaryCards';
@@ -0,0 +1,13 @@
1
+ import { EuiThemeComputed } from '@elastic/eui';
2
+ import { css } from '@emotion/react';
3
+
4
+ export const getWfoSummaryCardsStyles = (theme: EuiThemeComputed) => {
5
+ const cardContainerStyle = css({
6
+ height: theme.base * 36,
7
+ minWidth: theme.base * 25,
8
+ });
9
+
10
+ return {
11
+ cardContainerStyle,
12
+ };
13
+ };
@@ -2,33 +2,35 @@ import React, { ReactNode } from 'react';
2
2
 
3
3
  import { EuiBasicTable, EuiBasicTableColumn, Pagination } from '@elastic/eui';
4
4
  import { Criteria } from '@elastic/eui/src/components/basic_table/basic_table';
5
+ import { SerializedStyles } from '@emotion/react';
5
6
 
6
- import { useOrchestratorTheme } from '../../../hooks';
7
- import { SortOrder } from '../../../types';
8
7
  import type {
9
8
  TableColumnKeys,
10
9
  WfoDataSearch,
11
10
  WfoDataSorting,
12
- } from '../utils/columns';
11
+ } from '@/components';
13
12
  import {
14
13
  WFO_STATUS_COLOR_FIELD,
15
14
  WfoTableControlColumnConfig,
16
15
  WfoTableDataColumnConfig,
17
- } from '../utils/columns';
18
- import { WfoStatusColorField } from './WfoStatusColorField';
19
- import { WfoTableHeaderCell } from './WfoTableHeaderCell';
20
- import { getStyles } from './styles';
16
+ } from '@/components';
17
+ import { WfoStatusColorField } from '@/components';
18
+ import { WfoTableHeaderCell } from '@/components';
19
+ import { useOrchestratorTheme } from '@/hooks';
20
+ import { SortOrder } from '@/types';
21
21
 
22
- export type WfoBasicTableColumns<T> = {
22
+ import { getWfoBasicTableStyles } from './styles';
23
+
24
+ export type WfoBasicTableColumns<T extends object> = {
23
25
  [Property in keyof T]: WfoTableDataColumnConfig<T, Property> & {
24
26
  render?: (cellValue: T[Property], row: T) => ReactNode;
25
27
  };
26
28
  };
27
29
 
28
- export type WfoBasicTableColumnsWithControlColumns<T> =
30
+ export type WfoBasicTableColumnsWithControlColumns<T extends object> =
29
31
  WfoBasicTableColumns<T> & WfoTableControlColumnConfig<T>;
30
32
 
31
- export type WfoBasicTableProps<T> = {
33
+ export type WfoBasicTableProps<T extends object> = {
32
34
  data: T[];
33
35
  columns:
34
36
  | WfoBasicTableColumnsWithControlColumns<T>
@@ -44,9 +46,10 @@ export type WfoBasicTableProps<T> = {
44
46
  isExpandable?: boolean;
45
47
  itemIdToExpandedRowMap?: Record<string, ReactNode>;
46
48
  itemId?: string;
49
+ customTableStyle?: SerializedStyles;
47
50
  };
48
51
 
49
- export const WfoBasicTable = <T,>({
52
+ export const WfoBasicTable = <T extends object>({
50
53
  data,
51
54
  columns,
52
55
  hiddenColumns,
@@ -60,9 +63,10 @@ export const WfoBasicTable = <T,>({
60
63
  isExpandable,
61
64
  itemIdToExpandedRowMap,
62
65
  itemId,
66
+ customTableStyle,
63
67
  }: WfoBasicTableProps<T>) => {
64
68
  const { theme } = useOrchestratorTheme();
65
- const { basicTableStyle, getStatusColumnStyle } = getStyles(theme);
69
+ const { basicTableStyle } = getWfoBasicTableStyles(theme);
66
70
 
67
71
  const statusColorColumn: WfoTableControlColumnConfig<T> = {
68
72
  statusColorField: {
@@ -84,9 +88,7 @@ export const WfoBasicTable = <T,>({
84
88
  ? { ...statusColorColumn, ...columns }
85
89
  : { ...columns };
86
90
 
87
- const tableStyling = getStatusColorForRow
88
- ? [basicTableStyle, getStatusColumnStyle(1)]
89
- : basicTableStyle;
91
+ const tableStyling = customTableStyle ?? basicTableStyle;
90
92
 
91
93
  return (
92
94
  <EuiBasicTable
@@ -111,7 +113,7 @@ export const WfoBasicTable = <T,>({
111
113
  );
112
114
  };
113
115
 
114
- function mapWfoTableColumnsToEuiColumns<T>(
116
+ function mapWfoTableColumnsToEuiColumns<T extends object>(
115
117
  tableColumns: WfoBasicTableColumns<T>,
116
118
  hiddenColumns?: TableColumnKeys<T>,
117
119
  dataSorting?: WfoDataSorting<T>,
@@ -14,7 +14,7 @@ import { useWithOrchestratorTheme } from '../../../hooks';
14
14
  import { SortOrder } from '../../../types';
15
15
  import { WfoSortButtons } from '../WfoSortButtons';
16
16
  import { WfoSortDirectionIcon } from './WfoSortDirectionIcon';
17
- import { getStyles } from './styles';
17
+ import { getWfoBasicTableStyles } from './styles';
18
18
 
19
19
  export type WfoTableHeaderCellProps = {
20
20
  fieldName: string;
@@ -37,7 +37,7 @@ export const WfoTableHeaderCell: FC<WfoTableHeaderCellProps> = ({
37
37
  headerCellPopoverHeaderTitleStyle,
38
38
  headerCellPopoverContentStyle,
39
39
  getHeaderCellButtonStyle,
40
- } = useWithOrchestratorTheme(getStyles);
40
+ } = useWithOrchestratorTheme(getWfoBasicTableStyles);
41
41
  const t = useTranslations('common');
42
42
 
43
43
  const isSortable = !!onSetSortOrder;
@@ -2,3 +2,4 @@ export * from './WfoBasicTable';
2
2
  export * from './WfoSortDirectionIcon';
3
3
  export * from './WfoTableHeaderCell';
4
4
  export * from './WfoStatusColorField';
5
+ export * from './styles';