Skip to content
Snippets Groups Projects
Commit f757bd4c authored by André Fugmann's avatar André Fugmann
Browse files

Add flag to disable database functionality in const.ts

parent da27361b
No related branches found
No related tags found
1 merge request!3Add flag to disable database functionality in const.ts
......@@ -14,6 +14,7 @@ import { drawerWidth } from './NavigationDrawer';
import { selectDarkmodeEnabled, toggleDarkmode } from './darkmodeSlice';
import TextSnippetOutlinedIcon from '@mui/icons-material/TextSnippetOutlined';
import UserMenu from './UserMenu';
import { DB_DISABLED } from '../../../const';
// NavigationBar component
const NavigationBar = (): JSX.Element => {
......@@ -33,10 +34,10 @@ const NavigationBar = (): JSX.Element => {
<Button startIcon={<MenuBookIcon />} color={'inherit'} target="_blank" href="https://doi.org/10.5281/zenodo.7757249">
Docs
</Button>
<Button startIcon={<PublicIcon></PublicIcon>} component={Link} color={'inherit'} to={'/public'} disabled={false}>
<Button startIcon={<PublicIcon></PublicIcon>} component={Link} color={'inherit'} to={'/public'} disabled={DB_DISABLED}>
Public Models
</Button>
<Button startIcon={<LockOpenIcon></LockOpenIcon>} component={Link} color={'inherit'} to={'/private'} disabled={false}>
<Button startIcon={<LockOpenIcon></LockOpenIcon>} component={Link} color={'inherit'} to={'/private'} disabled={DB_DISABLED}>
Private Models
</Button>
<Button startIcon={<TextSnippetOutlinedIcon></TextSnippetOutlinedIcon>} component={Link} color={'inherit'} to={'/demo'} disabled={false}>
......
......@@ -7,6 +7,7 @@ import UserTokenDialog from './UserTokenDialog';
import JSZip from 'jszip';
import { clearPrivateProjects, selectProjects } from '../../../features/soil-editor/soileditorSlice';
import FileSaver from 'file-saver';
import { DB_DISABLED } from '../../../const';
const UserMenu = (): JSX.Element => {
const [anchorEl, setAnchorEl] = useState(null);
......@@ -36,12 +37,13 @@ const UserMenu = (): JSX.Element => {
return (
<div>
<Badge
invisible={usertoken.logged_in}
invisible={usertoken.logged_in || DB_DISABLED}
badgeContent={'!'}
color={'error'}
overlap={"circular"}
sx={{mr: 3}}>
<IconButton
disabled = {DB_DISABLED}
size="large"
aria-controls="menu-appbar"
aria-haspopup="true"
......
export const DEMO_MODE = true;
export const EXPERIMENTAL_MODE = true;
export const DB_DISABLED = true;
export const DEV_MODE = process.env.NODE_ENV === 'development';
export const BASE_URL = DEV_MODE ? "http://localhost:3000" : "https://iot.wzl-mq.rwth-aachen.de/soil";
export const DATA_BACKEND = DEV_MODE ? "http://localhost:8402" : "https://iot.wzl-mq.rwth-aachen.de/soil-data"
......
......@@ -7,6 +7,7 @@ import usertokenReducer from '../app/Layout/Navigation/usertokenSlice';
import toolbarReducer from '../features/soil-editor/SoilToolbar/toolbarSlice';
import topnavigationReducer from '../features/soil-editor/TopNavigationBar/topnavigationSlice';
import soileditorReducer, { getProjectsFromDatabase } from '../features/soil-editor/soileditorSlice';
import { DB_DISABLED } from '../const';
// Configuration for persisting the Redux store
const persistConfig = {
......@@ -15,7 +16,7 @@ const persistConfig = {
}
const onRehydrate = () => {
store.dispatch(getProjectsFromDatabase())
if(!DB_DISABLED) store.dispatch(getProjectsFromDatabase());
}
// Combine reducers and create a persisted reducer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment