@rh-support/troubleshoot 2.7.35 → 2.7.36
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":"VerifyCaseStatusModal.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VerifyCaseStatusModal.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAYzE,UAAU,MAAM;IACZ,SAAS,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,qBA6HlD"}
|
|
@@ -7,16 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { useApolloClient } from '@apollo/client/react';
|
|
11
10
|
import { Button, ButtonVariant, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, } from '@patternfly/react-core';
|
|
12
11
|
import { SingleSelectDropdown, ToastNotification } from '@rh-support/components';
|
|
13
12
|
import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
|
|
13
|
+
import { getPortalStatusDropdownOptions, mapSfdcStatusToPortalStatus, resolvePortalStatusToApiValue, } from '@rh-support/utils';
|
|
14
14
|
import isEqual from 'lodash/isEqual';
|
|
15
|
-
import React, { useContext,
|
|
15
|
+
import React, { useContext, useMemo, useReducer, useState } from 'react';
|
|
16
16
|
import { Trans, useTranslation } from 'react-i18next';
|
|
17
17
|
import { useCaseDispatch, useCaseSelector } from '../../../../../context/CaseContext';
|
|
18
18
|
import { useCaseUpdateErrorMessage } from '../../../../../hooks/useCaseUpdateErrorMessage';
|
|
19
|
-
import { caseOverviewReducer,
|
|
19
|
+
import { caseOverviewReducer, initialCaseViewState, setStatusUpdating, } from '../../../../../reducers/CaseOverviewReducer';
|
|
20
20
|
import { updateCaseDetails } from '../../../../../reducers/CaseReducer';
|
|
21
21
|
export function VerifyCaseStatusModal(props) {
|
|
22
22
|
const { t } = useTranslation();
|
|
@@ -24,75 +24,59 @@ export function VerifyCaseStatusModal(props) {
|
|
|
24
24
|
const [caseOverviewState, caseOverviewDispatch] = useReducer(caseOverviewReducer, initialCaseViewState);
|
|
25
25
|
const caseState = useCaseSelector((state) => ({
|
|
26
26
|
caseDetails: {
|
|
27
|
-
product: state.caseDetails.product,
|
|
28
|
-
version: state.caseDetails.version,
|
|
29
27
|
status: state.caseDetails.status,
|
|
30
|
-
caseType: state.caseDetails.caseType,
|
|
31
|
-
createdDate: state.caseDetails.createdDate,
|
|
32
|
-
createdById: state.caseDetails.createdById,
|
|
33
|
-
ownerId: state.caseDetails.ownerId,
|
|
34
|
-
caseNumber: state.caseDetails.caseNumber,
|
|
35
|
-
cep: state.caseDetails.cep,
|
|
36
|
-
accountNumber: state.caseDetails.accountNumberRef,
|
|
37
|
-
firstCaseInactivityWarningSentAt: state.caseDetails.firstCaseInactivityWarningSentAt,
|
|
38
|
-
secondCaseInactivityWarningSentAt: state.caseDetails.secondCaseInactivityWarningSentAt,
|
|
39
28
|
},
|
|
40
29
|
isCaseUpdating: state.isCaseUpdating,
|
|
41
|
-
contactIsPartner: state.contactIsPartner,
|
|
42
|
-
hotfixRequested: state.hotfixRequested,
|
|
43
|
-
hotfixDelivered: state.hotfixDelivered,
|
|
44
|
-
selectedAccountDetails: state.selectedAccountDetails,
|
|
45
30
|
}), isEqual);
|
|
46
31
|
const { status } = caseState.caseDetails;
|
|
47
32
|
const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
48
|
-
const apolloClient = useApolloClient();
|
|
49
33
|
const canManageCase = loggedInUserRights.data.canManageCases();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
34
|
+
const isInternal = loggedInUserRights.data.isInternal();
|
|
35
|
+
const currentPortalStatus = useMemo(() => (status ? mapSfdcStatusToPortalStatus(status) : ''), [status]);
|
|
36
|
+
const isClosed = currentPortalStatus === 'Closed';
|
|
53
37
|
const { isCaseUpdating } = caseState;
|
|
54
38
|
const canEditCase = useCanEditCase();
|
|
55
39
|
const caseDispatch = useCaseDispatch();
|
|
56
|
-
const [
|
|
40
|
+
const [selectedPortalStatus, setSelectedPortalStatus] = useState(currentPortalStatus);
|
|
57
41
|
const [isVerifyCaseStatusLoading, setIsVerifyCaseStatusLoading] = useState(false);
|
|
58
42
|
const onSubmit = () => __awaiter(this, void 0, void 0, function* () {
|
|
59
43
|
yield props.onConfirm();
|
|
60
|
-
yield updateStatusState(
|
|
44
|
+
yield updateStatusState(selectedPortalStatus);
|
|
61
45
|
setIsVerifyCaseStatusLoading(true);
|
|
62
46
|
});
|
|
63
|
-
const updateStatusState = (
|
|
64
|
-
if (
|
|
65
|
-
setStatusUpdating(caseOverviewDispatch, true);
|
|
66
|
-
try {
|
|
67
|
-
yield updateCaseDetails(caseDispatch, props.caseNumber, { status: statusVal });
|
|
68
|
-
setStatusUpdating(caseOverviewDispatch, false);
|
|
69
|
-
onStatusUpdate && (yield onStatusUpdate());
|
|
70
|
-
ToastNotification.addSuccessMessage(t('Status has been successfully updated'));
|
|
71
|
-
}
|
|
72
|
-
catch (e) {
|
|
73
|
-
setStatusUpdating(caseOverviewDispatch, false);
|
|
74
|
-
caseUpdateError.showFieldError(e, t('Status'), () => updateStatusState(statusVal, onStatusUpdate));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
47
|
+
const updateStatusState = (portalStatusVal_1, ...args_1) => __awaiter(this, [portalStatusVal_1, ...args_1], void 0, function* (portalStatusVal, onStatusUpdate = null) {
|
|
48
|
+
if (currentPortalStatus === portalStatusVal)
|
|
78
49
|
return;
|
|
50
|
+
const apiValue = resolvePortalStatusToApiValue(portalStatusVal, status);
|
|
51
|
+
setStatusUpdating(caseOverviewDispatch, true);
|
|
52
|
+
try {
|
|
53
|
+
yield updateCaseDetails(caseDispatch, props.caseNumber, { status: apiValue });
|
|
54
|
+
setStatusUpdating(caseOverviewDispatch, false);
|
|
55
|
+
if (onStatusUpdate)
|
|
56
|
+
yield onStatusUpdate();
|
|
57
|
+
ToastNotification.addSuccessMessage(t('Status has been successfully updated'));
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
setStatusUpdating(caseOverviewDispatch, false);
|
|
61
|
+
caseUpdateError.showFieldError(e, t('Status'), () => updateStatusState(portalStatusVal, onStatusUpdate));
|
|
79
62
|
}
|
|
80
63
|
});
|
|
81
64
|
const onStatusChange = (selectedOption) => __awaiter(this, void 0, void 0, function* () {
|
|
82
65
|
if (canEditCase.alert())
|
|
83
66
|
return;
|
|
84
|
-
|
|
67
|
+
if (selectedOption.disabled)
|
|
68
|
+
return;
|
|
69
|
+
setSelectedPortalStatus(selectedOption.value);
|
|
85
70
|
});
|
|
86
|
-
// Create selected option for SingleSelectDropdown
|
|
87
71
|
const getSelectedOption = () => ({
|
|
88
|
-
label: t(
|
|
89
|
-
value:
|
|
72
|
+
label: t(selectedPortalStatus || currentPortalStatus),
|
|
73
|
+
value: selectedPortalStatus || currentPortalStatus,
|
|
90
74
|
});
|
|
91
|
-
|
|
92
|
-
const getDropdownOptions = () =>
|
|
93
|
-
label: t(
|
|
94
|
-
value:
|
|
95
|
-
disabled:
|
|
75
|
+
const statusOptions = getPortalStatusDropdownOptions(isClosed, isInternal);
|
|
76
|
+
const getDropdownOptions = () => statusOptions.map((opt) => ({
|
|
77
|
+
label: t(opt.value),
|
|
78
|
+
value: opt.value,
|
|
79
|
+
disabled: opt.disabled,
|
|
96
80
|
}));
|
|
97
81
|
return (React.createElement(Modal, { id: "case-close-modal", title: t(`Please verify this case's status`), "aria-describedby": "case-close-modal", isOpen: true, onClose: props.onClose, variant: ModalVariant.medium },
|
|
98
82
|
React.createElement(ModalHeader, null,
|
|
@@ -100,9 +84,7 @@ export function VerifyCaseStatusModal(props) {
|
|
|
100
84
|
React.createElement(Trans, null, "Status"),
|
|
101
85
|
React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"))),
|
|
102
86
|
React.createElement(ModalBody, null,
|
|
103
|
-
React.createElement(SingleSelectDropdown, { ariaLabel: t(
|
|
104
|
-
caseOverviewState.allCaseStatuses.isFetching ||
|
|
105
|
-
(caseOverviewState.caseStatusUpdating && isCaseUpdating), isInvalid: !status, placeholder: t(status) })),
|
|
87
|
+
React.createElement(SingleSelectDropdown, { ariaLabel: t(currentPortalStatus), id: "verify-case-status", selected: getSelectedOption(), options: getDropdownOptions(), onSelect: onStatusChange, isDisabled: !canManageCase || (caseOverviewState.caseStatusUpdating && isCaseUpdating), isInvalid: !status, placeholder: t(currentPortalStatus) })),
|
|
106
88
|
React.createElement(ModalFooter, null,
|
|
107
89
|
React.createElement(Button, { key: "submit-description", variant: ButtonVariant.primary, onClick: onSubmit, isLoading: isVerifyCaseStatusLoading, isDisabled: props.isUpdating, "data-tracking-id": "close-case-description-modal-submit" },
|
|
108
90
|
React.createElement(Trans, null, "Continue")),
|
package/lib/esm/css/case.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.36",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"@progress/kendo-licensing": "1.3.5",
|
|
53
53
|
"@progress/kendo-react-pdf": "^5.16.0",
|
|
54
54
|
"@redux-devtools/extension": "^3.3.0",
|
|
55
|
-
"@rh-support/components": "2.6.
|
|
56
|
-
"@rh-support/react-context": "2.6.
|
|
55
|
+
"@rh-support/components": "2.6.32",
|
|
56
|
+
"@rh-support/react-context": "2.6.34",
|
|
57
57
|
"@rh-support/types": "2.0.31",
|
|
58
58
|
"@rh-support/user-permissions": "2.6.29",
|
|
59
59
|
"@rh-support/utils": "2.6.28",
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
"defaults and supports es6-module",
|
|
130
130
|
"maintained node versions"
|
|
131
131
|
],
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "872788369fcbc6755ab025758c43dde299c1863c"
|
|
133
133
|
}
|