@rh-support/manage 2.1.108 → 2.1.109

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":"ExpiredContentCategory.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentCategory.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAGhF,UAAU,MAAM;IACZ,QAAQ,EAAE,wBAAwB,CAAC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,QAAQ,EAAE,kBAA0B,EAAE,EAAE,MAAM,qBA0B9F"}
1
+ {"version":3,"file":"ExpiredContentCategory.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentCategory.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAGhF,UAAU,MAAM;IACZ,QAAQ,EAAE,wBAAwB,CAAC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,QAAQ,EAAE,kBAA0B,EAAE,EAAE,MAAM,qBAuC9F"}
@@ -1,8 +1,11 @@
1
1
  import { AccordionContent, AccordionItem, AccordionToggle } from '@patternfly/react-core';
2
- import React, { useEffect, useState } from 'react';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import React, { useContext, useEffect, useState } from 'react';
4
+ import { ExpiredContentStateContext } from '../../context/ExpiredContentContextProvider';
3
5
  import ExpiredContentSingleItem from './ExpiredContentSingleItem';
4
6
  export default function ExpiredContentCategory({ category, isCategoryExpanded = false }) {
5
7
  const [isExpanded, setIsExpanded] = useState(isCategoryExpanded);
8
+ const { showApprochingExpiry } = useContext(ExpiredContentStateContext);
6
9
  const toggleExpanded = () => {
7
10
  setIsExpanded((pre) => !pre);
8
11
  };
@@ -10,9 +13,17 @@ export default function ExpiredContentCategory({ category, isCategoryExpanded =
10
13
  isCategoryExpanded !== isExpanded && setIsExpanded(isCategoryExpanded);
11
14
  // eslint-disable-next-line react-hooks/exhaustive-deps
12
15
  }, [isCategoryExpanded]);
13
- return (React.createElement(AccordionItem, null,
16
+ const hasDateExpired = (dateString) => {
17
+ const inputDate = new Date(dateString);
18
+ const currentDate = new Date();
19
+ return inputDate < currentDate;
20
+ };
21
+ const expiredContents = showApprochingExpiry
22
+ ? category.content.filter((item) => !hasDateExpired(item.expiryDate))
23
+ : category.content;
24
+ return !isEmpty(expiredContents) ? (React.createElement(AccordionItem, null,
14
25
  React.createElement(AccordionToggle, { id: category.categoryName, onClick: toggleExpanded, isExpanded: isExpanded },
15
26
  React.createElement("h3", null, category.categoryName)),
16
27
  React.createElement(AccordionContent, { isHidden: !isExpanded },
17
- React.createElement("ul", { className: "list-flat list-flushleft" }, category.content.map((content, i) => (React.createElement(ExpiredContentSingleItem, { key: content.topContentId, content: content, category: category })))))));
28
+ React.createElement("ul", { className: "list-flat list-flushleft" }, expiredContents.map((content, i) => (React.createElement(ExpiredContentSingleItem, { key: content.topContentId, content: content, category: category }))))))) : (React.createElement(React.Fragment, null));
18
29
  }
@@ -58,7 +58,7 @@ export default function ExipredContentManager() {
58
58
  React.createElement(Trans, null, "All tags")),
59
59
  React.createElement(TagsSelector, { tagOptions: availableTags, onChange: onTagFilterChange, selectedTags: filteredTags, disabled: expiredContentResponse.isFetching })),
60
60
  React.createElement("div", { className: "toolbar-content pf-v5-u-mt-md" },
61
- React.createElement(Switch, { id: "content-approaching-expiry-", label: t('Show approaching expiry'), isChecked: showApprochingExpiry, onChange: handleChange }))),
61
+ React.createElement(Switch, { id: "content-approaching-expiry", label: t('Show approaching expiry'), isChecked: showApprochingExpiry, onChange: handleChange }))),
62
62
  React.createElement("div", { className: "expired-content-manage-wrapper pf-v5-u-pt-md", ref: expiredContentResultsRef }, expiredContentResponse.isFetching ? (React.createElement(Bullseye, null,
63
63
  React.createElement(EmptyState, { variant: EmptyStateVariant.full },
64
64
  React.createElement(Spinner, { size: "lg" })))) : isEmpty(filteredEC) ? (React.createElement(EmptyState, { variant: EmptyStateVariant.xs },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "2.1.108",
3
+ "version": "2.1.109",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "license": "ISC",
@@ -45,7 +45,7 @@
45
45
  "prepublishOnly": "npm run build"
46
46
  },
47
47
  "peerDependencies": {
48
- "@cee-eng/hydrajs": "4.17.25",
48
+ "@cee-eng/hydrajs": "4.17.26",
49
49
  "@patternfly/patternfly": "5.4.0",
50
50
  "@patternfly/react-core": "5.4.0",
51
51
  "@patternfly/react-table": "5.4.0",
@@ -75,16 +75,16 @@
75
75
  "typescript": "^5.3.3"
76
76
  },
77
77
  "dependencies": {
78
- "@cee-eng/hydrajs": "4.17.25",
78
+ "@cee-eng/hydrajs": "4.17.26",
79
79
  "@patternfly/patternfly": "5.4.0",
80
80
  "@patternfly/react-core": "5.4.0",
81
81
  "@patternfly/react-table": "5.4.0",
82
- "@rh-support/components": "2.1.83",
82
+ "@rh-support/components": "2.1.84",
83
83
  "@rh-support/configs": "2.0.21",
84
- "@rh-support/react-context": "2.1.92",
84
+ "@rh-support/react-context": "2.1.93",
85
85
  "@rh-support/types": "2.0.5",
86
- "@rh-support/user-permissions": "2.1.51",
87
- "@rh-support/utils": "2.1.40",
86
+ "@rh-support/user-permissions": "2.1.52",
87
+ "@rh-support/utils": "2.1.41",
88
88
  "@types/react-beautiful-dnd": "^13.0.0",
89
89
  "i18next": "^23.15.0",
90
90
  "lodash": ">=4.17.15",
@@ -103,5 +103,5 @@
103
103
  "defaults and supports es6-module",
104
104
  "maintained node versions"
105
105
  ],
106
- "gitHead": "1f6753bdcadf05aeacbef720888e034569e4750b"
106
+ "gitHead": "ad90558bba194b3dbb01ce3d6bd3cbb797621c8c"
107
107
  }