@orchestrator-ui/orchestrator-ui-components 0.8.0 → 0.8.1

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@0.8.0 build
2
+ > @orchestrator-ui/orchestrator-ui-components@0.8.1 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.13 MB
12
- ESM ⚡️ Build success in 854ms
13
- DTS ⚡️ Build success in 13905ms
14
- DTS dist/index.d.ts 114.15 KB
12
+ ESM ⚡️ Build success in 747ms
13
+ DTS ⚡️ Build success in 11913ms
14
+ DTS dist/index.d.ts 114.18 KB
@@ -1,4 +1,4 @@
1
1
 
2
- > @orchestrator-ui/orchestrator-ui-components@0.8.0 lint
2
+ > @orchestrator-ui/orchestrator-ui-components@0.8.1 lint
3
3
  > eslint "src/**/*.ts*"
4
4
 
@@ -1,32 +1,32 @@
1
1
 
2
- > @orchestrator-ui/orchestrator-ui-components@0.8.0 test
2
+ > @orchestrator-ui/orchestrator-ui-components@0.8.1 test
3
3
  > jest
4
4
 
5
5
  PASS Orchestrator UI Components Tests src/pages/processes/timelineUtils.spec.ts
6
6
  PASS Orchestrator UI Components Tests src/components/WfoForms/formFields/utils.spec.ts
7
7
  PASS Orchestrator UI Components Tests src/utils/date.spec.ts
8
- PASS Orchestrator UI Components Tests src/utils/getProductNamesFromProcess.spec.ts
9
8
  PASS Orchestrator UI Components Tests src/components/WfoSubscription/utils/utils.spec.ts
10
9
  PASS Orchestrator UI Components Tests src/components/WfoTable/WfoDataGridTable/WfodataGridColumns.spec.ts
10
+ PASS Orchestrator UI Components Tests src/utils/getProductNamesFromProcess.spec.ts
11
+ PASS Orchestrator UI Components Tests src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts
11
12
  PASS Orchestrator UI Components Tests src/components/WfoTree/treeUtils.spec.ts
12
13
  PASS Orchestrator UI Components Tests src/components/WfoTable/utils/tableConfigPersistence.spec.ts
13
- PASS Orchestrator UI Components Tests src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts
14
14
  PASS Orchestrator UI Components Tests src/utils/string.spec.ts
15
15
  PASS Orchestrator UI Components Tests src/components/WfoTable/utils/tableUtils.spec.ts
16
16
  PASS Orchestrator UI Components Tests src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.spec.ts
17
17
  PASS Orchestrator UI Components Tests src/messages/getTranslationMessages.spec.ts
18
18
  PASS Orchestrator UI Components Tests src/components/WfoTable/utils/columns.spec.ts
19
19
  PASS Orchestrator UI Components Tests src/utils/sortObjectKeys.spec.ts
20
- PASS Orchestrator UI Components Tests src/utils/getTokenName.spec.ts
21
20
  PASS Orchestrator UI Components Tests src/components/WfoWorkflowSteps/stepListUtils.spec.ts
22
21
  PASS Orchestrator UI Components Tests src/utils/environmentVariables.spec.ts
23
- PASS Orchestrator UI Components Tests src/utils/getTypedFieldFromObject.spec.ts
22
+ PASS Orchestrator UI Components Tests src/utils/getTokenName.spec.ts
24
23
  PASS Orchestrator UI Components Tests src/utils/uuid.spec.ts
25
- PASS Orchestrator UI Components Tests src/utils/getQueryVariablesForExport.spec.ts
24
+ PASS Orchestrator UI Components Tests src/utils/getTypedFieldFromObject.spec.ts
26
25
  PASS Orchestrator UI Components Tests src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.spec.ts
26
+ PASS Orchestrator UI Components Tests src/utils/getQueryVariablesForExport.spec.ts
27
27
 
28
28
  Test Suites: 22 passed, 22 total
29
29
  Tests: 131 passed, 131 total
30
30
  Snapshots: 0 total
31
- Time: 4.819 s
31
+ Time: 4.306 s
32
32
  Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @orchestrator-ui/orchestrator-ui-components
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5224527: 721: Fix customer select not being disabled
8
+ - 16f32ad: 651: Fix incorrect port select options
9
+ - 84a75b7: Change service port select label when root subscription instance has title
10
+
3
11
  ## 0.8.0
4
12
 
5
13
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1336,6 +1336,7 @@ interface IProps {
1336
1336
  preselectedInput?: unknown;
1337
1337
  formKey: string;
1338
1338
  handleSubmit: (userInputs: any) => void;
1339
+ handleCancel?: () => void;
1339
1340
  }
1340
1341
  declare function CreateForm(props: IProps): _emotion_react_jsx_runtime.JSX.Element;
1341
1342
 
package/dist/index.js CHANGED
@@ -34571,7 +34571,7 @@ var getAxiosInstance = (apiPath, accessToken) => {
34571
34571
  };
34572
34572
 
34573
34573
  // src/api/index.ts
34574
- var FORMS_ENDPOINT = "surf/forms/";
34574
+ var CIM_FORMS_ENDPOINT = "surf/cim/forms/";
34575
34575
  var PROCESS_ENDPOINT = "processes/";
34576
34576
  var PRODUCTS_ENDPOINT = "products/";
34577
34577
  var BaseApiClient = class {
@@ -34644,7 +34644,7 @@ var ApiClient = class extends ApiClientInterface {
34644
34644
  };
34645
34645
  this.cimStartForm = (formKey, userInputs) => {
34646
34646
  return this.postPutJson(
34647
- `${FORMS_ENDPOINT}${formKey}`,
34647
+ `${CIM_FORMS_ENDPOINT}${formKey}`,
34648
34648
  userInputs,
34649
34649
  "post",
34650
34650
  false,
@@ -50949,19 +50949,18 @@ var getStyles10 = (theme) => {
50949
50949
  // src/components/WfoForms/formFields/utils.ts
50950
50950
  import { isDate as isDate2 } from "moment";
50951
50951
  var getPortMode = (productBlockInstances) => {
50952
- const portMode = productBlockInstances == null ? void 0 : productBlockInstances.reduce(
50953
- (portMode2, productBlockInstance) => {
50952
+ return productBlockInstances == null ? void 0 : productBlockInstances.reduce(
50953
+ (portMode, productBlockInstance) => {
50954
50954
  const portModeField = productBlockInstance.productBlockInstanceValues.find(
50955
50955
  (productBlockInstanceValue) => productBlockInstanceValue.field === "portMode"
50956
50956
  );
50957
- if (portModeField) {
50957
+ if (!portMode && portModeField) {
50958
50958
  return portModeField.value;
50959
50959
  }
50960
- return portMode2;
50960
+ return portMode;
50961
50961
  },
50962
50962
  void 0
50963
50963
  );
50964
- return portMode;
50965
50964
  };
50966
50965
  var isEmpty = (obj) => {
50967
50966
  if (obj === void 0 || obj === null) {
@@ -51864,7 +51863,7 @@ import {
51864
51863
 
51865
51864
  // src/hooks/surf/useGetSubscriptionDropdownOptions.ts
51866
51865
  import { isError as isError2 } from "react-query";
51867
- var useGetSubscriptionDropdownOptions = (tags = [], statuses = []) => {
51866
+ var useGetSubscriptionDropdownOptions = (tags = [], statuses = ["active"]) => {
51868
51867
  const tagValue = tags.join("-");
51869
51868
  const statusValue = statuses.join("-");
51870
51869
  const filters = [];
@@ -52027,6 +52026,12 @@ function SubscriptionFieldDefinition(_a) {
52027
52026
  "IRBSP" /* IRBSP */
52028
52027
  ].includes(subscription.product.tag)) {
52029
52028
  const portMode = getPortMode(subscription.productBlockInstances);
52029
+ const subscriptionTitle = subscription.productBlockInstances[0].productBlockInstanceValues.find(
52030
+ (item) => item.field === "title"
52031
+ );
52032
+ if (subscriptionTitle) {
52033
+ return `${subscriptionSubstring} - ${description2.trim()} - ${subscriptionTitle.value}`;
52034
+ }
52030
52035
  return `${subscriptionSubstring} ${portMode == null ? void 0 : portMode.toUpperCase()} ${description2.trim()} ${(_a2 = subscription.customer) == null ? void 0 : _a2.fullname}`;
52031
52036
  } else {
52032
52037
  return description2.trim();
@@ -52999,7 +53004,7 @@ function Customer(_a) {
52999
53004
  __spreadProps(__spreadValues({}, props), {
53000
53005
  allowedValues: Array.from(uuidCustomerNameMap.keys()),
53001
53006
  transform: (uuid) => uuidCustomerNameMap.get(uuid) || uuid,
53002
- disabled: isLoading,
53007
+ disabled: isLoading || props.disabled,
53003
53008
  placeholder: !isLoading ? t("widgets.customer.placeholder") : t("widgets.customer.loading")
53004
53009
  })
53005
53010
  );
@@ -53554,7 +53559,7 @@ function UserInputForm({
53554
53559
  color: (_f = buttons2.next.color) != null ? _f : "primary",
53555
53560
  isLoading: processing,
53556
53561
  type: "submit",
53557
- iconType: () => /* @__PURE__ */ jsx130(WfoPlayFill, { color: "#FFF" }),
53562
+ iconType: buttons2.next.text ? void 0 : () => /* @__PURE__ */ jsx130(WfoPlayFill, { color: "#FFF" }),
53558
53563
  iconSide: "right",
53559
53564
  children: (_g = buttons2.next.text) != null ? _g : t(nextButtonTranslationKey)
53560
53565
  }
@@ -53688,7 +53693,7 @@ var UserInputFormWizard_default = UserInputFormWizard;
53688
53693
  // src/components/WfoForms/CreateForm.tsx
53689
53694
  import { jsx as jsx132 } from "@emotion/react/jsx-runtime";
53690
53695
  function CreateForm(props) {
53691
- const { preselectedInput, formKey, handleSubmit } = props;
53696
+ const { preselectedInput, formKey, handleSubmit, handleCancel } = props;
53692
53697
  const [form, setForm] = useState26({});
53693
53698
  const { stepUserInput, hasNext } = form;
53694
53699
  const apiClient = useAxiosApiClient();
@@ -53720,7 +53725,7 @@ function CreateForm(props) {
53720
53725
  {
53721
53726
  stepUserInput,
53722
53727
  validSubmit: submit,
53723
- cancel: () => alert("cancelled"),
53728
+ cancel: handleCancel,
53724
53729
  hasNext: hasNext != null ? hasNext : false,
53725
53730
  isTask: false
53726
53731
  }
@@ -55686,7 +55691,14 @@ var WfoProcessDetail = ({
55686
55691
  const router = useRouter9();
55687
55692
  const { isEngineRunningNow } = useCheckEngineStatus();
55688
55693
  const listIncludesStatus = (processStatusesForDisabledState, status) => status ? processStatusesForDisabledState.map((stat) => stat.toUpperCase()).includes(status) : false;
55689
- const retryButtonIsDisabled = buttonsAreDisabled || !listIncludesStatus(["failed" /* FAILED */], processDetail == null ? void 0 : processDetail.lastStatus);
55694
+ const retryButtonIsDisabled = buttonsAreDisabled || !listIncludesStatus(
55695
+ [
55696
+ "failed" /* FAILED */,
55697
+ "api_unavailable" /* API_UNAVAILABLE */,
55698
+ "inconsistent_data" /* INCONSISTENT_DATA */
55699
+ ],
55700
+ processDetail == null ? void 0 : processDetail.lastStatus
55701
+ );
55690
55702
  const abortButtonIsDisabled = buttonsAreDisabled || listIncludesStatus(
55691
55703
  ["completed" /* COMPLETED */, "aborted" /* ABORTED */],
55692
55704
  processDetail == null ? void 0 : processDetail.lastStatus
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestrator-ui/orchestrator-ui-components",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "test": "jest",
package/src/api/index.ts CHANGED
@@ -19,11 +19,12 @@ import {
19
19
  IpBlock,
20
20
  IpPrefix,
21
21
  NodeSubscription,
22
- } from '../components/WfoForms/formFields/surf/types';
23
- import { ProductDefinition } from '../types';
22
+ } from '@/components/WfoForms/formFields/surf/types';
23
+ import { ProductDefinition } from '@/types';
24
+
24
25
  import { getAxiosInstance } from './axios';
25
26
 
26
- const FORMS_ENDPOINT = 'surf/forms/';
27
+ const CIM_FORMS_ENDPOINT = 'surf/cim/forms/';
27
28
  const PROCESS_ENDPOINT = 'processes/';
28
29
  const PRODUCTS_ENDPOINT = 'products/';
29
30
 
@@ -146,7 +147,7 @@ export class ApiClient extends ApiClientInterface {
146
147
  userInputs: object[],
147
148
  ): Promise<{ id: string }> => {
148
149
  return this.postPutJson(
149
- `${FORMS_ENDPOINT}${formKey}`,
150
+ `${CIM_FORMS_ENDPOINT}${formKey}`,
150
151
  userInputs,
151
152
  'post',
152
153
  false,
@@ -14,7 +14,8 @@
14
14
  */
15
15
  import React, { useCallback, useEffect, useState } from 'react';
16
16
 
17
- import { Form, FormNotCompleteResponse } from '../../types/forms';
17
+ import { Form, FormNotCompleteResponse } from '@/types/forms';
18
+
18
19
  import UserInputFormWizard from './UserInputFormWizard';
19
20
  import { useAxiosApiClient } from './useAxiosApiClient';
20
21
 
@@ -23,10 +24,11 @@ interface IProps {
23
24
  preselectedInput?: unknown;
24
25
  formKey: string;
25
26
  handleSubmit: (userInputs: any) => void;
27
+ handleCancel?: () => void;
26
28
  }
27
29
 
28
30
  export function CreateForm(props: IProps) {
29
- const { preselectedInput, formKey, handleSubmit } = props;
31
+ const { preselectedInput, formKey, handleSubmit, handleCancel } = props;
30
32
  const [form, setForm] = useState<Form>({});
31
33
  const { stepUserInput, hasNext } = form;
32
34
  const apiClient = useAxiosApiClient();
@@ -61,7 +63,7 @@ export function CreateForm(props: IProps) {
61
63
  <UserInputFormWizard
62
64
  stepUserInput={stepUserInput}
63
65
  validSubmit={submit}
64
- cancel={() => alert('cancelled')}
66
+ cancel={handleCancel}
65
67
  hasNext={hasNext ?? false}
66
68
  isTask={false}
67
69
  />
@@ -559,7 +559,11 @@ function UserInputForm({
559
559
  color={buttons.next.color ?? 'primary'}
560
560
  isLoading={processing}
561
561
  type="submit"
562
- iconType={() => <WfoPlayFill color="#FFF" />}
562
+ iconType={
563
+ buttons.next.text
564
+ ? undefined
565
+ : () => <WfoPlayFill color="#FFF" />
566
+ }
563
567
  iconSide="right"
564
568
  >
565
569
  {buttons.next.text ?? t(nextButtonTranslationKey)}
@@ -44,7 +44,7 @@ function Customer({ ...props }: CustomerFieldProps) {
44
44
  {...props}
45
45
  allowedValues={Array.from(uuidCustomerNameMap.keys())}
46
46
  transform={(uuid: string) => uuidCustomerNameMap.get(uuid) || uuid}
47
- disabled={isLoading}
47
+ disabled={isLoading || props.disabled}
48
48
  placeholder={
49
49
  !isLoading
50
50
  ? t('widgets.customer.placeholder')
@@ -166,6 +166,13 @@ function SubscriptionFieldDefinition({
166
166
  ].includes(subscription.product.tag as ProductTag)
167
167
  ) {
168
168
  const portMode = getPortMode(subscription.productBlockInstances);
169
+ const subscriptionTitle =
170
+ subscription.productBlockInstances[0].productBlockInstanceValues.find(
171
+ (item) => item.field === 'title',
172
+ );
173
+ if (subscriptionTitle) {
174
+ return `${subscriptionSubstring} - ${description.trim()} - ${subscriptionTitle.value}`;
175
+ }
169
176
  return `${subscriptionSubstring} ${portMode?.toUpperCase()} ${description.trim()} ${
170
177
  subscription.customer?.fullname
171
178
  }`;
@@ -99,7 +99,7 @@ describe('formField utils', () => {
99
99
  expect(result).toEqual('NOTTAGGED');
100
100
  });
101
101
 
102
- it('returns undefined if the last portMode if there are more than one productBlockInstanceValue with portmode', () => {
102
+ it('returns the first portMode if there are more than one productBlockInstanceValue with portmode', () => {
103
103
  const result = getPortMode([
104
104
  getProductBlockInstance({
105
105
  productBlockInstanceValues: [
@@ -118,7 +118,7 @@ describe('formField utils', () => {
118
118
  ],
119
119
  }),
120
120
  ]);
121
- expect(result).toEqual('SECOND');
121
+ expect(result).toEqual('FIRST');
122
122
  });
123
123
 
124
124
  it('returns undefined if the productBlockInstances dont contain a portMode field', () => {
@@ -7,22 +7,20 @@ import { PortMode, ProductTag } from './surf/types';
7
7
  export const getPortMode = (
8
8
  productBlockInstances: ProductBlockInstance[],
9
9
  ): PortMode | undefined => {
10
- const portMode = productBlockInstances?.reduce(
10
+ return productBlockInstances?.reduce(
11
11
  (portMode: PortMode | undefined, productBlockInstance) => {
12
12
  const portModeField =
13
13
  productBlockInstance.productBlockInstanceValues.find(
14
14
  (productBlockInstanceValue) =>
15
15
  productBlockInstanceValue.field === 'portMode',
16
16
  );
17
- if (portModeField) {
17
+ if (!portMode && portModeField) {
18
18
  return portModeField.value as PortMode;
19
19
  }
20
20
  return portMode;
21
21
  },
22
22
  undefined,
23
23
  );
24
-
25
- return portMode;
26
24
  };
27
25
 
28
26
  export const isEmpty = (obj: unknown) => {
@@ -1,6 +1,6 @@
1
1
  import { useContext } from 'react';
2
2
 
3
- import { ApiClientContext } from '../../contexts';
3
+ import { ApiClientContext } from '@/contexts';
4
4
 
5
5
  export const useAxiosApiClient = () => {
6
6
  const { apiClient } = useContext(ApiClientContext);
@@ -1,9 +1,9 @@
1
1
  import React, { createContext, useContext } from 'react';
2
2
  import type { ReactNode } from 'react';
3
3
 
4
+ import { ApiClient, getApiClient } from '@/api';
4
5
  import { useSessionWithToken } from '@/hooks';
5
6
 
6
- import { ApiClient, getApiClient } from '../api';
7
7
  import { OrchestratorConfigContext } from './OrchestratorConfigContext';
8
8
 
9
9
  export interface ApiContext {
@@ -6,7 +6,7 @@ import { useQueryWithGraphql } from '../useQueryWithGraphql';
6
6
 
7
7
  export const useGetSubscriptionDropdownOptions = (
8
8
  tags: string[] = [],
9
- statuses: string[] = [],
9
+ statuses: string[] = ['active'],
10
10
  ) => {
11
11
  // The way the graphql filterBy clause on the backend handled multiple AND values is by joining them with -
12
12
  const tagValue = tags.join('-');
@@ -114,7 +114,14 @@ export const WfoProcessDetail = ({
114
114
 
115
115
  const retryButtonIsDisabled =
116
116
  buttonsAreDisabled ||
117
- !listIncludesStatus([ProcessStatus.FAILED], processDetail?.lastStatus);
117
+ !listIncludesStatus(
118
+ [
119
+ ProcessStatus.FAILED,
120
+ ProcessStatus.API_UNAVAILABLE,
121
+ ProcessStatus.INCONSISTENT_DATA,
122
+ ],
123
+ processDetail?.lastStatus,
124
+ );
118
125
  const abortButtonIsDisabled =
119
126
  buttonsAreDisabled ||
120
127
  listIncludesStatus(