diff --git a/generate-buildno.js b/generate-buildno.js new file mode 100644 index 0000000..a071bcf --- /dev/null +++ b/generate-buildno.js @@ -0,0 +1,11 @@ +var fs = require('fs'); +console.log('Incrementing build number...'); +fs.readFile('src/metadata.json',function(err,content) { + if (err) throw err; + var metadata = JSON.parse(content); + metadata.buildRevision = metadata.buildRevision + 1; + fs.writeFile('src/metadata.json',JSON.stringify(metadata),function(err){ + if (err) throw err; + console.log(`Current build number: ${metadata.buildMajor}.${metadata.buildMinor}.${metadata.buildRevision} ${metadata.buildTag}`); + }) +}); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0e0faeb..f48ba05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@emotion/styled": "^11.13.0", "@mui/icons-material": "^6.1.3", "@mui/material": "^6.1.3", + "@mui/x-tree-view": "^7.22.1", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -3491,6 +3492,64 @@ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "license": "MIT" }, + "node_modules/@mui/x-internals": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@mui/x-internals/-/x-internals-7.21.0.tgz", + "integrity": "sha512-94YNyZ0BhK5Z+Tkr90RKf47IVCW8R/1MvdUhh6MCQg6sZa74jsX+x+gEZ4kzuCqOsuyTyxikeQ8vVuCIQiP7UQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.25.7", + "@mui/utils": "^5.16.6 || ^6.0.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + }, + "peerDependencies": { + "react": "^17.0.0 || ^18.0.0" + } + }, + "node_modules/@mui/x-tree-view": { + "version": "7.22.1", + "resolved": "https://registry.npmjs.org/@mui/x-tree-view/-/x-tree-view-7.22.1.tgz", + "integrity": "sha512-EdFuzAgHn+/b++oNbm8JuXiF4MbRW+Dg70+MNbp2fQi8U1J38kg1hwvIFQ6Wi2AEt3Dv9euaPMFJM+a/4pk5Ng==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.25.7", + "@mui/utils": "^5.16.6 || ^6.0.0", + "@mui/x-internals": "7.21.0", + "@types/react-transition-group": "^4.4.11", + "clsx": "^2.1.1", + "prop-types": "^15.8.1", + "react-transition-group": "^4.4.5" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + }, + "peerDependencies": { + "@emotion/react": "^11.9.0", + "@emotion/styled": "^11.8.1", + "@mui/material": "^5.15.14 || ^6.0.0", + "@mui/system": "^5.15.14 || ^6.0.0", + "react": "^17.0.0 || ^18.0.0", + "react-dom": "^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@emotion/react": { + "optional": true + }, + "@emotion/styled": { + "optional": true + } + } + }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", diff --git a/package.json b/package.json index 9785172..f1dc36b 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "@emotion/styled": "^11.13.0", "@mui/icons-material": "^6.1.3", "@mui/material": "^6.1.3", + "@mui/x-tree-view": "^7.22.1", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -22,8 +23,8 @@ "xterm": "^5.3.0" }, "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", + "start": "node generate-buildno.js && react-scripts start", + "build": "node generate-buildno.js && react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/src/App.js b/src/App.js index ab2757b..9f5e6df 100644 --- a/src/App.js +++ b/src/App.js @@ -1,8 +1,10 @@ import React from 'react'; import Login from './Login/LoginPage'; import { BrowserRouter as Router, Route, Routes, Navigate} from 'react-router-dom'; -import Settings from './Settings/SettingsMain' +import SettingsMain from './Settings/SettingsMain' +import SettingsInfo from './Settings/SettingsInfo' import Dashboard from './Dashboard/DashboardMain' + import './App.css' import useToken from './core/useToken'; import Terminal from './Terminal/TerminalPage' @@ -24,7 +26,8 @@ function App() { } /> } /> */} } /> - } /> + } /> + } /> ); diff --git a/src/Dashboard/DashboardMain.js b/src/Dashboard/DashboardMain.js index ce670e1..9ee0511 100644 --- a/src/Dashboard/DashboardMain.js +++ b/src/Dashboard/DashboardMain.js @@ -26,6 +26,7 @@ import { ThemeProvider } from '@mui/material/styles'; import theme from '../theme'; import deleteToken from '../core/deleteToken'; import {SystemMon, WebsiteAvailability} from '../widgets/WidgetsStatistics' +import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView'; const drawerWidth = 240; diff --git a/src/Settings/SettingsInfo.js b/src/Settings/SettingsInfo.js new file mode 100644 index 0000000..9e2b028 --- /dev/null +++ b/src/Settings/SettingsInfo.js @@ -0,0 +1,147 @@ +import React, { useState } from 'react'; +import { + Box, + ListItem, + ListItemText, + List, + Drawer, + IconButton, + Divider, + CssBaseline, + AppBar, + Toolbar, + Typography, + Menu, + MenuItem, +} from '@mui/material'; +import PeopleIcon from '@mui/icons-material/PeopleOutline'; +import DashboardIcon from '@mui/icons-material/DashboardOutlined'; +import BarChartIcon from '@mui/icons-material/BarChartOutlined'; +import SettingsIcon from '@mui/icons-material/SettingsOutlined'; +import LogoutIcon from '@mui/icons-material/LogoutOutlined'; +import MenuIcon from '@mui/icons-material/Menu'; +import AccountCircleIcon from '@mui/icons-material/AccountCircleOutlined'; +import { ThemeProvider } from '@mui/material/styles'; +import theme from '../theme'; +import deleteToken from '../core/deleteToken'; +import '../metadata.json' +import { DashboardInfo } from '../widgets/WidgetStatic' + +const drawerWidth = 240; + +export default function SettingsInfo() { + const [open, setOpen] = useState(false); + const [anchorEl, setAnchorEl] = useState(null); + const openMenu = Boolean(anchorEl); + + const handleDrawer = () => { + if(open === false){ + setOpen(true); + } + else{ + setOpen(false); + } + }; + + + const handleMenuClick = (event) => { + setAnchorEl(event.currentTarget); + }; + + const handleMenuClose = () => { + setAnchorEl(null); + }; + + return ( + + + + + + + Admin Dashboard + + + + + + { handleMenuClose(); window.location.href = '/dashboard'; }}> + + Dashboard + + + + Profile + + + + My account + + { handleMenuClose(); window.location.href = '/settings'; }}> + + Settings + + { + handleMenuClose(); + deleteToken(); + window.location.reload(); + }}> + + Logout + + + + + + + + + + + + + + + + + + + + + + + + + + System Information + + + + + + ); +} \ No newline at end of file diff --git a/src/metadata.json b/src/metadata.json new file mode 100644 index 0000000..51202ff --- /dev/null +++ b/src/metadata.json @@ -0,0 +1 @@ +{"buildMajor":1,"buildMinor":0,"buildRevision":2,"buildTag":"DEV"} \ No newline at end of file diff --git a/src/widgets/WidgetStatic.js b/src/widgets/WidgetStatic.js new file mode 100644 index 0000000..0845b1c --- /dev/null +++ b/src/widgets/WidgetStatic.js @@ -0,0 +1,32 @@ +import React from 'react'; +import { + Box, + Typography, +} from '@mui/material'; +import { ThemeProvider } from '@mui/material/styles'; +import theme from '../theme'; +import metadata from '../metadata.json'; + +export const DashboardInfo = () => { + return ( + + + + Dashboard Info + + + Current Build: {metadata.buildMajor}.{metadata.buildMinor}.{metadata.buildRevision} {metadata.buildTag} + + + + ); +} + diff --git a/test.js b/test.js deleted file mode 100644 index f69e8b2..0000000 --- a/test.js +++ /dev/null @@ -1 +0,0 @@ -console.log(JSON.parse('{"token":"admin"}')) \ No newline at end of file