@orchestrator-ui/orchestrator-ui-components 5.5.1 → 5.5.3

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": "5.5.1",
3
+ "version": "5.5.3",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Library of UI Components used to display the workflow orchestrator frontend",
6
6
  "author": {
@@ -48,7 +48,7 @@
48
48
  "next-query-params": "^5.0.0",
49
49
  "object-hash": "^3.0.0",
50
50
  "prism-themes": "^1.9.0",
51
- "pydantic-forms": "^0.7.3",
51
+ "pydantic-forms": "^0.8.0",
52
52
  "react-diff-view": "^3.2.0",
53
53
  "react-draggable": "^4.4.6",
54
54
  "react-redux": "^9.1.2",
@@ -18,7 +18,7 @@ import { FieldProps, connectField, filterDOMProps } from 'uniforms';
18
18
 
19
19
  import { EuiFlexItem, EuiFormRow, EuiText } from '@elastic/eui';
20
20
 
21
- import { getStyles } from '@/components/WfoForms/formFields/SummaryFieldStyling';
21
+ import { summaryFieldStyles } from '@/components/WfoForms/formFields/SummaryFieldStyling';
22
22
  import { getCommonFormFieldStyles } from '@/components/WfoForms/formFields/commonStyles';
23
23
  import { useWithOrchestratorTheme } from '@/hooks';
24
24
 
@@ -38,7 +38,7 @@ function Summary({
38
38
  data,
39
39
  ...props
40
40
  }: SummaryFieldProps) {
41
- const { summaryFieldStyle } = useWithOrchestratorTheme(getStyles);
41
+ const { summaryFieldStyle } = useWithOrchestratorTheme(summaryFieldStyles);
42
42
  const { formRowStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
43
43
 
44
44
  if (!data) {
@@ -2,7 +2,7 @@ import { css } from '@emotion/react';
2
2
 
3
3
  import { WfoTheme } from '@/hooks';
4
4
 
5
- export const getStyles = ({ theme }: WfoTheme) => {
5
+ export const summaryFieldStyles = ({ theme }: WfoTheme) => {
6
6
  const summaryFieldStyle = css({
7
7
  'div.emailMessage': {
8
8
  td: {
@@ -26,3 +26,4 @@ export * from './ConnectedSelectField';
26
26
  export * from './deprecated/FileUploadField';
27
27
  export * from './commonStyles';
28
28
  export * from './types';
29
+ export * from './SummaryFieldStyling';
@@ -341,6 +341,7 @@ export const WfoPydanticForm = ({
341
341
  labelProvider: pydanticLabelProvider,
342
342
  rowRenderer: Row,
343
343
  customTranslations: customTranslations,
344
+ loadingComponent: <WfoLoading />,
344
345
  locale: getLocale(),
345
346
  };
346
347
  }, [
@@ -353,10 +354,9 @@ export const WfoPydanticForm = ({
353
354
 
354
355
  return (
355
356
  <PydanticForm
356
- id={processName}
357
+ formKey={processName}
357
358
  onSuccess={onSuccess}
358
359
  onCancel={handleCancel}
359
- loadingComponent={<WfoLoading />}
360
360
  config={config}
361
361
  />
362
362
  );
@@ -66,9 +66,9 @@ export const PlusButton = ({
66
66
  export const WfoArrayField = ({
67
67
  pydanticFormField,
68
68
  }: PydanticFormElementProps) => {
69
- const { config, rhf } = usePydanticFormContext();
69
+ const { config, reactHookForm } = usePydanticFormContext();
70
70
  const disabled = pydanticFormField.attributes?.disabled || false;
71
- const { control } = rhf;
71
+ const { control } = reactHookForm;
72
72
  const { id: arrayName, arrayItem } = pydanticFormField;
73
73
  const { minItems, maxItems } = pydanticFormField.validations;
74
74
  const { container, fieldWrapper } = getWfoArrayFieldStyles();
@@ -2,6 +2,7 @@ import { css } from '@emotion/react';
2
2
 
3
3
  export const getWfoArrayFieldStyles = () => {
4
4
  const container = css({
5
+ border: 'thin solid #eee',
5
6
  padding: '1rem',
6
7
  display: 'flex',
7
8
  flexDirection: 'column',
@@ -17,6 +18,7 @@ export const getWfoArrayFieldStyles = () => {
17
18
  const minusButton = css({
18
19
  width: '40px',
19
20
  cursor: 'pointer',
21
+ marginBottom: '12px',
20
22
  });
21
23
 
22
24
  const plusButtonWrapper = css({
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import ReactSelect, { components } from 'react-select';
3
3
  import type { GroupBase, InputProps } from 'react-select';
4
4
 
@@ -33,10 +33,20 @@ export const WfoReactSelect = <ValueType,>({
33
33
  hasError = false,
34
34
  refetch,
35
35
  }: WfoReactSelectProps<ValueType>) => {
36
- const selectedValue = options.find(
36
+ useEffect(() => {
37
+ const selectedValue = options.find(
38
+ (option: Option<ValueType>) => option.value === value,
39
+ );
40
+ setSelectedValue(selectedValue || null);
41
+ }, [options, value]);
42
+
43
+ const initialValue = options.find(
37
44
  (option: Option<ValueType>) => option.value === value,
38
45
  );
39
46
 
47
+ const [selectedValue, setSelectedValue] =
48
+ React.useState<Option<ValueType> | null>(initialValue || null);
49
+
40
50
  // React select allows callbacks to supply style for innercomponents: https://react-select.com/styles#inner-components
41
51
  const {
42
52
  reactSelectInnerComponentStyles,
@@ -79,8 +89,17 @@ export const WfoReactSelect = <ValueType,>({
79
89
  id={id}
80
90
  inputId={`${id}.search`}
81
91
  onChange={(option) => {
82
- const selectedValue = option?.value;
83
- onChange(selectedValue);
92
+ if (option === null) {
93
+ // By default reactSelect reverts to the initial option when cleared
94
+ // this is to make sure we can also deselect the value after it is
95
+ // initialized from error state for example.
96
+ setSelectedValue(null);
97
+ onChange(undefined);
98
+ } else {
99
+ const selectedValue = option?.value;
100
+ setSelectedValue(option);
101
+ onChange(selectedValue);
102
+ }
84
103
  }}
85
104
  css={reactSelectStyle}
86
105
  isLoading={isLoading}
@@ -1,59 +1,16 @@
1
1
  import React from 'react';
2
2
 
3
+ import { capitalize } from 'lodash';
3
4
  import type { PydanticFormElement } from 'pydantic-forms';
4
5
 
5
6
  import { EuiFlexItem, EuiFormRow, EuiText } from '@elastic/eui';
6
- import { tint } from '@elastic/eui';
7
- import { css } from '@emotion/react';
8
7
 
9
- import { getCommonFormFieldStyles } from '@/components';
10
- import { WfoTheme, useWithOrchestratorTheme } from '@/hooks';
11
-
12
- export const getStyles = ({ theme }: WfoTheme) => {
13
- const toShadeColor = (color: string) => tint(color, 0.9);
14
-
15
- const summaryFieldStyle = css({
16
- 'div.emailMessage': {
17
- td: {
18
- color: theme.colors.text,
19
- },
20
- p: {
21
- color: theme.colors.text,
22
- },
23
- html: {
24
- marginLeft: '-10px',
25
- },
26
- },
27
- 'section.table-summary': {
28
- marginTop: '20px',
29
- width: '100%',
30
- td: {
31
- padding: '10px',
32
- verticalAlign: 'top',
33
- },
34
- 'td:not(:first-child):not(:last-child)': {
35
- borderRight: `1px solid ${theme.colors.lightestShade}`,
36
- },
37
- '.label': {
38
- fontWeight: 'bold',
39
- color: theme.colors.lightestShade,
40
- backgroundColor: theme.colors.primary,
41
- borderRight: `2px solid ${theme.colors.lightestShade}`,
42
- borderBottom: `1px solid ${theme.colors.lightestShade}`,
43
- },
44
- '.value': {
45
- backgroundColor: toShadeColor(theme.colors.primary),
46
- borderBottom: `1px solid ${theme.colors.lightestShade}`,
47
- },
48
- },
49
- });
50
- return {
51
- summaryFieldStyle: summaryFieldStyle,
52
- };
53
- };
8
+ import { getCommonFormFieldStyles, summaryFieldStyles } from '@/components';
9
+ import { useWithOrchestratorTheme } from '@/hooks';
10
+ import { snakeToHuman } from '@/utils';
54
11
 
55
12
  export const WfoSummary: PydanticFormElement = ({ pydanticFormField }) => {
56
- const { summaryFieldStyle } = useWithOrchestratorTheme(getStyles);
13
+ const { summaryFieldStyle } = useWithOrchestratorTheme(summaryFieldStyles);
57
14
  const { formRowStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
58
15
 
59
16
  const { id, title, description } = pydanticFormField;
@@ -102,12 +59,14 @@ export const WfoSummary: PydanticFormElement = ({ pydanticFormField }) => {
102
59
  </tr>
103
60
  );
104
61
 
62
+ const formattedTitle = snakeToHuman(capitalize(title ?? ''));
63
+
105
64
  return (
106
65
  <EuiFlexItem data-testid={id} css={[summaryFieldStyle, formRowStyle]}>
107
66
  <section>
108
67
  <EuiFormRow
109
- label={description}
110
- labelAppend={<EuiText size="m">{title}</EuiText>}
68
+ label={<p className="label">{formattedTitle}</p>}
69
+ labelAppend={<EuiText size="m">{description}</EuiText>}
111
70
  id={id}
112
71
  fullWidth
113
72
  >
@@ -1 +1 @@
1
- export const ORCHESTRATOR_UI_LIBRARY_VERSION = '5.5.1';
1
+ export const ORCHESTRATOR_UI_LIBRARY_VERSION = '5.5.3';
@@ -388,8 +388,8 @@
388
388
  "tasks": {
389
389
  "page": {
390
390
  "taskName": "Task",
391
- "rerunAll": "Rerun all",
392
- "rerunAllQuestion": "Are you sure you want to rerun all failed tasks?"
391
+ "rerunAll": "Re-try all tasks",
392
+ "rerunAllQuestion": "Are you sure you want to re-try all failed tasks?"
393
393
  },
394
394
  "tabs": {
395
395
  "active": "Active",
@@ -385,8 +385,8 @@
385
385
  "tasks": {
386
386
  "page": {
387
387
  "taskName": "Taak",
388
- "rerunAll": "Alles opnieuw uitvoeren",
389
- "rerunAllQuestion": "Weet u zeker dat u alle gefaalde taken opnieuw wilt uitvoeren?"
388
+ "rerunAll": "Alle taken herstarten",
389
+ "rerunAllQuestion": "Weet u zeker dat u alle gefaalde taken opnieuw wilt herstarten?"
390
390
  },
391
391
  "tabs": {
392
392
  "active": "Actief",
@@ -452,6 +452,7 @@
452
452
  "hamburgerMenu": {
453
453
  "support": "Support",
454
454
  "softwareVersions": "Software Versies",
455
- "logout": "Logout"
455
+ "logout": "Logout",
456
+ "aoStatusPage": "A&O applicatie status pagina"
456
457
  }
457
458
  }