@rh-support/manage 1.0.4 → 1.0.6
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/ManageTabs.d.ts.map +1 -1
- package/lib/esm/ManageTabs.js +4 -7
- package/lib/esm/components/ManageBookmarkedAccountsTab/index.d.ts +0 -1
- package/lib/esm/components/ManageBookmarkedAccountsTab/index.d.ts.map +1 -1
- package/lib/esm/components/ManageBookmarkedAccountsTab/index.js +0 -1
- package/lib/esm/components/ManagePreferences/components/PreferenceSelect.d.ts +1 -1
- package/lib/esm/components/ManagePreferences/components/PreferenceSelect.d.ts.map +1 -1
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.d.ts.map +1 -1
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.js +54 -13
- package/lib/esm/hooks/useUserPreferences.d.ts +2 -0
- package/lib/esm/hooks/useUserPreferences.d.ts.map +1 -1
- package/lib/esm/hooks/useUserPreferences.js +16 -0
- package/package.json +6 -6
- package/lib/esm/components/ManageBookmarkedAccountsTab/ManageBookmarkedAccountsTab.d.ts +0 -6
- package/lib/esm/components/ManageBookmarkedAccountsTab/ManageBookmarkedAccountsTab.d.ts.map +0 -1
- package/lib/esm/components/ManageBookmarkedAccountsTab/ManageBookmarkedAccountsTab.js +0 -78
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageTabs.d.ts","sourceRoot":"","sources":["../../src/ManageTabs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ManageTabs.d.ts","sourceRoot":"","sources":["../../src/ManageTabs.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAmBvD,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;CACvC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eAqIvC"}
|
package/lib/esm/ManageTabs.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { ErrorBoundary, useDocumentTitle } from '@rh-support/components';
|
|
2
|
-
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
3
2
|
import { ability, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
4
|
-
import { CustomElements,
|
|
3
|
+
import { CustomElements, requireCustomElement } from '@rh-support/utils';
|
|
5
4
|
import map from 'lodash/map';
|
|
6
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
7
6
|
import { ConfigsTable } from './components/Configs/ConfigsTable';
|
|
8
7
|
import { ManageGroupUsers } from './components/Groups/ManageGroupUsers';
|
|
9
|
-
import {
|
|
8
|
+
import { ManageGroupedBookmarkedAccountsTab } from './components/ManageBookmarkedAccountsTab';
|
|
10
9
|
import { ManagePreferences } from './components/ManagePreferences';
|
|
11
10
|
import { NotificationEmails } from './components/NotificationEmails/index';
|
|
12
11
|
import { TopContentManagement } from './components/TopContentManagement';
|
|
@@ -23,8 +22,6 @@ export function ManageTabs(props) {
|
|
|
23
22
|
var _a, _b;
|
|
24
23
|
const history = props.routeProps.history;
|
|
25
24
|
const { groupsRoute, bookmarkedAccountsRoute, topContentRoute, notificationEmailsRoute, preferencesRoute, configsRoute, } = Routes.getPaths();
|
|
26
|
-
const { globalMetadataState: { pcmConfig }, } = useContext(GlobalMetadataStateContext);
|
|
27
|
-
const isGroupBookmarkEnabled = getConfigField(pcmConfig.data, 'isGroupBookmarkEnabled', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
|
|
28
25
|
// Changes route and saves the current path to the url query params
|
|
29
26
|
const isOnlyBasePath = history.location.pathname === Routes.basePath;
|
|
30
27
|
useDocumentTitle(PageTitle.MANAGE);
|
|
@@ -49,7 +46,7 @@ export function ManageTabs(props) {
|
|
|
49
46
|
onClick: () => {
|
|
50
47
|
changeRouteThunk(bookmarkedAccountsRoute);
|
|
51
48
|
},
|
|
52
|
-
component:
|
|
49
|
+
component: React.createElement(ManageGroupedBookmarkedAccountsTab, { canManageBookmarkAccounts: canManageBookmarkAccounts }),
|
|
53
50
|
});
|
|
54
51
|
canViewCaseGroups &&
|
|
55
52
|
tabsToRender.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageBookmarkedAccountsTab/index.ts"],"names":[],"mappings":"AAAA,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageBookmarkedAccountsTab/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC"}
|
|
@@ -1 +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,
|
|
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,GAAG,CAAC;IAChB,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAeA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAeA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA2PhD"}
|
|
@@ -22,7 +22,7 @@ import { PreferenceSelect } from '../components/PreferenceSelect';
|
|
|
22
22
|
import { PreferenceSwitch } from '../components/PreferenceSwitch';
|
|
23
23
|
export function PreferencesCaseView(props) {
|
|
24
24
|
const { t } = useTranslation();
|
|
25
|
-
const { updateCommentType, getCommentTypeFromPreference, getCommentSignature, updateCommentSignature } = useUserPreferences();
|
|
25
|
+
const { updateCommentType, getCommentTypeFromPreference, getCommentSignature, updateCommentSignature, getOriginalCaseView, updateOriginalCaseView, } = useUserPreferences();
|
|
26
26
|
const [isSharingHostNames, setIsSharingHostNames] = useState(false);
|
|
27
27
|
const [localCommentSignature, setLocalCommentSignature] = useState('');
|
|
28
28
|
const [originalCommentType, setOriginalCommentType] = useState('');
|
|
@@ -31,12 +31,39 @@ export function PreferencesCaseView(props) {
|
|
|
31
31
|
const [isHostnamesLoading, setIsHostnamesLoading] = useState(true);
|
|
32
32
|
const [isCommentSignatureLoading, setIsCommentSignatureLoading] = useState(false);
|
|
33
33
|
const commentTypes = [EditorMode.PLAIN, EditorMode.MARKDOWN];
|
|
34
|
+
const defaultCommentTitleID = 'default-comment-preference-select';
|
|
35
|
+
const defaultCaseViewID = 'default-case-view-select';
|
|
36
|
+
const canUseHostName = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.HOSTNAME);
|
|
37
|
+
const { globalMetadataState: { loggedInUsersAccount, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
38
|
+
const { request: fetchHostnameDefault } = useFetch(accounts.getIsSharingHostname);
|
|
39
|
+
const accountNumber = loggedInUsersAccount.data.accountNumber;
|
|
40
|
+
const { request: updateShareHostnames } = useFetch(accounts.updateIsSharingHostname);
|
|
41
|
+
const originalAccountPermission = loggedInUserRights.data.isInternal();
|
|
42
|
+
const [originalCaseView, setOriginalCaseView] = useState(+originalAccountPermission);
|
|
43
|
+
const caseViewTypes = [
|
|
44
|
+
{ value: t('Customer view'), description: t('Hide internal information that is unavailable to customers.') },
|
|
45
|
+
{
|
|
46
|
+
value: t('Internal view'),
|
|
47
|
+
description: t('View internal information available to Red Hat associates only.'),
|
|
48
|
+
}, // [1] ; true
|
|
49
|
+
];
|
|
50
|
+
const userOriginalCaseView = () => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
try {
|
|
52
|
+
const retrievedCaseView = yield getOriginalCaseView();
|
|
53
|
+
if (!isEmpty(retrievedCaseView)) {
|
|
54
|
+
setOriginalCaseView(retrievedCaseView);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (_a) {
|
|
58
|
+
ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
34
61
|
const userOriginalCommentType = () => __awaiter(this, void 0, void 0, function* () {
|
|
35
62
|
try {
|
|
36
63
|
const retrievedComment = yield getCommentTypeFromPreference();
|
|
37
64
|
setOriginalCommentType(retrievedComment);
|
|
38
65
|
}
|
|
39
|
-
catch (
|
|
66
|
+
catch (_b) {
|
|
40
67
|
ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
|
|
41
68
|
}
|
|
42
69
|
});
|
|
@@ -45,14 +72,16 @@ export function PreferencesCaseView(props) {
|
|
|
45
72
|
const retrievedSignature = yield getCommentSignature();
|
|
46
73
|
setOriginalCommentSignature(retrievedSignature);
|
|
47
74
|
}
|
|
48
|
-
catch (
|
|
75
|
+
catch (_c) {
|
|
49
76
|
ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
|
|
50
77
|
}
|
|
51
78
|
});
|
|
52
79
|
useEffect(() => {
|
|
53
80
|
userOriginalCommentSignature();
|
|
54
81
|
userOriginalCommentType();
|
|
55
|
-
|
|
82
|
+
userOriginalCaseView();
|
|
83
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
+
}, []);
|
|
56
85
|
useEffect(() => {
|
|
57
86
|
if (localCommentSignature === '' && commentValidated !== 'error') {
|
|
58
87
|
setCommentValidated('default');
|
|
@@ -80,15 +109,24 @@ export function PreferencesCaseView(props) {
|
|
|
80
109
|
setLocalCommentSignature(value);
|
|
81
110
|
setIsCommentSignatureLoading(false);
|
|
82
111
|
});
|
|
83
|
-
const
|
|
84
|
-
|
|
112
|
+
const onPrefCaseViewSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
try {
|
|
114
|
+
let selectedView = event.currentTarget.getAttribute('data-index');
|
|
115
|
+
updateOriginalCaseView(selectedView);
|
|
116
|
+
setOriginalCaseView(selectedView);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
console.log(error);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const onCommentSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
try {
|
|
124
|
+
yield updateCommentType(selection);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
console.log(error);
|
|
128
|
+
}
|
|
85
129
|
});
|
|
86
|
-
const titleId = 'default-comment-preference-select';
|
|
87
|
-
const canUseHostName = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.HOSTNAME);
|
|
88
|
-
const { globalMetadataState: { loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
|
|
89
|
-
const { request: fetchHostnameDefault } = useFetch(accounts.getIsSharingHostname);
|
|
90
|
-
const accountNumber = loggedInUsersAccount.data.accountNumber;
|
|
91
|
-
const { request: updateShareHostnames } = useFetch(accounts.updateIsSharingHostname);
|
|
92
130
|
useEffect(() => {
|
|
93
131
|
function userOriginalHostnameValue() {
|
|
94
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -125,7 +163,10 @@ export function PreferencesCaseView(props) {
|
|
|
125
163
|
React.createElement(CardBody, null,
|
|
126
164
|
React.createElement("form", null,
|
|
127
165
|
React.createElement("div", { className: "form-group" },
|
|
128
|
-
React.createElement(PreferenceSelect, { onSelect:
|
|
166
|
+
React.createElement(PreferenceSelect, { onSelect: onPrefCaseViewSelect, selections: (!isEmpty(originalCaseView) && caseViewTypes[originalCaseView].value) ||
|
|
167
|
+
caseViewTypes[+originalAccountPermission].value, id: defaultCaseViewID, label: "Default case view" }, caseViewTypes.map((option, index) => (React.createElement(SelectOption, Object.assign({ "data-index": index, key: index, value: option.value }, (option.description && { description: option.description }))))))),
|
|
168
|
+
React.createElement("div", { className: "form-group" },
|
|
169
|
+
React.createElement(PreferenceSelect, { onSelect: onCommentSelect, selections: originalCommentType, id: defaultCommentTitleID, label: "Default comment type" }, commentTypes.map((option, index) => (React.createElement(SelectOption, { key: index, value: option }))))),
|
|
129
170
|
React.createElement("div", { className: "form-group" },
|
|
130
171
|
React.createElement("label", { htmlFor: "comment-signature-textarea" },
|
|
131
172
|
React.createElement(Trans, null, "Comment signature")),
|
|
@@ -16,5 +16,7 @@ export declare function useUserPreferences(): {
|
|
|
16
16
|
updatePreferredLanguage: (value: string) => Promise<void>;
|
|
17
17
|
getDefaultGroup: () => any;
|
|
18
18
|
updateDefaultGroup: (value: string) => Promise<void>;
|
|
19
|
+
getOriginalCaseView: () => any;
|
|
20
|
+
updateOriginalCaseView: (value: any) => Promise<void>;
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=useUserPreferences.d.ts.map
|
|
@@ -1 +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
|
|
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;;;EAqElD"}
|
|
@@ -84,6 +84,20 @@ export function useUserPreferences() {
|
|
|
84
84
|
return;
|
|
85
85
|
yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.commentType, value }], 'add', true, true);
|
|
86
86
|
});
|
|
87
|
+
// Will return 1 if caseViewPref is set to internal. If returning 0, it is assumed the user wants external view. No value means has not been chosen.
|
|
88
|
+
const getOriginalCaseView = () => {
|
|
89
|
+
return getKeyValue(UserPreferencesKeys.caseViewInternal);
|
|
90
|
+
};
|
|
91
|
+
const updateOriginalCaseView = (value) => __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
if (doesKeyExistWithSameValue(UserPreferencesKeys.caseViewInternal, value))
|
|
93
|
+
return;
|
|
94
|
+
try {
|
|
95
|
+
yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.caseViewInternal, value }], 'add', true, true);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.log(error);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
87
101
|
return {
|
|
88
102
|
updateCommentType,
|
|
89
103
|
getCommentTypeFromPreference,
|
|
@@ -102,5 +116,7 @@ export function useUserPreferences() {
|
|
|
102
116
|
updatePreferredLanguage,
|
|
103
117
|
getDefaultGroup,
|
|
104
118
|
updateDefaultGroup,
|
|
119
|
+
getOriginalCaseView,
|
|
120
|
+
updateOriginalCaseView,
|
|
105
121
|
};
|
|
106
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
"@patternfly/pfe-tabs": "1.12.3",
|
|
95
95
|
"@patternfly/react-core": "4.202.16",
|
|
96
96
|
"@patternfly/react-table": "4.71.16",
|
|
97
|
-
"@rh-support/components": "1.2.
|
|
97
|
+
"@rh-support/components": "1.2.3",
|
|
98
98
|
"@rh-support/configs": "0.2.8",
|
|
99
|
-
"@rh-support/react-context": "1.0.
|
|
99
|
+
"@rh-support/react-context": "1.0.4",
|
|
100
100
|
"@rh-support/types": "0.2.0",
|
|
101
|
-
"@rh-support/user-permissions": "1.0.
|
|
102
|
-
"@rh-support/utils": "1.0.
|
|
101
|
+
"@rh-support/user-permissions": "1.0.3",
|
|
102
|
+
"@rh-support/utils": "1.0.2",
|
|
103
103
|
"@types/react-beautiful-dnd": "^13.0.0",
|
|
104
104
|
"i18next": ">=17.0.1",
|
|
105
105
|
"lodash": ">=4.17.15",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"react-i18next": ">=10.11.0",
|
|
110
110
|
"react-router-dom": ">=5.1.2"
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "8891e192aa5a3aef7b3b456fed64ef5ad68afa47"
|
|
113
113
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ManageBookmarkedAccountsTab.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageBookmarkedAccountsTab/ManageBookmarkedAccountsTab.tsx"],"names":[],"mappings":"AAYA,UAAU,MAAM;IACZ,yBAAyB,EAAE,OAAO,CAAC;CACtC;AAED,wBAAgB,2BAA2B,CAAC,EAAE,yBAAyB,EAAE,EAAE,MAAM,eAkIhF"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { AlertVariant, SearchInput } from '@patternfly/react-core';
|
|
2
|
-
import { defaultTableSortMethod, ErrorBoundary } from '@rh-support/components';
|
|
3
|
-
import { AccountSelectorInternal, AddRemoveBookmark, useGlobalStateContext } from '@rh-support/react-context';
|
|
4
|
-
import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
5
|
-
import isArray from 'lodash/isArray';
|
|
6
|
-
import isEmpty from 'lodash/isEmpty';
|
|
7
|
-
import React, { useState } from 'react';
|
|
8
|
-
import { Trans, useTranslation } from 'react-i18next';
|
|
9
|
-
import { ManageTable } from '../ManageTable';
|
|
10
|
-
export function ManageBookmarkedAccountsTab({ canManageBookmarkAccounts }) {
|
|
11
|
-
const { t } = useTranslation();
|
|
12
|
-
// bookmarks are fetched when the the loggedInUser is initially fetched.
|
|
13
|
-
const { globalMetadataState: { bookmarkedAccounts, loggedInUser }, } = useGlobalStateContext();
|
|
14
|
-
const _bookmarkedAccounts = bookmarkedAccounts.data || [];
|
|
15
|
-
const [accountToBookmark, setAccountToBookmark] = useState(null);
|
|
16
|
-
const [searchString, setSearchString] = useState('');
|
|
17
|
-
let accounts = _bookmarkedAccounts;
|
|
18
|
-
if (!isEmpty(searchString)) {
|
|
19
|
-
accounts = accounts.filter((account) => account.name.toLowerCase().includes(searchString.toLowerCase()) ||
|
|
20
|
-
account.accountNumber.includes(searchString));
|
|
21
|
-
}
|
|
22
|
-
const canBookmarkAccounts = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.BOOKMARK_ACCOUNTS);
|
|
23
|
-
const columns = [
|
|
24
|
-
{
|
|
25
|
-
id: 'account-number',
|
|
26
|
-
title: t('Account number'),
|
|
27
|
-
sortable: true,
|
|
28
|
-
cellWidth: 40,
|
|
29
|
-
rowProps: (account) => ({ accountnumber: account.accountNumber }),
|
|
30
|
-
sortMethod: ({ props: a }, { props: b }) => {
|
|
31
|
-
const aint = parseInt(a.accountnumber);
|
|
32
|
-
const bint = parseInt(b.accountnumber);
|
|
33
|
-
return defaultTableSortMethod(aint, bint);
|
|
34
|
-
},
|
|
35
|
-
cell: (account) => {
|
|
36
|
-
return (React.createElement(React.Fragment, null,
|
|
37
|
-
React.createElement(AddRemoveBookmark, { selectedAccount: account, addBookmarkTitle: t('Add bookmark'), removeBookmarkTitle: t('Remove bookmark') }),
|
|
38
|
-
account.accountNumber));
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
accessor: (account) => account.name,
|
|
43
|
-
sortable: true,
|
|
44
|
-
sortMethod: (a, b) => {
|
|
45
|
-
const aname = a.toLowerCase();
|
|
46
|
-
const bname = b.toLowerCase();
|
|
47
|
-
return defaultTableSortMethod(aname, bname);
|
|
48
|
-
},
|
|
49
|
-
id: 'account-name',
|
|
50
|
-
title: t('Account name'),
|
|
51
|
-
},
|
|
52
|
-
];
|
|
53
|
-
// the AccountSelectInternal is not multiselect and should only return on account.
|
|
54
|
-
const onAccountSelect = (accounts) => {
|
|
55
|
-
if (!isArray(accounts))
|
|
56
|
-
return;
|
|
57
|
-
setAccountToBookmark(accounts[0] || null);
|
|
58
|
-
};
|
|
59
|
-
if (!canManageBookmarkAccounts) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
return (React.createElement("section", { id: "manage-bookmarked-accounts" },
|
|
63
|
-
React.createElement("header", null,
|
|
64
|
-
React.createElement("p", null,
|
|
65
|
-
React.createElement("h2", null, t('Bookmarks')),
|
|
66
|
-
React.createElement(Trans, { i18nKey: "i18AddEditRemoveBookmark" }, "Add, edit or remove bookmarks to customize your search experience on the portal."))),
|
|
67
|
-
React.createElement("div", { className: "toolbar" },
|
|
68
|
-
React.createElement("form", { className: "toolbar-left" },
|
|
69
|
-
React.createElement("label", { htmlFor: "bookmark-account-selector" },
|
|
70
|
-
React.createElement(Trans, null, "Bookmark")),
|
|
71
|
-
React.createElement(AccountSelectorInternal, { bookmarkedAccounts: bookmarkedAccounts.data, canBookmarkAccount: canBookmarkAccounts, selectedAccounts: accountToBookmark ? [accountToBookmark] : [], excludeAccounts: _bookmarkedAccounts, name: "bookmark-account-selector", id: "bookmark-account-selector", placeholder: t('Search for an account to add a bookmark'), disabled: !loggedInUser.data.isInternal, onSelect: onAccountSelect, suggestBookmarkAccounts: false })),
|
|
72
|
-
React.createElement("div", { className: "toolbar-right" },
|
|
73
|
-
React.createElement("label", { htmlFor: "search-bookmark-account-selector" },
|
|
74
|
-
React.createElement(Trans, null, "Filter by")),
|
|
75
|
-
React.createElement(SearchInput, { className: "pf-u-flex-grow-1 pf-c-search-input pf-u-background-color-100", value: searchString, id: "search-bookmark-account-selector", placeholder: t('Search for a bookmark'), "aria-label": t('Bookmarked accounts search input'), onChange: setSearchString, onClear: () => setSearchString('') }))),
|
|
76
|
-
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading bookmarked accounts list') } },
|
|
77
|
-
React.createElement(ManageTable, { ariaLabel: t('Table to manage bookmarks'), columns: columns, data: accounts, sortInfo: { column: 'account-name', direction: 'asc' }, errorVariant: AlertVariant.warning, isFetching: bookmarkedAccounts.isFetching || loggedInUser.isFetching, isError: bookmarkedAccounts.isError, errorTitle: t('Bookmarked accounts error'), errorComponent: React.createElement(Trans, null, "Could not get bookmarked accounts") }))));
|
|
78
|
-
}
|