@antscorp/antsomi-ui 1.3.5-beta.469 → 1.3.5-beta.470

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.
@@ -19,7 +19,7 @@ export const useNavigatePath = () => {
19
19
  const { search } = useLocation();
20
20
  const isDev = env === ENV.DEV;
21
21
  const { activeItemPath, flattenMenuPermission } = usePermission();
22
- const hasRole = useDeepCompareMemo(() => hasSelectAccountPermission(activeItemPath, flattenMenuPermission), [activeItemPath, flattenMenuPermission]);
22
+ const hasRole = useDeepCompareMemo(() => hasSelectAccountPermission({ activeItemPath, flattenPermissionList: flattenMenuPermission }), [activeItemPath, flattenMenuPermission]);
23
23
  const urlParams = useMemo(() => new URLSearchParams(search), [search]);
24
24
  const oidParam = hasRole ? urlParams.get('oid') : null;
25
25
  const searchParams = oidParam ? `?oid=${oidParam}` : '';
@@ -126,7 +126,12 @@ export const Layout = memo(props => {
126
126
  const activeMenuCode = (_a = activeItemPath === null || activeItemPath === void 0 ? void 0 : activeItemPath[(activeItemPath === null || activeItemPath === void 0 ? void 0 : activeItemPath.length) - 1]) === null || _a === void 0 ? void 0 : _a.menu_item_code;
127
127
  setActiveMenuCode(activeMenuCode);
128
128
  onActiveMenuChange === null || onActiveMenuChange === void 0 ? void 0 : onActiveMenuChange(activeMenuCode);
129
- const hasRole = hasSelectAccountPermission(activeItemPath, flattenPermissionList, menuListPermission);
129
+ const hasRole = hasSelectAccountPermission({
130
+ activeItemPath: cloneDeep(activeItemPath),
131
+ flattenPermissionList,
132
+ menuListPermission,
133
+ appItem: activeItemPath[0],
134
+ });
130
135
  setShowAccountSelection(hasRole);
131
136
  }, [onActiveMenuChange]);
132
137
  return (React.createElement(LayoutWrapper, { showLeftMenu: !!showLeftMenu },
@@ -28,5 +28,5 @@ export declare const MENU_CODE: {
28
28
  JOURNEY_TACTIC: string;
29
29
  BATCH_STREAMING: string;
30
30
  REALTIME_STREAMING: string;
31
- DATA_SOURCE: string;
31
+ DATASOURCES: string;
32
32
  };
@@ -29,5 +29,5 @@ export const MENU_CODE = {
29
29
  JOURNEY_TACTIC: 'JOURNEY_TACTIC',
30
30
  BATCH_STREAMING: 'BATCH_STREAMING',
31
31
  REALTIME_STREAMING: 'REALTIME_STREAMING',
32
- DATA_SOURCE: 'DATA_SOURCE',
32
+ DATASOURCES: 'DATASOURCES',
33
33
  };
@@ -14,4 +14,9 @@ export declare const checkingRoleScope: (args: {
14
14
  scope?: number;
15
15
  isExactly?: boolean;
16
16
  }) => boolean;
17
- export declare const hasSelectAccountPermission: (activeItemPath: TFeatureMenu[], flattenPermissionList?: FeatureMenuPermission[], menuListPermission?: FeatureMenuPermission[]) => boolean;
17
+ export declare const hasSelectAccountPermission: (args: {
18
+ activeItemPath: TFeatureMenu[];
19
+ flattenPermissionList?: FeatureMenuPermission[];
20
+ menuListPermission?: FeatureMenuPermission[];
21
+ appItem?: TFeatureMenu;
22
+ }) => boolean;
@@ -19,7 +19,7 @@ export const checkingRoleScope = (args) => {
19
19
  MENU_CODE.EMAIL_TEMPLATE,
20
20
  MENU_CODE.BATCH_STREAMING,
21
21
  MENU_CODE.REALTIME_STREAMING,
22
- MENU_CODE.DATA_SOURCE,
22
+ MENU_CODE.DATASOURCES,
23
23
  // MENU_CODE.SEGMENT,
24
24
  // MENU_CODE.DESTINATIONS_HUB,
25
25
  MENU_CODE.BUSINESS_OBJECT,
@@ -50,7 +50,8 @@ export const checkingRoleScope = (args) => {
50
50
  }
51
51
  return isOK;
52
52
  };
53
- export const hasSelectAccountPermission = (activeItemPath, flattenPermissionList, menuListPermission) => {
53
+ export const hasSelectAccountPermission = (args) => {
54
+ const { activeItemPath, flattenPermissionList, menuListPermission, appItem } = args;
54
55
  if (isEmpty(activeItemPath))
55
56
  return false;
56
57
  let roleScope = false;
@@ -72,8 +73,21 @@ export const hasSelectAccountPermission = (activeItemPath, flattenPermissionList
72
73
  permissionCode = activeItem.permission_code;
73
74
  }
74
75
  const menuPermission = (() => {
76
+ var _a;
75
77
  if (KEEP_HASH_PATH_CODE.includes(activeItem.menu_item_code)) {
76
- // return;
78
+ if (appItem) {
79
+ const appPermission = (() => {
80
+ switch (appItem === null || appItem === void 0 ? void 0 : appItem.permission_code) {
81
+ case 'SQL_WORKSPACE':
82
+ return 'APP_ANTALYSER';
83
+ default:
84
+ return appItem === null || appItem === void 0 ? void 0 : appItem.permission_code;
85
+ }
86
+ })();
87
+ const parentMenu = menuListPermission === null || menuListPermission === void 0 ? void 0 : menuListPermission.find(item => item.app_code === appPermission);
88
+ return (_a = parentMenu === null || parentMenu === void 0 ? void 0 : parentMenu.childs) === null || _a === void 0 ? void 0 : _a.find(item => item.menu_code === permissionCode);
89
+ }
90
+ return;
77
91
  }
78
92
  return flattenPermissionList === null || flattenPermissionList === void 0 ? void 0 : flattenPermissionList.find(item => permissionCode === item.menu_code);
79
93
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.469",
3
+ "version": "1.3.5-beta.470",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",