@orchestrator-ui/orchestrator-ui-components 0.5.1 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestrator-ui/orchestrator-ui-components",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -5,6 +5,7 @@ import {
5
5
  AcceptField,
6
6
  BoolField,
7
7
  ContactPersonNameField,
8
+ CustomerField,
8
9
  DateField,
9
10
  DividerField,
10
11
  ImsNodeIdField,
@@ -17,7 +18,6 @@ import {
17
18
  NestField,
18
19
  NumField,
19
20
  OptGroupField,
20
- OrganisationField,
21
21
  ProductField,
22
22
  RadioField,
23
23
  SelectField,
@@ -74,8 +74,8 @@ export function autoFieldFunction(
74
74
  return SummaryField;
75
75
  case 'subscription':
76
76
  return SubscriptionSummaryField;
77
- case 'organisationId':
78
- return OrganisationField;
77
+ case 'customerId':
78
+ return CustomerField;
79
79
  case 'locationCode':
80
80
  return LocationCodeField;
81
81
  case 'contactPersonName': // Surf specific
@@ -361,14 +361,14 @@ function fillPreselection(form: JSONSchema6, router: NextRouter) {
361
361
  if (form && form.properties) {
362
362
  Object.keys(queryParams).forEach((param) => {
363
363
  if (form && form.properties && form.properties[param]) {
364
- const organisationInput = form.properties[
364
+ const customerInput = form.properties[
365
365
  param
366
366
  ] as UniformJSONSchemaProperty;
367
- if (!organisationInput.uniforms) {
368
- organisationInput.uniforms = {};
367
+ if (!customerInput.uniforms) {
368
+ customerInput.uniforms = {};
369
369
  }
370
- organisationInput.uniforms.disabled = true;
371
- organisationInput.default = queryParams[param];
370
+ customerInput.uniforms.disabled = true;
371
+ customerInput.default = queryParams[param];
372
372
  }
373
373
  });
374
374
 
@@ -40,16 +40,19 @@ export function stop(e: React.SyntheticEvent) {
40
40
 
41
41
  export type ContactPersonNameFieldProps = FieldProps<
42
42
  string,
43
- { organisationId?: string; organisationKey?: string }
43
+ {
44
+ customerId?: string;
45
+ customerKey?: string;
46
+ }
44
47
  >;
45
48
 
46
49
  declare module 'uniforms' {
47
50
  interface FilterDOMProps {
48
- organisationId: never;
49
- organisationKey: never;
51
+ customerId: never;
52
+ customerKey: never;
50
53
  }
51
54
  }
52
- filterDOMProps.register('organisationId', 'organisationKey');
55
+ filterDOMProps.register('customerId', 'customerKey');
53
56
 
54
57
  function ContactPersonName({
55
58
  disabled,
@@ -65,8 +68,8 @@ function ContactPersonName({
65
68
  error,
66
69
  showInlineError,
67
70
  errorMessage,
68
- organisationId,
69
- organisationKey,
71
+ customerId,
72
+ customerKey,
70
73
  ...props
71
74
  }: ContactPersonNameFieldProps) {
72
75
  const axiosApiClient = useAxiosApiClient();
@@ -86,26 +89,21 @@ function ContactPersonName({
86
89
  : name;
87
90
  const contactsField = useField(useFieldName, {}, { absoluteName: true })[0];
88
91
 
89
- const organisationFieldName =
90
- organisationKey ||
91
- contactsField.field.organisationKey ||
92
- 'organisation';
92
+ const customerIdFieldName =
93
+ customerKey || contactsField.field.customerKey || 'customer_id';
93
94
 
94
95
  // Get initial value for org field if it exists (we cant really test)
95
- let organisationInitialValue;
96
+ let customerInitialValue;
96
97
  try {
97
- organisationInitialValue = schema.getInitialValue(
98
- organisationFieldName,
99
- {},
100
- );
98
+ customerInitialValue = schema.getInitialValue(customerIdFieldName, {});
101
99
  } catch {
102
- organisationInitialValue = '';
100
+ customerInitialValue = '';
103
101
  }
104
102
 
105
- const organisationIdValue =
106
- organisationId ||
107
- contactsField.field.organisationId ||
108
- get(model, organisationFieldName, organisationInitialValue);
103
+ const customerIdValue =
104
+ customerId ||
105
+ contactsField.field.customerId ||
106
+ get(model, customerIdFieldName, customerInitialValue);
109
107
 
110
108
  const [displayAutocomplete, setDisplayAutocomplete] = useState(false);
111
109
  const [contactPersons, setContactPersons] = useState<ContactPerson[]>([]);
@@ -126,10 +124,10 @@ function ContactPersonName({
126
124
  : [];
127
125
 
128
126
  useEffect(() => {
129
- if (organisationIdValue) {
127
+ if (customerIdValue) {
130
128
  axiosApiClient
131
129
  .axiosFetch<ContactPerson[]>(
132
- `/surf/crm/contacts/${organisationIdValue}`,
130
+ `/surf/crm/contacts/${customerIdValue}`,
133
131
  {},
134
132
  {},
135
133
  false,
@@ -143,7 +141,7 @@ function ContactPersonName({
143
141
  setContactPersons([]);
144
142
  });
145
143
  }
146
- }, [organisationIdValue, axiosApiClient]);
144
+ }, [customerIdValue, axiosApiClient]);
147
145
 
148
146
  useEffect(() => {
149
147
  // Set focus to the last name component to be created
@@ -21,12 +21,12 @@ import { useGetCustomersQuery } from '@/rtk/endpoints';
21
21
 
22
22
  import { SelectField, SelectFieldProps } from './SelectField';
23
23
 
24
- export type OrganisationFieldProps = Omit<
24
+ export type CustomerFieldProps = Omit<
25
25
  SelectFieldProps,
26
26
  'placeholder' | 'transform' | 'allowedValues'
27
27
  >;
28
28
 
29
- function Organisation({ ...props }: OrganisationFieldProps) {
29
+ function Customer({ ...props }: CustomerFieldProps) {
30
30
  const t = useTranslations('pydanticForms');
31
31
 
32
32
  const { data: customers, isLoading } = useGetCustomersQuery();
@@ -47,11 +47,11 @@ function Organisation({ ...props }: OrganisationFieldProps) {
47
47
  disabled={isLoading}
48
48
  placeholder={
49
49
  !isLoading
50
- ? t('widgets.organisation.placeholder')
51
- : t('widgets.organisation.loading')
50
+ ? t('widgets.customer.placeholder')
51
+ : t('widgets.customer.loading')
52
52
  }
53
53
  />
54
54
  );
55
55
  }
56
56
 
57
- export const OrganisationField = connectField(Organisation, { kind: 'leaf' });
57
+ export const CustomerField = connectField(Customer, { kind: 'leaf' });
@@ -45,8 +45,8 @@ import { getPortMode } from './utils';
45
45
  declare module 'uniforms' {
46
46
  interface FilterDOMProps {
47
47
  excludedSubscriptionIds: never;
48
- organisationId: never;
49
- organisationKey: never;
48
+ customerId: never;
49
+ customerKey: never;
50
50
  visiblePortMode: never;
51
51
  bandwidth: never;
52
52
  bandwidthKey: never;
@@ -57,8 +57,8 @@ declare module 'uniforms' {
57
57
  filterDOMProps.register(
58
58
  'productIds',
59
59
  'excludedSubscriptionIds',
60
- 'organisationId',
61
- 'organisationKey',
60
+ 'customerId',
61
+ 'customerKey',
62
62
  'visiblePortMode',
63
63
  'bandwidth',
64
64
  'bandwidthKey',
@@ -71,8 +71,8 @@ export type SubscriptionFieldProps = FieldProps<
71
71
  {
72
72
  productIds?: string[];
73
73
  excludedSubscriptionIds?: string[];
74
- organisationId?: string;
75
- organisationKey?: string;
74
+ customerId?: string;
75
+ customerKey?: string;
76
76
  visiblePortMode?: string;
77
77
  bandwidth?: number;
78
78
  bandwidthKey?: string;
@@ -96,8 +96,8 @@ function SubscriptionFieldDefinition({
96
96
  className = '',
97
97
  productIds = [],
98
98
  excludedSubscriptionIds = [],
99
- organisationId,
100
- organisationKey,
99
+ customerId,
100
+ customerKey,
101
101
  visiblePortMode = 'all',
102
102
  bandwidth,
103
103
  bandwidthKey,
@@ -132,10 +132,10 @@ function SubscriptionFieldDefinition({
132
132
 
133
133
  const usedBandwidth = bandwidth || bandWithFromField;
134
134
 
135
- // Get value from org field if organisationKey is set.
136
- const usedOrganisationId = organisationKey
137
- ? get(model, organisationKey, 'nonExistingOrgToFilterEverything')
138
- : organisationId;
135
+ // Get value from org field if customerKey is set.
136
+ const usedCustomerId = customerKey
137
+ ? get(model, customerKey, 'nonExistingOrgToFilterEverything')
138
+ : customerId;
139
139
 
140
140
  const makeLabel = (subscription: SubscriptionDropdownOption) => {
141
141
  const description =
@@ -243,10 +243,10 @@ function SubscriptionFieldDefinition({
243
243
  }
244
244
  }
245
245
 
246
- // If a customer/organisation filter is applied we need to filter on that
246
+ // If a customer filter is applied we need to filter on that
247
247
  if (
248
- usedOrganisationId &&
249
- subscription.customer?.customerId !== usedOrganisationId
248
+ usedCustomerId &&
249
+ subscription.customer?.customerId !== usedCustomerId
250
250
  ) {
251
251
  return false;
252
252
  }
@@ -46,12 +46,11 @@ function Summary({
46
46
  const { headers, labels, columns } = data;
47
47
 
48
48
  const extraColumnsData = columns.filter((_, index) => index !== 0);
49
-
50
49
  const rows = columns[0].map((row, index) => (
51
50
  <tr key={index}>
52
51
  {labels && <td className={`label`}>{labels[index]}</td>}
53
52
  <td className={`value`}>
54
- {row.includes('<!doctype html>') ? (
53
+ {typeof row === 'string' && row.includes('<!doctype html>') ? (
55
54
  <div
56
55
  className="emailMessage"
57
56
  dangerouslySetInnerHTML={{ __html: row }}
@@ -18,7 +18,6 @@ export * from './SubscriptionSummaryField';
18
18
  export * from './TextField';
19
19
  export * from './DateField';
20
20
  export * from './TimestampField';
21
- export * from './OrganisationField';
22
21
  export * from './ContactPersonNameField';
23
22
  export * from './ImsNodeIdField';
24
23
  export * from './ImsPortIdField';
@@ -29,3 +28,4 @@ export * from './OptGroupField';
29
28
  export * from './SubscriptionField';
30
29
  export * from './IpNetworkField';
31
30
  export * from './SummaryField';
31
+ export * from './CustomerField';
@@ -236,9 +236,13 @@ export const WfoProcessesList = ({
236
236
  return (
237
237
  <WfoTableWithFilter<ProcessListItem>
238
238
  queryString={queryString}
239
- data={mapGraphQlProcessListResultToProcessListItems(
240
- processes || [],
241
- )}
239
+ data={
240
+ !isFetching
241
+ ? mapGraphQlProcessListResultToProcessListItems(
242
+ processes || [],
243
+ )
244
+ : []
245
+ }
242
246
  tableColumns={mapSortableAndFilterableValuesToTableColumnConfig(
243
247
  tableColumns,
244
248
  pageInfo?.sortFields,
@@ -9,23 +9,23 @@ import { SubscriptionDetailTab } from './utils';
9
9
 
10
10
  export const subscriptionDetailTabs: WfoFilterTab<SubscriptionDetailTab>[] = [
11
11
  {
12
- id: SubscriptionDetailTab.GENERAL_TAB,
13
- translationKey: 'general',
12
+ id: SubscriptionDetailTab.SERVICE_CONFIGURATION_TAB,
13
+ translationKey: 'serviceConfiguration',
14
14
  prepend: (
15
15
  <EuiFlexGroup justifyContent={'center'}>
16
16
  <EuiFlexItem>
17
- <WfoCubeSolid width="18" height="18" color="currentColor" />
17
+ <WfoCogFill width="16" height="16" color="currentColor" />
18
18
  </EuiFlexItem>
19
19
  </EuiFlexGroup>
20
20
  ),
21
21
  },
22
22
  {
23
- id: SubscriptionDetailTab.SERVICE_CONFIGURATION_TAB,
24
- translationKey: 'serviceConfiguration',
23
+ id: SubscriptionDetailTab.GENERAL_TAB,
24
+ translationKey: 'general',
25
25
  prepend: (
26
26
  <EuiFlexGroup justifyContent={'center'}>
27
27
  <EuiFlexItem>
28
- <WfoCogFill width="16" height="16" color="currentColor" />
28
+ <WfoCubeSolid width="18" height="18" color="currentColor" />
29
29
  </EuiFlexItem>
30
30
  </EuiFlexGroup>
31
31
  ),
@@ -20,14 +20,7 @@ export const GET_PROCESS_DETAIL_GRAPHQL_QUERY: TypedDocumentNode<
20
20
  lastStep
21
21
  workflowName
22
22
  isTask
23
- form {
24
- additionalProperties
25
- definitions
26
- properties
27
- required
28
- title
29
- type
30
- }
23
+ form
31
24
  steps {
32
25
  name
33
26
  status
@@ -62,9 +62,9 @@
62
62
  "inputFieldsHaveValidationErrors": "{nrOfValidationErrors} input field(s) have validation errors"
63
63
  },
64
64
  "widgets": {
65
- "organisation": {
66
- "placeholder": "Org placeholder",
67
- "loading": "Loading organisations..."
65
+ "customer": {
66
+ "placeholder": "Customer placeholder",
67
+ "loading": "Loading customers..."
68
68
  },
69
69
  "contactPersonName": {
70
70
  "placeholder": "Name placeholder"
@@ -62,9 +62,9 @@
62
62
  "inputFieldsHaveValidationErrors": "{nrOfValidationErrors} input veldn(en) hebben validatie errors"
63
63
  },
64
64
  "widgets": {
65
- "organisation": {
66
- "placeholder": "Org placeholder",
67
- "loading": "Organisaties laden..."
65
+ "customer": {
66
+ "placeholder": "Klant placeholder",
67
+ "loading": "Klanten laden..."
68
68
  },
69
69
  "contactPersonName": {
70
70
  "placeholder": "Naam placeholder"
@@ -5,7 +5,13 @@ import Link from 'next/link';
5
5
  import { useRouter } from 'next/router';
6
6
  import { StringParam, useQueryParam, withDefault } from 'use-query-params';
7
7
 
8
- import { EuiButton, EuiSpacer } from '@elastic/eui';
8
+ import {
9
+ EuiButton,
10
+ EuiFlexGroup,
11
+ EuiFlexItem,
12
+ EuiPageHeader,
13
+ EuiSpacer,
14
+ } from '@elastic/eui';
9
15
 
10
16
  import {
11
17
  ACTIVE_TASKS_LIST_TABLE_LOCAL_STORAGE_KEY,
@@ -17,7 +23,6 @@ import {
17
23
  WfoTableColumns,
18
24
  } from '@/components';
19
25
  import { PATH_TASKS } from '@/components';
20
- import { WfoPageHeader } from '@/components/WfoPageHeader/WfoPageHeader';
21
26
  import {
22
27
  ProcessListItem,
23
28
  WfoProcessesList,
@@ -137,17 +142,27 @@ export const WfoTasksListPage = () => {
137
142
  <>
138
143
  <EuiSpacer />
139
144
 
140
- <WfoPageHeader pageTitle="Tasks">
141
- <EuiButton
142
- onClick={handleRerunAllButtonClick}
143
- iconType={() => (
144
- <WfoRefresh color={theme.colors.primaryText} />
145
- )}
146
- >
147
- {t('rerunAll')}
148
- </EuiButton>
149
- <WfoStartTaskButtonComboBox />
150
- </WfoPageHeader>
145
+ <EuiFlexGroup>
146
+ <EuiFlexItem>
147
+ <EuiPageHeader pageTitle="Tasks"></EuiPageHeader>
148
+ </EuiFlexItem>
149
+
150
+ <EuiFlexItem>
151
+ <EuiFlexGroup justifyContent="flexEnd">
152
+ {' '}
153
+ <EuiButton
154
+ onClick={handleRerunAllButtonClick}
155
+ iconType={() => (
156
+ <WfoRefresh color={theme.colors.primaryText} />
157
+ )}
158
+ >
159
+ {t('rerunAll')}
160
+ </EuiButton>
161
+ <WfoStartTaskButtonComboBox />
162
+ </EuiFlexGroup>
163
+ </EuiFlexItem>
164
+ </EuiFlexGroup>
165
+
151
166
  <WfoFilterTabs
152
167
  tabs={defaultTasksListTabs}
153
168
  translationNamespace="tasks.tabs"
@@ -6,9 +6,9 @@ const customersQuery = `query Customers {
6
6
  customers(first: 1000000, after: 0) {
7
7
  page {
8
8
  fullname
9
- identifier
9
+ customerId
10
10
  shortcode
11
- }:
11
+ }
12
12
  }
13
13
  }`;
14
14
 
@@ -1,8 +1,7 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import type { ReactNode } from 'react';
3
3
  import { Provider } from 'react-redux';
4
4
 
5
- import { useOrchestratorConfig } from '@/hooks';
6
5
  import type { OrchestratorConfig } from '@/types';
7
6
 
8
7
  import { getOrchestratorStore } from './store';
@@ -16,11 +15,8 @@ export const StoreProvider = ({
16
15
  initialOrchestratorConfig,
17
16
  children,
18
17
  }: StoreProviderProps) => {
19
- const { orchestratorConfig } = useOrchestratorConfig(
20
- initialOrchestratorConfig,
21
- );
18
+ const store = getOrchestratorStore(initialOrchestratorConfig);
19
+ const [orchestratorStore] = useState(store);
22
20
 
23
- const store = getOrchestratorStore(orchestratorConfig);
24
-
25
- return <Provider store={store}>{children}</Provider>;
21
+ return <Provider store={orchestratorStore}>{children}</Provider>;
26
22
  };
@@ -1,25 +0,0 @@
1
- import React, { FC, ReactNode } from 'react';
2
-
3
- import { EuiFlexGroup, EuiFlexItem, EuiPageHeader } from '@elastic/eui';
4
-
5
- export type WfoPageHeaderProps = {
6
- pageTitle: string;
7
- children?: ReactNode;
8
- };
9
-
10
- export const WfoPageHeader: FC<WfoPageHeaderProps> = ({
11
- pageTitle,
12
- children,
13
- }) => (
14
- <EuiFlexGroup>
15
- <EuiFlexItem>
16
- <EuiPageHeader pageTitle={pageTitle}></EuiPageHeader>
17
- </EuiFlexItem>
18
-
19
- {children && (
20
- <EuiFlexItem>
21
- <EuiFlexGroup justifyContent="flexEnd">{children}</EuiFlexGroup>
22
- </EuiFlexItem>
23
- )}
24
- </EuiFlexGroup>
25
- );