@asaleh37/ui-base 25.8.10-6 → 25.8.10-7
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/common/NoLicenseComponent.tsx +41 -4
- package/src/layout/Layout.tsx +11 -47
package/package.json
CHANGED
|
@@ -4,10 +4,39 @@ import {
|
|
|
4
4
|
LicenseCheckObject,
|
|
5
5
|
} from "../../redux/features/common/AppInfoSlice";
|
|
6
6
|
import { useSelector } from "react-redux";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { useAxios } from "../../hooks";
|
|
7
9
|
|
|
8
|
-
const NoLicenseComponent: React.FC
|
|
10
|
+
const NoLicenseComponent: React.FC = () => {
|
|
11
|
+
const [licenseCheckObj, setLicenseCheckObject] = useState<LicenseCheckObject>(
|
|
12
|
+
{ isLicensed: true, lastLicenseCheckMessage: "", lastLicenseCheckTime: "" }
|
|
13
|
+
);
|
|
14
|
+
const { handleGetRequest } = useAxios();
|
|
9
15
|
const appInfo: AppInfo = useSelector((state: any) => state.AppInfo.value);
|
|
10
|
-
|
|
16
|
+
const checkSystemLicense = async () => {
|
|
17
|
+
if (appInfo?.checkLicense?.endpoint) {
|
|
18
|
+
await handleGetRequest({
|
|
19
|
+
endPointURI: appInfo.checkLicense?.endpoint,
|
|
20
|
+
successCallBkFn: (response) => {
|
|
21
|
+
setLicenseCheckObject(response.data);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (appInfo?.checkLicense?.endpoint) {
|
|
29
|
+
const interval = appInfo?.checkLicense?.interval || 60000;
|
|
30
|
+
const intervalId = setInterval(() => {
|
|
31
|
+
checkSystemLicense();
|
|
32
|
+
}, interval);
|
|
33
|
+
return () => {
|
|
34
|
+
clearInterval(intervalId);
|
|
35
|
+
console.log("Interval cleared");
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}, [appInfo]);
|
|
39
|
+
return !licenseCheckObj.isLicensed ? (
|
|
11
40
|
<Box
|
|
12
41
|
sx={{
|
|
13
42
|
flex: 1,
|
|
@@ -17,6 +46,11 @@ const NoLicenseComponent: React.FC<LicenseCheckObject> = (props) => {
|
|
|
17
46
|
flexDirection: "column",
|
|
18
47
|
alignItems: "center",
|
|
19
48
|
justifyContent: "center",
|
|
49
|
+
position: "fixed",
|
|
50
|
+
top: 0,
|
|
51
|
+
background: "rgba(235, 235, 235, 0.8)",
|
|
52
|
+
left: 0,
|
|
53
|
+
zIndex: 9999,
|
|
20
54
|
}}
|
|
21
55
|
>
|
|
22
56
|
<img src={appInfo.appLogo} />
|
|
@@ -30,12 +64,15 @@ const NoLicenseComponent: React.FC<LicenseCheckObject> = (props) => {
|
|
|
30
64
|
Please reach out to your vendor for assistance.
|
|
31
65
|
</Typography>
|
|
32
66
|
<Typography>
|
|
33
|
-
License Check @{
|
|
67
|
+
License Check @{licenseCheckObj?.lastLicenseCheckTime || "--------"}
|
|
34
68
|
</Typography>
|
|
35
69
|
<Typography>
|
|
36
|
-
License Check Result :
|
|
70
|
+
License Check Result :{" "}
|
|
71
|
+
{licenseCheckObj?.lastLicenseCheckMessage || "--------"}
|
|
37
72
|
</Typography>
|
|
38
73
|
</Box>
|
|
74
|
+
) : (
|
|
75
|
+
<></>
|
|
39
76
|
);
|
|
40
77
|
};
|
|
41
78
|
|
package/src/layout/Layout.tsx
CHANGED
|
@@ -8,17 +8,11 @@ import MainContent from "./MainContent";
|
|
|
8
8
|
import { BrowserRouter } from "react-router-dom";
|
|
9
9
|
import MobileDrawer from "./MobileDrawer";
|
|
10
10
|
import { ToastContainer } from "react-toastify";
|
|
11
|
-
import { useEffect, useState } from "react";
|
|
12
11
|
import { useIsMobile } from "../hooks/UseMobile";
|
|
13
|
-
import useAxios from "../hooks/useAxios";
|
|
14
12
|
import { DRAWER_WIDTH } from "../redux/features/common/AppLayoutSlice";
|
|
15
13
|
import { UserSessionProps } from "../redux/features/common/UserSessionSlice";
|
|
16
14
|
import LoadingMask from "../components/common/LoadingMask";
|
|
17
15
|
import Login from "../components/common/Login";
|
|
18
|
-
import {
|
|
19
|
-
AppInfo,
|
|
20
|
-
LicenseCheckObject,
|
|
21
|
-
} from "../redux/features/common/AppInfoSlice";
|
|
22
16
|
import NoLicenseComponent from "../components/common/NoLicenseComponent";
|
|
23
17
|
|
|
24
18
|
const Main = styled("main", {
|
|
@@ -61,40 +55,12 @@ const Main = styled("main", {
|
|
|
61
55
|
|
|
62
56
|
export default function Layout() {
|
|
63
57
|
const SideBarState = useSelector((state: any) => state.SideBar);
|
|
64
|
-
|
|
65
|
-
{ isLicensed: true, lastLicenseCheckMessage: "", lastLicenseCheckTime: "" }
|
|
66
|
-
);
|
|
58
|
+
|
|
67
59
|
const isMobile = useIsMobile();
|
|
68
|
-
const { handleGetRequest } = useAxios();
|
|
69
60
|
const UserSession: UserSessionProps = useSelector(
|
|
70
61
|
(state: any) => state.UserSession
|
|
71
62
|
);
|
|
72
|
-
const appInfo: AppInfo = useSelector((state: any) => state.AppInfo.value);
|
|
73
63
|
const AppLayout = useSelector((state: any) => state.AppLayout);
|
|
74
|
-
const checkSystemLicense = async () => {
|
|
75
|
-
if (appInfo?.checkLicense?.endpoint) {
|
|
76
|
-
await handleGetRequest({
|
|
77
|
-
endPointURI: appInfo.checkLicense?.endpoint,
|
|
78
|
-
successCallBkFn: (response) => {
|
|
79
|
-
setLicenseCheckObject(response.data);
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
if (appInfo?.checkLicense?.endpoint) {
|
|
87
|
-
const interval = appInfo?.checkLicense?.interval || 60000;
|
|
88
|
-
const intervalId = setInterval(() => {
|
|
89
|
-
checkSystemLicense();
|
|
90
|
-
}, interval);
|
|
91
|
-
return () => {
|
|
92
|
-
clearInterval(intervalId);
|
|
93
|
-
console.log("Interval cleared");
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
}, [appInfo]);
|
|
97
|
-
|
|
98
64
|
return (
|
|
99
65
|
<BrowserRouter>
|
|
100
66
|
<ToastContainer
|
|
@@ -104,18 +70,16 @@ export default function Layout() {
|
|
|
104
70
|
/>
|
|
105
71
|
<LoadingMask />
|
|
106
72
|
{UserSession.value.isAuthenticated === true ? (
|
|
107
|
-
licenseCheckObj?.isLicensed ? (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<NoLicenseComponent {...licenseCheckObj} />
|
|
118
|
-
)
|
|
73
|
+
// licenseCheckObj?.isLicensed ? (
|
|
74
|
+
<Main open={SideBarState.isOpened}>
|
|
75
|
+
<CssBaseline />
|
|
76
|
+
<TopBar />
|
|
77
|
+
{!isMobile ? <SideBar /> : null}
|
|
78
|
+
{isMobile ? <MobileDrawer /> : null}
|
|
79
|
+
<DrawerHeader />
|
|
80
|
+
<MainContent />
|
|
81
|
+
<NoLicenseComponent />
|
|
82
|
+
</Main>
|
|
119
83
|
) : (
|
|
120
84
|
<Login />
|
|
121
85
|
)}
|