@rh-support/manage 2.5.237 → 2.5.238
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 +7 -0
- 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 +72 -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 +199 -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 +63 -0
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ManageCaseLabelsTab';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageCaseLabels/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesCaseCreate.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseCreate.tsx"],"names":[],"mappings":"AAeA,OAAO,
|
|
1
|
+
{"version":3,"file":"PreferencesCaseCreate.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseCreate.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAMxE,UAAU,MAAM;CAAG;AACnB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,qBAmLlD"}
|
|
@@ -15,56 +15,41 @@ import { fetchLanguageMetadata, GlobalMetadataDispatchContext, GlobalMetadataRed
|
|
|
15
15
|
import { haventLoadedMetadata, PreferredLanguages } from '@rh-support/utils';
|
|
16
16
|
import isEmpty from 'lodash/isEmpty';
|
|
17
17
|
import map from 'lodash/map';
|
|
18
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
18
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
19
19
|
import { Trans, useTranslation } from 'react-i18next';
|
|
20
|
-
import { useLocation } from 'react-router-dom';
|
|
21
20
|
import { useUserPreferences } from '../../../hooks/useUserPreferences';
|
|
22
21
|
import { PreferenceSelect } from '../components/PreferenceSelect';
|
|
23
22
|
export function PreferencesCaseCreate(props) {
|
|
24
23
|
const { t } = useTranslation();
|
|
25
|
-
const location = useLocation();
|
|
26
24
|
const apolloClient = useApolloClient();
|
|
27
25
|
const { globalMetadataState: { caseGroups, caseLanguages, loggedInUserJwtToken, loggedInUserRights, loggedInUsersAccount, }, } = useContext(GlobalMetadataStateContext);
|
|
28
26
|
const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
|
|
29
27
|
const languageConst = caseLanguages.data;
|
|
30
|
-
const getDefaultGroupFetch = useFetch(publicApi.caseGroups.getCaseGroupsForSSO, {
|
|
31
|
-
propgateErrors: true,
|
|
32
|
-
});
|
|
33
28
|
const toggleDefaultGroupFetch = useFetch(publicApi.caseGroups.toggleDefaultGroup, {
|
|
34
29
|
propgateErrors: true,
|
|
35
30
|
});
|
|
36
|
-
const
|
|
37
|
-
try {
|
|
38
|
-
let list = yield getDefaultGroupFetch.request(ssoUser);
|
|
39
|
-
setUserDefaultGroupList(list);
|
|
40
|
-
let filteredDefaultGroup = (list ? list : []).filter((group) => group.isDefault === true);
|
|
41
|
-
if (!isEmpty(filteredDefaultGroup)) {
|
|
42
|
-
setOriginalDefaultGroup(filteredDefaultGroup[0].name);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
setOriginalDefaultGroup('Ungrouped Case');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
console.log(error);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
31
|
+
const groupList = useMemo(() => caseGroups.data || [], [caseGroups.data]);
|
|
52
32
|
const updateDefaultGroupPref = (groupNum) => __awaiter(this, void 0, void 0, function* () {
|
|
53
33
|
var _a;
|
|
54
34
|
try {
|
|
55
35
|
yield toggleDefaultGroupFetch.request(groupNum, loggedInUserRights.data.getSSOUsername(), true, loggedInUsersAccount.data.secureSupport);
|
|
56
|
-
const updatedGroups =
|
|
36
|
+
const updatedGroups = groupList.map((group) => (Object.assign(Object.assign({}, group), { isDefault: group.groupNum === groupNum })));
|
|
57
37
|
dispatchToGlobalMetadataReducer({
|
|
58
38
|
type: GlobalMetadataReducerConstants.setCaseGroups,
|
|
59
39
|
payload: {
|
|
60
40
|
caseGroups: Object.assign(Object.assign({}, caseGroups), { data: updatedGroups }),
|
|
61
41
|
},
|
|
62
42
|
});
|
|
63
|
-
setUserDefaultGroupList(updatedGroups);
|
|
64
43
|
setOriginalDefaultGroup(((_a = updatedGroups.find((g) => g.isDefault)) === null || _a === void 0 ? void 0 : _a.name) || 'Ungrouped Case');
|
|
65
44
|
}
|
|
66
45
|
catch (error) {
|
|
67
|
-
|
|
46
|
+
const message = String((error === null || error === void 0 ? void 0 : error.message) || '');
|
|
47
|
+
if (message.includes('insufficient access rights')) {
|
|
48
|
+
ToastNotification.addDangerMessage(t('You do not have permission to change the default group'));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
ToastNotification.addDangerMessage(t('Failed to update default group'));
|
|
52
|
+
}
|
|
68
53
|
}
|
|
69
54
|
});
|
|
70
55
|
const languagesList = map(languageConst, (cl) => ({
|
|
@@ -73,7 +58,6 @@ export function PreferencesCaseCreate(props) {
|
|
|
73
58
|
}));
|
|
74
59
|
const [originalPreferredLanguage, setOriginalPreferredLanguage] = useState('');
|
|
75
60
|
const [originalDefaultGroup, setOriginalDefaultGroup] = useState('');
|
|
76
|
-
const [userDefaultGroupList, setUserDefaultGroupList] = useState();
|
|
77
61
|
const { getPreferredLanguage, updatePreferredLanguage } = useUserPreferences();
|
|
78
62
|
const preferredLangTitleId = 'preferred-language-select';
|
|
79
63
|
const defaultGroupTitleId = 'default-group-select';
|
|
@@ -101,10 +85,12 @@ export function PreferencesCaseCreate(props) {
|
|
|
101
85
|
if (selection === 'Ungrouped Case') {
|
|
102
86
|
updateDefaultGroupPref('-1');
|
|
103
87
|
}
|
|
104
|
-
if (!isEmpty(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
88
|
+
if (!isEmpty(groupList)) {
|
|
89
|
+
const selectedGroup = groupList.find((group) => group.name === selection);
|
|
90
|
+
if (selectedGroup) {
|
|
91
|
+
yield updateDefaultGroupPref(selectedGroup.groupNum);
|
|
92
|
+
setOriginalDefaultGroup(selectedGroup.name);
|
|
93
|
+
}
|
|
108
94
|
}
|
|
109
95
|
}
|
|
110
96
|
catch (error) {
|
|
@@ -126,16 +112,9 @@ export function PreferencesCaseCreate(props) {
|
|
|
126
112
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
127
113
|
}, [caseLanguages, caseGroups, dispatchToGlobalMetadataReducer, loggedInUserJwtToken]);
|
|
128
114
|
useEffect(() => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}, [
|
|
132
|
-
useEffect(() => {
|
|
133
|
-
if (location.pathname !== '/manage/preferences') {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
grabDefaultGroupList(loggedInUserRights.data.getSSOUsername());
|
|
137
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
-
}, [location.pathname]);
|
|
115
|
+
const defaultGroup = groupList.find((g) => g.isDefault);
|
|
116
|
+
setOriginalDefaultGroup((defaultGroup === null || defaultGroup === void 0 ? void 0 : defaultGroup.name) || 'Ungrouped Case');
|
|
117
|
+
}, [groupList]);
|
|
139
118
|
useEffect(() => {
|
|
140
119
|
if (haventLoadedMetadata(caseLanguages)) {
|
|
141
120
|
fetchLanguageMetadata(dispatchToGlobalMetadataReducer, apolloClient);
|
|
@@ -153,5 +132,5 @@ export function PreferencesCaseCreate(props) {
|
|
|
153
132
|
React.createElement("p", { className: "form-instructions" },
|
|
154
133
|
React.createElement(Trans, null, "Preferred language will impact future cases, not existing ones."))),
|
|
155
134
|
React.createElement("div", { className: "form-group" },
|
|
156
|
-
React.createElement(PreferenceSelect, { label: "Default group", id: defaultGroupTitleId, onSelect: onDefaultGroupSelect, selections: originalDefaultGroup },
|
|
135
|
+
React.createElement(PreferenceSelect, { label: "Default group", id: defaultGroupTitleId, onSelect: onDefaultGroupSelect, selections: originalDefaultGroup }, groupList.map((option, index) => (React.createElement(SelectOption, { key: index, value: option.name })))))))));
|
|
157
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupSelectActions.d.ts","sourceRoot":"","sources":["../../../src/constants/GroupSelectActions.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB;IAC1B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"GroupSelectActions.d.ts","sourceRoot":"","sources":["../../../src/constants/GroupSelectActions.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB;IAC1B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,UAAU,gBAAgB;CAC7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CreateCaseGroupResponse, type DeleteCaseGroupResponse, type RenameCaseGroupResponse, type ToggleDefaultGroupResponse } from '@rh-support/utils';
|
|
1
|
+
import { type CreateCaseGroupMemberResponse, type CreateCaseGroupResponse, type DeleteCaseGroupResponse, type RenameCaseGroupResponse, type ToggleDefaultGroupResponse } from '@rh-support/utils';
|
|
2
2
|
import { type IGroupUserWithContactId } from '../utils/caseGroupMapper';
|
|
3
3
|
interface UseCaseGroupMembersResult {
|
|
4
4
|
data: IGroupUserWithContactId[];
|
|
@@ -13,6 +13,11 @@ interface UseCreateCaseGroupResult {
|
|
|
13
13
|
loading: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare function useCreateCaseGroup(): UseCreateCaseGroupResult;
|
|
16
|
+
interface UseCreateCaseGroupMemberResult {
|
|
17
|
+
createMember: (contactId: string, groupId: string) => Promise<CreateCaseGroupMemberResponse>;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function useCreateCaseGroupMember(): UseCreateCaseGroupMemberResult;
|
|
16
21
|
interface UseRenameCaseGroupResult {
|
|
17
22
|
renameGroup: (id: string, newName: string) => Promise<RenameCaseGroupResponse>;
|
|
18
23
|
loading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCaseGroupGraphQL.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseGroupGraphQL.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"useCaseGroupGraphQL.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseGroupGraphQL.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAE5B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAOlC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,KAAK,uBAAuB,EAAsC,MAAM,0BAA0B,CAAC;AAE5G,UAAU,yBAAyB;IAC/B,IAAI,EAAE,uBAAuB,EAAE,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,mBAAmB,IAAI,yBAAyB,CA6B/D;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACnF,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D;AAED,UAAU,8BAA8B;IACpC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC7F,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,wBAAwB,IAAI,8BAA8B,CAgBzE;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC/E,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC9D,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D;AAED,UAAU,2BAA2B;IACjC,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAClG,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,qBAAqB,IAAI,2BAA2B,CAcnE"}
|
|
@@ -7,47 +7,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import { CREATE_CASE_GROUP, DELETE_CASE_GROUP, GET_CASE_GROUP_MEMBERS, RENAME_CASE_GROUP, TOGGLE_DEFAULT_GROUP, } from '@rh-support/utils';
|
|
12
|
-
import { useState } from 'react';
|
|
10
|
+
import { useMutation, useQuery } from '@apollo/client/react';
|
|
11
|
+
import { CREATE_CASE_GROUP, CREATE_CASE_GROUP_MEMBER, DELETE_CASE_GROUP, GET_CASE_GROUP_MEMBERS, RENAME_CASE_GROUP, TOGGLE_DEFAULT_GROUP, } from '@rh-support/utils';
|
|
12
|
+
import { useMemo, useState } from 'react';
|
|
13
13
|
import { mapCaseGroupMemberNodeToIGroupUser } from '../utils/caseGroupMapper';
|
|
14
14
|
export function useCaseGroupMembers() {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const fetchMembers = (groupId) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
var _a, _b, _c;
|
|
22
|
-
setCurrentGroupId(groupId);
|
|
23
|
-
setLoading(true);
|
|
24
|
-
setError(undefined);
|
|
25
|
-
try {
|
|
26
|
-
const { data } = yield client.query({
|
|
27
|
-
query: GET_CASE_GROUP_MEMBERS,
|
|
28
|
-
variables: { where: { Group__c: { eq: groupId } } },
|
|
29
|
-
fetchPolicy: 'network-only',
|
|
30
|
-
});
|
|
31
|
-
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.RedHatSupportCaseGroupMember__c) === null || _c === void 0 ? void 0 : _c.edges) || [];
|
|
32
|
-
const mapped = edges
|
|
33
|
-
.filter(({ node }) => node.Contact__r !== null)
|
|
34
|
-
.map(({ node }) => mapCaseGroupMemberNodeToIGroupUser(node, groupId));
|
|
35
|
-
setMembers(mapped);
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
setError(e);
|
|
39
|
-
setMembers([]);
|
|
40
|
-
}
|
|
41
|
-
finally {
|
|
42
|
-
setLoading(false);
|
|
43
|
-
}
|
|
15
|
+
const [groupId, setGroupId] = useState(undefined);
|
|
16
|
+
const { data, loading, error, refetch } = useQuery(GET_CASE_GROUP_MEMBERS, {
|
|
17
|
+
variables: { where: { Group__c: { eq: groupId } } },
|
|
18
|
+
skip: !groupId,
|
|
19
|
+
fetchPolicy: 'network-only',
|
|
44
20
|
});
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
21
|
+
const members = useMemo(() => {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
if (!data || !groupId)
|
|
24
|
+
return [];
|
|
25
|
+
const response = data;
|
|
26
|
+
const edges = ((_c = (_b = (_a = response.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportCaseGroupMember__c) === null || _c === void 0 ? void 0 : _c.edges) || [];
|
|
27
|
+
return edges
|
|
28
|
+
.filter(({ node }) => node.Contact__r !== null)
|
|
29
|
+
.map(({ node }) => mapCaseGroupMemberNodeToIGroupUser(node, groupId));
|
|
30
|
+
}, [data, groupId]);
|
|
31
|
+
const fetchMembers = (id) => {
|
|
32
|
+
setGroupId(id);
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
data: members,
|
|
36
|
+
loading,
|
|
37
|
+
error: error,
|
|
38
|
+
refetch,
|
|
39
|
+
fetchMembers,
|
|
49
40
|
};
|
|
50
|
-
return { data: members, loading, error, refetch, fetchMembers };
|
|
51
41
|
}
|
|
52
42
|
export function useCreateCaseGroup() {
|
|
53
43
|
const [mutate, { loading }] = useMutation(CREATE_CASE_GROUP);
|
|
@@ -59,6 +49,21 @@ export function useCreateCaseGroup() {
|
|
|
59
49
|
});
|
|
60
50
|
return { createGroup, loading };
|
|
61
51
|
}
|
|
52
|
+
export function useCreateCaseGroupMember() {
|
|
53
|
+
const [mutate, { loading }] = useMutation(CREATE_CASE_GROUP_MEMBER);
|
|
54
|
+
const createMember = (contactId, groupId) => __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const result = yield mutate({
|
|
56
|
+
variables: {
|
|
57
|
+
memberInput: {
|
|
58
|
+
Contact__c: contactId,
|
|
59
|
+
Group__c: groupId,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
return result.data;
|
|
64
|
+
});
|
|
65
|
+
return { createMember, loading };
|
|
66
|
+
}
|
|
62
67
|
export function useRenameCaseGroup() {
|
|
63
68
|
const [mutate, { loading }] = useMutation(RENAME_CASE_GROUP);
|
|
64
69
|
const renameGroup = (id, newName) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type CreateCaseLabelResponse, type DeleteCaseLabelResponse, type UpdateCaseLabelResponse } from '@rh-support/utils';
|
|
2
|
+
import { ICaseLabel } from '../components/ManageCaseLabels/types';
|
|
3
|
+
interface UseCaseLabelsResult {
|
|
4
|
+
labels: ICaseLabel[];
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: Error | undefined;
|
|
7
|
+
refetch: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare function useCaseLabels(accountId?: string): UseCaseLabelsResult;
|
|
10
|
+
interface UseCreateCaseLabelResult {
|
|
11
|
+
createCaseLabel: (name: string, accountId: string) => Promise<CreateCaseLabelResponse>;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function useCreateCaseLabel(): UseCreateCaseLabelResult;
|
|
15
|
+
interface UseUpdateCaseLabelResult {
|
|
16
|
+
updateCaseLabel: (id: string, name: string) => Promise<UpdateCaseLabelResponse>;
|
|
17
|
+
loading: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function useUpdateCaseLabel(): UseUpdateCaseLabelResult;
|
|
20
|
+
interface UseDeleteCaseLabelResult {
|
|
21
|
+
deleteCaseLabel: (id: string) => Promise<DeleteCaseLabelResponse>;
|
|
22
|
+
loading: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function useDeleteCaseLabel(): UseDeleteCaseLabelResult;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=useCaseLabelGraphQL.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCaseLabelGraphQL.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseLabelGraphQL.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,uBAAuB,EAE5B,KAAK,uBAAuB,EAI5B,KAAK,uBAAuB,EAM/B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAQlE,UAAU,mBAAmB;IACzB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAmCrE;AAED,UAAU,wBAAwB;IAC9B,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACvF,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAkB7D;AAED,UAAU,wBAAwB;IAC9B,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAChF,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAkB7D;AAED,UAAU,wBAAwB;IAC9B,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAClE,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D"}
|
|
@@ -0,0 +1,99 @@
|
|
|
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, useMutation } from '@apollo/client/react';
|
|
11
|
+
import { CREATE_CASE_LABEL, DELETE_CASE_LABEL, GET_CASE_LABELS, UPDATE_CASE_LABEL, } from '@rh-support/utils';
|
|
12
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
13
|
+
const mapCaseLabelNode = (node) => {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
return ({
|
|
16
|
+
id: node.Id,
|
|
17
|
+
name: (_b = (_a = node.Name) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '',
|
|
18
|
+
assignedCaseCount: (_d = (_c = node.Case_Label_Links__r) === null || _c === void 0 ? void 0 : _c.totalCount) !== null && _d !== void 0 ? _d : 0,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export function useCaseLabels(accountId) {
|
|
22
|
+
const client = useApolloClient();
|
|
23
|
+
const [labels, setLabels] = useState([]);
|
|
24
|
+
const [loading, setLoading] = useState(false);
|
|
25
|
+
const [error, setError] = useState(undefined);
|
|
26
|
+
const fetchLabels = useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var _a, _b, _c, _d;
|
|
28
|
+
if (!accountId) {
|
|
29
|
+
setLabels([]);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setLoading(true);
|
|
33
|
+
setError(undefined);
|
|
34
|
+
try {
|
|
35
|
+
const { data } = yield client.query({
|
|
36
|
+
query: GET_CASE_LABELS,
|
|
37
|
+
variables: { where: { Account__c: { eq: accountId } } },
|
|
38
|
+
fetchPolicy: 'network-only',
|
|
39
|
+
});
|
|
40
|
+
const edges = (_d = (_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.RedHatSupportCaseLabel__c) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
41
|
+
setLabels(edges.map(({ node }) => mapCaseLabelNode(node)).filter((label) => label.id && label.name));
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
setError(e);
|
|
45
|
+
setLabels([]);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
setLoading(false);
|
|
49
|
+
}
|
|
50
|
+
}), [accountId, client]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
fetchLabels();
|
|
53
|
+
}, [fetchLabels]);
|
|
54
|
+
return { labels, loading, error, refetch: fetchLabels };
|
|
55
|
+
}
|
|
56
|
+
export function useCreateCaseLabel() {
|
|
57
|
+
const [mutate, { loading }] = useMutation(CREATE_CASE_LABEL);
|
|
58
|
+
const createCaseLabel = (name, accountId) => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const result = yield mutate({
|
|
60
|
+
variables: {
|
|
61
|
+
input: {
|
|
62
|
+
RedHatSupportCaseLabel__c: {
|
|
63
|
+
Name: name,
|
|
64
|
+
Account__c: accountId,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
return result.data;
|
|
70
|
+
});
|
|
71
|
+
return { createCaseLabel, loading };
|
|
72
|
+
}
|
|
73
|
+
export function useUpdateCaseLabel() {
|
|
74
|
+
const [mutate, { loading }] = useMutation(UPDATE_CASE_LABEL);
|
|
75
|
+
const updateCaseLabel = (id, name) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const result = yield mutate({
|
|
77
|
+
variables: {
|
|
78
|
+
input: {
|
|
79
|
+
Id: id,
|
|
80
|
+
RedHatSupportCaseLabel__c: {
|
|
81
|
+
Name: name,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
return result.data;
|
|
87
|
+
});
|
|
88
|
+
return { updateCaseLabel, loading };
|
|
89
|
+
}
|
|
90
|
+
export function useDeleteCaseLabel() {
|
|
91
|
+
const [mutate, { loading }] = useMutation(DELETE_CASE_LABEL);
|
|
92
|
+
const deleteCaseLabel = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const result = yield mutate({
|
|
94
|
+
variables: { id },
|
|
95
|
+
});
|
|
96
|
+
return result.data;
|
|
97
|
+
});
|
|
98
|
+
return { deleteCaseLabel, loading };
|
|
99
|
+
}
|
|
@@ -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,69 @@ 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
|
+
|
|
485
|
+
.case-label-delete-description {
|
|
486
|
+
display: flex;
|
|
487
|
+
flex-direction: column;
|
|
488
|
+
gap: var(--pf-t--global--spacer--lg);
|
|
489
|
+
|
|
490
|
+
p {
|
|
491
|
+
margin: 0;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.case-label-delete-description__impact {
|
|
495
|
+
white-space: nowrap;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
436
499
|
.pf-v6-c-empty-state__icon {
|
|
437
500
|
color: var(--pf-t--color--gray--30);
|
|
438
501
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.238",
|
|
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.190",
|
|
80
80
|
"@rh-support/configs": "2.0.75",
|
|
81
|
-
"@rh-support/react-context": "2.5.
|
|
81
|
+
"@rh-support/react-context": "2.5.284",
|
|
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.136",
|
|
84
|
+
"@rh-support/utils": "2.5.118",
|
|
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": "9017d17207b6357a27edbab889de8f10696e745b"
|
|
104
104
|
}
|