@rh-support/manage 2.5.237 → 2.5.239
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 +17 -2
- package/lib/esm/Routes.d.ts +1 -0
- package/lib/esm/Routes.d.ts.map +1 -1
- package/lib/esm/Routes.js +6 -0
- package/lib/esm/components/Groups/AddMembersModal/AddMembersModal.d.ts +12 -0
- package/lib/esm/components/Groups/AddMembersModal/AddMembersModal.d.ts.map +1 -0
- package/lib/esm/components/Groups/AddMembersModal/AddMembersModal.js +81 -0
- package/lib/esm/components/Groups/AddMembersModal/index.d.ts +2 -0
- package/lib/esm/components/Groups/AddMembersModal/index.d.ts.map +1 -0
- package/lib/esm/components/Groups/AddMembersModal/index.js +1 -0
- package/lib/esm/components/Groups/GroupSelect/GroupSelect.d.ts +1 -0
- package/lib/esm/components/Groups/GroupSelect/GroupSelect.d.ts.map +1 -1
- package/lib/esm/components/Groups/GroupSelect/GroupSelect.js +20 -5
- package/lib/esm/components/Groups/ManageGroupUsers/ManageGroupUsers.d.ts.map +1 -1
- package/lib/esm/components/Groups/ManageGroupUsers/ManageGroupUsers.js +17 -8
- package/lib/esm/components/ManageCaseLabels/AddEditCaseLabelModal.d.ts +19 -0
- package/lib/esm/components/ManageCaseLabels/AddEditCaseLabelModal.d.ts.map +1 -0
- package/lib/esm/components/ManageCaseLabels/AddEditCaseLabelModal.js +83 -0
- package/lib/esm/components/ManageCaseLabels/ManageCaseLabelsTab.d.ts +3 -0
- package/lib/esm/components/ManageCaseLabels/ManageCaseLabelsTab.d.ts.map +1 -0
- package/lib/esm/components/ManageCaseLabels/ManageCaseLabelsTab.js +208 -0
- package/lib/esm/components/ManageCaseLabels/index.d.ts +2 -0
- package/lib/esm/components/ManageCaseLabels/index.d.ts.map +1 -0
- package/lib/esm/components/ManageCaseLabels/index.js +1 -0
- package/lib/esm/components/ManageCaseLabels/types.d.ts +6 -0
- package/lib/esm/components/ManageCaseLabels/types.d.ts.map +1 -0
- package/lib/esm/components/ManageCaseLabels/types.js +1 -0
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseCreate.d.ts.map +1 -1
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseCreate.js +20 -41
- package/lib/esm/constants/GroupSelectActions.d.ts +2 -1
- package/lib/esm/constants/GroupSelectActions.d.ts.map +1 -1
- package/lib/esm/constants/GroupSelectActions.js +1 -0
- package/lib/esm/hooks/useCaseGroupGraphQL.d.ts +6 -1
- package/lib/esm/hooks/useCaseGroupGraphQL.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseGroupGraphQL.js +42 -37
- package/lib/esm/hooks/useCaseLabelGraphQL.d.ts +26 -0
- package/lib/esm/hooks/useCaseLabelGraphQL.d.ts.map +1 -0
- package/lib/esm/hooks/useCaseLabelGraphQL.js +99 -0
- package/lib/esm/hooks/useCurrentUserContact.d.ts +8 -0
- package/lib/esm/hooks/useCurrentUserContact.d.ts.map +1 -0
- package/lib/esm/hooks/useCurrentUserContact.js +74 -0
- package/lib/esm/scss/_main.scss +72 -0
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrentUserContact.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCurrentUserContact.ts"],"names":[],"mappings":"AAMA,UAAU,2BAA2B;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,IAAI,2BAA2B,CAiFnE"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { useApolloClient } from '@apollo/client/react';
|
|
11
|
+
import { setLoggedInUserRoles, useGlobalDispatchContext, useGlobalStateContext } from '@rh-support/react-context';
|
|
12
|
+
import { initUserRoles } from '@rh-support/user-permissions';
|
|
13
|
+
import { GET_CONTACT_BY_SSO } from '@rh-support/utils';
|
|
14
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
15
|
+
export function useCurrentUserContact() {
|
|
16
|
+
const client = useApolloClient();
|
|
17
|
+
const dispatch = useGlobalDispatchContext();
|
|
18
|
+
const { globalMetadataState: { loggedInUserJwtToken, loggedInUser, loggedInUsersAccount, managedAccounts, accountManagers, bookmarkedAccounts, pcmConfig, viewAsCustomer, }, } = useGlobalStateContext();
|
|
19
|
+
const ssoUsername = loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.preferred_username;
|
|
20
|
+
const [isOrgAdmin, setIsOrgAdmin] = useState(false);
|
|
21
|
+
const [loading, setLoading] = useState(true);
|
|
22
|
+
const [error, setError] = useState(undefined);
|
|
23
|
+
const hasFetched = useRef(false);
|
|
24
|
+
const fetchContact = useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a, _b, _c, _d, _e, _f;
|
|
26
|
+
if (!ssoUsername || hasFetched.current) {
|
|
27
|
+
if (!ssoUsername)
|
|
28
|
+
setLoading(false);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
hasFetched.current = true;
|
|
32
|
+
setLoading(true);
|
|
33
|
+
setError(undefined);
|
|
34
|
+
try {
|
|
35
|
+
const { data } = yield client.query({
|
|
36
|
+
query: GET_CONTACT_BY_SSO,
|
|
37
|
+
variables: { searchTerm: ssoUsername, namePattern: `%${ssoUsername}%` },
|
|
38
|
+
fetchPolicy: 'cache-first',
|
|
39
|
+
});
|
|
40
|
+
const edges = ((_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportContact) === null || _c === void 0 ? void 0 : _c.edges) || [];
|
|
41
|
+
const match = edges[0];
|
|
42
|
+
const adminStatus = (_f = (_e = (_d = match === null || match === void 0 ? void 0 : match.node) === null || _d === void 0 ? void 0 : _d.IsOrgAdmin__c) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : false;
|
|
43
|
+
setIsOrgAdmin(adminStatus);
|
|
44
|
+
if ((loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) && (loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data)) {
|
|
45
|
+
const updatedUser = Object.assign(Object.assign({}, loggedInUser.data), { isOrgAdmin: adminStatus });
|
|
46
|
+
const { user } = initUserRoles(updatedUser, loggedInUsersAccount.data, (managedAccounts === null || managedAccounts === void 0 ? void 0 : managedAccounts.data) || [], (accountManagers === null || accountManagers === void 0 ? void 0 : accountManagers.data) || [], (bookmarkedAccounts === null || bookmarkedAccounts === void 0 ? void 0 : bookmarkedAccounts.data) || [], (pcmConfig === null || pcmConfig === void 0 ? void 0 : pcmConfig.data) || [], viewAsCustomer, loggedInUserJwtToken);
|
|
47
|
+
setLoggedInUserRoles(dispatch, user);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
setError(e);
|
|
52
|
+
setIsOrgAdmin(false);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
setLoading(false);
|
|
56
|
+
}
|
|
57
|
+
}), [
|
|
58
|
+
client,
|
|
59
|
+
ssoUsername,
|
|
60
|
+
loggedInUser,
|
|
61
|
+
loggedInUsersAccount,
|
|
62
|
+
managedAccounts,
|
|
63
|
+
accountManagers,
|
|
64
|
+
bookmarkedAccounts,
|
|
65
|
+
pcmConfig,
|
|
66
|
+
viewAsCustomer,
|
|
67
|
+
loggedInUserJwtToken,
|
|
68
|
+
dispatch,
|
|
69
|
+
]);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
fetchContact();
|
|
72
|
+
}, [fetchContact]);
|
|
73
|
+
return { isOrgAdmin, loading, error };
|
|
74
|
+
}
|
package/lib/esm/scss/_main.scss
CHANGED
|
@@ -433,6 +433,78 @@ svg.hostnameSpinner {
|
|
|
433
433
|
border-radius: 8px;
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
#manage-case-labels {
|
|
437
|
+
thead {
|
|
438
|
+
display: none;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.case-labels-toolbar {
|
|
442
|
+
flex-direction: row;
|
|
443
|
+
align-items: center;
|
|
444
|
+
justify-content: space-between;
|
|
445
|
+
gap: var(--pf-t--global--spacer--md);
|
|
446
|
+
|
|
447
|
+
.toolbar-left {
|
|
448
|
+
flex: 0 1 auto;
|
|
449
|
+
margin-bottom: 0;
|
|
450
|
+
max-width: none;
|
|
451
|
+
|
|
452
|
+
& > *:nth-child(2):not(.group-action) {
|
|
453
|
+
width: auto;
|
|
454
|
+
min-width: 16rem;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.toolbar-right,
|
|
459
|
+
.case-labels-toolbar__loaded {
|
|
460
|
+
flex: 0 0 auto;
|
|
461
|
+
max-width: none;
|
|
462
|
+
margin-left: auto;
|
|
463
|
+
white-space: nowrap;
|
|
464
|
+
justify-content: flex-end;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.case-label-row {
|
|
469
|
+
display: flex;
|
|
470
|
+
align-items: center;
|
|
471
|
+
justify-content: space-between;
|
|
472
|
+
width: 100%;
|
|
473
|
+
gap: var(--pf-t--global--spacer--md);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.case-label-row__actions {
|
|
477
|
+
display: flex;
|
|
478
|
+
align-items: center;
|
|
479
|
+
flex-shrink: 0;
|
|
480
|
+
gap: var(--pf-t--global--spacer--sm);
|
|
481
|
+
margin-left: auto;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.case-labels-empty-state {
|
|
485
|
+
display: flex;
|
|
486
|
+
align-items: center;
|
|
487
|
+
justify-content: center;
|
|
488
|
+
min-height: 20rem;
|
|
489
|
+
padding: var(--pf-t--global--spacer--2xl) var(--pf-t--global--spacer--lg);
|
|
490
|
+
background-color: var(--pf-t--global--background--color--primary--default);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.case-label-delete-description {
|
|
495
|
+
display: flex;
|
|
496
|
+
flex-direction: column;
|
|
497
|
+
gap: var(--pf-t--global--spacer--lg);
|
|
498
|
+
|
|
499
|
+
p {
|
|
500
|
+
margin: 0;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.case-label-delete-description__impact {
|
|
504
|
+
white-space: nowrap;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
436
508
|
.pf-v6-c-empty-state__icon {
|
|
437
509
|
color: var(--pf-t--color--gray--30);
|
|
438
510
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.239",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"@patternfly/patternfly": "6.2.1",
|
|
77
77
|
"@patternfly/react-core": "6.2.1",
|
|
78
78
|
"@patternfly/react-table": "6.2.1",
|
|
79
|
-
"@rh-support/components": "2.5.
|
|
79
|
+
"@rh-support/components": "2.5.191",
|
|
80
80
|
"@rh-support/configs": "2.0.75",
|
|
81
|
-
"@rh-support/react-context": "2.5.
|
|
81
|
+
"@rh-support/react-context": "2.5.285",
|
|
82
82
|
"@rh-support/types": "2.0.26",
|
|
83
|
-
"@rh-support/user-permissions": "2.5.
|
|
84
|
-
"@rh-support/utils": "2.5.
|
|
83
|
+
"@rh-support/user-permissions": "2.5.137",
|
|
84
|
+
"@rh-support/utils": "2.5.119",
|
|
85
85
|
"@types/react-beautiful-dnd": "^13.0.0",
|
|
86
86
|
"i18next": "^23.15.0",
|
|
87
87
|
"lodash": ">=4.17.15",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"defaults and supports es6-module",
|
|
101
101
|
"maintained node versions"
|
|
102
102
|
],
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "e737fe04f1e771923e483cd65f7d6f6f87b53356"
|
|
104
104
|
}
|