From 475e1e1b4536a5b5e44aa6724066e51b35cb45fd Mon Sep 17 00:00:00 2001 From: SnippetsX Date: Fri, 22 Nov 2024 23:54:10 +0300 Subject: [PATCH 1/7] created dev branch where stored experimental eatures fixed ci/cd --- .gitea/workflows/build.yaml | 14 ++++++++++++++ .gitignore | 1 + generatetoken.js | 2 +- public/robots.txt | 2 +- src/metadata.json | 2 +- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 80ba9d2..174f2a2 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -3,6 +3,7 @@ on: push: branches: - master + - dev jobs: build-and-test: @@ -59,9 +60,22 @@ jobs: - name: Create Release uses: https://gitea.com/actions/gitea-release-action@v1 with: + body: | + ## Release Notes + + This is an automated release of version ${{ env.VERSION }} + + ### Changes + - Built from latest main branch + - Includes: + ${{ github.event.head_commit.message }} + + ### Installation + Download the zip file and extract to your desired location. token: ${{ secrets.GITHUB_TOKEN }} tag_name: v${{ env.VERSION }} name: Release v${{ env.VERSION }} + files: | release-artifacts/admin_dashboard-${{ env.VERSION }}.zip draft: false diff --git a/.gitignore b/.gitignore index 8c39a17..1599989 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ # production /build */build +/src/authtoken.json # misc .DS_Store diff --git a/generatetoken.js b/generatetoken.js index 12814b7..59c7a06 100644 --- a/generatetoken.js +++ b/generatetoken.js @@ -1,6 +1,6 @@ const fs = require('fs'); -const filePath = 'authtoken.json'; +const filePath = 'src/authtoken.json'; if (!fs.existsSync(filePath)) { const randomToken = (Math.random().toString(36).substring(2, 10)); diff --git a/public/robots.txt b/public/robots.txt index e9e57dc..b21f088 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,3 +1,3 @@ # https://www.robotstxt.org/robotstxt.html User-agent: * -Disallow: +Disallow: / diff --git a/src/metadata.json b/src/metadata.json index cdb01f7..c2431d7 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -1 +1 @@ -{"buildMajor":1,"buildMinor":0,"buildRevision":16,"buildTag":"DEV"} +{"buildMajor":1,"buildMinor":0,"buildRevision":17,"buildTag":"DEV"} \ No newline at end of file From a17f2091a118675d5cccff1ee1632b330e1e57a7 Mon Sep 17 00:00:00 2001 From: SnippetsX Date: Sat, 23 Nov 2024 00:12:40 +0300 Subject: [PATCH 2/7] added TOKEN info in releases --- .gitea/workflows/build.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 174f2a2..f4b6d92 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -6,7 +6,7 @@ on: - dev jobs: - build-and-test: + build-DEV: runs-on: ubuntu-latest steps: - name: Check out repository code @@ -33,6 +33,10 @@ jobs: - name: Build app run: npm run build + - name: Get developer token + run: TOKEN=$(jq -r '.token' src/authtoken.json) + echo "TOKEN=$TOKEN" >> $GITHUB_ENV + - name: Upload artifact uses: actions/upload-artifact@v3 with: @@ -70,6 +74,9 @@ jobs: - Includes: ${{ github.event.head_commit.message }} + ### Developer Token + - ${{ env.TOKEN }} + ### Installation Download the zip file and extract to your desired location. token: ${{ secrets.GITHUB_TOKEN }} From 6576ea13b6a523c167a2d46396910fee3e6a843d Mon Sep 17 00:00:00 2001 From: SnippetsX Date: Sat, 23 Nov 2024 00:14:13 +0300 Subject: [PATCH 3/7] upd version --- src/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metadata.json b/src/metadata.json index c2431d7..4b30c57 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -1 +1 @@ -{"buildMajor":1,"buildMinor":0,"buildRevision":17,"buildTag":"DEV"} \ No newline at end of file +{"buildMajor":1,"buildMinor":0,"buildRevision":18,"buildTag":"DEV"} \ No newline at end of file From 5bcd96cf4e728b9a4e4a236fa4398878364f1042 Mon Sep 17 00:00:00 2001 From: SnippetsX Date: Sat, 23 Nov 2024 00:15:49 +0300 Subject: [PATCH 4/7] fixed ci/cd --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index f4b6d92..dfe8721 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -6,7 +6,7 @@ on: - dev jobs: - build-DEV: + build-and-test: runs-on: ubuntu-latest steps: - name: Check out repository code From 9ebd7786ad8cb87456388e33212ba453b93cb1c3 Mon Sep 17 00:00:00 2001 From: SnippetsX Date: Sat, 23 Nov 2024 00:24:00 +0300 Subject: [PATCH 5/7] fixed dev --- .gitea/workflows/build.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index dfe8721..5c5f854 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -34,8 +34,9 @@ jobs: run: npm run build - name: Get developer token - run: TOKEN=$(jq -r '.token' src/authtoken.json) - echo "TOKEN=$TOKEN" >> $GITHUB_ENV + run: | + TOKEN=$(jq -r '.token' src/authtoken.json) + echo "TOKEN=$TOKEN" >> $GITHUB_ENV - name: Upload artifact uses: actions/upload-artifact@v3 From 4cd1ad45308b8996fccaa1b2d3e6e4f02570fadc Mon Sep 17 00:00:00 2001 From: SnippetsX Date: Sun, 24 Nov 2024 01:13:20 +0300 Subject: [PATCH 6/7] Fixed setting wrong switching in menu list Added bump for database settings --- src/App.js | 2 +- src/Maintenance/SystemUpdates.js | 0 src/Settings/SettingsDatabaseConfig.js | 28 ++++++++++++++++++++++++++ src/core/configEdit.js | 6 ++++++ src/metadata.json | 2 +- src/widgets/Sidebar.js | 22 +++++++++++--------- 6 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 src/Maintenance/SystemUpdates.js create mode 100644 src/Settings/SettingsDatabaseConfig.js diff --git a/src/App.js b/src/App.js index f51a1d5..b8e5c62 100644 --- a/src/App.js +++ b/src/App.js @@ -27,7 +27,7 @@ function App() { } /> } /> {/* } /> - } /> */} + } /> */} } /> } /> } /> diff --git a/src/Maintenance/SystemUpdates.js b/src/Maintenance/SystemUpdates.js new file mode 100644 index 0000000..e69de29 diff --git a/src/Settings/SettingsDatabaseConfig.js b/src/Settings/SettingsDatabaseConfig.js new file mode 100644 index 0000000..7900c16 --- /dev/null +++ b/src/Settings/SettingsDatabaseConfig.js @@ -0,0 +1,28 @@ +import React from "react"; +import { ThemeProvider, Box, Typography } from "@mui/material"; +import { theme } from "../theme"; + + +const SettingsDatabaseConfig = () => { + return ( + + + + + + + + + Database Configuration + + + + + + ); +}; + +export default SettingsDatabaseConfig; diff --git a/src/core/configEdit.js b/src/core/configEdit.js index 07f247c..01c39b2 100644 --- a/src/core/configEdit.js +++ b/src/core/configEdit.js @@ -65,3 +65,9 @@ export function getDeveloperMode() { throw error; }); } + +export function getDatabaseConfig() { + return getConfig().then(config => config.database); +} + + diff --git a/src/metadata.json b/src/metadata.json index 4b30c57..104804c 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -1 +1 @@ -{"buildMajor":1,"buildMinor":0,"buildRevision":18,"buildTag":"DEV"} \ No newline at end of file +{"buildMajor":1,"buildMinor":0,"buildRevision":19,"buildTag":"DEV"} \ No newline at end of file diff --git a/src/widgets/Sidebar.js b/src/widgets/Sidebar.js index 0146d6b..eb70825 100644 --- a/src/widgets/Sidebar.js +++ b/src/widgets/Sidebar.js @@ -31,24 +31,28 @@ export const SidebarSettings = () => { > - + window.location.href = '/settings'}> + + + + window.location.href = '/settings/database'}> - + window.location.href = '/settings/access'}> - + window.location.href = '/settings/update'}> - + window.location.href = '/settings/info'}> - { window.location.href = '/settings/info'; }}/> + {getDeveloperMode() && ( - + window.location.href = '/settings/debug'}> @@ -82,15 +86,15 @@ export const SidebarMain = () => { - + window.location.href = '/dashboard/users'}> - + window.location.href = '/dashboard/reports'}> - + window.location.href = '/dashboard/configuration'}> From eb83e4f598137cea2bc41c2a16f7de790bcb3a85 Mon Sep 17 00:00:00 2001 From: SnippetsX Date: Sat, 30 Nov 2024 01:29:42 +0300 Subject: [PATCH 7/7] Add DashboardReports and WidgetReport components; update AppBar title with build tag --- database.sql | 5 +++-- src/App.js | 5 +++-- src/Dashboard/DashboardReports.js | 33 +++++++++++++++++++++++++++++++ src/metadata.json | 2 +- src/widgets/AppBar.js | 6 +++++- src/widgets/WidgetReport.js | 22 +++++++++++++++++++++ 6 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 src/Dashboard/DashboardReports.js create mode 100644 src/widgets/WidgetReport.js diff --git a/database.sql b/database.sql index b6f6453..1315470 100644 --- a/database.sql +++ b/database.sql @@ -1,10 +1,11 @@ CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, + token VARCHAR(255) NOT NULL, username VARCHAR(50) NOT NULL UNIQUE, password_hash VARCHAR(255) NOT NULL, perms VARCHAR(255) NOT NULL ); -- Test user with admin permissions -INSERT INTO users (username, password_hash, perms) -VALUES ('admin', 'ecd71870d1963316a97e3ac3408c9835ad8cf0f3c1bc703527c30265534f75ae', 'admin'); +INSERT INTO users (token, username, password_hash, perms) +VALUES ('be01e88cc202593292d503e4ed9e51e9eb217093662efbb145030ba51b97c22a','admin', 'ecd71870d1963316a97e3ac3408c9835ad8cf0f3c1bc703527c30265534f75ae', 'admin'); diff --git a/src/App.js b/src/App.js index b8e5c62..7378abf 100644 --- a/src/App.js +++ b/src/App.js @@ -11,6 +11,7 @@ import metadata from './metadata.json'; import './App.css' import useToken from './core/useToken'; import Terminal from './Terminal/TerminalPage' +import DashboardReports from './Dashboard/DashboardReports'; function App() { @@ -26,8 +27,8 @@ function App() { } /> } /> } /> - {/* } /> - } /> */} + {/* } /> */} + } /> } /> } /> } /> diff --git a/src/Dashboard/DashboardReports.js b/src/Dashboard/DashboardReports.js new file mode 100644 index 0000000..30681f3 --- /dev/null +++ b/src/Dashboard/DashboardReports.js @@ -0,0 +1,33 @@ +import React from 'react'; +import { + Box, + CssBaseline, + Toolbar, +} from '@mui/material'; +import { ThemeProvider } from '@mui/material/styles'; +import theme from '../theme'; +import { SidebarMain } from '../widgets/Sidebar'; +import { AppBarFull } from '../widgets/AppBar'; +import WidgetReport from '../widgets/WidgetReport'; + +export default function DashboardReports() { + return ( + + + + + + + + {/* Hi {localStorage.getItem('token')} */} + + + + + + + ); +} \ No newline at end of file diff --git a/src/metadata.json b/src/metadata.json index 104804c..de45e7b 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -1 +1 @@ -{"buildMajor":1,"buildMinor":0,"buildRevision":19,"buildTag":"DEV"} \ No newline at end of file +{"buildMajor":1,"buildMinor":0,"buildRevision":21,"buildTag":"DEV"} \ No newline at end of file diff --git a/src/widgets/AppBar.js b/src/widgets/AppBar.js index eeed9b3..e8a15a0 100644 --- a/src/widgets/AppBar.js +++ b/src/widgets/AppBar.js @@ -9,6 +9,7 @@ import DashboardIcon from '@mui/icons-material/DashboardOutlined'; import SettingsIcon from '@mui/icons-material/SettingsOutlined'; import LogoutIcon from '@mui/icons-material/LogoutOutlined'; import deleteToken from "../core/deleteToken"; +import metadata from "../metadata.json"; const drawerWidth = 240; @@ -43,7 +44,10 @@ export const AppBarFull = () => { - Admin Dashboard + {['DEV', 'ALPHA', 'BETA'].includes(metadata.buildTag) ? + `Admin Dashboard ${metadata.buildTag}` : + 'Admin Dashboard' + } + + + + + + + + ); +} \ No newline at end of file