Skip to content

Commit

Permalink
chore(ACL): use React.lazy for ACL [YTFRONT-3814]
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-efremoff committed Apr 19, 2024
1 parent 3d46dba commit b9c0e01
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
36 changes: 36 additions & 0 deletions packages/ui/src/ui/containers/ACL/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import withLazyLoading from '../../hocs/withLazyLoading';

function importAcl() {
return import(/* webpackChunkName: "acl" */ './ACL-connect-helpers');
}

export const AccessContentAcl = withLazyLoading(
React.lazy(async () => {
return {default: (await importAcl()).AccessContentAcl};
}),
);

export const NavigationAcl = withLazyLoading(
React.lazy(async () => {
return {default: (await importAcl()).NavigationAcl};
}),
);

export const PoolAclPanel = withLazyLoading(
React.lazy(async () => {
return {default: (await importAcl()).PoolAclPanel};
}),
);

export const AccountsAcl = withLazyLoading(
React.lazy(async () => {
return {default: (await importAcl()).AccountsAcl};
}),
);

export const BundleAcl = withLazyLoading(
React.lazy(async () => {
return {default: (await importAcl()).BundleAcl};
}),
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AccountsNoContent from '../../../../pages/accounts/AccountsNoContent';
import {getActiveAccount} from '../../../../store/selectors/accounts/accounts';
import {fetchAccounts} from '../../../../store/actions/accounts/accounts';
import {loadUsers} from '../../../../store/actions/accounts/editor';
import {AccountsAcl} from '../../../../containers/ACL/ACL-connect-helpers';
import {AccountsAcl} from '../../../../containers/ACL';

AccountsAclTab.propTypes = {
activeAccount: PropTypes.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {useSelector} from 'react-redux';

import {getChytCurrentAlias} from '../../../store/selectors/chyt';
import {AccessContentAcl} from '../../../containers/ACL/ACL-connect-helpers';
import {AccessContentAcl} from '../../../containers/ACL';

export function ChytPageCliqueAcl() {
const alias = useSelector(getChytCurrentAlias);
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/pages/navigation/tabs/ACL/ACL.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {connect} from 'react-redux';

import {AccessContentAcl, NavigationAcl} from '../../../../containers/ACL/ACL-connect-helpers';
import {AccessContentAcl, NavigationAcl} from '../../../../containers/ACL';
import {getAclLoadState} from '../../../../store/selectors/acl';
import {getAttributes, getRawPath} from '../../../../store/selectors/navigation';
import {IdmObjectType} from '../../../../constants/acl';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
getPools,
getTree,
} from '../../../../../store/selectors/scheduling/scheduling';
import {PoolAclPanel} from '../../../../../containers/ACL/ACL-connect-helpers';
import {PoolAclPanel} from '../../../../../containers/ACL';
import {RumMeasureTypes} from '../../../../../rum/rum-measure-types';
import {useRumMeasureStop} from '../../../../../rum/RumUiContext';
import {isFinalLoadingStatus} from '../../../../../utils/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ErrorBoundary from '../../../components/ErrorBoundary/ErrorBoundary';
import {getTabletsActiveBundle} from '../../../store/selectors/tablet_cell_bundles';
import {isPoolAclAllowed} from '../../../store/selectors/scheduling/scheduling';
import {NoContent} from '../../../components/NoContent/NoContent';
import {BundleAcl} from '../../../containers/ACL/ACL-connect-helpers';
import {BundleAcl} from '../../../containers/ACL';

export default function BundleAclTab() {
const activeBundle = useSelector(getTabletsActiveBundle);
Expand Down

0 comments on commit b9c0e01

Please # to comment.