@rh-support/manage 0.2.12 → 0.2.16

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.
Files changed (50) hide show
  1. package/lib/esm/ManageTabs.d.ts.map +1 -1
  2. package/lib/esm/ManageTabs.js +32 -19
  3. package/lib/esm/Routes.d.ts +1 -0
  4. package/lib/esm/Routes.d.ts.map +1 -1
  5. package/lib/esm/Routes.js +6 -0
  6. package/lib/esm/components/ManagePreferences/ManagePreferences.d.ts +5 -0
  7. package/lib/esm/components/ManagePreferences/ManagePreferences.d.ts.map +1 -0
  8. package/lib/esm/components/ManagePreferences/ManagePreferences.js +5 -0
  9. package/lib/esm/components/ManagePreferences/Preferences.d.ts +5 -0
  10. package/lib/esm/components/ManagePreferences/Preferences.d.ts.map +1 -0
  11. package/lib/esm/components/ManagePreferences/Preferences.js +8 -0
  12. package/lib/esm/components/ManagePreferences/PreferencesBody.d.ts +5 -0
  13. package/lib/esm/components/ManagePreferences/PreferencesBody.d.ts.map +1 -0
  14. package/lib/esm/components/ManagePreferences/PreferencesBody.js +10 -0
  15. package/lib/esm/components/ManagePreferences/PreferencesHeader.d.ts +2 -0
  16. package/lib/esm/components/ManagePreferences/PreferencesHeader.d.ts.map +1 -0
  17. package/lib/esm/components/ManagePreferences/PreferencesHeader.js +9 -0
  18. package/lib/esm/components/ManagePreferences/components/PreferenceSelect.d.ts +11 -0
  19. package/lib/esm/components/ManagePreferences/components/PreferenceSelect.d.ts.map +1 -0
  20. package/lib/esm/components/ManagePreferences/components/PreferenceSelect.js +46 -0
  21. package/lib/esm/components/ManagePreferences/components/PreferenceSwitch.d.ts +10 -0
  22. package/lib/esm/components/ManagePreferences/components/PreferenceSwitch.d.ts.map +1 -0
  23. package/lib/esm/components/ManagePreferences/components/PreferenceSwitch.js +33 -0
  24. package/lib/esm/components/ManagePreferences/index.d.ts +2 -0
  25. package/lib/esm/components/ManagePreferences/index.d.ts.map +1 -0
  26. package/lib/esm/components/ManagePreferences/index.js +1 -0
  27. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseCreate.d.ts +5 -0
  28. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseCreate.d.ts.map +1 -0
  29. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseCreate.js +97 -0
  30. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseSearch.d.ts +5 -0
  31. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseSearch.d.ts.map +1 -0
  32. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseSearch.js +92 -0
  33. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.d.ts +5 -0
  34. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.d.ts.map +1 -0
  35. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.js +114 -0
  36. package/lib/esm/components/TopContentManagement/NoTopContentFound.d.ts +1 -1
  37. package/lib/esm/components/TopContentManagement/NoTopContentFound.d.ts.map +1 -1
  38. package/lib/esm/components/TopContentManagement/NoTopContentFound.js +1 -1
  39. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.d.ts.map +1 -1
  40. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.js +25 -17
  41. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentEditor.d.ts.map +1 -1
  42. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentEditor.js +3 -2
  43. package/lib/esm/hooks/useUserPreferences.d.ts +20 -0
  44. package/lib/esm/hooks/useUserPreferences.d.ts.map +1 -0
  45. package/lib/esm/hooks/useUserPreferences.js +106 -0
  46. package/lib/esm/reducers/TopContentReducer.d.ts +3 -1
  47. package/lib/esm/reducers/TopContentReducer.d.ts.map +1 -1
  48. package/lib/esm/reducers/TopContentReducer.js +10 -0
  49. package/lib/esm/scss/_main.scss +12 -0
  50. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"ManageTabs.d.ts","sourceRoot":"","sources":["../../src/ManageTabs.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAoBvD,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;CACvC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eA2GvC"}
1
+ {"version":3,"file":"ManageTabs.d.ts","sourceRoot":"","sources":["../../src/ManageTabs.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAqBvD,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;CACvC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eAiIvC"}
@@ -6,6 +6,7 @@ import map from 'lodash/map';
6
6
  import React, { useContext } from 'react';
7
7
  import { ManageGroupUsers } from './components/Groups/ManageGroupUsers';
8
8
  import { ManageBookmarkedAccountsTab, ManageGroupedBookmarkedAccountsTab, } from './components/ManageBookmarkedAccountsTab';
9
+ import { ManagePreferences } from './components/ManagePreferences';
9
10
  import { NotificationEmails } from './components/NotificationEmails/index';
10
11
  import { TopContentManagement } from './components/TopContentManagement';
11
12
  import { PageTitle } from './constants/pageTitle';
@@ -20,9 +21,10 @@ requireCustomElement([
20
21
  export function ManageTabs(props) {
21
22
  var _a, _b;
22
23
  const history = props.routeProps.history;
23
- const { groupsRoute, bookmarkedAccountsRoute, topContentRoute, notificationEmailsRoute } = Routes.getPaths();
24
+ const { groupsRoute, bookmarkedAccountsRoute, topContentRoute, notificationEmailsRoute, preferencesRoute } = Routes.getPaths();
24
25
  const { globalMetadataState: { pcmConfig }, } = useContext(GlobalMetadataStateContext);
25
26
  const isGroupBookmarkEnabled = getConfigField(pcmConfig.data, 'isGroupBookmarkEnabled', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
27
+ const isPreferencesPageEnabled = getConfigField(pcmConfig.data, 'allowPreferencesPage', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
26
28
  // Changes route and saves the current path to the url query params
27
29
  const isOnlyBasePath = history.location.pathname === Routes.basePath;
28
30
  useDocumentTitle(PageTitle.MANAGE);
@@ -36,17 +38,6 @@ export function ManageTabs(props) {
36
38
  const canManageBookmarkAccounts = ability.can(resourceActions.CREATE, resources.BOOKMARK_ACCOUNTS) && canViewManageTab;
37
39
  const canViewEmailNotificationTab = ability.can(resourceActions.READ, resources.NOTIFICATION_EMAIL);
38
40
  const tabsToRender = [];
39
- canViewCaseGroups &&
40
- tabsToRender.push({
41
- title: 'Groups',
42
- key: 'groups-tab',
43
- routePath: groupsRoute,
44
- 'data-tracking-id': 'manage-groups-tab',
45
- onClick: () => {
46
- changeRouteThunk(groupsRoute);
47
- },
48
- component: React.createElement(ManageGroupUsers, null),
49
- });
50
41
  canManageBookmarkAccounts &&
51
42
  tabsToRender.push({
52
43
  title: 'Bookmarks',
@@ -58,16 +49,16 @@ export function ManageTabs(props) {
58
49
  },
59
50
  component: isGroupBookmarkEnabled ? (React.createElement(ManageGroupedBookmarkedAccountsTab, { canManageBookmarkAccounts: canManageBookmarkAccounts })) : (React.createElement(ManageBookmarkedAccountsTab, { canManageBookmarkAccounts: canManageBookmarkAccounts })),
60
51
  });
61
- canViewManageTopContent &&
52
+ canViewCaseGroups &&
62
53
  tabsToRender.push({
63
- title: 'Top content',
64
- key: 'top-content-tab',
65
- 'data-tracking-id': 'manage-top-content-tab',
66
- routePath: topContentRoute,
54
+ title: 'Groups',
55
+ key: 'groups-tab',
56
+ routePath: groupsRoute,
57
+ 'data-tracking-id': 'manage-groups-tab',
67
58
  onClick: () => {
68
- changeRouteThunk(topContentRoute);
59
+ changeRouteThunk(groupsRoute);
69
60
  },
70
- component: React.createElement(TopContentManagement, null),
61
+ component: React.createElement(ManageGroupUsers, null),
71
62
  });
72
63
  canViewEmailNotificationTab &&
73
64
  tabsToRender.push({
@@ -80,6 +71,28 @@ export function ManageTabs(props) {
80
71
  },
81
72
  component: React.createElement(NotificationEmails, null),
82
73
  });
74
+ isPreferencesPageEnabled &&
75
+ tabsToRender.push({
76
+ title: 'Preferences',
77
+ key: 'preferences-tab',
78
+ 'data-tracking-id': 'preferences-tab',
79
+ routePath: preferencesRoute,
80
+ onClick: () => {
81
+ changeRouteThunk(preferencesRoute);
82
+ },
83
+ component: React.createElement(ManagePreferences, null),
84
+ });
85
+ canViewManageTopContent &&
86
+ tabsToRender.push({
87
+ title: 'Top content',
88
+ key: 'top-content-tab',
89
+ 'data-tracking-id': 'manage-top-content-tab',
90
+ routePath: topContentRoute,
91
+ onClick: () => {
92
+ changeRouteThunk(topContentRoute);
93
+ },
94
+ component: React.createElement(TopContentManagement, null),
95
+ });
83
96
  /**
84
97
  * Render without tabs if there is only one element
85
98
  */
@@ -13,6 +13,7 @@ interface ManageRoutes {
13
13
  groups: Route;
14
14
  savedSearches: Route;
15
15
  topContent: Route;
16
+ preferences: Route;
16
17
  notificationEmails: Route;
17
18
  }
18
19
  export declare const Routes: ManageRoutes;
@@ -1 +1 @@
1
- {"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../src/Routes.ts"],"names":[],"mappings":"AAAA,UAAU,KAAK;IACX,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,eAAe,EAAE,KAAK,CAAC;IACvB,QAAQ,EAAE,MAAM;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC1C,aAAa,EAAE,MAAM,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,KAAK,CAAC;IACd,aAAa,EAAE,KAAK,CAAC;IACrB,UAAU,EAAE,KAAK,CAAC;IAClB,kBAAkB,EAAE,KAAK,CAAC;CAC7B;AAED,eAAO,MAAM,MAAM,EAAE,YAwDpB,CAAC"}
1
+ {"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../src/Routes.ts"],"names":[],"mappings":"AAAA,UAAU,KAAK;IACX,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,eAAe,EAAE,KAAK,CAAC;IACvB,QAAQ,EAAE,MAAM;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC1C,aAAa,EAAE,MAAM,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,KAAK,CAAC;IACd,aAAa,EAAE,KAAK,CAAC;IACrB,UAAU,EAAE,KAAK,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC;IACnB,kBAAkB,EAAE,KAAK,CAAC;CAC7B;AAED,eAAO,MAAM,MAAM,EAAE,YA8DpB,CAAC"}
package/lib/esm/Routes.js CHANGED
@@ -30,6 +30,12 @@ export const Routes = {
30
30
  return getPath(this);
31
31
  },
32
32
  },
33
+ preferences: {
34
+ path: '/preferences',
35
+ getPath() {
36
+ return getPath(this);
37
+ },
38
+ },
33
39
  notificationEmails: {
34
40
  path: '/notification-emails',
35
41
  getPath() {
@@ -0,0 +1,5 @@
1
+ interface IProps {
2
+ }
3
+ export declare function ManagePreferences(props: IProps): JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=ManagePreferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManagePreferences.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePreferences/ManagePreferences.tsx"],"names":[],"mappings":"AAIA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,eAE9C"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { Preferences } from './Preferences';
3
+ export function ManagePreferences(props) {
4
+ return React.createElement(Preferences, null);
5
+ }
@@ -0,0 +1,5 @@
1
+ interface IProps {
2
+ }
3
+ export declare function Preferences(props: IProps): JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=Preferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Preferences.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePreferences/Preferences.tsx"],"names":[],"mappings":"AAIA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eAOxC"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { PreferencesHeader } from '../ManagePreferences/PreferencesHeader';
3
+ import { PreferencesBody } from './PreferencesBody';
4
+ export function Preferences(props) {
5
+ return (React.createElement(React.Fragment, null,
6
+ React.createElement(PreferencesHeader, null),
7
+ React.createElement(PreferencesBody, null)));
8
+ }
@@ -0,0 +1,5 @@
1
+ interface IProps {
2
+ }
3
+ export declare function PreferencesBody(props: IProps): JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=PreferencesBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesBody.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePreferences/PreferencesBody.tsx"],"names":[],"mappings":"AAMA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,eAQ5C"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { PreferencesCaseCreate } from './sections/PreferencesCaseCreate';
3
+ import { PreferencesCaseSearch } from './sections/PreferencesCaseSearch';
4
+ import { PreferencesCaseView } from './sections/PreferencesCaseView';
5
+ export function PreferencesBody(props) {
6
+ return (React.createElement("section", { className: "pfe-l-grid pfe-m-gutters pfe-m-all-4-col", id: "preferences-body" },
7
+ React.createElement(PreferencesCaseSearch, null),
8
+ React.createElement(PreferencesCaseView, null),
9
+ React.createElement(PreferencesCaseCreate, null)));
10
+ }
@@ -0,0 +1,2 @@
1
+ export declare function PreferencesHeader(): JSX.Element;
2
+ //# sourceMappingURL=PreferencesHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePreferences/PreferencesHeader.tsx"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,gBAahC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { Trans } from 'react-i18next';
3
+ export function PreferencesHeader() {
4
+ return (React.createElement("header", null,
5
+ React.createElement("h2", null,
6
+ React.createElement(Trans, null, "Preferences")),
7
+ React.createElement("p", { className: "pf-u-mt-md pf-u-mb-sm" },
8
+ React.createElement(Trans, null, "Setting preferences will personalize your support case experience to best suit your needs."))));
9
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface IProps {
3
+ id: string;
4
+ label: string;
5
+ selections: string;
6
+ onSelect: (event: any, selection: any, isPlaceholder: any) => Promise<any>;
7
+ children: React.ReactElement[];
8
+ }
9
+ export declare function PreferenceSelect({ id, label, selections, children, onSelect }: IProps): JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=PreferenceSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferenceSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/components/PreferenceSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,UAAU,MAAM;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,KAAA,EAAE,SAAS,KAAA,EAAE,aAAa,KAAA,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5D,QAAQ,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;CAClC;AACD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,MAAM,eA6CrF"}
@@ -0,0 +1,46 @@
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 { Select, SelectVariant, Spinner } from '@patternfly/react-core';
11
+ import { ToastNotification } from '@rh-support/components';
12
+ import React, { useState } from 'react';
13
+ import { Trans, useTranslation } from 'react-i18next';
14
+ export function PreferenceSelect({ id, label, selections, children, onSelect }) {
15
+ const { t } = useTranslation();
16
+ const [isOpen, setIsOpen] = useState(false);
17
+ const [isLoading, setIsLoading] = useState(false);
18
+ const onSelectToggle = (isOpen) => {
19
+ setIsOpen(isOpen);
20
+ };
21
+ const onSelectLocal = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
22
+ if (isPlaceholder)
23
+ defaultClearSelection();
24
+ else {
25
+ setIsLoading(true);
26
+ try {
27
+ yield onSelect(event, selection, isPlaceholder);
28
+ ToastNotification.addSuccessMessage(t('Successfully updated preference'));
29
+ }
30
+ catch (e) {
31
+ ToastNotification.addDangerMessage(t('Failed to update preference'));
32
+ }
33
+ finally {
34
+ defaultClearSelection();
35
+ setIsLoading(false);
36
+ }
37
+ }
38
+ });
39
+ const defaultClearSelection = () => {
40
+ setIsOpen(false);
41
+ };
42
+ return (React.createElement(React.Fragment, null,
43
+ React.createElement("label", { id: id },
44
+ React.createElement(Trans, null, label)),
45
+ React.createElement(Select, { variant: SelectVariant.single, onToggle: onSelectToggle, onSelect: onSelectLocal, selections: selections, isOpen: isOpen, "aria-labelledby": id, toggleIcon: isLoading && React.createElement(Spinner, { size: "sm" }) }, children)));
46
+ }
@@ -0,0 +1,10 @@
1
+ interface IProps {
2
+ className: string;
3
+ id: string;
4
+ label: string;
5
+ onSwitchChange: (checked: boolean) => Promise<any>;
6
+ isChecked: boolean;
7
+ }
8
+ export declare function PreferenceSwitch({ onSwitchChange, className, id, label, isChecked }: IProps): JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=PreferenceSwitch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferenceSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/components/PreferenceSwitch.tsx"],"names":[],"mappings":"AAKA,UAAU,MAAM;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACnD,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,eA6B3F"}
@@ -0,0 +1,33 @@
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 { Switch } from '@patternfly/react-core';
11
+ import { ToastNotification } from '@rh-support/components';
12
+ import React, { useState } from 'react';
13
+ import { useTranslation } from 'react-i18next';
14
+ export function PreferenceSwitch({ onSwitchChange, className, id, label, isChecked }) {
15
+ const [isSwitchLoading, setIsSwitchLoading] = useState(false);
16
+ let isCheckedLocal = isChecked;
17
+ const { t } = useTranslation();
18
+ const onChangeLocal = (checked) => __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ setIsSwitchLoading(true);
21
+ yield onSwitchChange(checked);
22
+ isCheckedLocal = isChecked;
23
+ ToastNotification.addSuccessMessage(t('Successfully updated preference'));
24
+ setIsSwitchLoading(false);
25
+ }
26
+ catch (_a) {
27
+ isCheckedLocal = !checked;
28
+ ToastNotification.addDangerMessage(t('Failed to update preference'));
29
+ setIsSwitchLoading(false);
30
+ }
31
+ });
32
+ return (React.createElement(Switch, { className: className, id: id, label: t(label), isChecked: isCheckedLocal, onChange: onChangeLocal, isDisabled: isSwitchLoading }));
33
+ }
@@ -0,0 +1,2 @@
1
+ export * from './ManagePreferences';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePreferences/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './ManagePreferences';
@@ -0,0 +1,5 @@
1
+ interface IProps {
2
+ }
3
+ export declare function PreferencesCaseCreate(props: IProps): JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=PreferencesCaseCreate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesCaseCreate.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseCreate.tsx"],"names":[],"mappings":"AAaA,UAAU,MAAM;CAAG;AACnB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,eAwHlD"}
@@ -0,0 +1,97 @@
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 { Card, CardBody, CardHeader, SelectOption } from '@patternfly/react-core';
11
+ import { languageConst, ToastNotification } from '@rh-support/components';
12
+ import { GlobalMetadataStateContext } from '@rh-support/react-context';
13
+ import { invert } from 'lodash';
14
+ import isEmpty from 'lodash/isEmpty';
15
+ import React, { useContext, useEffect, useState } from 'react';
16
+ import { Trans, useTranslation } from 'react-i18next';
17
+ import { useUserPreferences } from '../../../hooks/useUserPreferences';
18
+ import { PreferenceSelect } from '../components/PreferenceSelect';
19
+ export function PreferencesCaseCreate(props) {
20
+ const { t } = useTranslation();
21
+ const { globalMetadataState: { caseGroups }, } = useContext(GlobalMetadataStateContext);
22
+ const [originalPreferredLanguage, setOriginalPreferredLanguage] = useState('');
23
+ const [originalDefaultGroup, setOriginalDefaultGroup] = useState('');
24
+ const [groupDictionary, setGroupDictionary] = useState({});
25
+ const [userDefaultGroupList, setUserDefaultGroupList] = useState([]);
26
+ const { getPreferredLanguage, updatePreferredLanguage, updateDefaultGroup, getDefaultGroup } = useUserPreferences();
27
+ const preferredLangTitleId = 'preferred-language-select';
28
+ const defaultGroupTitleId = 'default-group-select';
29
+ const getKeyByValue = (object, value) => {
30
+ return Object.keys(object).find((key) => object[key] === value);
31
+ };
32
+ const onPreferredLanguageSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
33
+ const selectedLanguageCode = getKeyByValue(languageConst, selection);
34
+ yield updatePreferredLanguage(selectedLanguageCode);
35
+ });
36
+ const onDefaultGroupSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
37
+ console.log(selection);
38
+ console.log('groupDictionary: ', groupDictionary);
39
+ console.log(groupDictionary[`${selection}`]);
40
+ const selectionKey = invert(groupDictionary)[selection];
41
+ console.log('selectionKey', selectionKey);
42
+ yield updateDefaultGroup(selectionKey);
43
+ });
44
+ const userOriginalPreferredLanguage = () => __awaiter(this, void 0, void 0, function* () {
45
+ try {
46
+ const retrievedLanguage = yield getPreferredLanguage();
47
+ setOriginalPreferredLanguage(languageConst[retrievedLanguage]);
48
+ }
49
+ catch (_a) {
50
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
51
+ }
52
+ });
53
+ const userOriginalDefaultGroup = () => __awaiter(this, void 0, void 0, function* () {
54
+ try {
55
+ const retrievedGroupId = yield getDefaultGroup();
56
+ setOriginalDefaultGroup(groupDictionary[retrievedGroupId]);
57
+ }
58
+ catch (_b) {
59
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
60
+ }
61
+ });
62
+ const createCaseGroupStruct = (caseGroups) => {
63
+ const defaultGroupDictionary = {};
64
+ for (let i = 0; i < caseGroups.data.length; i++) {
65
+ defaultGroupDictionary[caseGroups.data[i].groupNum] = caseGroups.data[i].name;
66
+ }
67
+ console.log(defaultGroupDictionary);
68
+ return defaultGroupDictionary;
69
+ };
70
+ useEffect(() => {
71
+ userOriginalPreferredLanguage();
72
+ userOriginalDefaultGroup();
73
+ });
74
+ useEffect(() => {
75
+ var _a;
76
+ if (!isEmpty(caseGroups) && ((_a = caseGroups === null || caseGroups === void 0 ? void 0 : caseGroups.data) === null || _a === void 0 ? void 0 : _a.length) > 0 && Object.keys(groupDictionary).length === 0) {
77
+ let updatedDictionary = createCaseGroupStruct(caseGroups);
78
+ setGroupDictionary(updatedDictionary);
79
+ const parsedDefaultGroupNames = [];
80
+ for (let groupId in updatedDictionary) {
81
+ parsedDefaultGroupNames.push(updatedDictionary[groupId]);
82
+ }
83
+ console.log('parsedDefaultGroupNames, ', parsedDefaultGroupNames);
84
+ setUserDefaultGroupList(parsedDefaultGroupNames);
85
+ }
86
+ }, [caseGroups, groupDictionary]);
87
+ return (React.createElement(Card, { className: "preference-card" },
88
+ React.createElement(CardHeader, null,
89
+ React.createElement("h3", null,
90
+ React.createElement(Trans, null, "Case create"))),
91
+ React.createElement(CardBody, null,
92
+ React.createElement("form", null,
93
+ React.createElement("div", { className: "form-group" },
94
+ React.createElement(PreferenceSelect, { label: "Preferred case language", id: preferredLangTitleId, onSelect: onPreferredLanguageSelect, selections: originalPreferredLanguage }, Object.keys(languageConst).map((option, index) => (React.createElement(SelectOption, { key: index, value: languageConst[option] }))))),
95
+ React.createElement("div", { className: "form-group" },
96
+ React.createElement(PreferenceSelect, { label: "Default group", id: defaultGroupTitleId, onSelect: onDefaultGroupSelect, selections: originalDefaultGroup }, userDefaultGroupList.map((option, index) => (React.createElement(SelectOption, { key: index, value: option })))))))));
97
+ }
@@ -0,0 +1,5 @@
1
+ interface IProps {
2
+ }
3
+ export declare function PreferencesCaseSearch(props: IProps): JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=PreferencesCaseSearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesCaseSearch.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseSearch.tsx"],"names":[],"mappings":"AAYA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,eAwHlD"}
@@ -0,0 +1,92 @@
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 { Card, CardBody, CardHeader, SelectOption } from '@patternfly/react-core';
11
+ import { ToastNotification } from '@rh-support/components';
12
+ import { UserPreferencesKeys } from '@rh-support/react-context';
13
+ import find from 'lodash/find';
14
+ import React, { useEffect, useState } from 'react';
15
+ import { Trans, useTranslation } from 'react-i18next';
16
+ import { useUserPreferences } from '../../../hooks/useUserPreferences';
17
+ import { PreferenceSelect } from '../components/PreferenceSelect';
18
+ import { PreferenceSwitch } from '../components/PreferenceSwitch';
19
+ export function PreferencesCaseSearch(props) {
20
+ const { t } = useTranslation();
21
+ const { getAutoRestoreSavedSearchPreference, updateAutoRestoreSavedSearchPreference, getAutoRestoreLastSearchPreference, updateAutoRestoreLastSearchPreference, getAutoSaveSelectedColumnsPreference, updateAutoSaveSelectedColumnsPreference, hydraUserPreferences, } = useUserPreferences();
22
+ const [isAutoRestoreChecked, setIsAutoRestoreChecked] = useState(false);
23
+ const [isAutoSaveChecked, setIsAutoSaveChecked] = useState(false);
24
+ const [bookmarkedSearches, setBookmarkedSearches] = useState([]);
25
+ const [originalSavedSearch, setOriginalSavedSearch] = useState('');
26
+ const parseToBoolean = (value) => {
27
+ return value === 'true';
28
+ };
29
+ useEffect(() => {
30
+ const savedFiltrerKey = UserPreferencesKeys.caseSavedSearchFilters;
31
+ const savedSearches = find(hydraUserPreferences.data, (pref) => pref.key === savedFiltrerKey);
32
+ if (savedSearches) {
33
+ const _bookmarkedSearches = JSON.parse(savedSearches.value);
34
+ setBookmarkedSearches(Object.keys(_bookmarkedSearches));
35
+ }
36
+ }, [hydraUserPreferences.data]);
37
+ const userOriginalSavedSearch = () => __awaiter(this, void 0, void 0, function* () {
38
+ try {
39
+ const originalSearch = yield getAutoRestoreSavedSearchPreference();
40
+ setOriginalSavedSearch(originalSearch);
41
+ }
42
+ catch (_a) {
43
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
44
+ }
45
+ });
46
+ const userOriginalAutoRestoreLastSearch = () => __awaiter(this, void 0, void 0, function* () {
47
+ try {
48
+ const originalLastSearchPref = yield getAutoRestoreLastSearchPreference();
49
+ const parsedLastSearchPref = parseToBoolean(originalLastSearchPref);
50
+ setIsAutoRestoreChecked(parsedLastSearchPref);
51
+ }
52
+ catch (_b) {
53
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
54
+ }
55
+ });
56
+ const userOriginalAutoSaveColumns = () => __awaiter(this, void 0, void 0, function* () {
57
+ try {
58
+ const originalColumnsPref = yield getAutoSaveSelectedColumnsPreference();
59
+ const parsedColumnPref = parseToBoolean(originalColumnsPref);
60
+ setIsAutoSaveChecked(parsedColumnPref);
61
+ }
62
+ catch (_c) {
63
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
64
+ }
65
+ });
66
+ useEffect(() => {
67
+ userOriginalSavedSearch();
68
+ userOriginalAutoRestoreLastSearch();
69
+ userOriginalAutoSaveColumns();
70
+ });
71
+ const onSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
72
+ yield updateAutoRestoreSavedSearchPreference(selection);
73
+ });
74
+ const onAutoRestoreSwitchChange = (checked) => __awaiter(this, void 0, void 0, function* () {
75
+ yield updateAutoRestoreLastSearchPreference(checked);
76
+ });
77
+ const onAutoSaveSwitchChange = (checked) => __awaiter(this, void 0, void 0, function* () {
78
+ yield updateAutoSaveSelectedColumnsPreference(checked);
79
+ });
80
+ const titleId = 'auto-restore-preference-dropdown';
81
+ return (React.createElement(Card, { className: "preference-card" },
82
+ React.createElement(CardHeader, null,
83
+ React.createElement("h3", null,
84
+ React.createElement(Trans, null, "Case search"))),
85
+ React.createElement(CardBody, null,
86
+ React.createElement("form", null,
87
+ React.createElement("div", { className: "form-group" },
88
+ React.createElement(PreferenceSelect, { label: "Auto-restore my saved search", id: titleId, onSelect: onSelect, selections: originalSavedSearch }, bookmarkedSearches.map((option, index) => (React.createElement(SelectOption, { key: index, value: option }))))),
89
+ React.createElement("div", { className: "form-group" },
90
+ React.createElement(PreferenceSwitch, { className: "preference-page-switches", id: "auto-restore-last-search-switch", label: "Auto-restore last search", onSwitchChange: onAutoRestoreSwitchChange, isChecked: isAutoRestoreChecked }),
91
+ React.createElement(PreferenceSwitch, { className: "preference-page-switches", id: "auto-save-columns-switch", label: "Auto-save selected table columns", onSwitchChange: onAutoSaveSwitchChange, isChecked: isAutoSaveChecked }))))));
92
+ }
@@ -0,0 +1,5 @@
1
+ interface IProps {
2
+ }
3
+ export declare function PreferencesCaseView(props: IProps): JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=PreferencesCaseView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAUA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAiJhD"}
@@ -0,0 +1,114 @@
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 { Card, CardBody, CardHeader, SelectOption, Spinner, TextArea } from '@patternfly/react-core';
11
+ import { EditorMode, ToastNotification } from '@rh-support/components';
12
+ import debounce from 'lodash/debounce';
13
+ import React, { useEffect, useState } from 'react';
14
+ import { Trans, useTranslation } from 'react-i18next';
15
+ import { useUserPreferences } from '../../../hooks/useUserPreferences';
16
+ import { PreferenceSelect } from '../components/PreferenceSelect';
17
+ import { PreferenceSwitch } from '../components/PreferenceSwitch';
18
+ export function PreferencesCaseView(props) {
19
+ const { t } = useTranslation();
20
+ const { updateCommentType, getCommentTypeFromPreference, getCommentSignature, updateCommentSignature, getShareHostNames, updateShareHostNames, } = useUserPreferences();
21
+ const [isSharingHostNames, setIsSharingHostNames] = useState(false);
22
+ const [localCommentSignature, setLocalCommentSignature] = useState('');
23
+ const [originalCommentType, setOriginalCommentType] = useState('');
24
+ const [originalCommentSignature, setOriginalCommentSignature] = useState('');
25
+ const [commentValidated, setCommentValidated] = useState('default');
26
+ const [isCommentSignatureLoading, setIsCommentSignatureLoading] = useState(false);
27
+ const commentTypes = [EditorMode.PLAIN, EditorMode.MARKDOWN];
28
+ const parseToBoolean = (value) => {
29
+ return value === 'true';
30
+ };
31
+ const userOriginalShareHostNames = () => __awaiter(this, void 0, void 0, function* () {
32
+ try {
33
+ const retrievedShareHostNames = yield getShareHostNames();
34
+ const parsedShareHostNames = parseToBoolean(retrievedShareHostNames);
35
+ setIsSharingHostNames(parsedShareHostNames);
36
+ }
37
+ catch (_a) {
38
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
39
+ }
40
+ });
41
+ const userOriginalCommentType = () => __awaiter(this, void 0, void 0, function* () {
42
+ try {
43
+ const retrievedComment = yield getCommentTypeFromPreference();
44
+ setOriginalCommentType(retrievedComment);
45
+ }
46
+ catch (_b) {
47
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
48
+ }
49
+ });
50
+ const userOriginalCommentSignature = () => __awaiter(this, void 0, void 0, function* () {
51
+ try {
52
+ const retrievedSignature = yield getCommentSignature();
53
+ setOriginalCommentSignature(retrievedSignature);
54
+ }
55
+ catch (_c) {
56
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
57
+ }
58
+ });
59
+ useEffect(() => {
60
+ userOriginalCommentSignature();
61
+ userOriginalCommentType();
62
+ userOriginalShareHostNames();
63
+ });
64
+ useEffect(() => {
65
+ if (localCommentSignature === '' && commentValidated !== 'error') {
66
+ setCommentValidated('default');
67
+ }
68
+ }, [localCommentSignature, commentValidated]);
69
+ const debounceUpdateCommentSignature = debounce((value) => __awaiter(this, void 0, void 0, function* () {
70
+ try {
71
+ yield updateCommentSignature(value);
72
+ }
73
+ catch (error) {
74
+ setLocalCommentSignature('');
75
+ setOriginalCommentSignature(originalCommentSignature);
76
+ ToastNotification.addDangerMessage(t('Failed to update preference'));
77
+ setCommentValidated('error');
78
+ setIsCommentSignatureLoading(false);
79
+ }
80
+ }), 1000);
81
+ const handleCommentSignatureChange = (value) => __awaiter(this, void 0, void 0, function* () {
82
+ setIsCommentSignatureLoading(true);
83
+ yield debounceUpdateCommentSignature(value);
84
+ setTimeout(() => setCommentValidated('success'), 2000);
85
+ setLocalCommentSignature(value);
86
+ setIsCommentSignatureLoading(false);
87
+ });
88
+ const onShareHostNamesSwitch = (checked) => __awaiter(this, void 0, void 0, function* () {
89
+ yield updateShareHostNames(checked);
90
+ });
91
+ const onSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
92
+ yield updateCommentType(selection);
93
+ });
94
+ const titleId = 'default-comment-preference-select';
95
+ return (React.createElement(Card, { className: "preference-card" },
96
+ React.createElement(CardHeader, null,
97
+ React.createElement("h3", null,
98
+ React.createElement(Trans, null, "Case view"))),
99
+ React.createElement(CardBody, null,
100
+ React.createElement("form", null,
101
+ React.createElement("div", { className: "form-group" },
102
+ React.createElement(PreferenceSelect, { onSelect: onSelect, selections: originalCommentType, id: titleId, label: "Default comment type" }, commentTypes.map((option, index) => (React.createElement(SelectOption, { key: index, value: option }))))),
103
+ React.createElement("div", { className: "form-group" },
104
+ React.createElement("label", { htmlFor: "comment-signature-textarea" },
105
+ React.createElement(Trans, null, "Comment signature")),
106
+ React.createElement(TextArea, { value: localCommentSignature, onChange: handleCommentSignatureChange, "aria-label": "comment-signature-textarea", placeholder: originalCommentSignature, id: "comment-signature-textarea",
107
+ // @ts-ignore
108
+ validated: commentValidated }),
109
+ isCommentSignatureLoading && React.createElement(Spinner, { size: "md" })),
110
+ React.createElement("div", { className: "form-group" },
111
+ React.createElement("label", { htmlFor: "share-hostnames-switch" },
112
+ React.createElement(Trans, null, "Case information")),
113
+ React.createElement(PreferenceSwitch, { className: "switches", id: "share-hostnames-switch", label: "Share hostnames with Red Hat", isChecked: isSharingHostNames, onSwitchChange: onShareHostNamesSwitch }))))));
114
+ }
@@ -2,7 +2,7 @@ interface IProps {
2
2
  version: string;
3
3
  product: string;
4
4
  dataLength: number;
5
- onAddCategory: (majorOnly: boolean, newSet: boolean, version: string) => void;
5
+ onAddCategory: (majorOnly: boolean, newSet: boolean, version: string, hasMajorContentCreatingMinorContent?: boolean) => void;
6
6
  onVersionChange?: (version: string) => void;
7
7
  isContentOnlyForMajorVersion: boolean;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NoTopContentFound.d.ts","sourceRoot":"","sources":["../../../../src/components/TopContentManagement/NoTopContentFound.tsx"],"names":[],"mappings":"AAeA,UAAU,MAAM;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9E,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,4BAA4B,EAAE,OAAO,CAAC;CACzC;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,OAAO,EACP,OAAO,EACP,UAAU,EACV,aAAa,EACb,eAAe,EACf,4BAA4B,GAC/B,EAAE,MAAM,eAyFR"}
1
+ {"version":3,"file":"NoTopContentFound.d.ts","sourceRoot":"","sources":["../../../../src/components/TopContentManagement/NoTopContentFound.tsx"],"names":[],"mappings":"AAeA,UAAU,MAAM;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CACX,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,EACf,mCAAmC,CAAC,EAAE,OAAO,KAC5C,IAAI,CAAC;IACV,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,4BAA4B,EAAE,OAAO,CAAC;CACzC;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,OAAO,EACP,OAAO,EACP,UAAU,EACV,aAAa,EACb,eAAe,EACf,4BAA4B,GAC/B,EAAE,MAAM,eAyFR"}
@@ -39,7 +39,7 @@ export function NoTopContentFound({ version, product, dataLength, onAddCategory,
39
39
  ' ',
40
40
  "troubleshooting this version"),
41
41
  React.createElement("div", { className: "pf-u-mt-lg" },
42
- React.createElement(Button, { isInline: true, className: "pf-c-alert__action", variant: ButtonVariant.primary, onClick: () => onAddCategory(false, true, version) },
42
+ React.createElement(Button, { isInline: true, className: "pf-c-alert__action", variant: ButtonVariant.primary, onClick: () => onAddCategory(false, true, version, true) },
43
43
  React.createElement(Trans, null,
44
44
  "Create new set for ",
45
45
  version)))));
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentSingleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,EAGH,oBAAoB,EAOvB,MAAM,wCAAwC,CAAC;AAGhD,UAAU,MAAM;IACZ,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,CAAC,EAAE,MAAM,CAAC;CACb;AAaD,eAAO,MAAM,oBAAoB,kDAAmD,MAAM,gBAwXzF,CAAC"}
1
+ {"version":3,"file":"TopContentSingleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,EAIH,oBAAoB,EAOvB,MAAM,wCAAwC,CAAC;AAGhD,UAAU,MAAM;IACZ,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,CAAC,EAAE,MAAM,CAAC;CACb;AAaD,eAAO,MAAM,oBAAoB,kDAAmD,MAAM,gBAgYzF,CAAC"}
@@ -19,7 +19,7 @@ import React, { useEffect, useState } from 'react';
19
19
  import { Trans, useTranslation } from 'react-i18next';
20
20
  import { useTopContentContext, useTopContentDispatchContext } from '../../../../context/TopContentProvider';
21
21
  import { getTopContentUrl } from '../../../../reducers/TopContentHelpers';
22
- import { ContentMode, deleteTopContent, removeTopContent, saveAddedNewSectionContents, saveAddToTopContent, saveChangeInCategoryContent, setIsAddingCategory, } from '../../../../reducers/TopContentReducer';
22
+ import { ContentMode, deleteTopContent, fetchTopContent, removeTopContent, saveAddedNewSectionContents, saveAddToTopContent, saveChangeInCategoryContent, setIsAddingCategory, } from '../../../../reducers/TopContentReducer';
23
23
  import { AddNewCategoryDropDown } from './AddNewCategoryDropDown';
24
24
  function formatDuplicateWarning(arr) {
25
25
  if (arr.length === 0 || arr.length === 1)
@@ -90,41 +90,42 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
90
90
  throwWarningMessage();
91
91
  }
92
92
  });
93
- const onContentUrlChange = (contentUrl, event) => __awaiter(void 0, void 0, void 0, function* () {
94
- setContentUrlIsValid(event.target.validity.valid);
93
+ const checkDuplicateUrls = (contentUrl) => {
95
94
  const dupObjCopy = cloneDeep(contentUrls);
96
- const cat = category.categoryName;
95
+ const selectedCategory = category.categoryName;
97
96
  // remove old url that is edited from obj
98
- if (dupObjCopy[content.contentUrl] && dupObjCopy[content.contentUrl][cat] > 1) {
99
- dupObjCopy[content.contentUrl][cat]--;
97
+ if (dupObjCopy[content.contentUrl] && dupObjCopy[content.contentUrl][selectedCategory] > 1) {
98
+ dupObjCopy[content.contentUrl][selectedCategory]--;
100
99
  }
101
100
  else {
102
101
  delete dupObjCopy[content.contentUrl];
103
102
  }
104
103
  //remove prev url from dup obj
105
104
  if (dupObjCopy[localContentUrl]) {
106
- if (dupObjCopy[localContentUrl][cat]) {
107
- dupObjCopy[localContentUrl][cat]--;
105
+ if (dupObjCopy[localContentUrl][selectedCategory]) {
106
+ dupObjCopy[localContentUrl][selectedCategory]--;
108
107
  }
109
108
  }
110
109
  //add new typed url to dup
111
110
  if (dupObjCopy[contentUrl]) {
112
- if (dupObjCopy[contentUrl][cat]) {
113
- dupObjCopy[contentUrl][cat]++;
111
+ if (dupObjCopy[contentUrl][selectedCategory]) {
112
+ dupObjCopy[contentUrl][selectedCategory]++;
114
113
  }
115
114
  else {
116
- dupObjCopy[contentUrl][cat] = 1;
115
+ dupObjCopy[contentUrl][selectedCategory] = 1;
117
116
  }
118
117
  }
119
118
  else {
120
- dupObjCopy[contentUrl] = { [cat]: 1 };
119
+ dupObjCopy[contentUrl] = { [selectedCategory]: 1 };
121
120
  }
122
- if (dupObjCopy[contentUrl][cat] > 1 || Object.keys(dupObjCopy[contentUrl]).length > 1) {
121
+ if (dupObjCopy[contentUrl][selectedCategory] > 1 || Object.keys(dupObjCopy[contentUrl]).length > 1) {
123
122
  const dupArrays = [];
124
123
  for (const cat in dupObjCopy[contentUrl]) {
125
- cat === category.categoryName && dupArrays.unshift(React.createElement("strong", { key: `${cat}` }, "this section"));
126
- decodeURI(cat) !== category.categoryName &&
127
- dupArrays.push(React.createElement("strong", { key: `${cat}` }, decodeURI(cat)));
124
+ if (cat !== 'undefined') {
125
+ cat === category.categoryName
126
+ ? dupArrays.unshift(React.createElement("strong", { key: `${cat}` }, "this section"))
127
+ : dupArrays.push(React.createElement("strong", { key: `${cat}` }, decodeURI(cat)));
128
+ }
128
129
  }
129
130
  setDuplicatUrlErrorArray(dupArrays);
130
131
  setShowDuplicateError(true);
@@ -133,6 +134,10 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
133
134
  else {
134
135
  setShowDuplicateError(false);
135
136
  }
137
+ };
138
+ const onContentUrlChange = (contentUrl, event) => __awaiter(void 0, void 0, void 0, function* () {
139
+ setContentUrlIsValid(event.target.validity.valid);
140
+ checkDuplicateUrls(contentUrl);
136
141
  setLocalContentUrl(contentUrl);
137
142
  setIsFetchingSolrSearch(true);
138
143
  yield updateContentTitleFromUrl(contentUrl);
@@ -212,7 +217,10 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
212
217
  setNewCategory(category);
213
218
  };
214
219
  const onCancel = () => {
215
- if (content.mode === ContentMode.ADD || content.mode === ContentMode.NEW_SECTION_CONTENT) {
220
+ if (content.mode === ContentMode.NEW_SECTION_CONTENT) {
221
+ fetchTopContent(topContentDispatch, selectedProduct, selectedVersion);
222
+ }
223
+ if (content.mode === ContentMode.ADD) {
216
224
  removeTopContent(topContentDispatch, topContentEditState, category.id, i);
217
225
  }
218
226
  // reset values to initial props values
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/TopContentEditor/TopContentEditor.tsx"],"names":[],"mappings":"AAsCA,wBAAgB,gBAAgB,gBA+Q/B"}
1
+ {"version":3,"file":"TopContentEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/TopContentEditor/TopContentEditor.tsx"],"names":[],"mappings":"AAuCA,wBAAgB,gBAAgB,gBAqR/B"}
@@ -15,7 +15,7 @@ import React, { useEffect, useRef, useState } from 'react';
15
15
  import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
16
16
  import { Trans, useTranslation } from 'react-i18next';
17
17
  import { useTopContentContext, useTopContentDispatchContext } from '../../../context/TopContentProvider';
18
- import { CategoryMode, fetchTopContent, reArrangeCategory, resetChangeInCategory, resetContentWithSelectedProduct, setAddNewSection, setIsAddingCategory, setIsSearchModeEnabled, setTopContentArrangingCategory, setTopContentArrangingContent, } from '../../../reducers/TopContentReducer';
18
+ import { CategoryMode, fetchTopContent, reArrangeCategory, resetChangeInCategory, resetContentWithSelectedProduct, resetDuplicatUrls, setAddNewSection, setIsAddingCategory, setIsSearchModeEnabled, setTopContentArrangingCategory, setTopContentArrangingContent, } from '../../../reducers/TopContentReducer';
19
19
  import { NoTopContentFound } from '../NoTopContentFound';
20
20
  import { TopContentHeader } from '../TopContentHeader';
21
21
  import { TopContentProductVersionSelector } from '../TopContentProductVersionSelector';
@@ -42,7 +42,8 @@ export function TopContentEditor() {
42
42
  !isSearchModeEnabled && setFilteredTC(topContentEditState);
43
43
  // eslint-disable-next-line react-hooks/exhaustive-deps
44
44
  }, [topContentEditState]);
45
- const onAddCategory = (isMajorVersionOnly, isCreatingNewSet = false, version) => {
45
+ const onAddCategory = (isMajorVersionOnly, isCreatingNewSet = false, version, hasMajorContentCreatingMinorContent) => {
46
+ hasMajorContentCreatingMinorContent && resetDuplicatUrls(topContentDispatch);
46
47
  setCategoryToOpen(null);
47
48
  setIsAddingCategory(topContentDispatch, true);
48
49
  setAddNewSection(topContentDispatch, topContentEditState, isMajorVersionOnly, isCreatingNewSet);
@@ -0,0 +1,20 @@
1
+ export declare function useUserPreferences(): {
2
+ updateCommentType: (value: string) => Promise<void>;
3
+ getCommentTypeFromPreference: () => any;
4
+ hydraUserPreferences: import("@rh-support/types/shared").IApiResponseDetails<import("@cee-eng/hydrajs/@types/models/general").IPreference[]>;
5
+ getAutoRestoreSavedSearchPreference: () => any;
6
+ updateAutoRestoreSavedSearchPreference: (value: string) => Promise<void>;
7
+ getAutoRestoreLastSearchPreference: () => any;
8
+ updateAutoRestoreLastSearchPreference: (value: boolean) => Promise<void>;
9
+ getAutoSaveSelectedColumnsPreference: () => any;
10
+ updateAutoSaveSelectedColumnsPreference: (value: boolean) => Promise<void>;
11
+ getCommentSignature: () => any;
12
+ updateCommentSignature: (value: string) => Promise<void>;
13
+ getShareHostNames: () => any;
14
+ updateShareHostNames: (value: boolean) => Promise<void>;
15
+ getPreferredLanguage: () => any;
16
+ updatePreferredLanguage: (value: string) => Promise<void>;
17
+ getDefaultGroup: () => any;
18
+ updateDefaultGroup: (value: string) => Promise<void>;
19
+ };
20
+ //# sourceMappingURL=useUserPreferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUserPreferences.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUserPreferences.tsx"],"names":[],"mappings":"AAQA,wBAAgB,kBAAkB;+BAoIU,MAAM;;;;oDApHe,MAAM;;mDAoBP,OAAO;;qDAgBL,OAAO;;oCAgBxB,MAAM;;kCAgBR,OAAO;;qCAgBJ,MAAM;;gCAgBX,MAAM;EA+ClD"}
@@ -0,0 +1,106 @@
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 { GlobalMetadataDispatchContext, GlobalMetadataStateContext, updateUserPreferences, UserPreferencesKeys, } from '@rh-support/react-context';
11
+ import { useContext } from 'react';
12
+ export function useUserPreferences() {
13
+ const { globalMetadataState: { loggedInUser, hydraUserPreferences }, } = useContext(GlobalMetadataStateContext);
14
+ const globalMetadataDispatch = useContext(GlobalMetadataDispatchContext);
15
+ const doesKeyExistWithSameValue = (key, value) => {
16
+ const item = getKeyValue(key);
17
+ return item && item === value;
18
+ };
19
+ const getKeyValue = (key) => {
20
+ const item = hydraUserPreferences.data.find((pref) => pref.key === key);
21
+ return item ? item.value : null;
22
+ };
23
+ const updateAutoRestoreSavedSearchPreference = (value) => __awaiter(this, void 0, void 0, function* () {
24
+ if (doesKeyExistWithSameValue(UserPreferencesKeys.autoRestoreSavedSearch, value))
25
+ return;
26
+ yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.autoRestoreSavedSearch, value }], 'add', true, true);
27
+ });
28
+ const getAutoRestoreSavedSearchPreference = () => {
29
+ return getKeyValue(UserPreferencesKeys.autoRestoreSavedSearch);
30
+ };
31
+ const getAutoRestoreLastSearchPreference = () => {
32
+ return getKeyValue(UserPreferencesKeys.autoRestoreLastSearch);
33
+ };
34
+ const updateAutoRestoreLastSearchPreference = (value) => __awaiter(this, void 0, void 0, function* () {
35
+ if (doesKeyExistWithSameValue(UserPreferencesKeys.autoRestoreLastSearch, value))
36
+ return;
37
+ yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.autoRestoreLastSearch, value }], 'add', true, true);
38
+ });
39
+ const getAutoSaveSelectedColumnsPreference = () => {
40
+ return getKeyValue(UserPreferencesKeys.autoSaveSelectedColumns);
41
+ };
42
+ const updateAutoSaveSelectedColumnsPreference = (value) => __awaiter(this, void 0, void 0, function* () {
43
+ if (doesKeyExistWithSameValue(UserPreferencesKeys.autoSaveSelectedColumns, value))
44
+ return;
45
+ yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.autoSaveSelectedColumns, value }], 'add', true, true);
46
+ });
47
+ const getCommentSignature = () => {
48
+ return getKeyValue(UserPreferencesKeys.commentSignature);
49
+ };
50
+ const updateCommentSignature = (value) => __awaiter(this, void 0, void 0, function* () {
51
+ if (doesKeyExistWithSameValue(UserPreferencesKeys.commentSignature, value))
52
+ return;
53
+ yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.commentSignature, value }], 'add', true, true);
54
+ });
55
+ const getShareHostNames = () => {
56
+ return getKeyValue(UserPreferencesKeys.shareHostnames);
57
+ };
58
+ const updateShareHostNames = (value) => __awaiter(this, void 0, void 0, function* () {
59
+ if (doesKeyExistWithSameValue(UserPreferencesKeys.shareHostnames, value))
60
+ return;
61
+ yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.shareHostnames, value }], 'add', true, true);
62
+ });
63
+ const getPreferredLanguage = () => {
64
+ return getKeyValue(UserPreferencesKeys.preferredLanguage);
65
+ };
66
+ const updatePreferredLanguage = (value) => __awaiter(this, void 0, void 0, function* () {
67
+ if (doesKeyExistWithSameValue(UserPreferencesKeys.preferredLanguage, value))
68
+ return;
69
+ yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.preferredLanguage, value }], 'add', true, true);
70
+ });
71
+ const getDefaultGroup = () => {
72
+ return getKeyValue(UserPreferencesKeys.defaultGroups);
73
+ };
74
+ const updateDefaultGroup = (value) => __awaiter(this, void 0, void 0, function* () {
75
+ if (doesKeyExistWithSameValue(UserPreferencesKeys.defaultGroups, value))
76
+ return;
77
+ yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.defaultGroups, value }], 'add', true, true);
78
+ });
79
+ const getCommentTypeFromPreference = () => {
80
+ return getKeyValue(UserPreferencesKeys.commentType);
81
+ };
82
+ const updateCommentType = (value) => __awaiter(this, void 0, void 0, function* () {
83
+ if (doesKeyExistWithSameValue(UserPreferencesKeys.commentType, value))
84
+ return;
85
+ yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.commentType, value }], 'add', true, true);
86
+ });
87
+ return {
88
+ updateCommentType,
89
+ getCommentTypeFromPreference,
90
+ hydraUserPreferences,
91
+ getAutoRestoreSavedSearchPreference,
92
+ updateAutoRestoreSavedSearchPreference,
93
+ getAutoRestoreLastSearchPreference,
94
+ updateAutoRestoreLastSearchPreference,
95
+ getAutoSaveSelectedColumnsPreference,
96
+ updateAutoSaveSelectedColumnsPreference,
97
+ getCommentSignature,
98
+ updateCommentSignature,
99
+ getShareHostNames,
100
+ updateShareHostNames,
101
+ getPreferredLanguage,
102
+ updatePreferredLanguage,
103
+ getDefaultGroup,
104
+ updateDefaultGroup,
105
+ };
106
+ }
@@ -55,7 +55,8 @@ export declare enum TopContentReducerConstants {
55
55
  setNewSetStatus = "setNewSetStatus",
56
56
  updateTopContentCategories = "updateTopContentCategories",
57
57
  changeTopContentStateOnCatsArrangementSave = "changeTopContentStateOnCatsArrangementSave",
58
- setIsSearchModeEnabled = "setIsSearchModeEnabled"
58
+ setIsSearchModeEnabled = "setIsSearchModeEnabled",
59
+ resetDuplicatUrls = "resetDuplicatUrls"
59
60
  }
60
61
  declare type IActionType = IAction<TopContentReducerConstants, ITopContentState>;
61
62
  export declare type TopContentReducerDispatchType = (value: IActionType) => void;
@@ -78,5 +79,6 @@ export declare const reArrangeContent: (dispatch: TopContentReducerDispatchType,
78
79
  export declare const reArrangeCategory: (topContentEditState: ITopContentEditState[]) => Promise<import("@cee-eng/hydrajs/@types/models/topContent/topContentModel").ITopContentPutBody>;
79
80
  export declare const fetchCategories: (dispatch: TopContentReducerDispatchType) => Promise<never>;
80
81
  export declare const setIsSearchModeEnabled: (dispatch: TopContentReducerDispatchType, isSearchModeEnabled: boolean) => void;
82
+ export declare const resetDuplicatUrls: (dispatch: TopContentReducerDispatchType) => void;
81
83
  export {};
82
84
  //# sourceMappingURL=TopContentReducer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/TopContentReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EACH,WAAW,EAEX,mBAAmB,EACnB,eAAe,EAGlB,MAAM,2DAA2D,CAAC;AACnE,OAAO,EA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AAO,MAAM,gBAAgB,aACf,6BAA6B,uBAClB,oBAAoB,EAAE,cAC/B,MAAM,KACf,MAAM,SAoBZ,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAC1B,6BAA6B,uBAClB,oBAAoB,EAAE,oBACzB,mBAAmB,mBACpB,QAAQ,QAAQ,CAAC,mBACjB,MAAM,4BACG,OAAO,cACrB,GAAG,mBA2DlB,CAAC;AAGF,eAAO,MAAM,mBAAmB,aAClB,6BAA6B,uBAClB,oBAAoB,EAAE,MACvC,MAAM,cACE,MAAM,WACT,oBAAoB,SACtB,MAAM,mBA2ChB,CAAC;AAGF,eAAO,MAAM,2BAA2B,aAC1B,6BAA6B,uBAClB,oBAAoB,EAAE,cAC/B,MAAM,WACT,oBAAoB,SACtB,MAAM,mBAsChB,CAAC;AAGF,eAAO,MAAM,gBAAgB,aACf,6BAA6B,uBAClB,oBAAoB,EAAE,cAC/B,MAAM,mBA+BrB,CAAC;AAGF,eAAO,MAAM,iBAAiB,wBAA+B,oBAAoB,EAAE,oGAiBlF,CAAC;AAEF,eAAO,MAAM,eAAe,aAAoB,6BAA6B,mBAwB5E,CAAC;AAEF,eAAO,MAAM,sBAAsB,aAAc,6BAA6B,uBAAuB,OAAO,SAK3G,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,6BAA6B,SAKxE,CAAC"}
@@ -35,6 +35,7 @@ export var TopContentReducerConstants;
35
35
  TopContentReducerConstants["updateTopContentCategories"] = "updateTopContentCategories";
36
36
  TopContentReducerConstants["changeTopContentStateOnCatsArrangementSave"] = "changeTopContentStateOnCatsArrangementSave";
37
37
  TopContentReducerConstants["setIsSearchModeEnabled"] = "setIsSearchModeEnabled";
38
+ TopContentReducerConstants["resetDuplicatUrls"] = "resetDuplicatUrls";
38
39
  })(TopContentReducerConstants || (TopContentReducerConstants = {}));
39
40
  export const TopContentReducer = (pState, action) => {
40
41
  switch (action.type) {
@@ -68,6 +69,9 @@ export const TopContentReducer = (pState, action) => {
68
69
  case TopContentReducerConstants.setIsSearchModeEnabled: {
69
70
  return Object.assign(Object.assign({}, pState), { isSearchModeEnabled: action.payload.isSearchModeEnabled });
70
71
  }
72
+ case TopContentReducerConstants.resetDuplicatUrls: {
73
+ return Object.assign(Object.assign({}, pState), { contentUrls: action.payload.contentUrls });
74
+ }
71
75
  default: {
72
76
  return pState;
73
77
  }
@@ -466,3 +470,9 @@ export const setIsSearchModeEnabled = (dispatch, isSearchModeEnabled) => {
466
470
  payload: { isSearchModeEnabled },
467
471
  });
468
472
  };
473
+ export const resetDuplicatUrls = (dispatch) => {
474
+ dispatch({
475
+ type: TopContentReducerConstants.resetDuplicatUrls,
476
+ payload: { contentUrls: {} },
477
+ });
478
+ };
@@ -276,3 +276,15 @@
276
276
  .pf-c-table__action li:nth-child(3) button:hover {
277
277
  color: #a30000;
278
278
  }
279
+
280
+ .preference-card {
281
+ background-color: #f0f0f0;
282
+ }
283
+
284
+ .preference-dropdown {
285
+ background-color: #fff;
286
+ }
287
+
288
+ .preference-page-switches {
289
+ padding: 0.5rem;
290
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "0.2.12",
3
+ "version": "0.2.16",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "homepage": "",
@@ -51,7 +51,7 @@
51
51
  "not op_mini all"
52
52
  ],
53
53
  "peerDependencies": {
54
- "@cee-eng/hydrajs": "4.4.7",
54
+ "@cee-eng/hydrajs": "4.5.4",
55
55
  "@patternfly/patternfly": "4.102.2",
56
56
  "@patternfly/pfe-accordion": "1.1.0",
57
57
  "@patternfly/pfe-collapse": "1.1.0",
@@ -89,20 +89,20 @@
89
89
  "typescript": "4.3.5"
90
90
  },
91
91
  "dependencies": {
92
- "@cee-eng/hydrajs": "4.4.7",
92
+ "@cee-eng/hydrajs": "4.5.4",
93
93
  "@patternfly/patternfly": "4.102.2",
94
94
  "@patternfly/pfe-accordion": "1.1.0",
95
95
  "@patternfly/pfe-collapse": "1.1.0",
96
96
  "@patternfly/pfe-tabs": "1.1.0",
97
97
  "@patternfly/react-core": "4.128.2",
98
98
  "@patternfly/react-table": "4.26.7",
99
- "@rh-support/api": "0.3.3",
100
- "@rh-support/components": "1.1.9",
99
+ "@rh-support/api": "0.3.5",
100
+ "@rh-support/components": "1.1.11",
101
101
  "@rh-support/configs": "0.2.1",
102
- "@rh-support/react-context": "0.2.10",
102
+ "@rh-support/react-context": "0.2.13",
103
103
  "@rh-support/types": "0.2.0",
104
- "@rh-support/user-permissions": "0.2.5",
105
- "@rh-support/utils": "0.2.5",
104
+ "@rh-support/user-permissions": "0.2.7",
105
+ "@rh-support/utils": "0.2.7",
106
106
  "@types/react-beautiful-dnd": "^13.0.0",
107
107
  "i18next": ">=17.0.1",
108
108
  "lodash": ">=4.17.15",
@@ -113,5 +113,5 @@
113
113
  "react-i18next": ">=10.11.0",
114
114
  "react-router-dom": ">=5.1.2"
115
115
  },
116
- "gitHead": "fef7bdba8f82597f1f1d2f3fd0cbca9217de7de5"
116
+ "gitHead": "7810850223c19ea278acdfd211515cb0f80feb52"
117
117
  }