@rh-support/cases 1.0.39 → 1.0.41-beta.32

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":"NewCaseButton.d.ts","sourceRoot":"","sources":["../../../../src/components/case/NewCaseButton.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,eAmB1C"}
1
+ {"version":3,"file":"NewCaseButton.d.ts","sourceRoot":"","sources":["../../../../src/components/case/NewCaseButton.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,eAyB1C"}
@@ -2,8 +2,9 @@ import { Button, ButtonVariant } from '@patternfly/react-core';
2
2
  import { useCanCreateCase } from '@rh-support/react-context';
3
3
  import { getStringifiedParams } from '@rh-support/utils';
4
4
  import React from 'react';
5
- import { Trans } from 'react-i18next';
5
+ import { Trans, useTranslation } from 'react-i18next';
6
6
  export function NewCaseButton(props) {
7
+ const { t } = useTranslation();
7
8
  const canCreateCase = useCanCreateCase();
8
9
  const onNew = () => {
9
10
  if (canCreateCase.alert()) {
@@ -15,6 +16,6 @@ export function NewCaseButton(props) {
15
16
  }
16
17
  };
17
18
  return (React.createElement(React.Fragment, null,
18
- React.createElement(Button, { variant: ButtonVariant.tertiary, onClick: onNew, "data-tracking-id": "open-new-case" },
19
- React.createElement(Trans, null, "Open a case"))));
19
+ React.createElement(Button, { variant: ButtonVariant.tertiary, onClick: onNew, "data-tracking-id": "get-support-new-case", "aria-label": t('Get support') },
20
+ React.createElement(Trans, null, "Get support"))));
20
21
  }
@@ -37,7 +37,7 @@ const isStatusFilterWithSFDCSupportedValues = ({ case_status = [] }) => {
37
37
  return statusLength !== 2 || (statusLength === 2 && !case_status.includes(CaseStatus.Closed));
38
38
  };
39
39
  // SFDC on most fields including case_status only accept one value
40
- // on case type field if 'closed' is selected then, we can have 2 filters selected
40
+ // on support type field if 'closed' is selected then, we can have 2 filters selected
41
41
  // because closed in SFDC passes as a seperate param
42
42
  // if closed not selected then only one filter can be selected
43
43
  const isStatusFilterWithSFDCSupported = (filterKey, filterValue) => {
@@ -1 +1 @@
1
- {"version":3,"file":"CaseListFilterChips.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilterChips.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAMtD,UAAU,MAAM;IACZ,yBAAyB,EAAE,uBAAuB,EAAE,CAAC;IACrD,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA6HhD"}
1
+ {"version":3,"file":"CaseListFilterChips.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilterChips.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAMtD,UAAU,MAAM;IACZ,yBAAyB,EAAE,uBAAuB,EAAE,CAAC;IACrD,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA+HhD"}
@@ -1,4 +1,5 @@
1
1
  import { Button, Chip, ChipGroup } from '@patternfly/react-core';
2
+ import { toNewCaseTypeMapper, toOldCaseTypeSwitcher } from '@rh-support/utils';
2
3
  import flatMap from 'lodash/flatMap';
3
4
  import remove from 'lodash/remove';
4
5
  import React, { useContext } from 'react';
@@ -19,7 +20,8 @@ export function CaseListFilterChips(props) {
19
20
  removeFilterItem(dispatch, { filterKey, value });
20
21
  };
21
22
  const getChipKey = (item) => {
22
- return typeof item === 'string' ? item : item.key;
23
+ const newCaseTypeFilterItem = toOldCaseTypeSwitcher(item);
24
+ return typeof item === 'string' ? newCaseTypeFilterItem : item.key;
23
25
  };
24
26
  const getChipValue = (item) => {
25
27
  return typeof item === 'string' ? item : item.value;
@@ -34,6 +36,7 @@ export function CaseListFilterChips(props) {
34
36
  return filterChips;
35
37
  };
36
38
  const getChipGroupForFilter = (filterKey, filterValues, groupName = '') => {
39
+ const caseTypeFilter = filterKey === 'case_type' ? toNewCaseTypeMapper(filterValues) : filterValues;
37
40
  if (props.isSolrSearchDown && !visibleFilterChipsWhenSolrDownSfdcUp.includes(filterKey)) {
38
41
  return React.createElement(React.Fragment, null);
39
42
  }
@@ -41,7 +44,7 @@ export function CaseListFilterChips(props) {
41
44
  return (React.createElement("div", { className: "filter-chip", key: `${filterKey}-bookmarks-${groupName}` },
42
45
  React.createElement("span", { className: "filter-chip__heading" },
43
46
  React.createElement(Trans, null, groupName || filterNamesMap[filterKey] || filterKey)),
44
- React.createElement(ChipGroup, { numChips: 7, className: "pf-c-chip-group__simple" }, renderFilterValueChips(filterKey, filterValues, groupName))));
47
+ React.createElement(ChipGroup, { numChips: 7, className: "pf-c-chip-group__simple" }, renderFilterValueChips(filterKey, caseTypeFilter, groupName))));
45
48
  }
46
49
  };
47
50
  const renderAccountFilterChip = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"TypeFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/TypeFilter.tsx"],"names":[],"mappings":"AAUA,UAAU,MAAM;IACZ,YAAY,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eAkDvC"}
1
+ {"version":3,"file":"TypeFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/TypeFilter.tsx"],"names":[],"mappings":"AAUA,UAAU,MAAM;IACZ,YAAY,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eAyDvC"}
@@ -1,5 +1,5 @@
1
1
  import { Select, SelectOption, SelectVariant } from '@patternfly/react-core';
2
- import { getDropdownBtnPlaceholder } from '@rh-support/utils';
2
+ import { getDropdownBtnPlaceholder, toNewCaseTypeMapper, toOldCaseTypeSwitcher } from '@rh-support/utils';
3
3
  import React, { useContext, useState } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { SolrKeys } from '../../../enums/filters';
@@ -13,16 +13,21 @@ export function TypeFilter(props) {
13
13
  const [isOpen, setIsOpen] = useState(false);
14
14
  const toggleIsOpen = (isExpanded) => setIsOpen(isExpanded);
15
15
  const onFilterChangeMultipleSelect = (event, selectedTypes) => {
16
- const newState = filterInfo[SolrKeys.type].includes(selectedTypes)
17
- ? filterInfo[SolrKeys.type].filter((item) => item !== selectedTypes)
18
- : [...filterInfo[SolrKeys.type], selectedTypes];
16
+ // To convert the selected type to old case type
17
+ const convertedSelectedType = toOldCaseTypeSwitcher(selectedTypes);
18
+ const newState = filterInfo[SolrKeys.type].includes(convertedSelectedType)
19
+ ? filterInfo[SolrKeys.type].filter((item) => item !== convertedSelectedType)
20
+ : [...filterInfo[SolrKeys.type], convertedSelectedType];
19
21
  updateFilter(dispatch, {
20
22
  filterKey: SolrKeys.type,
21
23
  values: newState,
22
24
  });
23
25
  };
24
26
  const titleId = 'case-list-type-filter';
27
+ // To switch from old case type to new support type
28
+ const newCaseTypesArray = toNewCaseTypeMapper(props.allCaseTypes).sort();
29
+ const toNewCaseTypesFilter = toNewCaseTypeMapper(filterInfo[SolrKeys.type]);
25
30
  return (React.createElement("div", { className: "pf-c-select" },
26
31
  React.createElement("label", { htmlFor: titleId }, t(filterNamesMap[SolrKeys.type])),
27
- React.createElement(Select, { id: titleId, variant: SelectVariant.checkbox, "aria-label": t('Select a case type'), onToggle: toggleIsOpen, onSelect: onFilterChangeMultipleSelect, selections: filterInfo[SolrKeys.type], isOpen: isOpen, placeholderText: getDropdownBtnPlaceholder(t('Select a case type'), filterInfo[SolrKeys.type], ' ', props.allCaseTypes.length, t('All selected')), isCheckboxSelectionBadgeHidden: true, "aria-labelledby": titleId, "data-tracking-id": "type-filter", hasPlaceholderStyle: true }, props.allCaseTypes.map((filterValue) => (React.createElement(SelectOption, { key: filterValue, value: filterValue }))))));
32
+ React.createElement(Select, { id: titleId, variant: SelectVariant.checkbox, "aria-label": t('Select a support type'), onToggle: toggleIsOpen, onSelect: onFilterChangeMultipleSelect, selections: toNewCaseTypesFilter, isOpen: isOpen, placeholderText: getDropdownBtnPlaceholder(t('Select a support type'), toNewCaseTypesFilter, ' ', props.allCaseTypes.length, t('All selected')), isCheckboxSelectionBadgeHidden: true, "aria-labelledby": titleId, "data-tracking-id": "type-filter", hasPlaceholderStyle: true }, newCaseTypesArray.map((filterValue) => (React.createElement(SelectOption, { key: filterValue, value: filterValue }))))));
28
33
  }
@@ -2,7 +2,7 @@ import { Bullseye, Button, EmptyState, EmptyStateBody, EmptyStateIcon, EmptyStat
2
2
  import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
3
3
  import { PFTable, Table, TableColumnSelector, TablePagination, } from '@rh-support/components';
4
4
  import { GlobalMetadataDispatchContext, GlobalMetadataStateContext, updateUserPreferences, useGlobalStateContext, UserPreferencesKeys, } from '@rh-support/react-context';
5
- import { formatDate, scrollIntoView } from '@rh-support/utils';
5
+ import { formatDate, scrollIntoView, toNewCaseTypeSwitcher } from '@rh-support/utils';
6
6
  import find from 'lodash/find';
7
7
  import flatMap from 'lodash/flatMap';
8
8
  import get from 'lodash/get';
@@ -155,9 +155,9 @@ export function CaseListTable(props) {
155
155
  {
156
156
  id: CaseListColumnIds.type,
157
157
  cellWidth: 10,
158
- title: t('Case type'),
158
+ title: t('Support type'),
159
159
  sortable: true,
160
- accessor: (data) => data.case_type,
160
+ accessor: (data) => toNewCaseTypeSwitcher(data.case_type),
161
161
  show: isColumnVisible(CaseListColumnIds.type),
162
162
  },
163
163
  {
@@ -53,7 +53,7 @@ const csvHeadersSFDC = [
53
53
  { label: 'Modified date', key: SFDCKeys.lastPublicUpdateDate, transform: formatDateTime },
54
54
  { label: 'Uri', key: SFDCKeys.uri },
55
55
  { label: 'Alternate case ID', key: SFDCKeys.alternateId },
56
- { label: 'Case type', key: SFDCKeys.caseType },
56
+ { label: 'Support type', key: SFDCKeys.caseType },
57
57
  { label: 'Closed date', key: SFDCKeys.caseClosedDate, transform: formatDateTime },
58
58
  ];
59
59
  const groupHeaderSOLR = { label: 'Group', key: SolrKeys.groupName };
@@ -483,104 +483,59 @@
483
483
  .case-list-table tbody > tr > :nth-child(2) {
484
484
  position: sticky;
485
485
  background-color: white;
486
- left: 94px;
486
+ left: 87px;
487
487
  z-index: 1;
488
488
  background-clip: padding-box;
489
489
  }
490
490
 
491
- /* Issue Summary */
492
- .case-list-table tbody > tr > :nth-child(3) {
491
+ /* Case ID Header */
492
+ th.pf-c-table__sort[data-label='Case ID'] {
493
493
  position: sticky;
494
494
  background-color: white;
495
- left: 214px;
495
+ left: 87px;
496
496
  z-index: 1;
497
497
  background-clip: padding-box;
498
498
  }
499
499
 
500
- /* Vertical border to divide sticky columns and other columns */
501
- .case-list-table tbody > tr > :nth-child(3):after,
502
- th.pf-c-table__sort[data-label='Issue summary']:before {
500
+ /* Vertical border to divide sticky columns and other columns*/
501
+ .case-list-table tbody > tr > :nth-child(2):before,
502
+ th.pf-c-table__sort[data-label='Case ID']:before {
503
503
  position: absolute;
504
504
  content: '';
505
505
  top: 0px;
506
- left: 0px;
507
- width: 100%;
506
+ right: 0px;
508
507
  height: 100%;
509
508
  border-right: var(--pf-c-table--border-width--base) solid var(--pf-c-table--BorderColor);
510
509
  }
511
510
 
512
- /* Case ID Header */
513
- th.pf-c-table__sort[data-label='Case ID'] {
514
- min-width: 120px;
515
- position: sticky;
516
- background-color: white;
517
- left: 94px;
518
- z-index: 1;
519
- background-clip: padding-box;
520
- }
521
-
522
511
  /* Issue Summary Header */
523
- th.pf-c-table__sort[data-label='Issue summary'] {
512
+ th.pf-c-table__sort[data-label='Issue summary'],
513
+ .case-list-table tbody > tr > :nth-child(3) {
524
514
  min-width: 260px;
525
- position: sticky;
526
- background-color: white;
527
- left: 214px;
528
- z-index: 1;
529
- background-clip: padding-box;
530
- }
531
-
532
- /* Owner Header */
533
- th.pf-c-table__sort[data-label='Owner'] {
534
- min-width: 120px;
535
515
  }
536
516
 
537
- /* Modified by Header */
538
- th.pf-c-table__sort[data-label='Modified by'] {
539
- min-width: 150px;
540
- }
541
-
542
- /* Severity Header */
543
- th.pf-c-table__sort[data-label='Severity'] {
544
- min-width: 120px;
545
- }
546
-
547
- /* Status Header */
548
- th.pf-c-table__sort[data-label='Status'] {
549
- min-width: 120px;
550
- }
551
-
552
- /* Created by Header */
553
- th.pf-c-table__sort[data-label='Created by'] {
554
- min-width: 150px;
517
+ th.pf-c-table__sort[data-label='Owner'],
518
+ th.pf-c-table__sort[data-label='Status'],
519
+ th.pf-c-table__sort[data-label='Group'] {
520
+ min-width: 140px;
555
521
  }
556
522
 
557
- /* Product and version Header */
558
- th.pf-m-width-15[data-label='Product and version'] {
523
+ th.pf-c-table__sort[data-label='Severity'],
524
+ th.pf-c-table__sort[data-label='Case ID'] {
559
525
  min-width: 150px;
560
526
  }
561
527
 
562
- /* Account number Header */
563
- th.pf-c-table__sort[data-label='Account number'] {
564
- min-width: 180px;
565
- }
566
-
567
- /* Alternate case ID Header */
528
+ th.pf-c-table__sort[data-label='Modified by'],
529
+ th.pf-c-table__sort[data-label='Created by'],
530
+ th.pf-m-width-15[data-label='Product and version'],
531
+ th.pf-c-table__sort[data-label='Account number'],
568
532
  th.pf-c-table__sort[data-label='Alternate case ID'] {
569
- min-width: 180px;
570
- }
571
-
572
- /* Case type Header */
573
- th.pf-c-table__sort[data-label='Case type'] {
574
- min-width: 140px;
575
- }
576
-
577
- /* Group Header */
578
- th.pf-c-table__sort[data-label='Group'] {
579
- min-width: 120px;
533
+ min-width: 220px;
580
534
  }
581
535
 
582
536
  /* Closed Date Header */
583
- th.pf-c-table__sort.pf-m-width-10[data-label='Closed date'] {
584
- min-width: 150px;
537
+ th.pf-c-table__sort.pf-m-width-10[data-label='Closed date'],
538
+ th.pf-c-table__sort[data-label='Case type'] {
539
+ min-width: 200px;
585
540
  }
586
541
  }
@@ -70,6 +70,6 @@ export const caseTableColumSortNamesMap = {
70
70
  [CaseListColumnIds.accountNumber]: 'Account number',
71
71
  [CaseListColumnIds.group]: 'Groups',
72
72
  [CaseListColumnIds.alternateCaseId]: 'Alternate case Id',
73
- [CaseListColumnIds.type]: 'Case type',
73
+ [CaseListColumnIds.type]: 'Support type',
74
74
  [CaseListColumnIds.caseClosedDate]: 'Close date',
75
75
  };
@@ -17,7 +17,7 @@ export const filterNamesMap = {
17
17
  [SolrKeys.caseNumber]: 'Case number',
18
18
  [SolrKeys.createdBySsoUsername]: 'Created by me',
19
19
  [SolrKeys.caseContactSSO]: 'Owned by me',
20
- [SolrKeys.type]: 'Case type',
20
+ [SolrKeys.type]: 'Support type',
21
21
  usernameFilterTitle: 'Username',
22
22
  };
23
23
  export const UpdatedCaseDataEvent = 'PCM-Next > case-list-data-background-refresh';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/cases",
3
- "version": "1.0.39",
3
+ "version": "1.0.41-beta.32",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -51,11 +51,11 @@
51
51
  "@patternfly/pfe-collapse": "1.12.3",
52
52
  "@patternfly/react-core": "4.264.0",
53
53
  "@patternfly/react-table": "4.111.33",
54
- "@rh-support/components": "1.2.21",
55
- "@rh-support/react-context": "1.0.29",
56
- "@rh-support/types": "0.2.0",
57
- "@rh-support/user-permissions": "1.0.11",
58
- "@rh-support/utils": "1.0.9",
54
+ "@rh-support/components": "1.2.22-beta.32",
55
+ "@rh-support/react-context": "1.0.30-beta.32",
56
+ "@rh-support/types": "0.2.1-beta.32",
57
+ "@rh-support/user-permissions": "1.0.12-beta.32",
58
+ "@rh-support/utils": "1.0.10-beta.32",
59
59
  "i18next": "^19.0.1",
60
60
  "localforage": "^1.7.3",
61
61
  "lodash": "^4.17.21",
@@ -99,5 +99,5 @@
99
99
  "not ie <= 11",
100
100
  "not op_mini all"
101
101
  ],
102
- "gitHead": "27c5a87e60c71c152e093c2f957c6e03a2cd96df"
102
+ "gitHead": "87be4349c6ce8c1dbebefcc96d2438b8d253afb7"
103
103
  }