@orchestrator-ui/orchestrator-ui-components 1.25.0 → 1.26.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @orchestrator-ui/orchestrator-ui-components@1.25.0 build
2
+ > @orchestrator-ui/orchestrator-ui-components@1.26.0 build
3
3
  > tsup src/index.ts --format esm --dts --tsconfig tsconfig.build.json
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -9,6 +9,6 @@
9
9
  ESM Build start
10
10
  DTS Build start
11
11
  ESM dist/index.js 2.15 MB
12
- ESM ⚡️ Build success in 925ms
13
- DTS ⚡️ Build success in 13888ms
14
- DTS dist/index.d.ts 173.36 KB
12
+ ESM ⚡️ Build success in 803ms
13
+ DTS ⚡️ Build success in 13528ms
14
+ DTS dist/index.d.ts 173.37 KB
@@ -1,5 +1,5 @@
1
1
 
2
- > @orchestrator-ui/orchestrator-ui-components@1.25.0 lint
2
+ > @orchestrator-ui/orchestrator-ui-components@1.26.0 lint
3
3
  > eslint "src/**/*.ts*"
4
4
 
5
5
 
@@ -1,19 +1,19 @@
1
1
 
2
- > @orchestrator-ui/orchestrator-ui-components@1.25.0 test
2
+ > @orchestrator-ui/orchestrator-ui-components@1.26.0 test
3
3
  > jest
4
4
 
5
- PASS Orchestrator UI Components Tests src/components/WfoSubscription/utils/utils.spec.ts
6
- PASS Orchestrator UI Components Tests src/components/WfoForms/formFields/utils.spec.ts
7
5
  PASS Orchestrator UI Components Tests src/utils/date.spec.ts
6
+ PASS Orchestrator UI Components Tests src/components/WfoForms/formFields/utils.spec.ts
7
+ PASS Orchestrator UI Components Tests src/components/WfoSubscription/utils/utils.spec.ts
8
8
  PASS Orchestrator UI Components Tests src/components/WfoTree/treeUtils.spec.ts
9
- PASS Orchestrator UI Components Tests src/pages/processes/timelineUtils.spec.ts
10
9
  PASS Orchestrator UI Components Tests src/utils/getProductNamesFromProcess.spec.ts
11
- PASS Orchestrator UI Components Tests src/components/WfoTable/WfoDataGridTable/WfodataGridColumns.spec.ts
10
+ PASS Orchestrator UI Components Tests src/pages/processes/timelineUtils.spec.ts
12
11
  PASS Orchestrator UI Components Tests src/utils/string.spec.ts
12
+ PASS Orchestrator UI Components Tests src/components/WfoTable/WfoDataGridTable/WfodataGridColumns.spec.ts
13
13
  PASS Orchestrator UI Components Tests src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts
14
- PASS Orchestrator UI Components Tests src/components/WfoTable/utils/tableUtils.spec.ts
15
14
  PASS Orchestrator UI Components Tests src/components/WfoTable/utils/tableConfigPersistence.spec.ts
16
15
  PASS Orchestrator UI Components Tests src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.spec.ts
16
+ PASS Orchestrator UI Components Tests src/components/WfoTable/utils/tableUtils.spec.ts
17
17
  PASS Orchestrator UI Components Tests src/utils/resultFlattener.spec.ts
18
18
  PASS Orchestrator UI Components Tests src/components/WfoPageTemplate/WfoSidebar/utils/menuItemIsAllowed.spec.ts
19
19
  PASS Orchestrator UI Components Tests src/messages/getTranslationMessages.spec.ts
@@ -23,17 +23,17 @@ PASS Orchestrator UI Components Tests src/utils/getEnvironmentVariables.spec.ts
23
23
  PASS Orchestrator UI Components Tests src/components/WfoTable/utils/columns.spec.ts
24
24
  PASS Orchestrator UI Components Tests src/utils/filterData.spec.ts
25
25
  PASS Orchestrator UI Components Tests src/utils/sortObjectKeys.spec.ts
26
- PASS Orchestrator UI Components Tests src/components/WfoWorkflowSteps/stepListUtils.spec.ts
27
26
  PASS Orchestrator UI Components Tests src/utils/getTokenName.spec.ts
28
- PASS Orchestrator UI Components Tests src/utils/environmentVariables.spec.ts
27
+ PASS Orchestrator UI Components Tests src/components/WfoWorkflowSteps/stepListUtils.spec.ts
29
28
  PASS Orchestrator UI Components Tests src/utils/onlyUnique.spec.ts
29
+ PASS Orchestrator UI Components Tests src/utils/environmentVariables.spec.ts
30
30
  PASS Orchestrator UI Components Tests src/utils/uuid.spec.ts
31
- PASS Orchestrator UI Components Tests src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.spec.ts
32
- PASS Orchestrator UI Components Tests src/utils/getQueryVariablesForExport.spec.ts
33
31
  PASS Orchestrator UI Components Tests src/utils/getTypedFieldFromObject.spec.ts
32
+ PASS Orchestrator UI Components Tests src/utils/getQueryVariablesForExport.spec.ts
33
+ PASS Orchestrator UI Components Tests src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.spec.ts
34
34
 
35
35
  Test Suites: 29 passed, 29 total
36
36
  Tests: 167 passed, 167 total
37
37
  Snapshots: 0 total
38
- Time: 3.979 s
38
+ Time: 4.002 s
39
39
  Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @orchestrator-ui/orchestrator-ui-components
2
2
 
3
+ ## 1.26.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3508ff8: Sort product block instance values by field name
8
+
9
+ ### Patch Changes
10
+
11
+ - 257ef6e: Added number type to parseDate function
12
+
3
13
  ## 1.25.0
4
14
 
5
15
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -4039,7 +4039,7 @@ declare const getCsvFileNameWithDate: (fileNameWithoutExtension: string) => stri
4039
4039
  declare const csvDownloadHandler: <T extends object, U extends object>(dataFetchFunction: () => Promise<T | undefined>, dataMapper: (data: T) => U[], pageInfoMapper: (data: T) => GraphQLPageInfo, keyOrder: string[], filename: string, addToastFunction: (type: ToastTypes, text: string, title: string) => void, translationFunction: (translationKey: string, variables?: TranslationValues | undefined) => string) => () => Promise<void>;
4040
4040
 
4041
4041
  declare const getCurrentBrowserLocale: () => string;
4042
- declare const parseDate: (date: string | null | undefined) => Date | null;
4042
+ declare const parseDate: (date: string | null | undefined | number) => Date | null;
4043
4043
  declare const calculateTimeDifference: (from: string, to: string) => string;
4044
4044
  declare const formatDate: (dateString: string | undefined | null) => string;
4045
4045
  declare const parseIsoString: (dateToStringParser: (date: Date | null) => string) => (date: string | null) => string;
package/dist/index.js CHANGED
@@ -46629,7 +46629,8 @@ var getStyles6 = (wfoTheme) => {
46629
46629
  });
46630
46630
  const leftColumnStyle = css10({
46631
46631
  width: 250,
46632
- flexShrink: 0
46632
+ flexShrink: 0,
46633
+ paddingTop: `${theme.base / 4}px`
46633
46634
  });
46634
46635
  const leftColumnStyleWithAlignSelf = css10({
46635
46636
  width: 250,
@@ -46770,6 +46771,16 @@ var WfoSubscriptionProductBlock = ({
46770
46771
  (productBlockInstanceValue) => !HIDDEN_KEYS.includes(
46771
46772
  productBlockInstanceValue.field
46772
46773
  )
46774
+ ).sort(
46775
+ ({ field: fieldNameA }, { field: fieldNameB }) => {
46776
+ if (fieldNameA < fieldNameB) {
46777
+ return -1;
46778
+ }
46779
+ if (fieldNameA > fieldNameB) {
46780
+ return 1;
46781
+ }
46782
+ return 0;
46783
+ }
46773
46784
  ).map((productBlockInstanceValue, index) => {
46774
46785
  if (productBlockInstanceValue && !isEmpty2(
46775
46786
  productBlockInstanceValue.value
@@ -55010,19 +55021,28 @@ var WfoStepForm = ({
55010
55021
  processId
55011
55022
  }) => {
55012
55023
  const [isProcessing, setIsProcessing] = useState35(false);
55024
+ const [hasError, setHasError] = useState35(false);
55013
55025
  const { theme } = useOrchestratorTheme();
55014
55026
  const [resumeProcess] = useResumeProcessMutation();
55015
55027
  const submitForm = (processInput) => {
55016
55028
  if (!processId) {
55017
55029
  return Promise.reject();
55018
55030
  }
55019
- return resumeProcess({ processId, userInputs: processInput }).then(
55020
- () => {
55021
- setIsProcessing(true);
55031
+ return resumeProcess({ processId, userInputs: processInput }).unwrap().then(() => {
55032
+ setIsProcessing(true);
55033
+ }).catch((error) => {
55034
+ if ((error == null ? void 0 : error.status) !== 510 /* FormNotComplete */) {
55035
+ if ((error == null ? void 0 : error.status) === 400 /* BadRequest */) {
55036
+ throw error;
55037
+ }
55038
+ console.error(error);
55039
+ setHasError(true);
55040
+ } else {
55041
+ throw error;
55022
55042
  }
55023
- );
55043
+ });
55024
55044
  };
55025
- return /* @__PURE__ */ jsx161(EuiFlexItem25, { css: { margin: theme.size.m }, children: isProcessing && /* @__PURE__ */ jsx161(WfoLoading, {}) || /* @__PURE__ */ jsx161(
55045
+ return /* @__PURE__ */ jsx161(EuiFlexItem25, { css: { margin: theme.size.m }, children: hasError && /* @__PURE__ */ jsx161(WfoError, {}) || isProcessing && /* @__PURE__ */ jsx161(WfoLoading, {}) || /* @__PURE__ */ jsx161(
55026
55046
  UserInputFormWizard,
55027
55047
  {
55028
55048
  stepUserInput: userInputForm,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestrator-ui/orchestrator-ui-components",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Library of UI Components used to display the workflow orchestrator frontend",
6
6
  "author": {
@@ -212,6 +212,20 @@ export const WfoSubscriptionProductBlock = ({
212
212
  productBlockInstanceValue.field,
213
213
  ),
214
214
  )
215
+ .sort(
216
+ (
217
+ { field: fieldNameA },
218
+ { field: fieldNameB },
219
+ ) => {
220
+ if (fieldNameA < fieldNameB) {
221
+ return -1;
222
+ }
223
+ if (fieldNameA > fieldNameB) {
224
+ return 1;
225
+ }
226
+ return 0;
227
+ },
228
+ )
215
229
  .map((productBlockInstanceValue, index) => {
216
230
  if (
217
231
  productBlockInstanceValue &&
@@ -36,6 +36,7 @@ export const getStyles = (wfoTheme: WfoTheme) => {
36
36
  const leftColumnStyle = css({
37
37
  width: 250,
38
38
  flexShrink: 0,
39
+ paddingTop: `${theme.base / 4}px`,
39
40
  });
40
41
 
41
42
  const leftColumnStyleWithAlignSelf = css({
@@ -2,8 +2,9 @@ import React, { useState } from 'react';
2
2
 
3
3
  import { EuiFlexItem } from '@elastic/eui';
4
4
 
5
- import { UserInputFormWizard, WfoLoading } from '@/components';
5
+ import { UserInputFormWizard, WfoError, WfoLoading } from '@/components';
6
6
  import { useOrchestratorTheme } from '@/hooks';
7
+ import { HttpStatus } from '@/rtk';
7
8
  import { useResumeProcessMutation } from '@/rtk/endpoints/forms';
8
9
  import { InputForm } from '@/types/forms';
9
10
 
@@ -19,6 +20,7 @@ export const WfoStepForm = ({
19
20
  processId,
20
21
  }: WfoStepFormProps) => {
21
22
  const [isProcessing, setIsProcessing] = useState<boolean>(false);
23
+ const [hasError, setHasError] = useState<boolean>(false);
22
24
  const { theme } = useOrchestratorTheme();
23
25
  const [resumeProcess] = useResumeProcessMutation();
24
26
 
@@ -27,16 +29,28 @@ export const WfoStepForm = ({
27
29
  return Promise.reject();
28
30
  }
29
31
 
30
- return resumeProcess({ processId, userInputs: processInput }).then(
31
- () => {
32
+ return resumeProcess({ processId, userInputs: processInput })
33
+ .unwrap()
34
+ .then(() => {
32
35
  setIsProcessing(true);
33
- },
34
- );
36
+ })
37
+ .catch((error) => {
38
+ if (error?.status !== HttpStatus.FormNotComplete) {
39
+ if (error?.status === HttpStatus.BadRequest) {
40
+ // Rethrow the error so userInputForm can catch it and display validation errors
41
+ throw error;
42
+ }
43
+ console.error(error);
44
+ setHasError(true);
45
+ } else {
46
+ throw error;
47
+ }
48
+ });
35
49
  };
36
50
 
37
51
  return (
38
52
  <EuiFlexItem css={{ margin: theme.size.m }}>
39
- {(isProcessing && <WfoLoading />) || (
53
+ {(hasError && <WfoError />) || (isProcessing && <WfoLoading />) || (
40
54
  <UserInputFormWizard
41
55
  stepUserInput={userInputForm}
42
56
  stepSubmit={submitForm}
package/src/utils/date.ts CHANGED
@@ -2,7 +2,9 @@ import { Locale } from '../types/types';
2
2
 
3
3
  export const getCurrentBrowserLocale = () => window.navigator.language;
4
4
 
5
- export const parseDate = (date: string | null | undefined): Date | null => {
5
+ export const parseDate = (
6
+ date: string | null | undefined | number,
7
+ ): Date | null => {
6
8
  if (date === null || date === undefined || date === '') {
7
9
  return null;
8
10
  }