diff --git a/app/Controllers/Http/Api/HomeController.ts b/app/Controllers/Http/Api/HomeController.ts index 020f651..fdec7f9 100644 --- a/app/Controllers/Http/Api/HomeController.ts +++ b/app/Controllers/Http/Api/HomeController.ts @@ -17,7 +17,8 @@ export default class HomeController { // .preload('authors') // .orderBy('server_date_published'); - const datasets = await db.from('documents as doc') + const datasets = await db + .from('documents as doc') .select(['publish_id', 'server_date_published', db.raw(`date_part('year', server_date_published) as pub_year`)]) .where('server_state', serverState) .innerJoin('link_documents_persons as ba', 'doc.id', 'ba.document_id') @@ -59,7 +60,6 @@ export default class HomeController { // const year = params.year; // const from = parseInt(year); try { - // const datasets = await Database.from('documents as doc') // .select([Database.raw(`date_part('month', server_date_published) as pub_month`), Database.raw('COUNT(*) as count')]) // .where('server_state', serverState) @@ -68,9 +68,12 @@ export default class HomeController { // .groupBy('pub_month'); // // .orderBy('server_date_published'); - const years = [2021, 2022, 2023]; // Add the second year + // Calculate the last 4 years including the current year + const currentYear = new Date().getFullYear(); + const years = Array.from({ length: 4 }, (_, i) => currentYear - (i + 1)).reverse(); - const result = await db.from('documents as doc') + const result = await db + .from('documents as doc') .select([ db.raw(`date_part('year', server_date_published) as pub_year`), db.raw(`date_part('month', server_date_published) as pub_month`), @@ -83,7 +86,7 @@ export default class HomeController { .groupBy('pub_year', 'pub_month') .orderBy('pub_year', 'asc') .orderBy('pub_month', 'asc'); - + const labels = Array.from({ length: 12 }, (_, i) => i + 1); // Assuming 12 months const inputDatasets: Map = result.reduce((acc, item) => { @@ -100,15 +103,15 @@ export default class HomeController { acc[pub_year].data[pub_month - 1] = parseInt(count); - return acc ; + return acc; }, {}); const outputDatasets = Object.entries(inputDatasets).map(([year, data]) => ({ data: data.data, label: year, borderColor: data.borderColor, - fill: data.fill - })); + fill: data.fill, + })); const data = { labels: labels, @@ -126,11 +129,11 @@ export default class HomeController { private getRandomHexColor() { const letters = '0123456789ABCDEF'; let color = '#'; - + for (let i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } - + return color; } } @@ -139,5 +142,4 @@ interface ChartDataset { label: string; borderColor: string; fill: boolean; - } diff --git a/package-lock.json b/package-lock.json index 14d7224..706e8ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -348,12 +348,12 @@ } }, "node_modules/@adonisjs/drive": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@adonisjs/drive/-/drive-3.2.0.tgz", - "integrity": "sha512-vfZphRUmnOHlt5insWes07xXtQn3pn3bvI1SyfOeFV8rK5stKLQ7xD7qp/DcmhW5qzMnyGTuOYUdVOYDJHIiEg==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@adonisjs/drive/-/drive-3.4.1.tgz", + "integrity": "sha512-oDYY4wJ7wDMlO4E+dZPYBu+T3Av7Mj+JL8+J33qgyxtiJylnZgoZDuRfFjZZix/bFNNuWX2sLwTMnyiDcK+YsA==", "license": "MIT", "dependencies": { - "flydrive": "^1.0.3" + "flydrive": "^1.1.0" }, "engines": { "node": ">=20.6.0" @@ -389,13 +389,13 @@ } }, "node_modules/@adonisjs/env": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@adonisjs/env/-/env-6.1.1.tgz", - "integrity": "sha512-sYvcJMbLSqwFWH0WtTTLddxkyXzERZl+8TEkXlMiIFaAZveq9h5eC4SQ+L5ILe9FHHiHVfmHsYF6LlAfcsIG1w==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/@adonisjs/env/-/env-6.2.0.tgz", + "integrity": "sha512-DZ7zQ4sBhzWftjU/SxJ7BstimrEiByCvmtAcMNDpDjOtJnR50172PRz1X7KjM3EqjCVrB19izzRVx/rmpCRPOA==", "license": "MIT", "dependencies": { "@poppinss/utils": "^6.9.2", - "@poppinss/validator-lite": "^2.0.1", + "@poppinss/validator-lite": "^2.1.0", "dotenv": "^16.4.7", "split-lines": "^3.0.0" }, @@ -3128,9 +3128,9 @@ "license": "CC0-1.0" }, "node_modules/@swc/wasm": { - "version": "1.11.10", - "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.11.10.tgz", - "integrity": "sha512-ujwBa7w9wYa5L8J+KptuWlaDm3r/MUvVntVaNsseJSmW/A7SkvqizDGCYJU9wHMaQqED7J2bN1e3xdOnyPwFtQ==", + "version": "1.11.11", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.11.11.tgz", + "integrity": "sha512-mPwKhESXb/SHtKGEeTM+TwA7zrpn1tF2cf7GnUakJh07SeUdJeTGP+zadotUzqqAWzYNHHWcMcM3C8Wef1ObjQ==", "dev": true, "license": "Apache-2.0" }, @@ -4812,9 +4812,9 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.3.tgz", - "integrity": "sha512-iP4DebzoNlP/YN2dpwCgb8zoCmhtkajzS48JvwmkSkXvPI3DHc7m+XYL5tGnSlJtR6nImXZmdCuN5aP8dh1d8A==", + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz", + "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", @@ -5189,9 +5189,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001705", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001705.tgz", - "integrity": "sha512-S0uyMMiYvA7CxNgomYBwwwPUnWzFD83f3B1ce5jHUfHTH//QL6hHsreI8RVC5606R4ssqravelYO5TU6t8sEyg==", + "version": "1.0.30001706", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001706.tgz", + "integrity": "sha512-3ZczoTApMAZwPKYWmwVbQMFpXBDds3/0VciVoUwPUbldlYyVLmRVuRs/PcUZtHpbLRpzzDvrvnFuREsGt6lUug==", "dev": true, "funding": [ { @@ -6354,9 +6354,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.119", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.119.tgz", - "integrity": "sha512-Ku4NMzUjz3e3Vweh7PhApPrZSS4fyiCIbcIrG9eKrriYVLmbMepETR/v6SU7xPm98QTqMSYiCwfO89QNjXLkbQ==", + "version": "1.5.122", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.122.tgz", + "integrity": "sha512-EML1wnwkY5MFh/xUnCvY8FrhUuKzdYhowuZExZOfwJo+Zu9OsNCI23Cgl5y7awy7HrUHSwB1Z8pZX5TI34lsUg==", "dev": true, "license": "ISC" }, @@ -9648,9 +9648,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.10.tgz", - "integrity": "sha512-vSJJTG+t/dIKAUhUDw/dLdZ9s//5OxcHqLaDWWrW4Cdq7o6tdLIczUkMXt2MBNmk6sJRZBZRXVixs7URY1CmIg==", + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "funding": [ { "type": "github", @@ -10360,9 +10360,9 @@ } }, "node_modules/pg": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.14.0.tgz", - "integrity": "sha512-nXbVpyoaXVmdqlKEzToFf37qzyeeh7mbiXsnoWvstSqohj88yaa/I/Rq/HEVn2QPSZEuLIJa/jSpRDyzjEx4FQ==", + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.14.1.tgz", + "integrity": "sha512-0TdbqfjwIun9Fm/r89oB7RFQ0bLgduAhiIqIXOsyKoiC/L54DbuAAzIEN/9Op0f1Po9X7iCPXGoa/Ah+2aI8Xw==", "license": "MIT", "dependencies": { "pg-connection-string": "^2.7.0", @@ -11076,9 +11076,9 @@ } }, "node_modules/quansync": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/quansync/-/quansync-0.2.8.tgz", - "integrity": "sha512-4+saucphJMazjt7iOM27mbFCk+D9dd/zmgMDCzRZ8MEoBfYp7lAvoN38et/phRQF6wOPMy/OROBGgoWeSKyluA==", + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/quansync/-/quansync-0.2.10.tgz", + "integrity": "sha512-t41VRkMYbkHyCYmOvx/6URnN80H7k4X0lLdBMGsz+maAwrJQYB1djpV6vHrQIBE0WBSGqhtEHrK9U3DWWH8v7A==", "funding": [ { "type": "individual", diff --git a/resources/js/Components/NavBar.vue b/resources/js/Components/NavBar.vue index dce1325..766b001 100644 --- a/resources/js/Components/NavBar.vue +++ b/resources/js/Components/NavBar.vue @@ -21,12 +21,11 @@ import { mdiFormatListGroup, mdiFormatListNumbered, mdiLogout, - mdiGithub, mdiThemeLightDark, mdiViewDashboard, - mdiMapSearch, mdiInformationVariant, mdiGlasses, + mdiXml } from '@mdi/js'; import NavBarItem from '@/Components/NavBarItem.vue'; import NavBarItemLabel from '@/Components/NavBarItemLabel.vue'; @@ -100,7 +99,8 @@ const showAbout = async () => {
- + @@ -110,9 +110,9 @@ const showAbout = async () => { - + @@ -186,12 +186,15 @@ const showAbout = async () => { - + + + - + diff --git a/resources/js/Pages/Dashboard.vue b/resources/js/Pages/Dashboard.vue index 55f09d0..2b9264a 100644 --- a/resources/js/Pages/Dashboard.vue +++ b/resources/js/Pages/Dashboard.vue @@ -18,20 +18,19 @@ import CardBoxWidget from '@/Components/CardBoxWidget.vue'; import CardBox from '@/Components/CardBox.vue'; import TableSampleClients from '@/Components/TableSampleClients.vue'; // import NotificationBar from '@/Components/NotificationBar.vue'; -import BaseButton from '@/Components/BaseButton.vue'; import CardBoxClient from '@/Components/CardBoxClient.vue'; import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue'; import SectionTitleLineWithButton from '@/Components/SectionTitleLineWithButton.vue'; -import SectionBannerStarOnGitHub from '@/Components/SectionBannerStarOnGitea.vue'; +// import SectionBannerStarOnGitHub from '@/Components/SectionBannerStarOnGitea.vue'; import CardBoxDataset from '@/Components/CardBoxDataset.vue'; const mainService = MainService() // const chartData = ref(); -const fillChartData = async () => { - await mainService.fetchChartData("2022"); - // chartData.value = chartConfig.sampleChartData(); - // chartData.value = mainService.graphData; -}; +// const fillChartData = async () => { +// await mainService.fetchChartData("2022"); +// // chartData.value = chartConfig.sampleChartData(); +// // chartData.value = mainService.graphData; +// }; const chartData = computed(() => mainService.graphData); // onMounted(async () => { // await mainService.fetchChartData("2022"); @@ -61,15 +60,15 @@ const datasetBarItems = computed(() => mainService.datasets.slice(0, 5)); - + /> -->
@@ -120,7 +119,7 @@ const datasetBarItems = computed(() => mainService.datasets.slice(0, 5));
- + diff --git a/resources/js/menu.ts b/resources/js/menu.ts index 544b0cb..16d08d7 100644 --- a/resources/js/menu.ts +++ b/resources/js/menu.ts @@ -156,18 +156,13 @@ export default [ // label: 'Create Dataset', // }, ], - }, + }, // { - // route: 'dataset.create', - // icon: mdiDatabasePlus, - // label: 'Create Dataset', + // href: '', + // icon: mdiGithub, + // label: 'Forgejo', + // target: '_blank', // }, - { - href: 'https://gitea.geosphere.at/geolba/tethys.backend', - icon: mdiGithub, - label: 'Forgejo', - target: '_blank', - }, { href: '/oai', icon: mdiAccountEye,