@rh-support/manage 2.5.80 → 2.5.83

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 +1 @@
1
- {"version":3,"file":"Manage.d.ts","sourceRoot":"","sources":["../../src/Manage.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAK3B,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAS,mBAAmB,EAAU,MAAM,kBAAkB,CAAC;AAItE,MAAM,WAAW,qBAAqB;CAAG;AACzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;IACvD,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,SAAS,EAAE,GAAG,CAAC;QACf,oBAAoB,EAAE,GAAG,CAAC;QAC1B,MAAM,EAAE,GAAG,CAAC;QACZ,KAAK,EAAE,GAAG,CAAC;QACX,aAAa,EAAE;YACX,cAAc,EAAE,MAAM,CAAC;YACvB,OAAO,EAAE,MAAM,CAAC;SACnB,CAAC;KACL;IAED,UAAU,QAAQ;QACd,YAAY,EAAE,GAAG,CAAC;KACrB;IAED,UAAU,GAAG,CAAC;QACV,UAAU,iBAAkB,SAAQ,QAAQ;SAAG;KAClD;CACJ;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,qBAYnC"}
1
+ {"version":3,"file":"Manage.d.ts","sourceRoot":"","sources":["../../src/Manage.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAI3B,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAS,mBAAmB,EAAU,MAAM,kBAAkB,CAAC;AAItE,MAAM,WAAW,qBAAqB;CAAG;AACzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;IACvD,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,SAAS,EAAE,GAAG,CAAC;QACf,oBAAoB,EAAE,GAAG,CAAC;QAC1B,MAAM,EAAE,GAAG,CAAC;QACZ,KAAK,EAAE,GAAG,CAAC;QACX,aAAa,EAAE;YACX,cAAc,EAAE,MAAM,CAAC;YACvB,OAAO,EAAE,MAAM,CAAC;SACnB,CAAC;KACL;IAED,UAAU,QAAQ;QACd,YAAY,EAAE,GAAG,CAAC;KACrB;IAED,UAAU,GAAG,CAAC;QACV,UAAU,iBAAkB,SAAQ,QAAQ;SAAG;KAClD;CACJ;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,qBAYnC"}
package/lib/esm/Manage.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import './scss/index.scss';
2
- //test
3
2
  import { ConfirmationServiceProvider } from '@rh-support/components';
4
3
  import React from 'react';
5
4
  import { Route, Switch } from 'react-router-dom';
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigsTable.d.ts","sourceRoot":"","sources":["../../../../src/components/Configs/ConfigsTable.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,eAAO,MAAM,YAAY,yBA8JxB,CAAC"}
1
+ {"version":3,"file":"ConfigsTable.d.ts","sourceRoot":"","sources":["../../../../src/components/Configs/ConfigsTable.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAO/D,eAAO,MAAM,YAAY,yBAqLxB,CAAC"}
@@ -10,9 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { configuration, maintenance } from '@cee-eng/hydrajs';
11
11
  import { SearchInput } from '@patternfly/react-core';
12
12
  import { defaultTableSortMethod, ErrorBoundary, ToastNotification, useFetch } from '@rh-support/components/';
13
- import { formatDate } from '@rh-support/utils';
13
+ import { GlobalMetadataDispatchContext, GlobalMetadataReducerConstants } from '@rh-support/react-context';
14
+ import { formatDate, getApiResourceObject } from '@rh-support/utils';
14
15
  import isEmpty from 'lodash/isEmpty';
15
- import React, { useEffect, useState } from 'react';
16
+ import React, { useContext, useEffect, useState } from 'react';
16
17
  import { Trans, useTranslation } from 'react-i18next';
17
18
  import { ManageTable } from '../ManageTable/ManageTable';
18
19
  import { ConfigInLineEdit } from './ConfigInLineEdit';
@@ -23,6 +24,7 @@ export const ConfigsTable = () => {
23
24
  const [filteredValues, setFilteredValues] = useState([]);
24
25
  const [searchString, setSearchString] = useState('');
25
26
  const [keepPageNumberOnDataChange, setKeepPageNumberOnDataChange] = useState(undefined);
27
+ const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
26
28
  const { request: getConfigs, isFetching } = useFetch(configuration.getConfig);
27
29
  const { request: updateConfig, isFetching: isUpdating } = useFetch(maintenance.updateHydraConfiguration, {
28
30
  propgateErrors: true,
@@ -32,6 +34,23 @@ export const ConfigsTable = () => {
32
34
  setKeepPageNumberOnDataChange(false);
33
35
  setSearchString(str);
34
36
  };
37
+ // Function to reload all configs and update the global context
38
+ const reloadAndUpdateContext = () => __awaiter(void 0, void 0, void 0, function* () {
39
+ try {
40
+ const allConfigs = yield configuration.getConfig(configType);
41
+ setConfigValues(allConfigs);
42
+ setFilteredValues(allConfigs);
43
+ if (dispatchToGlobalMetadataReducer) {
44
+ dispatchToGlobalMetadataReducer({
45
+ type: GlobalMetadataReducerConstants.setPcmConfig,
46
+ payload: { pcmConfig: getApiResourceObject(allConfigs) },
47
+ });
48
+ }
49
+ }
50
+ catch (error) {
51
+ console.error('Failed to reload configurations', error);
52
+ }
53
+ });
35
54
  const onUpdate = (fieldName, fieldValue, id) => __awaiter(void 0, void 0, void 0, function* () {
36
55
  try {
37
56
  yield updateConfig({
@@ -49,6 +68,7 @@ export const ConfigsTable = () => {
49
68
  });
50
69
  setKeepPageNumberOnDataChange(true);
51
70
  setConfigValues(updatedData);
71
+ yield reloadAndUpdateContext();
52
72
  }
53
73
  catch (e) {
54
74
  ToastNotification.addDangerMessage('Failed to update config');
@@ -98,9 +118,11 @@ export const ConfigsTable = () => {
98
118
  ];
99
119
  useEffect(() => {
100
120
  const loadConfig = () => __awaiter(void 0, void 0, void 0, function* () {
101
- const data = yield getConfigs(configType);
102
- setConfigValues(data);
103
- setFilteredValues(data);
121
+ if (getConfigs) {
122
+ const data = yield getConfigs(configType);
123
+ setConfigValues(data);
124
+ setFilteredValues(data);
125
+ }
104
126
  });
105
127
  loadConfig();
106
128
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1 +1 @@
1
- {"version":3,"file":"RequestCollaborationModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/RequestCollaborationModal.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAK3D,UAAU,MAAM;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACrC;AAID,eAAO,MAAM,yBAAyB,UAAW,MAAM,sBAiPtD,CAAC"}
1
+ {"version":3,"file":"RequestCollaborationModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/RequestCollaborationModal.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAM3D,UAAU,MAAM;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACrC;AAID,eAAO,MAAM,yBAAyB,UAAW,MAAM,sBA8QtD,CAAC"}
@@ -14,6 +14,7 @@ import { ToastNotification, useCopyToClipboard } from '@rh-support/components';
14
14
  import isEmpty from 'lodash/isEmpty';
15
15
  import React, { useRef, useState } from 'react';
16
16
  import { Trans, useTranslation } from 'react-i18next';
17
+ import { PARTNERSHIP_LINK_LIMIT, PARTNERSHIP_LINK_LIMIT_EXCEED_ERROR } from '../../constants/PartnershipLink';
17
18
  import { useManagePartnershipsDispatchContext } from '../../context/ManagePartnershipsProvider';
18
19
  import { setIsUpdatingRequests } from '../../reducers/ManagePartnershipsReducer';
19
20
  export const RequestCollaborationModal = (props) => {
@@ -37,13 +38,16 @@ export const RequestCollaborationModal = (props) => {
37
38
  setLocalLinkName(link);
38
39
  setFriendlyName(link);
39
40
  setIsDuplicateLinkName(false);
40
- if (isEmpty(link.trim()) && nextButtonIsClicked) {
41
+ if ((isEmpty(link.trim()) && nextButtonIsClicked) || isInvalidPartnershipLink(link)) {
41
42
  setValidated('error');
42
43
  }
43
44
  else {
44
45
  setValidated('success');
45
46
  }
46
47
  };
48
+ const isInvalidPartnershipLink = (link) => {
49
+ return link.length > PARTNERSHIP_LINK_LIMIT;
50
+ };
47
51
  const handleKeyDown = (e) => __awaiter(void 0, void 0, void 0, function* () {
48
52
  if (validated !== 'error' && e.keyCode === 13) {
49
53
  onNext && onNext();
@@ -124,14 +128,23 @@ export const RequestCollaborationModal = (props) => {
124
128
  React.createElement(Form, { className: "pf-v6-u-mt-md" },
125
129
  React.createElement(Grid, { sm: 12, md: 12, lg: 12 },
126
130
  React.createElement(GridItem, null,
127
- React.createElement(FormGroup, { label: t('Name your link'), type: "string", fieldId: partnershipLinkId, isRequired: true },
128
- React.createElement(TextInput, { isRequired: true, className: showDone || isRequestingAgain ? 'request-collaboration-input' : '', value: localLinkName || props.sendReqAgainFriendlyName, id: partnershipLinkId, "aria-describedby": "age-1-helper", onChange: handleLinkNameChange, onKeyDown: handleKeyDown, placeholder: t('e.g. Customer name'), isDisabled: showDone || isRequestingAgain }),
131
+ React.createElement(FormGroup, { label: React.createElement(React.Fragment, null,
132
+ t('Name your link'),
133
+ React.createElement("span", { className: "form-required", "aria-hidden": "true" }, "*")), labelInfo: React.createElement("span", { className: isInvalidPartnershipLink(friendlyName)
134
+ ? 'pf-v6-u-text-color-status-danger'
135
+ : '' },
136
+ friendlyName.length,
137
+ "/",
138
+ PARTNERSHIP_LINK_LIMIT), type: "string", fieldId: partnershipLinkId },
139
+ React.createElement(TextInput, { isRequired: true, className: showDone || isRequestingAgain ? 'request-collaboration-input' : '', value: localLinkName || props.sendReqAgainFriendlyName, id: partnershipLinkId, "aria-describedby": "age-1-helper", onChange: handleLinkNameChange, onKeyDown: handleKeyDown, placeholder: t('e.g. Customer name'), isDisabled: showDone || isRequestingAgain, validated: isInvalidPartnershipLink(friendlyName) ? 'error' : 'default' }),
129
140
  React.createElement(FormHelperText, null,
130
141
  React.createElement(HelperText, null, validated !== 'error' ? (React.createElement(HelperTextItem, null,
131
142
  React.createElement(Trans, null, "Please enter a name for your request"))) : (React.createElement(HelperTextItem, { variant: "error" },
132
143
  React.createElement(Trans, null, isDuplicateLinkName
133
144
  ? t('Link name already used. Please enter a unique name')
134
- : t('Please enter a name for your request')))))))))),
145
+ : isInvalidPartnershipLink(friendlyName)
146
+ ? PARTNERSHIP_LINK_LIMIT_EXCEED_ERROR
147
+ : t('Please enter a name for your request')))))))))),
135
148
  showDone && (React.createElement(React.Fragment, null, !isRequestingAgain ? (React.createElement(React.Fragment, null,
136
149
  React.createElement("h4", { className: "label-text-size" },
137
150
  React.createElement("strong", null, "Copy and send")),
@@ -0,0 +1,3 @@
1
+ export declare const PARTNERSHIP_LINK_LIMIT = 50;
2
+ export declare const PARTNERSHIP_LINK_LIMIT_EXCEED_ERROR = "Customer name exceeds the 50-character limit. Please shorten it.";
3
+ //# sourceMappingURL=PartnershipLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PartnershipLink.d.ts","sourceRoot":"","sources":["../../../src/constants/PartnershipLink.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,mCAAmC,qEAAqE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const PARTNERSHIP_LINK_LIMIT = 50;
2
+ export const PARTNERSHIP_LINK_LIMIT_EXCEED_ERROR = 'Customer name exceeds the 50-character limit. Please shorten it.';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "2.5.80",
3
+ "version": "2.5.83",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "license": "ISC",
@@ -79,12 +79,12 @@
79
79
  "@patternfly/patternfly": "6.2.1",
80
80
  "@patternfly/react-core": "6.2.1",
81
81
  "@patternfly/react-table": "6.2.1",
82
- "@rh-support/components": "2.5.62",
82
+ "@rh-support/components": "2.5.65",
83
83
  "@rh-support/configs": "2.0.21",
84
- "@rh-support/react-context": "2.5.78",
84
+ "@rh-support/react-context": "2.5.81",
85
85
  "@rh-support/types": "2.0.5",
86
- "@rh-support/user-permissions": "2.5.29",
87
- "@rh-support/utils": "2.5.26",
86
+ "@rh-support/user-permissions": "2.5.32",
87
+ "@rh-support/utils": "2.5.28",
88
88
  "@types/react-beautiful-dnd": "^13.0.0",
89
89
  "i18next": "^23.15.0",
90
90
  "lodash": ">=4.17.15",
@@ -103,5 +103,5 @@
103
103
  "defaults and supports es6-module",
104
104
  "maintained node versions"
105
105
  ],
106
- "gitHead": "c5f0c0b18e82aff2ad923b11d474c44b75cb3d37"
106
+ "gitHead": "5bd0b48bd344b4362efb801ad01b96f0bba0df1a"
107
107
  }