@orchestrator-ui/orchestrator-ui-components 0.2.2 → 0.2.4

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 (43) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +1 -1
  4. package/CHANGELOG.md +12 -0
  5. package/dist/index.d.ts +55 -32
  6. package/dist/index.js +397 -82
  7. package/package.json +1 -1
  8. package/src/components/WFOBadges/{WFOStatusBadge/WFOStatusBadge.stories.tsx → WFOSubscriptionStatusBadge/WFOSubscriptionStatusBadge.stories.tsx} +4 -4
  9. package/src/components/WFOBadges/{WFOStatusBadge/WFOStatusBadge.tsx → WFOSubscriptionStatusBadge/WFOSubscriptionStatusBadge.tsx} +5 -3
  10. package/src/components/WFOBadges/WFOSubscriptionStatusBadge/index.ts +1 -0
  11. package/src/components/WFOBadges/index.ts +1 -1
  12. package/src/components/{WFOBreadcrumbs → WFOPageTemplate/WFOBreadcrumbs}/WFOBreadcrumbs.tsx +1 -1
  13. package/src/components/WFOPageTemplate/WFOPageTemplate/WFOPageTemplate.tsx +2 -0
  14. package/src/components/WFOPageTemplate/WFOSidebar/WFOSidebar.tsx +14 -12
  15. package/src/components/WFOPageTemplate/index.ts +1 -0
  16. package/src/components/WFOPageTemplate/paths.ts +11 -0
  17. package/src/components/WFOSubscription/WFOSubscriptionBlock.tsx +3 -2
  18. package/src/components/WFOSubscriptionsList/WFOSubscriptionsList.tsx +199 -0
  19. package/src/components/WFOSubscriptionsList/index.ts +4 -0
  20. package/src/components/WFOSubscriptionsList/mapGrapghQlSubscriptionsResultToSubscriptionListItems.ts +34 -0
  21. package/src/{pages/subscriptions → components/WFOSubscriptionsList}/types.ts +0 -2
  22. package/src/components/WFOTable/utils/constants.ts +2 -0
  23. package/src/components/index.ts +1 -1
  24. package/src/graphqlQueries/index.ts +2 -1
  25. package/src/graphqlQueries/processListQuery.ts +5 -8
  26. package/src/graphqlQueries/productsQuery.ts +3 -4
  27. package/src/graphqlQueries/subscriptionsListQuery.ts +55 -0
  28. package/src/graphqlQueries/workflowsQuery.ts +3 -4
  29. package/src/index.ts +1 -0
  30. package/src/messages/en-US.json +4 -3
  31. package/src/messages/nl-NL.json +4 -3
  32. package/src/pages/metadata/WFOProductBlocksPage.tsx +4 -2
  33. package/src/pages/metadata/WFOProductsPage.tsx +4 -2
  34. package/src/pages/processes/WFOProcessListPage.tsx +22 -13
  35. package/src/pages/processes/tableConfig.ts +3 -3
  36. package/src/pages/subscriptions/WFOSubscriptionsListPage.tsx +85 -0
  37. package/src/pages/subscriptions/index.ts +1 -2
  38. package/src/types/index.ts +2 -0
  39. package/src/types/subscription.ts +21 -0
  40. package/src/{types.ts → types/types.ts} +14 -17
  41. package/src/components/WFOBadges/WFOStatusBadge/index.ts +0 -1
  42. /package/src/components/{WFOBreadcrumbs → WFOPageTemplate/WFOBreadcrumbs}/index.ts +0 -0
  43. /package/src/{pages/subscriptions → components/WFOSubscriptionsList}/subscriptionListTabs.ts +0 -0
@@ -22,7 +22,7 @@ import { Pagination } from '@elastic/eui/src/components';
22
22
  import { WFOProcessesListSubscriptionsCell } from './WFOProcessesListSubscriptionsCell';
23
23
  import { StringParam, useQueryParam, withDefault } from 'use-query-params';
24
24
  import { useRouter } from 'next/router';
25
- import { EuiSpacer } from '@elastic/eui';
25
+ import { EuiPageHeader, EuiSpacer } from '@elastic/eui';
26
26
  import { defaultProcessListTabs, WFOProcessListTabType } from './tabConfig';
27
27
  import { getProcessListTabTypeFromString } from './getProcessListTabTypeFromString';
28
28
  import {
@@ -49,7 +49,11 @@ export const WFOProcessListPage = () => {
49
49
  useDataDisplayParams<Process>({
50
50
  pageSize: initialPageSize,
51
51
  sortBy: {
52
- field: 'lastModified',
52
+ // Todo: waiting for fix in backend -- currently the sortBy field id's are not matching with the returned data
53
+ // https://github.com/workfloworchestrator/orchestrator-ui/issues/91
54
+ // @ts-ignore
55
+ field: 'modified',
56
+ // field: 'lastModified',
53
57
  order: SortOrder.DESC,
54
58
  },
55
59
  });
@@ -72,11 +76,10 @@ export const WFOProcessListPage = () => {
72
76
  field: 'workflowName',
73
77
  name: t('workflowName'),
74
78
  },
75
- lastStep: {
76
- field: 'lastStep',
77
- name: t('lastStep'),
79
+ step: {
80
+ field: 'step',
81
+ name: t('step'),
78
82
  },
79
-
80
83
  status: {
81
84
  field: 'status',
82
85
  name: t('status'),
@@ -84,6 +87,10 @@ export const WFOProcessListPage = () => {
84
87
  <WFOProcessStatusBadge processStatus={cellValue} />
85
88
  ),
86
89
  },
90
+ workflowTarget: {
91
+ field: 'workflowTarget',
92
+ name: t('workflowTarget'),
93
+ },
87
94
  product: {
88
95
  field: 'product',
89
96
  name: t('product'),
@@ -108,9 +115,9 @@ export const WFOProcessListPage = () => {
108
115
  field: 'assignee',
109
116
  name: t('assignee'),
110
117
  },
111
- id: {
112
- field: 'id',
113
- name: t('id'),
118
+ processId: {
119
+ field: 'processId',
120
+ name: t('processId'),
114
121
  },
115
122
  started: {
116
123
  field: 'started',
@@ -127,10 +134,7 @@ export const WFOProcessListPage = () => {
127
134
  {
128
135
  first: dataDisplayParams.pageSize,
129
136
  after: dataDisplayParams.pageIndex * dataDisplayParams.pageSize,
130
- // Todo: waiting for fix in backend -- currently the sortBy field id's are not matching with the returned data
131
- // sortBy: { field: 'lastModified', order: SortOrder.DESC },
132
- // @ts-ignore
133
- sortBy: { field: 'modified', order: SortOrder.DESC },
137
+ sortBy: dataDisplayParams.sortBy,
134
138
  filterBy: alwaysOnFilters,
135
139
  },
136
140
  'processList',
@@ -172,6 +176,11 @@ export const WFOProcessListPage = () => {
172
176
 
173
177
  return (
174
178
  <>
179
+ <EuiSpacer />
180
+
181
+ <EuiPageHeader pageTitle="Processes" />
182
+ <EuiSpacer size="m" />
183
+
175
184
  <WFOFilterTabs
176
185
  tabs={defaultProcessListTabs}
177
186
  translationNamespace="processes.tabs"
@@ -6,17 +6,17 @@ export const defaultHiddenColumnsActiveProcesses: TableColumnKeys<Process> = [
6
6
  'customer',
7
7
  'createdBy',
8
8
  'assignee',
9
- 'id',
9
+ 'processId',
10
10
  ];
11
11
 
12
12
  export const defaultHiddenColumnsCompletedProcesses: TableColumnKeys<Process> =
13
13
  [
14
- 'lastStep',
14
+ 'step',
15
15
  'status',
16
16
  'product',
17
17
  'customer',
18
18
  'createdBy',
19
19
  'assignee',
20
- 'id',
20
+ 'processId',
21
21
  'started',
22
22
  ];
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+ import { useRouter } from 'next/router';
3
+ import { StringParam, useQueryParam, withDefault } from 'use-query-params';
4
+ import { EuiPageHeader, EuiSpacer } from '@elastic/eui';
5
+ import { useDataDisplayParams } from '../../hooks';
6
+ import {
7
+ defaultSubscriptionsTabs,
8
+ getSubscriptionsTabTypeFromString,
9
+ SubscriptionListItem,
10
+ WFOSubscriptionsList,
11
+ WFOSubscriptionsTabType,
12
+ } from '../../components/WFOSubscriptionsList';
13
+ import { SortOrder } from '../../types';
14
+ import {
15
+ DEFAULT_PAGE_SIZE,
16
+ getSortDirectionFromString,
17
+ getTableConfigFromLocalStorage,
18
+ SUBSCRIPTIONS_TABLE_LOCAL_STORAGE_KEY,
19
+ } from '../../components/WFOTable';
20
+ import { WFOFilterTabs } from '../../components';
21
+
22
+ export const WFOSubscriptionsListPage = () => {
23
+ const router = useRouter();
24
+
25
+ const initialPageSize =
26
+ getTableConfigFromLocalStorage(SUBSCRIPTIONS_TABLE_LOCAL_STORAGE_KEY)
27
+ ?.selectedPageSize ?? DEFAULT_PAGE_SIZE;
28
+ const { dataDisplayParams, setDataDisplayParam } =
29
+ useDataDisplayParams<SubscriptionListItem>({
30
+ pageSize: initialPageSize,
31
+ sortBy: {
32
+ field: 'startDate',
33
+ order: SortOrder.DESC,
34
+ },
35
+ });
36
+
37
+ const [activeTab, setActiveTab] = useQueryParam(
38
+ 'activeTab',
39
+ withDefault(StringParam, WFOSubscriptionsTabType.ACTIVE),
40
+ );
41
+
42
+ const sortOrder = getSortDirectionFromString(
43
+ dataDisplayParams.sortBy?.order,
44
+ );
45
+ const selectedSubscriptionsTab =
46
+ getSubscriptionsTabTypeFromString(activeTab);
47
+ if (!sortOrder || !selectedSubscriptionsTab) {
48
+ router.replace('/subscriptions');
49
+ return null;
50
+ }
51
+
52
+ const handleChangeSubscriptionsTab = (
53
+ updatedSubscriptionsTab: WFOSubscriptionsTabType,
54
+ ) => {
55
+ setActiveTab(updatedSubscriptionsTab);
56
+ setDataDisplayParam('pageIndex', 0);
57
+ };
58
+
59
+ const alwaysOnFilters = defaultSubscriptionsTabs.find(
60
+ ({ id }) => id === selectedSubscriptionsTab,
61
+ )?.alwaysOnFilters;
62
+
63
+ return (
64
+ <>
65
+ <EuiSpacer />
66
+
67
+ <EuiPageHeader pageTitle="Subscriptions" />
68
+ <EuiSpacer size="m" />
69
+
70
+ <WFOFilterTabs
71
+ tabs={defaultSubscriptionsTabs}
72
+ selectedTab={selectedSubscriptionsTab}
73
+ translationNamespace="subscriptions.tabs"
74
+ onChangeTab={handleChangeSubscriptionsTab}
75
+ />
76
+ <EuiSpacer size="xxl" />
77
+
78
+ <WFOSubscriptionsList
79
+ dataDisplayParams={dataDisplayParams}
80
+ setDataDisplayParam={setDataDisplayParam}
81
+ alwaysOnFilters={alwaysOnFilters}
82
+ />
83
+ </>
84
+ );
85
+ };
@@ -1,2 +1 @@
1
- export * from './subscriptionListTabs';
2
- export * from './types';
1
+ export * from './WFOSubscriptionsListPage';
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './subscription';
@@ -0,0 +1,21 @@
1
+ import { ProductDefinition } from './types';
2
+
3
+ export enum SubscriptionStatus {
4
+ INITIAL = 'INITIAL',
5
+ ACTIVE = 'ACTIVE',
6
+ MIGRATING = 'MIGRATING',
7
+ DISABLED = 'DISABLED',
8
+ TERMINATED = 'TERMINATED',
9
+ PROVISIONING = 'PROVISIONING',
10
+ }
11
+
12
+ export type Subscription = {
13
+ subscriptionId: string;
14
+ description: string;
15
+ note: string;
16
+ startDate: string;
17
+ endDate: string;
18
+ insync: boolean;
19
+ status: SubscriptionStatus;
20
+ product: Pick<ProductDefinition, 'name' | 'tag' | 'productType'>;
21
+ };
@@ -1,5 +1,6 @@
1
1
  import { _EuiThemeColorsMode } from '@elastic/eui/src/global_styling/variables/colors';
2
- import { ProcessStatus } from './hooks';
2
+ import { ProcessStatus } from '../hooks';
3
+ import { Subscription } from './subscription';
3
4
 
4
5
  export type Nullable<T> = T | null;
5
6
 
@@ -148,9 +149,9 @@ export interface ProductDefinition {
148
149
  // https://github.com/workfloworchestrator/orchestrator-ui/issues/217
149
150
  export type Process = {
150
151
  workflowName: string;
151
- lastStep: string;
152
+ step: string;
152
153
  status: ProcessStatus;
153
- // target: string;
154
+ workflowTarget: string;
154
155
  product: string;
155
156
  customer: string;
156
157
  // abbrev: string;
@@ -159,19 +160,11 @@ export type Process = {
159
160
  };
160
161
  createdBy: string;
161
162
  assignee: string;
162
- id: string;
163
+ processId: string;
163
164
  started: string;
164
165
  lastModified: string;
165
166
  };
166
167
 
167
- // Todo: this will replace the generated Subscription
168
- // Currently partially implemented since it is used in Process object
169
- // https://github.com/workfloworchestrator/orchestrator-ui/issues/149
170
- export type Subscription = {
171
- subscriptionId: string;
172
- description: string;
173
- };
174
-
175
168
  export interface WorkflowDefinition {
176
169
  name: string;
177
170
  description: string;
@@ -206,14 +199,18 @@ export type GraphqlQueryVariables<Type> = {
206
199
  filterBy?: GraphqlFilter<Type>[];
207
200
  };
208
201
 
209
- type GraphQLPageInfo = {
202
+ export type GraphQLPageInfo = {
210
203
  hasNextPage: boolean;
211
204
  hasPreviousPage: boolean;
212
- startCursor: number;
213
- totalItems: number;
214
- endCursor: number;
205
+ startCursor?: number;
206
+ totalItems?: number;
207
+ endCursor?: number;
215
208
  };
216
209
 
210
+ export interface SubscriptionsResult {
211
+ subscriptions: GraphQlResultPage<Subscription>;
212
+ }
213
+
217
214
  export interface ProductDefinitionsResult {
218
215
  products: GraphQlResultPage<ProductDefinition>;
219
216
  }
@@ -226,7 +223,7 @@ export interface ResourceTypeDefinitionsResult {
226
223
  resourceTypes: GraphQlResultPage<ResourceTypeDefinition>;
227
224
  }
228
225
 
229
- export interface ProcessesDefinitionsResult {
226
+ export interface ProcessesResult {
230
227
  processes: GraphQlResultPage<Process>;
231
228
  }
232
229
 
@@ -1 +0,0 @@
1
- export * from './WFOStatusBadge';