1414// You should have received a copy of the GNU Affero General Public License
1515// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17- import React , { Fragment , useEffect , useState } from "react" ;
17+ import React , { Fragment , Suspense , useEffect , useState } from "react" ;
1818import { Theme } from "@mui/material/styles" ;
1919import createStyles from "@mui/styles/createStyles" ;
2020import withStyles from "@mui/styles/withStyles" ;
@@ -35,42 +35,74 @@ import { ISessionResponse } from "./types";
3535import { snackBarMessage } from "../../types" ;
3636import { snackBarCommon } from "./Common/FormComponents/common/styleLibrary" ;
3737import { ErrorResponseHandler } from "../../common/types" ;
38- import Buckets from "./Buckets/Buckets" ;
39- import Policies from "./Policies/Policies" ;
40- import Dashboard from "./Dashboard/Dashboard" ;
38+
4139import Menu from "./Menu/Menu" ;
4240import api from "../../common/api" ;
43- import Account from "./Account/Account" ;
44- import Users from "./Users/Users" ;
45- import Groups from "./Groups/Groups" ;
46- import ConfigurationMain from "./Configurations/ConfigurationMain" ;
47- import TenantDetails from "./Tenants/TenantDetails/TenantDetails" ;
48- import License from "./License/License" ;
49- import Trace from "./Trace/Trace" ;
50- import Heal from "./Heal/Heal" ;
51- import Watch from "./Watch/Watch" ;
52- import HealthInfo from "./HealthInfo/HealthInfo" ;
53- import Storage from "./Storage/Storage" ;
54- import Metrics from "./Dashboard/Metrics" ;
55- import Hop from "./Tenants/TenantDetails/hop/Hop" ;
41+
5642import MainError from "./Common/MainError/MainError" ;
57- import AddTenant from "./Tenants/AddTenant/AddTenant" ;
58- import NotificationEndpoints from "./NotificationEndpoints/NotificationEndpoints" ;
59- import AddNotificationEndpoint from "./NotificationEndpoints/AddNotificationEndpoint" ;
60- import NotificationTypeSelector from "./NotificationEndpoints/NotificationTypeSelector" ;
61- import ListTiersConfiguration from "./Configurations/TiersConfiguration/ListTiersConfiguration" ;
62- import TierTypeSelector from "./Configurations/TiersConfiguration/TierTypeSelector" ;
63- import AddTierConfiguration from "./Configurations/TiersConfiguration/AddTierConfiguration" ;
64- import ListTenants from "./Tenants/ListTenants/ListTenants" ;
65- import Tools from "./Tools/Tools" ;
66- import ErrorLogs from "./Logs/ErrorLogs/ErrorLogs" ;
67- import LogsSearchMain from "./Logs/LogSearch/LogsSearchMain" ;
68- import GroupsDetails from "./Groups/GroupsDetails" ;
69- import Speedtest from "./Speedtest/Speedtest" ;
70- import IconsScreen from "./Common/IconsScreen" ;
43+
44+ const Trace = React . lazy ( ( ) => import ( "./Trace/Trace" ) ) ;
45+ const Heal = React . lazy ( ( ) => import ( "./Heal/Heal" ) ) ;
46+ const Watch = React . lazy ( ( ) => import ( "./Watch/Watch" ) ) ;
47+ const HealthInfo = React . lazy ( ( ) => import ( "./HealthInfo/HealthInfo" ) ) ;
48+ const Storage = React . lazy ( ( ) => import ( "./Storage/Storage" ) ) ;
49+ const Metrics = React . lazy ( ( ) => import ( "./Dashboard/Metrics" ) ) ;
50+ const Hop = React . lazy ( ( ) => import ( "./Tenants/TenantDetails/hop/Hop" ) ) ;
51+
52+ const AddTenant = React . lazy ( ( ) => import ( "./Tenants/AddTenant/AddTenant" ) ) ;
53+
54+ const NotificationEndpoints = React . lazy (
55+ ( ) => import ( "./NotificationEndpoints/NotificationEndpoints" )
56+ ) ;
57+ const AddNotificationEndpoint = React . lazy (
58+ ( ) => import ( "./NotificationEndpoints/AddNotificationEndpoint" )
59+ ) ;
60+ const NotificationTypeSelector = React . lazy (
61+ ( ) => import ( "./NotificationEndpoints/NotificationTypeSelector" )
62+ ) ;
63+
64+ const ListTiersConfiguration = React . lazy (
65+ ( ) => import ( "./Configurations/TiersConfiguration/ListTiersConfiguration" )
66+ ) ;
67+ const TierTypeSelector = React . lazy (
68+ ( ) => import ( "./Configurations/TiersConfiguration/TierTypeSelector" )
69+ ) ;
70+ const AddTierConfiguration = React . lazy (
71+ ( ) => import ( "./Configurations/TiersConfiguration/AddTierConfiguration" )
72+ ) ;
73+ const ListTenants = React . lazy (
74+ ( ) => import ( "./Tenants/ListTenants/ListTenants" )
75+ ) ;
76+
77+ const ErrorLogs = React . lazy ( ( ) => import ( "./Logs/ErrorLogs/ErrorLogs" ) ) ;
78+ const LogsSearchMain = React . lazy (
79+ ( ) => import ( "./Logs/LogSearch/LogsSearchMain" )
80+ ) ;
81+ const GroupsDetails = React . lazy ( ( ) => import ( "./Groups/GroupsDetails" ) ) ;
82+
83+ const Tools = React . lazy ( ( ) => import ( "./Tools/Tools" ) ) ;
84+
85+ const IconsScreen = React . lazy ( ( ) => import ( "./Common/IconsScreen" ) ) ;
86+
87+ const Speedtest = React . lazy ( ( ) => import ( "./Speedtest/Speedtest" ) ) ;
7188
7289const drawerWidth = 245 ;
7390
91+ const Buckets = React . lazy ( ( ) => import ( "./Buckets/Buckets" ) ) ;
92+ const Policies = React . lazy ( ( ) => import ( "./Policies/Policies" ) ) ;
93+ const Dashboard = React . lazy ( ( ) => import ( "./Dashboard/Dashboard" ) ) ;
94+
95+ const Account = React . lazy ( ( ) => import ( "./Account/Account" ) ) ;
96+ const Users = React . lazy ( ( ) => import ( "./Users/Users" ) ) ;
97+ const Groups = React . lazy ( ( ) => import ( "./Groups/Groups" ) ) ;
98+ const ConfigurationMain = React . lazy (
99+ ( ) => import ( "./Configurations/ConfigurationMain" )
100+ ) ;
101+ const TenantDetails = React . lazy (
102+ ( ) => import ( "./Tenants/TenantDetails/TenantDetails" )
103+ ) ;
104+ const License = React . lazy ( ( ) => import ( "./License/License" ) ) ;
105+
74106const styles = ( theme : Theme ) =>
75107 createStyles ( {
76108 root : {
@@ -509,12 +541,16 @@ const Console = ({
509541 exact
510542 path = { route . path }
511543 children = { ( routerProps ) => (
512- < route . component { ...routerProps } { ...route . props } />
544+ < Suspense fallback = { < div > Loading...</ div > } >
545+ < route . component { ...routerProps } { ...route . props } />
546+ </ Suspense >
513547 ) }
514548 />
515549 ) ) }
516550 < Route key = { "/icons" } exact path = { "/icons" } >
517- < IconsScreen />
551+ < Suspense fallback = { < div > Loading...</ div > } >
552+ < IconsScreen />
553+ </ Suspense >
518554 </ Route >
519555 { allowedRoutes . length > 0 ? (
520556 < Redirect to = { allowedRoutes [ 0 ] . path } />
0 commit comments