@orchestrator-ui/orchestrator-ui-components 3.0.0 → 3.0.2

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": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Library of UI Components used to display the workflow orchestrator frontend",
6
6
  "author": {
@@ -18,6 +18,7 @@ import React, { useContext, useState } from 'react';
18
18
 
19
19
  import invariant from 'invariant';
20
20
  import { JSONSchema6 } from 'json-schema';
21
+ import { isObject } from 'lodash';
21
22
  import cloneDeep from 'lodash/cloneDeep';
22
23
  import get from 'lodash/get';
23
24
  import { useTranslations } from 'next-intl';
@@ -393,17 +394,29 @@ function fillPreselection(form: JSONSchema6, router: NextRouter) {
393
394
  // ipvany preselect
394
395
  if (queryParams.prefix && queryParams.prefixlen) {
395
396
  if (form && form.properties.ip_prefix) {
396
- const ipPrefixInput = form.properties
397
- .ip_prefix as UniformJSONSchemaProperty;
397
+ const ipPrefix = isObject(form.properties.ip_prefix)
398
+ ? form.properties.ip_prefix
399
+ : {};
400
+ const ipPrefixInput = {
401
+ ...ipPrefix,
402
+ uniforms: { prefixMin: 0 },
403
+ default: {},
404
+ } as UniformJSONSchemaProperty;
398
405
  if (!ipPrefixInput.uniforms) {
399
- ipPrefixInput.uniforms = {};
406
+ ipPrefixInput.uniforms = { prefixMin: 0 };
400
407
  }
401
408
  ipPrefixInput.default = `${queryParams.prefix}/${queryParams.prefixlen}`;
402
409
  ipPrefixInput.uniforms.prefixMin = parseInt(
403
- (queryParams.prefix_min as string) ??
404
- (queryParams.prefixlen as string),
410
+ queryParams.prefixlen as string,
405
411
  10,
406
412
  );
413
+ return {
414
+ ...form,
415
+ properties: {
416
+ ...form.properties,
417
+ ip_prefix: ipPrefixInput,
418
+ },
419
+ };
407
420
  }
408
421
  }
409
422
  }
@@ -1 +1 @@
1
- export const ORCHESTRATOR_UI_LIBRARY_VERSION = '3.0.0';
1
+ export const ORCHESTRATOR_UI_LIBRARY_VERSION = '3.0.2';
@@ -35,9 +35,15 @@ import { FormNotCompleteResponse } from '@/types/forms';
35
35
 
36
36
  import { WfoProcessDetail } from './WfoProcessDetail';
37
37
 
38
+ type PreselectedInput = {
39
+ prefix?: string;
40
+ prefixlen?: string;
41
+ };
42
+
38
43
  type StartCreateWorkflowPayload = {
39
44
  product: string;
40
- };
45
+ } & PreselectedInput;
46
+
41
47
  type StartModifyWorkflowPayload = {
42
48
  subscription_id: string;
43
49
  };
@@ -46,10 +52,10 @@ type StartWorkflowPayload =
46
52
  | StartCreateWorkflowPayload
47
53
  | StartModifyWorkflowPayload;
48
54
 
49
- interface StartProcessPageQuery {
55
+ type StartProcessPageQuery = {
50
56
  productId?: string;
51
57
  subscriptionId?: string;
52
- }
58
+ } & PreselectedInput;
53
59
 
54
60
  interface WfoStartProcessPageProps {
55
61
  processName: string;
@@ -65,15 +71,14 @@ const getInitialProcessPayload = ({
65
71
  productId,
66
72
  subscriptionId,
67
73
  }: StartProcessPageQuery): StartWorkflowPayload | undefined => {
68
- if (productId) {
69
- return {
70
- product: productId,
71
- };
72
- }
73
74
  if (subscriptionId) {
74
75
  return {
75
76
  subscription_id: subscriptionId,
76
77
  };
78
+ } else if (productId) {
79
+ return {
80
+ product: productId,
81
+ };
77
82
  }
78
83
  return undefined;
79
84
  };
@@ -108,8 +113,11 @@ export const WfoStartProcessPage = ({
108
113
  const [startProcess] = useStartProcessMutation();
109
114
 
110
115
  const startProcessPayload = useMemo(
111
- () => getInitialProcessPayload({ productId, subscriptionId }),
112
- [productId, subscriptionId],
116
+ () =>
117
+ getInitialProcessPayload({
118
+ productId,
119
+ }),
120
+ [productId],
113
121
  );
114
122
 
115
123
  const { stepUserInput, hasNext } = form;
@@ -2,11 +2,8 @@ import { debounce } from 'lodash';
2
2
  import { getSession } from 'next-auth/react';
3
3
 
4
4
  import type { WfoSession } from '@/hooks';
5
- import { addToastMessage } from '@/rtk/slices/toastMessages';
6
5
  import type { RootState } from '@/rtk/store';
7
- import { ToastTypes } from '@/types';
8
6
  import { CacheTag, CacheTagType } from '@/types';
9
- import { getToastMessage } from '@/utils/getToastMessage';
10
7
 
11
8
  import { orchestratorApi } from '../api';
12
9
 
@@ -66,12 +63,6 @@ const streamMessagesApi = orchestratorApi.injectEndpoints({
66
63
  },
67
64
  ) {
68
65
  const cleanUp = () => {
69
- const message = getToastMessage(
70
- ToastTypes.ERROR,
71
- 'Connection to the server was lost. Please click the websocket icon or refresh the page to reconnect.',
72
- 'WebSocket closed',
73
- );
74
- dispatch(addToastMessage(message));
75
66
  clearInterval(pingInterval);
76
67
  updateCachedData(() => false);
77
68
  };