@rh-support/cases 2.6.219 → 2.6.227
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/NewCaseButton.js +1 -1
- package/lib/esm/components/case-list/CaseList.d.ts +7 -0
- package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +135 -366
- package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListContext.js +2 -5
- package/lib/esm/components/case-list/CaseListFilterContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterContext.js +1 -2
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts +2 -3
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterHelpers.js +6 -19
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +4 -36
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.js +12 -6
- package/lib/esm/components/case-list/CaseListReducer.d.ts +10 -22
- package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListReducer.js +7 -25
- package/lib/esm/components/case-list/case-list-filters/AccountsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/AccountsFilter.js +11 -18
- package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.js +2 -6
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +7 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +16 -12
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +5 -2
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +13 -14
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.js +14 -21
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.js +0 -3
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts +1 -11
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.js +70 -90
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts +3 -1
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +2 -2
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts +4 -5
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +54 -15
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +3 -0
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +44 -18
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +3 -0
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +44 -14
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +3 -1
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +59 -60
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +3 -8
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/CaseListTable.js +55 -88
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +5 -0
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.js +70 -51
- package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +15 -5
- package/lib/esm/components/case-list/case-list-table/SeverityLabel.js +1 -1
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.js +3 -2
- package/lib/esm/components/case-list/case-list-table/table-column-selector/TableColumnSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/table-column-selector/TableColumnSelector.js +0 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +0 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.js +24 -55
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.js +1 -2
- package/lib/esm/css/caseList.css +22 -183
- package/lib/esm/css/caseSearch.css +0 -114
- package/lib/esm/enums/case.d.ts +5 -13
- package/lib/esm/enums/case.d.ts.map +1 -1
- package/lib/esm/enums/case.js +3 -23
- package/lib/esm/enums/caseSearch.d.ts +0 -3
- package/lib/esm/enums/caseSearch.d.ts.map +1 -1
- package/lib/esm/enums/caseSearch.js +1 -2
- package/lib/esm/enums/filters.d.ts +1 -3
- package/lib/esm/enums/filters.d.ts.map +1 -1
- package/lib/esm/enums/filters.js +0 -2
- package/lib/esm/hooks/useCloseCase.d.ts.map +1 -1
- package/lib/esm/hooks/useCloseCase.js +21 -38
- package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/hooks/useExportCaseListCSV.js +9 -1
- package/lib/esm/hooks/useFilterStateOnLoad.d.ts +1 -1
- package/lib/esm/hooks/useFilterStateOnLoad.d.ts.map +1 -1
- package/lib/esm/hooks/useFilterStateOnLoad.js +5 -7
- package/lib/esm/index.js +0 -1
- package/lib/esm/models/caseList.d.ts +0 -1
- package/lib/esm/models/caseList.d.ts.map +1 -1
- package/lib/esm/test-utils/mockData.d.ts +0 -1
- package/lib/esm/test-utils/mockData.d.ts.map +1 -1
- package/lib/esm/test-utils/mockData.js +1 -2
- package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseSearchUtils.js +2 -39
- package/lib/esm/utils/constants.d.ts +1 -5
- package/lib/esm/utils/constants.d.ts.map +1 -1
- package/lib/esm/utils/constants.js +2 -10
- package/lib/esm/utils/mockSolrResponse.js +1 -1
- package/package.json +8 -10
- package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts +0 -3
- package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.js +0 -177
- package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.d.ts +0 -9
- package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.js +0 -105
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts +0 -8
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.js +0 -8
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.js +0 -29
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.js +0 -16
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.js +0 -21
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts +0 -12
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.js +0 -31
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.js +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.js +0 -92
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.js +0 -20
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.js +0 -28
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.js +0 -241
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts +0 -11
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.js +0 -23
- package/lib/esm/hooks/useCaseLabels.d.ts +0 -14
- package/lib/esm/hooks/useCaseLabels.d.ts.map +0 -1
- package/lib/esm/hooks/useCaseLabels.js +0 -55
- package/lib/esm/utils/advanceSearchFormMapper.d.ts +0 -11
- package/lib/esm/utils/advanceSearchFormMapper.d.ts.map +0 -1
- package/lib/esm/utils/advanceSearchFormMapper.js +0 -71
- package/lib/esm/utils/advanceSearchUtils.d.ts +0 -24
- package/lib/esm/utils/advanceSearchUtils.d.ts.map +0 -1
- package/lib/esm/utils/advanceSearchUtils.js +0 -150
- package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts +0 -12
- package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseGroupDefaultFilterUtils.js +0 -34
- package/lib/esm/utils/caseGroupDefaultUtils.d.ts +0 -10
- package/lib/esm/utils/caseGroupDefaultUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseGroupDefaultUtils.js +0 -20
- package/lib/esm/utils/caseListGraphQLUtils.d.ts +0 -28
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseListGraphQLUtils.js +0 -280
- package/lib/esm/utils/caseListMapper.d.ts +0 -6
- package/lib/esm/utils/caseListMapper.d.ts.map +0 -1
- package/lib/esm/utils/caseListMapper.js +0 -44
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +0 -15
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +0 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +0 -517
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Button, Divider, ExpandableSection, Flex, FlexItem, ModalBody, ModalFooter, Stack, } from '@patternfly/react-core';
|
|
2
|
-
import { AbilityContext, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
3
|
-
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { Trans, useTranslation } from 'react-i18next';
|
|
5
|
-
import { createInitialAdvanceSearchFormState, hasInvalidAdvanceSearchDates, isAdvanceSearchFormEmpty, mapFilterStateToAdvanceSearchForm, } from '../../../../utils/advanceSearchUtils';
|
|
6
|
-
import { CaseListFilterStateContext } from '../../CaseListFilterContext';
|
|
7
|
-
import { AdvanceSearchAccountSection } from './AdvanceSearchAccountSection';
|
|
8
|
-
import { AdvanceSearchAuditsSection } from './AdvanceSearchAuditsSection';
|
|
9
|
-
import { AdvanceSearchCaseSection } from './AdvanceSearchCaseSection';
|
|
10
|
-
import { AdvanceSearchOwnerSection } from './AdvanceSearchOwnerSection';
|
|
11
|
-
import { AdvanceSearchProductSection } from './AdvanceSearchProductSection';
|
|
12
|
-
export function AdvanceSearchModal({ isOpen, onClose, onSearch }) {
|
|
13
|
-
const { t } = useTranslation();
|
|
14
|
-
const ability = useContext(AbilityContext);
|
|
15
|
-
const filterState = useContext(CaseListFilterStateContext);
|
|
16
|
-
const canReadAccounts = ability.can(resourceActions.READ, resources.ACCOUNTS_FILTER);
|
|
17
|
-
const canAccessProductsFilter = ability.can(resourceActions.PATCH, resources.CASE_LIST, CaseListFields.PRODUCTS_FILTER);
|
|
18
|
-
const [formState, setFormState] = useState(createInitialAdvanceSearchFormState);
|
|
19
|
-
const [isCaseSectionExpanded, setIsCaseSectionExpanded] = useState(true);
|
|
20
|
-
const [isProductSectionExpanded, setIsProductSectionExpanded] = useState(true);
|
|
21
|
-
const [isAccountSectionExpanded, setIsAccountSectionExpanded] = useState(true);
|
|
22
|
-
const [isOwnerSectionExpanded, setIsOwnerSectionExpanded] = useState(true);
|
|
23
|
-
const [isAuditsSectionExpanded, setIsAuditsSectionExpanded] = useState(true);
|
|
24
|
-
const [showDateValidationErrors, setShowDateValidationErrors] = useState(false);
|
|
25
|
-
const modalRef = useRef(null);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (isOpen) {
|
|
28
|
-
setFormState(mapFilterStateToAdvanceSearchForm(filterState));
|
|
29
|
-
setShowDateValidationErrors(false);
|
|
30
|
-
}
|
|
31
|
-
// Hydrate form only when the panel opens
|
|
32
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
-
}, [isOpen]);
|
|
34
|
-
const updateFormState = useCallback((updates) => {
|
|
35
|
-
setFormState((previousState) => (Object.assign(Object.assign({}, previousState), updates)));
|
|
36
|
-
}, []);
|
|
37
|
-
const handleClearAll = () => {
|
|
38
|
-
const clearedFormState = createInitialAdvanceSearchFormState();
|
|
39
|
-
setFormState(clearedFormState);
|
|
40
|
-
setShowDateValidationErrors(false);
|
|
41
|
-
onSearch(clearedFormState);
|
|
42
|
-
onClose();
|
|
43
|
-
};
|
|
44
|
-
const hasDateErrors = hasInvalidAdvanceSearchDates(formState);
|
|
45
|
-
const handleSearch = () => {
|
|
46
|
-
if (hasDateErrors) {
|
|
47
|
-
setShowDateValidationErrors(true);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
onSearch(formState);
|
|
51
|
-
onClose();
|
|
52
|
-
};
|
|
53
|
-
const isSearchDisabled = isAdvanceSearchFormEmpty(formState) || (showDateValidationErrors && hasDateErrors);
|
|
54
|
-
const handleBackdropMouseDown = (event) => {
|
|
55
|
-
if (modalRef.current && !modalRef.current.contains(event.target)) {
|
|
56
|
-
onClose();
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const sectionToggleLabel = (text) => (React.createElement("span", { className: "pf-v6-u-font-size-md pf-v6-u-font-weight-bold" }, text));
|
|
60
|
-
if (!isOpen) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
return (React.createElement(React.Fragment, null,
|
|
64
|
-
React.createElement("div", { className: "advance-search-modal-backdrop", onMouseDown: handleBackdropMouseDown, "aria-hidden": "true" }),
|
|
65
|
-
React.createElement("div", { ref: modalRef, role: "dialog", "aria-modal": "true", "aria-label": t('Advanced search'), className: "pf-v6-c-modal-box advance-search-modal", "data-tracking-id": "advance-search-modal" },
|
|
66
|
-
React.createElement(ModalBody, { className: "pf-v6-u-p-0" },
|
|
67
|
-
React.createElement(Stack, null,
|
|
68
|
-
React.createElement(ExpandableSection, { className: "advance-search-expandable-section", toggleContent: sectionToggleLabel(t('Case')), isExpanded: isCaseSectionExpanded, onToggle: (_event, expanded) => setIsCaseSectionExpanded(expanded) },
|
|
69
|
-
React.createElement(AdvanceSearchCaseSection, { formState: formState, onChange: updateFormState })),
|
|
70
|
-
canAccessProductsFilter && (React.createElement(ExpandableSection, { className: "advance-search-expandable-section", toggleContent: sectionToggleLabel(t('Product')), isExpanded: isProductSectionExpanded, onToggle: (_event, expanded) => setIsProductSectionExpanded(expanded) },
|
|
71
|
-
React.createElement(AdvanceSearchProductSection, { formState: formState, onChange: updateFormState }))),
|
|
72
|
-
React.createElement(ExpandableSection, { className: "advance-search-expandable-section", toggleContent: sectionToggleLabel(t('Account')), isExpanded: isAccountSectionExpanded, onToggle: (_event, expanded) => setIsAccountSectionExpanded(expanded) },
|
|
73
|
-
React.createElement(AdvanceSearchAccountSection, { formState: formState, onChange: updateFormState, canReadAccounts: canReadAccounts })),
|
|
74
|
-
React.createElement(ExpandableSection, { className: "advance-search-expandable-section", toggleContent: sectionToggleLabel(t('Case owner & assignment')), isExpanded: isOwnerSectionExpanded, onToggle: (_event, expanded) => setIsOwnerSectionExpanded(expanded) },
|
|
75
|
-
React.createElement(AdvanceSearchOwnerSection, { formState: formState, onChange: updateFormState })),
|
|
76
|
-
React.createElement(ExpandableSection, { className: "advance-search-expandable-section", toggleContent: sectionToggleLabel(t('Audits')), isExpanded: isAuditsSectionExpanded, onToggle: (_event, expanded) => setIsAuditsSectionExpanded(expanded) },
|
|
77
|
-
React.createElement(AdvanceSearchAuditsSection, { formState: formState, onChange: updateFormState, showDateValidationErrors: showDateValidationErrors })))),
|
|
78
|
-
React.createElement(Divider, null),
|
|
79
|
-
React.createElement(ModalFooter, { className: "pf-v6-u-p-0" },
|
|
80
|
-
React.createElement(Flex, { justifyContent: { default: 'justifyContentSpaceBetween' }, alignItems: { default: 'alignItemsCenter' }, className: "pf-v6-u-w-100 pf-v6-u-p-md" },
|
|
81
|
-
React.createElement(FlexItem, null,
|
|
82
|
-
React.createElement(Button, { variant: "tertiary", size: "sm", onClick: handleClearAll },
|
|
83
|
-
React.createElement(Trans, null, "Clear all"))),
|
|
84
|
-
React.createElement(FlexItem, null,
|
|
85
|
-
React.createElement(Flex, { spaceItems: { default: 'spaceItemsSm' } },
|
|
86
|
-
React.createElement(FlexItem, null,
|
|
87
|
-
React.createElement(Button, { variant: "secondary", size: "sm", onClick: onClose },
|
|
88
|
-
React.createElement(Trans, null, "Cancel"))),
|
|
89
|
-
React.createElement(FlexItem, null,
|
|
90
|
-
React.createElement(Button, { variant: "primary", size: "sm", onClick: handleSearch, isDisabled: isSearchDisabled, "data-tracking-id": "advance-search-modal-search-button" },
|
|
91
|
-
React.createElement(Trans, null, "Search"))))))))));
|
|
92
|
-
}
|
package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IAdvanceSearchFormState } from '../../CaseListFilterReducer';
|
|
3
|
-
interface IProps {
|
|
4
|
-
formState: IAdvanceSearchFormState;
|
|
5
|
-
onChange: (updates: Partial<IAdvanceSearchFormState>) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function AdvanceSearchOwnerSection({ formState, onChange }: IProps): React.JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=AdvanceSearchOwnerSection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AdvanceSearchOwnerSection.d.ts","sourceRoot":"","sources":["../../../../../../src/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAI1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAGtE,UAAU,MAAM;IACZ,SAAS,EAAE,uBAAuB,CAAC;IACnC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAC;CACjE;AAED,wBAAgB,yBAAyB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,MAAM,qBAwDxE"}
|
package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Button, Stack, TextInput } from '@patternfly/react-core';
|
|
2
|
-
import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
|
|
3
|
-
import { AbilityContext, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
4
|
-
import React, { useContext } from 'react';
|
|
5
|
-
import { Trans, useTranslation } from 'react-i18next';
|
|
6
|
-
import { GroupsFilter } from '../../case-list-filters/GroupsFilter';
|
|
7
|
-
import { AdvanceSearchFieldBlock } from './AdvanceSearchFieldBlock';
|
|
8
|
-
export function AdvanceSearchOwnerSection({ formState, onChange }) {
|
|
9
|
-
const { t } = useTranslation();
|
|
10
|
-
const ability = useContext(AbilityContext);
|
|
11
|
-
const canAccessGroupsFilter = ability.can(resourceActions.PATCH, resources.CASE_LIST, CaseListFields.GROUPS_FILTER);
|
|
12
|
-
const hasSelectedGroups = formState.groups.length > 0;
|
|
13
|
-
return (React.createElement(Stack, null,
|
|
14
|
-
React.createElement(AdvanceSearchFieldBlock, { label: React.createElement(Trans, null, "Enter owner name Or SSO") },
|
|
15
|
-
React.createElement(TextInput, { id: "advance-search-owner", type: "text", value: formState.ownerNameAndSso, onChange: (_event, value) => onChange({ ownerNameAndSso: value }), "aria-label": t('Owner name and SSO'), placeholder: t('Owner name & SSO') })),
|
|
16
|
-
React.createElement(AdvanceSearchFieldBlock, { label: React.createElement(Trans, null, "Enter case assigned to name Or SSO") },
|
|
17
|
-
React.createElement(TextInput, { id: "advance-search-assigned-to", type: "text", value: formState.assignedToNameAndSso, onChange: (_event, value) => onChange({ assignedToNameAndSso: value }), "aria-label": t('Case assigned to name and SSO'), placeholder: t('Case assigned to name and SSO') })),
|
|
18
|
-
canAccessGroupsFilter && (React.createElement(AdvanceSearchFieldBlock, { label: React.createElement(Trans, null, "Select case group"), headerActions: hasSelectedGroups ? (React.createElement(Button, { variant: "plain", icon: React.createElement(TimesIcon, { "aria-hidden": true }), "aria-label": t('Clear groups selection'), onClick: () => onChange({ groups: [] }), "data-tracking-id": "advance-search-groups-clear", className: "pf-v6-u-p-0" })) : undefined },
|
|
19
|
-
React.createElement(GroupsFilter, { selectedGroups: formState.groups, onGroupsChange: (groups) => onChange({ groups }), hideLabel: true, idPrefix: "advance-search-groups-filter", showSelectionCountBadge: true, placeholder: t('Case group') })))));
|
|
20
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IAdvanceSearchFormState } from '../../CaseListFilterReducer';
|
|
3
|
-
interface IProps {
|
|
4
|
-
formState: IAdvanceSearchFormState;
|
|
5
|
-
onChange: (updates: Partial<IAdvanceSearchFormState>) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function AdvanceSearchProductSection({ formState, onChange }: IProps): React.JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=AdvanceSearchProductSection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AdvanceSearchProductSection.d.ts","sourceRoot":"","sources":["../../../../../../src/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAYtE,UAAU,MAAM;IACZ,SAAS,EAAE,uBAAuB,CAAC;IACnC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAC;CACjE;AAED,wBAAgB,2BAA2B,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,MAAM,qBAqD1E"}
|
package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Button, Stack, TextInput } from '@patternfly/react-core';
|
|
2
|
-
import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
|
|
3
|
-
import React, { useMemo } from 'react';
|
|
4
|
-
import { Trans, useTranslation } from 'react-i18next';
|
|
5
|
-
import { SolrKeys } from '../../../../enums/filters';
|
|
6
|
-
import { AdvanceSearchFieldBlock } from './AdvanceSearchFieldBlock';
|
|
7
|
-
import { ProductVersionDrilldownSelect } from './ProductVersionDrilldownSelect';
|
|
8
|
-
// Temporary until openShiftClusterIdRelevantInCases is available via GraphQL product metadata.
|
|
9
|
-
const OCP_PRODUCT_NAME = 'OpenShift Container Platform';
|
|
10
|
-
const isOcpProductName = (productName) => productName.trim() === OCP_PRODUCT_NAME;
|
|
11
|
-
const hasOcpProductSelected = (products) => products.some((product) => isOcpProductName(product.value));
|
|
12
|
-
export function AdvanceSearchProductSection({ formState, onChange }) {
|
|
13
|
-
const { t } = useTranslation();
|
|
14
|
-
const selectedVersionCount = useMemo(() => formState.products.reduce((count, product) => { var _a; return count + (((_a = product[SolrKeys.version]) === null || _a === void 0 ? void 0 : _a.length) || 0); }, 0), [formState.products]);
|
|
15
|
-
const showClusterIdField = useMemo(() => hasOcpProductSelected(formState.products), [formState.products]);
|
|
16
|
-
const handleProductsChange = (products) => {
|
|
17
|
-
const updates = { products };
|
|
18
|
-
if (!hasOcpProductSelected(products) && formState.openshiftClusterId) {
|
|
19
|
-
updates.openshiftClusterId = '';
|
|
20
|
-
}
|
|
21
|
-
onChange(updates);
|
|
22
|
-
};
|
|
23
|
-
return (React.createElement(Stack, null,
|
|
24
|
-
React.createElement(AdvanceSearchFieldBlock, { label: React.createElement(Trans, null, "Select Product & version"), headerActions: selectedVersionCount > 0 ? (React.createElement(Button, { variant: "plain", icon: React.createElement(TimesIcon, { "aria-hidden": true }), "aria-label": t('Clear product and version selection'), onClick: () => onChange({ products: [], openshiftClusterId: '' }), "data-tracking-id": "advance-search-product-version-clear", className: "pf-v6-u-p-0" })) : undefined },
|
|
25
|
-
React.createElement(ProductVersionDrilldownSelect, { products: formState.products, onChange: handleProductsChange })),
|
|
26
|
-
showClusterIdField && (React.createElement(AdvanceSearchFieldBlock, { label: t('Enter clusterID') },
|
|
27
|
-
React.createElement(TextInput, { id: "advance-search-cluster-id", type: "text", value: formState.openshiftClusterId, onChange: (_event, value) => onChange({ openshiftClusterId: value }), "aria-label": t('Cluster ID'), placeholder: t('Cluster ID') })))));
|
|
28
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IProductFilter } from '../../CaseListFilterReducer';
|
|
3
|
-
interface IProps {
|
|
4
|
-
products: IProductFilter[];
|
|
5
|
-
onChange: (products: IProductFilter[]) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function ProductVersionDrilldownSelect({ products, onChange }: IProps): React.JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=ProductVersionDrilldownSelect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProductVersionDrilldownSelect.d.ts","sourceRoot":"","sources":["../../../../../../src/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAIrE,OAAO,EAAE,cAAc,EAAuB,MAAM,6BAA6B,CAAC;AAclF,UAAU,MAAM;IACZ,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;CAClD;AAED,wBAAgB,6BAA6B,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,MAAM,qBAsZ3E"}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { useApolloClient } from '@apollo/client/react';
|
|
2
|
-
import { Badge, Divider, DrilldownMenu, Flex, FlexItem, Menu, MenuContainer, MenuContent, MenuItem, MenuList, MenuToggle, SearchInput, Spinner, } from '@patternfly/react-core';
|
|
3
|
-
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
4
|
-
import { compareVersions, GET_PRODUCTS, handleGraphQLVersionsResponse } from '@rh-support/utils';
|
|
5
|
-
import React, { useContext, useMemo, useRef, useState } from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { SolrKeys } from '../../../../enums/filters';
|
|
8
|
-
const ROOT_MENU_ID = 'advance-search-product-version-root';
|
|
9
|
-
export function ProductVersionDrilldownSelect({ products, onChange }) {
|
|
10
|
-
var _a;
|
|
11
|
-
const { t } = useTranslation();
|
|
12
|
-
const apolloClient = useApolloClient();
|
|
13
|
-
const { globalMetadataState: { allProducts }, } = useContext(GlobalMetadataStateContext);
|
|
14
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
15
|
-
const [productSearch, setProductSearch] = useState('');
|
|
16
|
-
const [menuDrilledIn, setMenuDrilledIn] = useState([]);
|
|
17
|
-
const [drilldownPath, setDrilldownPath] = useState([]);
|
|
18
|
-
const [activeMenu, setActiveMenu] = useState(ROOT_MENU_ID);
|
|
19
|
-
const [menuHeights, setMenuHeights] = useState({});
|
|
20
|
-
const [versionsByProductId, setVersionsByProductId] = useState({});
|
|
21
|
-
const [loadingProductIds, setLoadingProductIds] = useState({});
|
|
22
|
-
const toggleRef = useRef(null);
|
|
23
|
-
const menuRef = useRef(null);
|
|
24
|
-
const productOptions = useMemo(() => {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
return ((_b = (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult) === null || _b === void 0 ? void 0 : _b.map((product) => ({
|
|
27
|
-
name: product.product || product.name || '',
|
|
28
|
-
productId: product.productId || '',
|
|
29
|
-
}))) || [];
|
|
30
|
-
}, [(_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult]);
|
|
31
|
-
const filteredProducts = useMemo(() => {
|
|
32
|
-
if (!productSearch.trim()) {
|
|
33
|
-
return productOptions;
|
|
34
|
-
}
|
|
35
|
-
const formattedValue = productSearch.replace(/\\/g, '');
|
|
36
|
-
const searchPattern = new RegExp(formattedValue, 'i');
|
|
37
|
-
return productOptions.filter((product) => searchPattern.test(product.name));
|
|
38
|
-
}, [productOptions, productSearch]);
|
|
39
|
-
const selectedFilterCount = useMemo(() => products.reduce((count, product) => {
|
|
40
|
-
const versions = product[SolrKeys.version] || [];
|
|
41
|
-
return count + (versions.length > 0 ? versions.length : 1);
|
|
42
|
-
}, 0), [products]);
|
|
43
|
-
const resetDrilldownState = () => {
|
|
44
|
-
setMenuDrilledIn([]);
|
|
45
|
-
setDrilldownPath([]);
|
|
46
|
-
setActiveMenu(ROOT_MENU_ID);
|
|
47
|
-
setProductSearch('');
|
|
48
|
-
setMenuHeights({});
|
|
49
|
-
};
|
|
50
|
-
const handleOpenChange = (open) => {
|
|
51
|
-
setIsOpen(open);
|
|
52
|
-
if (!open) {
|
|
53
|
-
resetDrilldownState();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const setHeight = (menuId, height) => {
|
|
57
|
-
setMenuHeights((previousHeights) => {
|
|
58
|
-
if (previousHeights[menuId] === undefined ||
|
|
59
|
-
(menuId !== ROOT_MENU_ID && previousHeights[menuId] !== height)) {
|
|
60
|
-
return Object.assign(Object.assign({}, previousHeights), { [menuId]: height });
|
|
61
|
-
}
|
|
62
|
-
return previousHeights;
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
const updateMenuHeight = (menuId) => {
|
|
66
|
-
requestAnimationFrame(() => {
|
|
67
|
-
var _a;
|
|
68
|
-
const menuContent = (_a = document.getElementById(menuId)) === null || _a === void 0 ? void 0 : _a.querySelector('.pf-v6-c-menu__content');
|
|
69
|
-
if (menuContent instanceof HTMLElement) {
|
|
70
|
-
setHeight(menuId, menuContent.clientHeight);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
const drillIn = (_event, fromMenuId, toMenuId, pathId) => {
|
|
75
|
-
setMenuDrilledIn((previousMenus) => [...previousMenus, fromMenuId]);
|
|
76
|
-
setDrilldownPath((previousPath) => [...previousPath, pathId]);
|
|
77
|
-
setActiveMenu(toMenuId);
|
|
78
|
-
const productId = pathId.replace('product-', '');
|
|
79
|
-
const product = productOptions.find((item) => item.productId === productId);
|
|
80
|
-
if (product) {
|
|
81
|
-
fetchVersionsForProduct(product);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const drillOut = (_event, toMenuId) => {
|
|
85
|
-
setMenuDrilledIn((previousMenus) => previousMenus.slice(0, -1));
|
|
86
|
-
setDrilldownPath((previousPath) => previousPath.slice(0, -1));
|
|
87
|
-
setActiveMenu(toMenuId);
|
|
88
|
-
};
|
|
89
|
-
const fetchVersionsForProduct = (product) => {
|
|
90
|
-
if (!product.productId || versionsByProductId[product.productId] || loadingProductIds[product.productId]) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
setLoadingProductIds((previousState) => (Object.assign(Object.assign({}, previousState), { [product.productId]: true })));
|
|
94
|
-
apolloClient
|
|
95
|
-
.query({
|
|
96
|
-
query: GET_PRODUCTS,
|
|
97
|
-
variables: {
|
|
98
|
-
where: { ParentProduct__c: { eq: product.productId }, IsActive: { eq: true } },
|
|
99
|
-
first: 200,
|
|
100
|
-
orderBy: { Name: { order: 'ASC' } },
|
|
101
|
-
},
|
|
102
|
-
fetchPolicy: 'cache-first',
|
|
103
|
-
})
|
|
104
|
-
.then(({ data }) => {
|
|
105
|
-
var _a, _b, _c, _d;
|
|
106
|
-
const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportProduct2) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
107
|
-
const versionData = handleGraphQLVersionsResponse(edges, product.name);
|
|
108
|
-
const sortedVersions = [...versionData].sort((versionA, versionB) => compareVersions(versionA.name, versionB.name));
|
|
109
|
-
setVersionsByProductId((previousState) => (Object.assign(Object.assign({}, previousState), { [product.productId]: sortedVersions })));
|
|
110
|
-
updateMenuHeight(`versions-menu-${product.productId}`);
|
|
111
|
-
})
|
|
112
|
-
.catch((error) => {
|
|
113
|
-
console.error('[ProductVersionDrilldownSelect] Failed to fetch versions:', error);
|
|
114
|
-
setVersionsByProductId((previousState) => (Object.assign(Object.assign({}, previousState), { [product.productId]: [] })));
|
|
115
|
-
updateMenuHeight(`versions-menu-${product.productId}`);
|
|
116
|
-
})
|
|
117
|
-
.finally(() => {
|
|
118
|
-
setLoadingProductIds((previousState) => (Object.assign(Object.assign({}, previousState), { [product.productId]: false })));
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
const getProductAppliedFilterCount = (product) => {
|
|
122
|
-
const selectedProduct = products.find((item) => item.value === product.name);
|
|
123
|
-
if (!selectedProduct) {
|
|
124
|
-
return 0;
|
|
125
|
-
}
|
|
126
|
-
const versions = selectedProduct[SolrKeys.version] || [];
|
|
127
|
-
return versions.length > 0 ? versions.length : 1;
|
|
128
|
-
};
|
|
129
|
-
const isProductOnlySelected = (product) => {
|
|
130
|
-
var _a;
|
|
131
|
-
const selectedProduct = products.find((item) => item.value === product.name);
|
|
132
|
-
return !!selectedProduct && !((_a = selectedProduct[SolrKeys.version]) === null || _a === void 0 ? void 0 : _a.length);
|
|
133
|
-
};
|
|
134
|
-
const toggleProductOnlySelection = (product) => {
|
|
135
|
-
var _a;
|
|
136
|
-
const productIndex = products.findIndex((item) => item.value === product.name);
|
|
137
|
-
if (productIndex === -1) {
|
|
138
|
-
onChange([
|
|
139
|
-
...products,
|
|
140
|
-
{
|
|
141
|
-
field: SolrKeys.product,
|
|
142
|
-
value: product.name,
|
|
143
|
-
productId: product.productId,
|
|
144
|
-
[SolrKeys.version]: [],
|
|
145
|
-
},
|
|
146
|
-
]);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const currentProduct = products[productIndex];
|
|
150
|
-
const hasVersions = (((_a = currentProduct[SolrKeys.version]) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0;
|
|
151
|
-
if (!hasVersions) {
|
|
152
|
-
onChange(products.filter((_, index) => index !== productIndex));
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const nextProducts = [...products];
|
|
156
|
-
nextProducts[productIndex] = Object.assign(Object.assign({}, currentProduct), { [SolrKeys.version]: [] });
|
|
157
|
-
onChange(nextProducts);
|
|
158
|
-
};
|
|
159
|
-
const isVersionSelected = (productName, versionName) => {
|
|
160
|
-
var _a, _b;
|
|
161
|
-
const selectedProduct = products.find((product) => product.value === productName);
|
|
162
|
-
return (_b = (_a = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct[SolrKeys.version]) === null || _a === void 0 ? void 0 : _a.some((version) => version.value === versionName)) !== null && _b !== void 0 ? _b : false;
|
|
163
|
-
};
|
|
164
|
-
const toggleVersionSelection = (product, version) => {
|
|
165
|
-
const nextProducts = [...products];
|
|
166
|
-
const productIndex = nextProducts.findIndex((item) => item.value === product.name);
|
|
167
|
-
if (productIndex === -1) {
|
|
168
|
-
onChange([
|
|
169
|
-
...nextProducts,
|
|
170
|
-
{
|
|
171
|
-
field: SolrKeys.product,
|
|
172
|
-
value: product.name,
|
|
173
|
-
productId: product.productId,
|
|
174
|
-
[SolrKeys.version]: [
|
|
175
|
-
{
|
|
176
|
-
field: SolrKeys.version,
|
|
177
|
-
value: version.name,
|
|
178
|
-
productId: version.id,
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
},
|
|
182
|
-
]);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const currentProduct = nextProducts[productIndex];
|
|
186
|
-
const currentVersions = currentProduct[SolrKeys.version] || [];
|
|
187
|
-
const versionIndex = currentVersions.findIndex((item) => item.value === version.name);
|
|
188
|
-
const nextVersions = versionIndex >= 0
|
|
189
|
-
? currentVersions.filter((_, index) => index !== versionIndex)
|
|
190
|
-
: [
|
|
191
|
-
...currentVersions,
|
|
192
|
-
{
|
|
193
|
-
field: SolrKeys.version,
|
|
194
|
-
value: version.name,
|
|
195
|
-
productId: version.id,
|
|
196
|
-
},
|
|
197
|
-
];
|
|
198
|
-
if (nextVersions.length === 0) {
|
|
199
|
-
onChange(nextProducts.filter((_, index) => index !== productIndex));
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
nextProducts[productIndex] = Object.assign(Object.assign({}, currentProduct), { [SolrKeys.version]: nextVersions });
|
|
203
|
-
onChange(nextProducts);
|
|
204
|
-
};
|
|
205
|
-
const renderVersionItems = (product) => {
|
|
206
|
-
const versions = versionsByProductId[product.productId];
|
|
207
|
-
const isLoading = loadingProductIds[product.productId];
|
|
208
|
-
if (isLoading || versions === undefined) {
|
|
209
|
-
return (React.createElement(MenuItem, { itemId: `loading-${product.productId}`, isDisabled: true },
|
|
210
|
-
React.createElement(Spinner, { size: "sm", "aria-label": t('Loading versions') }),
|
|
211
|
-
" ",
|
|
212
|
-
t('Loading...')));
|
|
213
|
-
}
|
|
214
|
-
if (!versions.length) {
|
|
215
|
-
return (React.createElement(MenuItem, { itemId: `no-versions-${product.productId}`, isDisabled: true }, t('No versions found')));
|
|
216
|
-
}
|
|
217
|
-
return versions.map((version) => (React.createElement(MenuItem, { key: `${product.productId}-${version.name}`, itemId: `version-${product.productId}-${version.name}`, hasCheckbox: true, isSelected: isVersionSelected(product.name, version.name), onClick: () => toggleVersionSelection(product, version) }, version.name)));
|
|
218
|
-
};
|
|
219
|
-
const renderProductDrilldownMenu = (product) => (React.createElement(DrilldownMenu, { id: `versions-menu-${product.productId}` },
|
|
220
|
-
React.createElement(MenuItem, { itemId: `breadcrumb-${product.productId}`, direction: "up" }, product.name),
|
|
221
|
-
React.createElement(Divider, { component: "li" }),
|
|
222
|
-
React.createElement(MenuItem, { itemId: `product-only-${product.productId}`, hasCheckbox: true, isSelected: isProductOnlySelected(product), onClick: () => toggleProductOnlySelection(product) }, t('Entire product')),
|
|
223
|
-
React.createElement(Divider, { component: "li" }),
|
|
224
|
-
renderVersionItems(product)));
|
|
225
|
-
const toggleLabel = t('Select Product & version');
|
|
226
|
-
const isRootMenuActive = activeMenu === ROOT_MENU_ID;
|
|
227
|
-
return (React.createElement(MenuContainer, { isOpen: isOpen, onOpenChange: handleOpenChange, menuRef: menuRef, toggleRef: toggleRef, popperProps: { direction: 'down', enableFlip: false, width: 'trigger' }, toggle: React.createElement(MenuToggle, { ref: toggleRef, onClick: () => handleOpenChange(!isOpen), isExpanded: isOpen, isFullWidth: true, "aria-label": t('Select Product & version') },
|
|
228
|
-
React.createElement(Flex, { alignItems: { default: 'alignItemsCenter' }, justifyContent: { default: 'justifyContentSpaceBetween' }, className: "pf-v6-u-w-100 advance-search-dropdown-toggle-content" },
|
|
229
|
-
React.createElement(FlexItem, { className: "pf-v6-u-text-align-left" }, toggleLabel),
|
|
230
|
-
selectedFilterCount > 0 ? (React.createElement(FlexItem, { className: "advance-search-dropdown-toggle-badge-wrap" },
|
|
231
|
-
React.createElement(Badge, { className: "advance-search-dropdown-toggle-badge" }, t('{{count}} selected', { count: selectedFilterCount })))) : null)), menu: React.createElement(Menu, { id: ROOT_MENU_ID, ref: menuRef, containsDrilldown: true, drilldownItemPath: drilldownPath, drilledInMenus: menuDrilledIn, activeMenu: activeMenu, onDrillIn: drillIn, onDrillOut: drillOut, onGetMenuHeight: setHeight, isScrollable: true, "data-tracking-id": "advance-search-product-version-drilldown" },
|
|
232
|
-
React.createElement(MenuContent, { menuHeight: `${menuHeights[activeMenu]}px` },
|
|
233
|
-
!isRootMenuActive ? null : (React.createElement("div", { className: "advance-search-product-version-search pf-v6-u-p-sm", onMouseDown: (event) => event.stopPropagation() },
|
|
234
|
-
React.createElement(SearchInput, { placeholder: t('Find product by name'), value: productSearch, onChange: (_event, value) => setProductSearch(value), onClear: () => setProductSearch(''), "aria-label": t('Find product by name') }))),
|
|
235
|
-
React.createElement(MenuList, null, filteredProducts.length === 0 ? (React.createElement(MenuItem, { itemId: "no-products-found", isDisabled: true }, t('No results found'))) : (filteredProducts.map((product) => {
|
|
236
|
-
const productAppliedCount = getProductAppliedFilterCount(product);
|
|
237
|
-
return (React.createElement(MenuItem, { key: product.productId, itemId: `product-${product.productId}`, direction: "down", actions: productAppliedCount > 0 ? (React.createElement(Badge, { className: "advance-search-product-menu-item-badge pf-v6-u-mx-sm", "aria-label": t('{{count}} filters applied', {
|
|
238
|
-
count: productAppliedCount,
|
|
239
|
-
}) }, productAppliedCount)) : undefined, drilldownMenu: renderProductDrilldownMenu(product) }, product.name));
|
|
240
|
-
}))))) }));
|
|
241
|
-
}
|
package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface IProps {
|
|
3
|
-
label: string;
|
|
4
|
-
options: string[];
|
|
5
|
-
selected: string[];
|
|
6
|
-
onChange: (selected: string[]) => void;
|
|
7
|
-
sectionId: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function SelectableLabelFilter({ label, options, selected, onChange, sectionId }: IProps): React.JSX.Element;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=SelectableLabelFilter.d.ts.map
|
package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableLabelFilter.d.ts","sourceRoot":"","sources":["../../../../../../src/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,MAAM;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,MAAM,qBAwD9F"}
|
package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Button, Flex, Label } from '@patternfly/react-core';
|
|
2
|
-
import CloseIcon from '@patternfly/react-icons/dist/esm/icons/close-icon';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { AdvanceSearchFieldBlock } from './AdvanceSearchFieldBlock';
|
|
6
|
-
export function SelectableLabelFilter({ label, options, selected, onChange, sectionId }) {
|
|
7
|
-
const { t } = useTranslation();
|
|
8
|
-
const toggleOption = (option) => {
|
|
9
|
-
if (selected.includes(option)) {
|
|
10
|
-
onChange(selected.filter((value) => value !== option));
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
onChange([...selected, option]);
|
|
14
|
-
};
|
|
15
|
-
const clearSelection = () => onChange([]);
|
|
16
|
-
return (React.createElement(AdvanceSearchFieldBlock, { label: React.createElement(React.Fragment, null,
|
|
17
|
-
label,
|
|
18
|
-
selected.length > 0 ? ` (${selected.length})` : ''), headerActions: selected.length > 0 ? (React.createElement(Button, { variant: "plain", onClick: clearSelection, "aria-label": t('Clear {{label}} selection', { label }), icon: React.createElement(CloseIcon, { "aria-hidden": true }), className: "pf-v6-u-p-0" })) : undefined },
|
|
19
|
-
React.createElement(Flex, { flexWrap: { default: 'wrap' }, spaceItems: { default: 'spaceItemsSm' }, rowGap: { default: 'rowGapSm' } }, options.map((option) => {
|
|
20
|
-
const isSelected = selected.includes(option);
|
|
21
|
-
return (React.createElement(Label, { key: option, color: isSelected ? 'blue' : 'grey', variant: isSelected ? 'filled' : 'outline', isCompact: true, onClick: () => toggleOption(option), id: `${sectionId}-${option.replace(/\s+/g, '-')}` }, option));
|
|
22
|
-
}))));
|
|
23
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface ICaseLabelOption {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
}
|
|
5
|
-
interface UseCaseLabelsResult {
|
|
6
|
-
labels: ICaseLabelOption[];
|
|
7
|
-
loading: boolean;
|
|
8
|
-
error: Error | undefined;
|
|
9
|
-
refetch: () => Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
/** Fetches account-scoped case labels for the Case List Case labels filter. */
|
|
12
|
-
export declare function useCaseLabels(accountId?: string): UseCaseLabelsResult;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=useCaseLabels.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCaseLabels.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseLabels.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAOD,UAAU,mBAAmB;IACzB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAmCrE"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useApolloClient } from '@apollo/client/react';
|
|
11
|
-
import { GET_CASE_LABELS, } from '@rh-support/utils';
|
|
12
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
13
|
-
const mapCaseLabelNode = (node) => {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
return ({
|
|
16
|
-
id: node.Id,
|
|
17
|
-
name: (_b = (_a = node.Name) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '',
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
/** Fetches account-scoped case labels for the Case List Case labels filter. */
|
|
21
|
-
export function useCaseLabels(accountId) {
|
|
22
|
-
const client = useApolloClient();
|
|
23
|
-
const [labels, setLabels] = useState([]);
|
|
24
|
-
const [loading, setLoading] = useState(false);
|
|
25
|
-
const [error, setError] = useState(undefined);
|
|
26
|
-
const fetchLabels = useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
var _a, _b, _c, _d;
|
|
28
|
-
if (!accountId) {
|
|
29
|
-
setLabels([]);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
setLoading(true);
|
|
33
|
-
setError(undefined);
|
|
34
|
-
try {
|
|
35
|
-
const { data } = yield client.query({
|
|
36
|
-
query: GET_CASE_LABELS,
|
|
37
|
-
variables: { where: { Account__c: { eq: accountId } } },
|
|
38
|
-
fetchPolicy: 'cache-first',
|
|
39
|
-
});
|
|
40
|
-
const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportCaseLabel__c) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
41
|
-
setLabels(edges.map(({ node }) => mapCaseLabelNode(node)).filter((label) => label.id && label.name));
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
setError(e);
|
|
45
|
-
setLabels([]);
|
|
46
|
-
}
|
|
47
|
-
finally {
|
|
48
|
-
setLoading(false);
|
|
49
|
-
}
|
|
50
|
-
}), [accountId, client]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
fetchLabels();
|
|
53
|
-
}, [fetchLabels]);
|
|
54
|
-
return { labels, loading, error, refetch: fetchLabels };
|
|
55
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IAdvanceSearchDateRanges, IAdvanceSearchFormState, ICaseListFilterState, IFilterInfo } from '../components/case-list/CaseListFilterReducer';
|
|
2
|
-
import { CaseSearchQueryType } from '../enums/caseSearch';
|
|
3
|
-
export declare const hasAdvanceSearchActiveState: (filterState: ICaseListFilterState) => boolean;
|
|
4
|
-
export declare const deriveSearchQueryType: (filterState: ICaseListFilterState) => CaseSearchQueryType;
|
|
5
|
-
export declare const toNameOrSsoFilterValues: (value: string) => string[];
|
|
6
|
-
export declare const mapAdvanceSearchFormToFilterInfo: (formState: IAdvanceSearchFormState) => IFilterInfo;
|
|
7
|
-
export declare const mergeAdvanceSearchFormIntoFilterInfo: (formState: IAdvanceSearchFormState, currentFilterInfo?: Partial<IFilterInfo>) => IFilterInfo;
|
|
8
|
-
export declare const buildAdvanceSearchParsedQuery: (formState: IAdvanceSearchFormState, filterInfo: Partial<IFilterInfo>) => string;
|
|
9
|
-
export declare const mapAdvanceSearchFormToDateRanges: (formState: IAdvanceSearchFormState) => IAdvanceSearchDateRanges;
|
|
10
|
-
export declare const createCaseListFilterStateFromAdvanceSearchForm: (formState: IAdvanceSearchFormState, currentFilterState: ICaseListFilterState) => ICaseListFilterState;
|
|
11
|
-
//# sourceMappingURL=advanceSearchFormMapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"advanceSearchFormMapper.d.ts","sourceRoot":"","sources":["../../../src/utils/advanceSearchFormMapper.ts"],"names":[],"mappings":"AAIA,OAAO,EAGH,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACd,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK1D,eAAO,MAAM,2BAA2B,GAAI,aAAa,oBAAoB,KAAG,OACwB,CAAC;AAEzG,eAAO,MAAM,qBAAqB,GAAI,aAAa,oBAAoB,KAAG,mBAC6B,CAAC;AAIxG,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAAM,EAc7D,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,WAAW,uBAAuB,KAAG,WAsBrF,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAC7C,WAAW,uBAAuB,EAClC,oBAAmB,OAAO,CAAC,WAAW,CAAM,KAC7C,WAoBF,CAAC;AAmBF,eAAO,MAAM,6BAA6B,GACtC,WAAW,uBAAuB,EAClC,YAAY,OAAO,CAAC,WAAW,CAAC,KACjC,MASF,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,WAAW,uBAAuB,KAAG,wBAIpF,CAAC;AAEH,eAAO,MAAM,8CAA8C,GACvD,WAAW,uBAAuB,EAClC,oBAAoB,oBAAoB,KACzC,oBA0BF,CAAC"}
|