feat(frontend): switching for enterprise version
This commit is contained in:
parent
894f7868b5
commit
bcfeb296ae
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
NEXT_PUBLIC_REST_ENDPOINT="http://localhost:8000/api"
|
NEXT_PUBLIC_REST_ENDPOINT="http://localhost:8000/api"
|
||||||
NEXT_PUBLIC_WS_ENDPOINT="http://localhost:5000/"
|
NEXT_PUBLIC_WS_ENDPOINT="http://localhost:5000/"
|
||||||
|
NEXT_PUBLIC_ENTERPRISE_VERSION="false"
|
||||||
# ---------------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------------- #
|
||||||
|
|
||||||
# -------------------------- Production Environment -------------------------- #
|
# -------------------------- Production Environment -------------------------- #
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ COPY ../ ./
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
RUN NEXT_PUBLIC_REST_ENDPOINT=REST_API_URL NEXT_PUBLIC_WS_ENDPOINT=WS_URL npm run build
|
RUN NEXT_PUBLIC_REST_ENDPOINT=REST_API_URL NEXT_PUBLIC_WS_ENDPOINT=WS_URL NEXT_PUBLIC_ENTERPRISE_VERSION=ENTERPRISE_VERSION npm run build
|
||||||
|
|
||||||
RUN ls -la && echo "Listing directory contents done"
|
RUN ls -la && echo "Listing directory contents done"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,12 @@ function apply_path {
|
||||||
echo "Check that we have NEXT_PUBLIC_WS_ENDPOINT vars"
|
echo "Check that we have NEXT_PUBLIC_WS_ENDPOINT vars"
|
||||||
test -n "$NEXT_PUBLIC_WS_ENDPOINT"
|
test -n "$NEXT_PUBLIC_WS_ENDPOINT"
|
||||||
|
|
||||||
|
echo "Check that we have NEXT_PUBLIC_ENTERPRISE_VERSION vars"
|
||||||
|
test -n "$NEXT_PUBLIC_ENTERPRISE_VERSION"
|
||||||
|
|
||||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#REST_API_URL#$NEXT_PUBLIC_REST_ENDPOINT#g"
|
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#REST_API_URL#$NEXT_PUBLIC_REST_ENDPOINT#g"
|
||||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#WS_URL#$NEXT_PUBLIC_WS_ENDPOINT#g"
|
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#WS_URL#$NEXT_PUBLIC_WS_ENDPOINT#g"
|
||||||
|
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#ENTERPRISE_VERSION#$NEXT_PUBLIC_ENTERPRISE_VERSION#g"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_path
|
apply_path
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ Tab,
|
||||||
Tabs,
|
Tabs,
|
||||||
SvgIcon,
|
SvgIcon,
|
||||||
Breadcrumbs,
|
Breadcrumbs,
|
||||||
Link } from '@mui/material';
|
Link,
|
||||||
|
Tooltip,
|
||||||
|
IconButton} from '@mui/material';
|
||||||
import { Layout as DashboardLayout } from 'src/layouts/dashboard/layout';
|
import { Layout as DashboardLayout } from 'src/layouts/dashboard/layout';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { DevicesRPC } from 'src/sections/devices/cwmp/devices-rpc';
|
import { DevicesRPC } from 'src/sections/devices/cwmp/devices-rpc';
|
||||||
|
|
@ -19,6 +21,7 @@ import { DevicesWiFi } from 'src/sections/devices/cwmp/devices-wifi';
|
||||||
import { DevicesDiagnostic } from 'src/sections/devices/cwmp/devices-diagnostic';
|
import { DevicesDiagnostic } from 'src/sections/devices/cwmp/devices-diagnostic';
|
||||||
import { SiteSurvey } from 'src/sections/devices/cwmp/site-survey';
|
import { SiteSurvey } from 'src/sections/devices/cwmp/site-survey';
|
||||||
import { ConnectedDevices } from 'src/sections/devices/cwmp/connecteddevices';
|
import { ConnectedDevices } from 'src/sections/devices/cwmp/connecteddevices';
|
||||||
|
import InformactionCircleIcon from '@heroicons/react/24/outline/InformationCircleIcon';
|
||||||
|
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
|
|
@ -26,6 +29,7 @@ const Page = () => {
|
||||||
|
|
||||||
const deviceID = router.query.id[0]
|
const deviceID = router.query.id[0]
|
||||||
const section = router.query.id[1]
|
const section = router.query.id[1]
|
||||||
|
const enterpriseVersion = process.env.NEXT_PUBLIC_ENTERPRISE_VERSION === "true" ? true : false;
|
||||||
|
|
||||||
const sectionHandler = () => {
|
const sectionHandler = () => {
|
||||||
switch(section){
|
switch(section){
|
||||||
|
|
@ -80,14 +84,43 @@ const Page = () => {
|
||||||
<Box sx={{
|
<Box sx={{
|
||||||
display:'flex',
|
display:'flex',
|
||||||
justifyContent:'center',
|
justifyContent:'center',
|
||||||
}}>
|
}}>
|
||||||
<Tabs value={router.query.id[1]} aria-label="icon label tabs example">
|
<Tabs value={router.query.id[1]} aria-label="icon label tabs example">
|
||||||
<Tab icon={<SvgIcon><WifiIcon/></SvgIcon>} iconPosition={"end"} label="Wi-Fi" onClick={()=>{router.push(`/devices/cwmp/${deviceID}/wifi`)}} value={"wifi"}/>
|
<Tab
|
||||||
<Tab icon={<SvgIcon><SignalIcon/></SvgIcon>} iconPosition={"end"} label="Site Survey" onClick={()=>{router.push(`/devices/cwmp/${deviceID}/site-survey`)}} value={"site-survey"}/>
|
icon={<SvgIcon><WifiIcon/></SvgIcon>}
|
||||||
<Tab icon={<SvgIcon><DevicePhoneMobile/></SvgIcon>} iconPosition={"end"} label="Connected Devices" onClick={()=>{router.push(`/devices/cwmp/${deviceID}/connected-devices`)}} value={"connected-devices"}/>
|
iconPosition={"end"}
|
||||||
|
label="Wi-Fi"
|
||||||
|
onClick={()=>{router.push(`/devices/cwmp/${deviceID}/wifi`)}}
|
||||||
|
value={"wifi"}/>
|
||||||
|
<Tab
|
||||||
|
icon={<SvgIcon><SignalIcon/></SvgIcon>}
|
||||||
|
iconPosition={"end"}
|
||||||
|
label="Site Survey"
|
||||||
|
onClick={()=>{router.push(`/devices/cwmp/${deviceID}/site-survey`)}}
|
||||||
|
value={"site-survey"}
|
||||||
|
disabled={!enterpriseVersion}/>
|
||||||
|
<Tab
|
||||||
|
icon={<SvgIcon><DevicePhoneMobile/></SvgIcon>}
|
||||||
|
iconPosition={"end"}
|
||||||
|
label="Connected Devices"
|
||||||
|
onClick={()=>{router.push(`/devices/cwmp/${deviceID}/connected-devices`)}}
|
||||||
|
value={"connected-devices"}
|
||||||
|
disabled={!enterpriseVersion}
|
||||||
|
/>
|
||||||
{/* <Tab value={"discovery"} onClick={()=>{router.push(`/devices/cwmp/${deviceID}/discovery`)}} icon={<SvgIcon><MagnifyingGlassIcon/></SvgIcon>} iconPosition={"end"} label="Discover Parameters" /> */}
|
{/* <Tab value={"discovery"} onClick={()=>{router.push(`/devices/cwmp/${deviceID}/discovery`)}} icon={<SvgIcon><MagnifyingGlassIcon/></SvgIcon>} iconPosition={"end"} label="Discover Parameters" /> */}
|
||||||
<Tab icon={<SvgIcon><WrenchScrewDriverIcon/></SvgIcon>} iconPosition={"end"} label="Diagnostic" onClick={()=>{router.push(`/devices/cwmp/${deviceID}/diagnostic`)}} value={"diagnostic"}/>
|
<Tab
|
||||||
<Tab value={"msg"} onClick={()=>{router.push(`/devices/cwmp/${deviceID}/msg`)}} icon={<SvgIcon><EnvelopeIcon/></SvgIcon>} iconPosition={"end"} label="Remote Messages" />
|
icon={<SvgIcon><WrenchScrewDriverIcon/></SvgIcon>}
|
||||||
|
iconPosition={"end"}
|
||||||
|
label="Diagnostic"
|
||||||
|
onClick={()=>{router.push(`/devices/cwmp/${deviceID}/diagnostic`)}}
|
||||||
|
value={"diagnostic"}
|
||||||
|
disabled={!enterpriseVersion}/>
|
||||||
|
<Tab
|
||||||
|
value={"msg"}
|
||||||
|
onClick={()=>{router.push(`/devices/cwmp/${deviceID}/msg`)}}
|
||||||
|
icon={<SvgIcon><EnvelopeIcon/></SvgIcon>}
|
||||||
|
iconPosition={"end"}
|
||||||
|
label="Remote Messages" />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user