@rh-support/cases 0.2.20 → 0.2.21
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/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +14 -6
- package/lib/esm/utils/caseListUtils.d.ts +1 -1
- package/lib/esm/utils/caseListUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseListUtils.js +16 -7
- package/lib/esm/utils/mockSolrResponse.d.ts +42 -0
- package/lib/esm/utils/mockSolrResponse.d.ts.map +1 -0
- package/lib/esm/utils/mockSolrResponse.js +2685 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAyBlC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAyBlC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAKH,0BAA0B,EAK7B,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,mBAAmB,EAAe,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAK1C,OAAO,EAAgB,WAAW,EAA2B,MAAM,uBAAuB,CAAC;AA4B3F,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC3D,YAAY,EAAE,cAAc,EAAE,CAAC;CAClC;AAED,oBAAY,YAAY,GAAG,0BAA0B,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;AAM5F,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,eA0arC"}
|
|
@@ -9,14 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import '../../css/caseList.css';
|
|
11
11
|
import '../../css/caseSearch.css';
|
|
12
|
-
import { Button } from '@patternfly/react-core';
|
|
12
|
+
import { Alert, AlertVariant, Button } from '@patternfly/react-core';
|
|
13
13
|
import AngleDoubleDownIcon from '@patternfly/react-icons/dist/js/icons/angle-double-down-icon';
|
|
14
14
|
import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/js/icons/angle-double-left-icon';
|
|
15
15
|
import AngleDoubleRightIcon from '@patternfly/react-icons/dist/js/icons/angle-double-right-icon';
|
|
16
16
|
import AngleDoubleUpIcon from '@patternfly/react-icons/dist/js/icons/angle-double-up-icon';
|
|
17
17
|
import { ErrorBoundary, ToastNotification, useBreakpoint, useDocumentTitle, useForceUpdate, usePrevious, } from '@rh-support/components';
|
|
18
18
|
import { fetchCaseGroupsForSSO, fetchCaseTypes, GlobalMetadataDispatchContext, GlobalMetadataStateContext, setUserPreferences, updateUserPreferences, UserPreferencesKeys, } from '@rh-support/react-context';
|
|
19
|
-
import { getStringifiedParams, getUrlParsedParams, haventLoadedMetadata, pendoTrackEvent, solrResponseToFacetFields, solrResponseToPivotFields, } from '@rh-support/utils';
|
|
19
|
+
import { getConfigField, getStringifiedParams, getUrlParsedParams, haventLoadedMetadata, PCM_CONFIG_FIELD_TYPE, pendoTrackEvent, solrResponseToFacetFields, solrResponseToPivotFields, } from '@rh-support/utils';
|
|
20
20
|
import every from 'lodash/every';
|
|
21
21
|
import get from 'lodash/get';
|
|
22
22
|
import some from 'lodash/some';
|
|
@@ -45,10 +45,10 @@ export function CaseList(props) {
|
|
|
45
45
|
const { t } = useTranslation();
|
|
46
46
|
useDocumentTitle(PageTitle.CASE_LIST);
|
|
47
47
|
const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
|
|
48
|
-
const { caseList, pivotValues, isFetching, filterValuesFromFacetResponse, currentQuery
|
|
48
|
+
const { caseList, pivotValues, isFetching, filterValuesFromFacetResponse, currentQuery } = useCaseListStateContext();
|
|
49
49
|
const CaseListDispatch = useCaseListDispatchContext();
|
|
50
50
|
const breakPoint = useBreakpoint();
|
|
51
|
-
const { globalMetadataState, globalMetadataState: { caseGroups, loggedInUserJwtToken, loggedInUserRights, loggedInUsersAccount, userPreferences, managedAccounts, bookmarkedAccounts, bookmarkedGroupAccounts, allCaseTypes, }, } = useContext(GlobalMetadataStateContext);
|
|
51
|
+
const { globalMetadataState, globalMetadataState: { caseGroups, loggedInUserJwtToken, loggedInUserRights, loggedInUsersAccount, userPreferences, managedAccounts, bookmarkedAccounts, bookmarkedGroupAccounts, allCaseTypes, pcmConfig, }, } = useContext(GlobalMetadataStateContext);
|
|
52
52
|
const location = useLocation();
|
|
53
53
|
const searchParams = getUrlParsedParams(location.search);
|
|
54
54
|
const queryFromUrl = searchParams[FILTER_URL_QUERY_SEARCH_PARAM];
|
|
@@ -68,6 +68,7 @@ export function CaseList(props) {
|
|
|
68
68
|
const prevSearchType = usePrevious(filterState.filterQueryInfo.type);
|
|
69
69
|
let isSearchTypeChanged = filterState.filterQueryInfo.type !== prevSearchType;
|
|
70
70
|
const [hasError, setHasError] = useState(null);
|
|
71
|
+
const alwaysUseSFDC = getConfigField(pcmConfig.data, 'alwaysUseSFDC', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
|
|
71
72
|
// sfdc call should be called only when we don't have any filter applied
|
|
72
73
|
const forceSfdcSearch = () => every(filterState.filterInfo, (filter) => filter.length === 0);
|
|
73
74
|
function getCases(currentFilterState) {
|
|
@@ -82,7 +83,7 @@ export function CaseList(props) {
|
|
|
82
83
|
// recreate a new AbortController for each call
|
|
83
84
|
let controller = new AbortController();
|
|
84
85
|
abortControllerRef.current = controller;
|
|
85
|
-
const res = yield getCaseList(currentFilterState, loggedInUserRights.data, loggedInUsersAccount.data, controller.signal, forceSfdcSearch());
|
|
86
|
+
const res = yield getCaseList(currentFilterState, loggedInUserRights.data, loggedInUsersAccount.data, controller.signal, forceSfdcSearch(), alwaysUseSFDC);
|
|
86
87
|
setFilterValuesFromFacetResponse(CaseListDispatch, solrResponseToFacetFields(res));
|
|
87
88
|
setPivotValues(CaseListDispatch, solrResponseToPivotFields(res));
|
|
88
89
|
setCaseList(CaseListDispatch, res.response);
|
|
@@ -129,7 +130,7 @@ export function CaseList(props) {
|
|
|
129
130
|
};
|
|
130
131
|
const checkNewCases = () => __awaiter(this, void 0, void 0, function* () {
|
|
131
132
|
try {
|
|
132
|
-
const res = yield getCaseList(filterState, loggedInUserRights.data, loggedInUsersAccount.data, null, forceSfdcSearch());
|
|
133
|
+
const res = yield getCaseList(filterState, loggedInUserRights.data, loggedInUsersAccount.data, null, forceSfdcSearch(), alwaysUseSFDC);
|
|
133
134
|
let changed = false;
|
|
134
135
|
if (res.response.numFound <= filterState.paginationInfo.pageSize &&
|
|
135
136
|
res.response.numFound !== caseList.numFound) {
|
|
@@ -279,6 +280,13 @@ export function CaseList(props) {
|
|
|
279
280
|
}, [breakPoint]);
|
|
280
281
|
return (React.createElement("article", { id: "rh-support-cases", className: "cases-main" },
|
|
281
282
|
React.createElement("section", { className: "case-search-top" },
|
|
283
|
+
alwaysUseSFDC && (React.createElement("div", null,
|
|
284
|
+
React.createElement(Alert, { className: "pf-u-mb-md", isInline: true, variant: AlertVariant.warning, title: React.createElement(Trans, null,
|
|
285
|
+
"Case search is working with limited functionality. Please check",
|
|
286
|
+
' ',
|
|
287
|
+
React.createElement("a", { href: "https://status.redhat.com", target: "_blank", rel: "noreferrer" }, "status page"),
|
|
288
|
+
' ',
|
|
289
|
+
"for details.") }))),
|
|
282
290
|
React.createElement("div", { className: "search-wrapper" },
|
|
283
291
|
React.createElement("div", { className: "open-case" },
|
|
284
292
|
React.createElement(NewCaseButton, { routeProps: props.routeProps })),
|
|
@@ -8,6 +8,6 @@ export interface IPromiseReflection<T> {
|
|
|
8
8
|
status: 'fulfilled' | 'rejected';
|
|
9
9
|
e?: Error;
|
|
10
10
|
}
|
|
11
|
-
export declare function getCaseList(filterState: ICaseListFilterState, loggedInUser: UserAuth, loggedInUserAccount: Partial<IAccount>, abortSignal: AbortSignal, forceSfdcSearch?: boolean): Promise<ISolrCaseSearchResponse>;
|
|
11
|
+
export declare function getCaseList(filterState: ICaseListFilterState, loggedInUser: UserAuth, loggedInUserAccount: Partial<IAccount>, abortSignal: AbortSignal, forceSfdcSearch?: boolean, alwaysUseSFDC?: boolean): Promise<ISolrCaseSearchResponse>;
|
|
12
12
|
export declare function getCaseListFromSolr(solrQuery: ISearchSolrQuery, partnerSearch: boolean, abortSignal: AbortSignal, isSecureSupport?: boolean): Promise<ISolrCaseSearchResponse>;
|
|
13
13
|
//# sourceMappingURL=caseListUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseListUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"caseListUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAIxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAuC,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAQlG,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACjC,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;IACjC,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAoBD,wBAAsB,WAAW,CAC7B,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,QAAQ,EACtB,mBAAmB,EAAE,OAAO,CAAC,QAAQ,CAAC,EACtC,WAAW,EAAE,WAAW,EACxB,eAAe,CAAC,EAAE,OAAO,EACzB,aAAa,UAAQ,GACtB,OAAO,CAAC,uBAAuB,CAAC,CA4ClC;AAED,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,gBAAgB,EAC3B,aAAa,EAAE,OAAO,EACtB,WAAW,EAAE,WAAW,EACxB,eAAe,GAAE,OAAe,GACjC,OAAO,CAAC,uBAAuB,CAAC,CASlC"}
|
|
@@ -19,8 +19,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
21
|
import { publicApi, search } from '@cee-eng/hydrajs';
|
|
22
|
+
import isEmpty from 'lodash/isEmpty';
|
|
22
23
|
import { isNoFilterApplied, isSearchSupportedBySFDC } from '../components/case-list/CaseListFilterHelpers';
|
|
23
24
|
import { createSFDCQueryFromFilterState, createSolrQueryFromFilterState, mapSFDCCaseListToSolrCaseList, } from './caseSearchUtils';
|
|
25
|
+
import { mockSolrResponse } from './mockSolrResponse';
|
|
24
26
|
const reflect = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
27
|
try {
|
|
26
28
|
const v = yield p;
|
|
@@ -39,26 +41,33 @@ const reflect = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
39
41
|
// and override the solr result with sfdc.
|
|
40
42
|
// Even though SFDC support most of the filters but another problem with SFDC is it doesnot support multiple values for a praticular filter.
|
|
41
43
|
// if user applies any filter apart from default filter we will always call solr and assume that(not safely) 10 sec scenario is not bound to happen.
|
|
42
|
-
export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abortSignal, forceSfdcSearch) {
|
|
44
|
+
export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abortSignal, forceSfdcSearch, alwaysUseSFDC = false) {
|
|
43
45
|
var _a, _b, _c, _d;
|
|
44
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
47
|
const solrFilter = createSolrQueryFromFilterState(filterState, loggedInUser);
|
|
46
48
|
const isSfdcSearchRequired = ((forceSfdcSearch || isSearchSupportedBySFDC(filterState)) && !filterState.filterQueryInfo.queryString) ||
|
|
47
49
|
loggedInUserAccount.secureSupport;
|
|
48
50
|
const partnerSearch = loggedInUser.hasManagedAccounts() && ((_b = (_a = filterState.filterInfo) === null || _a === void 0 ? void 0 : _a.case_accountNumber) !== null && _b !== void 0 ? _b : []).length > 0;
|
|
49
|
-
|
|
51
|
+
let solrPromise = Promise.resolve(undefined);
|
|
52
|
+
if (!alwaysUseSFDC) {
|
|
53
|
+
solrPromise = getCaseListFromSolr(solrFilter, partnerSearch, abortSignal, loggedInUserAccount === null || loggedInUserAccount === void 0 ? void 0 : loggedInUserAccount.secureSupport);
|
|
54
|
+
}
|
|
50
55
|
let sfdcPromise;
|
|
51
|
-
|
|
56
|
+
const needToUseSFDC = isSfdcSearchRequired || alwaysUseSFDC;
|
|
57
|
+
if (needToUseSFDC) {
|
|
52
58
|
const sfdcFilter = createSFDCQueryFromFilterState(filterState, loggedInUser, loggedInUserAccount, isNoFilterApplied(filterState));
|
|
53
59
|
sfdcPromise = publicApi.caseList.getCaseListFromSFDC(sfdcFilter, partnerSearch, loggedInUserAccount === null || loggedInUserAccount === void 0 ? void 0 : loggedInUserAccount.secureSupport, abortSignal);
|
|
54
60
|
}
|
|
55
61
|
const res = yield Promise.all([solrPromise, sfdcPromise].filter((item) => !!item).map(reflect));
|
|
56
|
-
|
|
62
|
+
let solrResponse = res[0];
|
|
63
|
+
if (isEmpty(solrResponse === null || solrResponse === void 0 ? void 0 : solrResponse.v) && alwaysUseSFDC) {
|
|
64
|
+
solrResponse.v = mockSolrResponse;
|
|
65
|
+
}
|
|
57
66
|
const sfdcResponse = res[1];
|
|
58
|
-
if (solrResponse.status === 'rejected') {
|
|
59
|
-
throw new Error(solrResponse.e.message);
|
|
67
|
+
if ((solrResponse === null || solrResponse === void 0 ? void 0 : solrResponse.status) === 'rejected') {
|
|
68
|
+
throw new Error(solrResponse === null || solrResponse === void 0 ? void 0 : solrResponse.e.message);
|
|
60
69
|
}
|
|
61
|
-
if (
|
|
70
|
+
if (needToUseSFDC && sfdcResponse) {
|
|
62
71
|
if (sfdcResponse.status === 'fulfilled') {
|
|
63
72
|
const mappedSfdcRes = sfdcResponse && mapSFDCCaseListToSolrCaseList((_d = (_c = sfdcResponse === null || sfdcResponse === void 0 ? void 0 : sfdcResponse.v) === null || _c === void 0 ? void 0 : _c.cases) !== null && _d !== void 0 ? _d : []);
|
|
64
73
|
solrResponse.v.response.docs = mappedSfdcRes;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const mockSolrResponse: {
|
|
2
|
+
response: {
|
|
3
|
+
numFound: number;
|
|
4
|
+
start: number;
|
|
5
|
+
docs: any[];
|
|
6
|
+
};
|
|
7
|
+
responseHeader: {
|
|
8
|
+
zkConnected: boolean;
|
|
9
|
+
status: number;
|
|
10
|
+
QTime: number;
|
|
11
|
+
params: {};
|
|
12
|
+
};
|
|
13
|
+
facet_counts: {
|
|
14
|
+
facet_queries: {};
|
|
15
|
+
facet_fields: {
|
|
16
|
+
case_product: (string | number)[];
|
|
17
|
+
case_severity: (string | number)[];
|
|
18
|
+
case_status: (string | number)[];
|
|
19
|
+
};
|
|
20
|
+
facet_ranges: {};
|
|
21
|
+
facet_intervals: {};
|
|
22
|
+
facet_heatmaps: {};
|
|
23
|
+
facet_pivot: {
|
|
24
|
+
'case_product,case_version': ({
|
|
25
|
+
field: string;
|
|
26
|
+
value: string;
|
|
27
|
+
count: number;
|
|
28
|
+
pivot: {
|
|
29
|
+
field: string;
|
|
30
|
+
value: string;
|
|
31
|
+
count: number;
|
|
32
|
+
}[];
|
|
33
|
+
} | {
|
|
34
|
+
field: string;
|
|
35
|
+
value: string;
|
|
36
|
+
count: number;
|
|
37
|
+
pivot?: undefined;
|
|
38
|
+
})[];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=mockSolrResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockSolrResponse.d.ts","sourceRoot":"","sources":["../../../src/utils/mockSolrResponse.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4nF5B,CAAC"}
|