@antscorp/antsomi-ui 1.3.5-beta.923 → 1.3.5-beta.925
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/es/components/molecules/HeaderV2/HeaderV2.js +5 -1
- package/es/components/organism/LeftMenu/hooks/usePermission.js +3 -1
- package/es/components/template/Layout/Layout.js +11 -4
- package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/components/OldLeftMenu/index.js +3 -1
- package/package.json +1 -1
|
@@ -26,7 +26,11 @@ export const HeaderV2 = memo(props => {
|
|
|
26
26
|
// * Prefer to use Header in AppConfigContext
|
|
27
27
|
const { show = true, className, style, breadcrumbs, showLogo = false, rightContent, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, onCLickLogo, } = props;
|
|
28
28
|
/** General config for children component */
|
|
29
|
-
const { env = envContext, language = languageCode,
|
|
29
|
+
const { env = envContext, language = languageCode,
|
|
30
|
+
// NOTE: Just hot fix for change userId to accountId
|
|
31
|
+
userId = isNaN(Number(auth?.accountId || auth?.userId))
|
|
32
|
+
? 0
|
|
33
|
+
: Number(auth?.accountId || auth?.userId), portalId = auth?.portalId, token = auth?.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, appCode = contextAppCode, menuCode = contextMenuCode, } = config || {};
|
|
30
34
|
const { currentAccount, inputStyle = 'select', onSelectAccount, ...accountSelectionProps } = accountSelection;
|
|
31
35
|
const urlParams = useMemo(() => new URLSearchParams(search), [search]);
|
|
32
36
|
const oidParam = urlParams.get('oid') || currentAccount || 'all';
|
|
@@ -101,7 +101,9 @@ export const usePermission = () => {
|
|
|
101
101
|
auth: {
|
|
102
102
|
token: auth?.token,
|
|
103
103
|
url: permissionDomain || PERMISSION_API,
|
|
104
|
-
|
|
104
|
+
// NOTE: Hot fix for case menu permission working wrong
|
|
105
|
+
// userId: auth?.userId,
|
|
106
|
+
userId: auth?.accountId,
|
|
105
107
|
accountId: auth?.accountId,
|
|
106
108
|
},
|
|
107
109
|
params: {
|
|
@@ -199,7 +199,8 @@ export const Layout = memo(props => {
|
|
|
199
199
|
permissionDomain,
|
|
200
200
|
socketDomain: SOCKET_API,
|
|
201
201
|
token,
|
|
202
|
-
accountId: userId,
|
|
202
|
+
// accountId: userId,
|
|
203
|
+
accountId,
|
|
203
204
|
userId,
|
|
204
205
|
lang: languageCode,
|
|
205
206
|
networkId: portalId,
|
|
@@ -223,6 +224,12 @@ export const Layout = memo(props => {
|
|
|
223
224
|
: menu_item_name);
|
|
224
225
|
setActiveMenu(activeMenuItem);
|
|
225
226
|
onActiveMenuChange?.(menu_item_code);
|
|
227
|
+
console.log({
|
|
228
|
+
activeItemPath: cloneDeep(activeItemPath),
|
|
229
|
+
flattenPermissionList,
|
|
230
|
+
menuListPermission,
|
|
231
|
+
appItem: activeItemPath[0],
|
|
232
|
+
});
|
|
226
233
|
const hasRole = hasSelectAccountPermission({
|
|
227
234
|
activeItemPath: cloneDeep(activeItemPath),
|
|
228
235
|
flattenPermissionList,
|
|
@@ -253,10 +260,10 @@ export const Layout = memo(props => {
|
|
|
253
260
|
useDeepCompareEffect(() => {
|
|
254
261
|
const { userId: userIdParam } = (params || {});
|
|
255
262
|
console.log('🚀 ~ useDeepCompareEffect ~ userId:', userIdParam, userId);
|
|
256
|
-
if (userIdParam &&
|
|
257
|
-
replace(`${location.pathname.replace(userIdParam, `${
|
|
263
|
+
if (userIdParam && accountId && +userIdParam !== +accountId && location.pathname) {
|
|
264
|
+
replace(`${location.pathname.replace(userIdParam, `${accountId}`)}${location.search}`);
|
|
258
265
|
}
|
|
259
|
-
}, [params, location.pathname,
|
|
266
|
+
}, [params, location.pathname, accountId, replace]);
|
|
260
267
|
/** If left menu props has customization then set layout loading to false, because we don't need check permission here */
|
|
261
268
|
useDeepCompareEffect(() => {
|
|
262
269
|
if (mergeLeftMenuProps.customization) {
|
|
@@ -43,7 +43,9 @@ export const OldLeftMenu = memo(props => {
|
|
|
43
43
|
auth: {
|
|
44
44
|
token: auth?.token,
|
|
45
45
|
url: PERMISSION_API,
|
|
46
|
-
|
|
46
|
+
// NOTE: Hot fix for case menu permission working wrong
|
|
47
|
+
// userId: auth?.userId,
|
|
48
|
+
userId: auth?.accountId,
|
|
47
49
|
accountId: auth?.accountId,
|
|
48
50
|
},
|
|
49
51
|
params: {
|