From 97c453c03de3575743aae27780d03766f6938aff Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:19:02 +0100 Subject: [PATCH 01/10] remove duplicate var --- misc/build.func | 1 - 1 file changed, 1 deletion(-) diff --git a/misc/build.func b/misc/build.func index 4b61dd8..72edaa0 100644 --- a/misc/build.func +++ b/misc/build.func @@ -336,7 +336,6 @@ base_settings() { IPv6="auto" IPv6GW="" GATE="" - IPv6GW="" APT_CACHER="" APT_CACHER_IP="" DISABLEIP6="no" From d9e1010f1302376b6403167c045f508fe94fdc9a Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Tue, 11 Mar 2025 16:20:13 +0100 Subject: [PATCH 02/10] build.func --- misc/build.func | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc/build.func b/misc/build.func index 72edaa0..dbab43f 100644 --- a/misc/build.func +++ b/misc/build.func @@ -721,6 +721,7 @@ advanced_settings() { if IP6GW=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Enter IPv6 Gateway" 8 58 --title "IPv6 Gateway" 3>&1 1>&2 2>&3); then if [ -z $IP6GW ]; then IP6GW="Default" + IPv6GW="" echo -e "${GATEWAY}${BOLD}${DGN}IPv6 Gateway: ${BGN}$IP6GW${CL}" else IPv6GW=",gw6=$IP6GW" @@ -1137,7 +1138,7 @@ build_container() { -unprivileged $CT_TYPE $PW " - else + elif [[ DISABLEIP6 == "no" ]]; then export PCT_OPTIONS=" -features $FEATURES -hostname $HN From 161ca20b691cdb98be30f312c96a94ecc03fdaa4 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Tue, 11 Mar 2025 16:22:48 +0100 Subject: [PATCH 03/10] build.func --- misc/build.func | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/misc/build.func b/misc/build.func index dbab43f..58a4c31 100644 --- a/misc/build.func +++ b/misc/build.func @@ -713,14 +713,15 @@ advanced_settings() { if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "IPv6" --yesno "Disable IPv6?" 10 58); then DISABLEIP6="yes" else + IPv6="auto" DISABLEIP6="no" - if IP6=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "IPv6" --inputbox "Enter IPv6 Address (Default SLAAC)" 10 58); then + + if IP6=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set IPv6" 8 58 --title "Set IPv6" 3>&1 1>&2 2>&3); then IPv6=$IP6 echo -e "${NETWORK}${BOLD}${DGN}IPv6 Address: ${BGN}$IPv6${CL}" - if IP6GW=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Enter IPv6 Gateway" 8 58 --title "IPv6 Gateway" 3>&1 1>&2 2>&3); then + if IP6GW=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Enter ipv6 Gateway" 8 58 --title "Enter ipv6 Gateway" 3>&1 1>&2 2>&3); then if [ -z $IP6GW ]; then - IP6GW="Default" IPv6GW="" echo -e "${GATEWAY}${BOLD}${DGN}IPv6 Gateway: ${BGN}$IP6GW${CL}" else From 607887579d1520ec77a38991cf26bf972f2d9939 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:26:59 +0100 Subject: [PATCH 04/10] symbolic link --- frontend/public/json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 120000 frontend/public/json diff --git a/frontend/public/json b/frontend/public/json deleted file mode 100644 index cd80456..0000000 --- a/frontend/public/json +++ /dev/null @@ -1 +0,0 @@ -../../json \ No newline at end of file diff --git a/frontend/public/json b/frontend/public/json new file mode 120000 index 0000000..f1f1abd --- /dev/null +++ b/frontend/public/json @@ -0,0 +1 @@ +C:/Users/LeskowitzMickey/Documents/GitHub/ProxmoxVED/json \ No newline at end of file From 9f51fecbada53704583e2cea12192e914e991556 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:27:22 +0100 Subject: [PATCH 05/10] Update json --- frontend/public/json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/public/json b/frontend/public/json index f1f1abd..85d7be7 120000 --- a/frontend/public/json +++ b/frontend/public/json @@ -1 +1 @@ -C:/Users/LeskowitzMickey/Documents/GitHub/ProxmoxVED/json \ No newline at end of file +../../json From 4aa103c5ae42b9d36913661ceeb942cb335d6b8f Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Tue, 11 Mar 2025 16:27:16 +0100 Subject: [PATCH 06/10] ip6 --- misc/build.func | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc/build.func b/misc/build.func index 58a4c31..f3d2e34 100644 --- a/misc/build.func +++ b/misc/build.func @@ -723,7 +723,7 @@ advanced_settings() { if IP6GW=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Enter ipv6 Gateway" 8 58 --title "Enter ipv6 Gateway" 3>&1 1>&2 2>&3); then if [ -z $IP6GW ]; then IPv6GW="" - echo -e "${GATEWAY}${BOLD}${DGN}IPv6 Gateway: ${BGN}$IP6GW${CL}" + echo -e "${GATEWAY}${BOLD}${DGN}IPv6 Gateway: ${BGN}SLAAC${CL}" else IPv6GW=",gw6=$IP6GW" echo -e "${GATEWAY}${BOLD}${DGN}IPv6 Gateway: ${BGN}$IP6GW${CL}" @@ -733,6 +733,7 @@ advanced_settings() { fi else IPv6="auto" + echo -e "${NETWORK}${BOLD}${DGN}IPv6 Address: ${BGN}SLAAC${CL}" fi fi echo -e "${DISABLEIPV6}${BOLD}${DGN}Disable IPv6: ${BGN}$DISABLEIP6${CL}" From ef261cb3573b1afcadc540fc3ce5845b5387ffb8 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Tue, 11 Mar 2025 16:30:08 +0100 Subject: [PATCH 07/10] ip6 --- misc/build.func | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/build.func b/misc/build.func index f3d2e34..dc72d29 100644 --- a/misc/build.func +++ b/misc/build.func @@ -333,7 +333,7 @@ base_settings() { HN=$NSAPP BRG="vmbr0" NET="dhcp" - IPv6="auto" + IPv6="dhcp" IPv6GW="" GATE="" APT_CACHER="" @@ -714,7 +714,7 @@ advanced_settings() { DISABLEIP6="yes" else - IPv6="auto" + IPv6="dhcp" DISABLEIP6="no" if IP6=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set IPv6" 8 58 --title "Set IPv6" 3>&1 1>&2 2>&3); then @@ -732,7 +732,7 @@ advanced_settings() { exit_script fi else - IPv6="auto" + IPv6="dhcp" echo -e "${NETWORK}${BOLD}${DGN}IPv6 Address: ${BGN}SLAAC${CL}" fi fi From 9d86f0f2d8f044f28afef82be1c6cdf8e9b4bf53 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Wed, 12 Mar 2025 11:26:11 +0100 Subject: [PATCH 08/10] Frontend API --- frontend/src/app/data/page.tsx | 198 +++++++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 frontend/src/app/data/page.tsx diff --git a/frontend/src/app/data/page.tsx b/frontend/src/app/data/page.tsx new file mode 100644 index 0000000..5a766f7 --- /dev/null +++ b/frontend/src/app/data/page.tsx @@ -0,0 +1,198 @@ +"use client"; + +import React, { JSX, useEffect, useState } from "react"; +import DatePicker from 'react-datepicker'; +import 'react-datepicker/dist/react-datepicker.css'; +import ApplicationChart from "../../components/ApplicationChart"; + +interface DataModel { + id: number; + ct_type: number; + disk_size: number; + core_count: number; + ram_size: number; + os_type: string; + os_version: string; + disableip6: string; + nsapp: string; + created_at: string; + method: string; + pve_version: string; + status: string; + error: string; + type: string; + [key: string]: any; +} + +interface SummaryData { + total_entries: number; + status_count: Record; + nsapp_count: Record; +} + +const DataFetcher: React.FC = () => { + const [data, setData] = useState([]); + const [summary, setSummary] = useState(null); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + const [currentPage, setCurrentPage] = useState(1); + const [itemsPerPage, setItemsPerPage] = useState(25); + const [sortConfig, setSortConfig] = useState<{ key: string; direction: 'ascending' | 'descending' } | null>(null); + + useEffect(() => { + const fetchSummary = async () => { + try { + const response = await fetch("https://api.htl-braunau.at/dev/data/summary"); + if (!response.ok) throw new Error(`Failed to fetch summary: ${response.statusText}`); + const result: SummaryData = await response.json(); + setSummary(result); + } catch (err) { + setError((err as Error).message); + } + }; + + fetchSummary(); + }, []); + + useEffect(() => { + const fetchPaginatedData = async () => { + setLoading(true); + try { + const response = await fetch(`https://api.htl-braunau.at/dev/data/paginated?page=${currentPage}&limit=${itemsPerPage === 0 ? '' : itemsPerPage}`); + if (!response.ok) throw new Error(`Failed to fetch data: ${response.statusText}`); + const result: DataModel[] = await response.json(); + setData(result); + } catch (err) { + setError((err as Error).message); + } finally { + setLoading(false); + } + }; + + fetchPaginatedData(); + }, [currentPage, itemsPerPage]); + + const sortedData = React.useMemo(() => { + if (!sortConfig) return data; + const sorted = [...data].sort((a, b) => { + if (a[sortConfig.key] < b[sortConfig.key]) { + return sortConfig.direction === 'ascending' ? -1 : 1; + } + if (a[sortConfig.key] > b[sortConfig.key]) { + return sortConfig.direction === 'ascending' ? 1 : -1; + } + return 0; + }); + return sorted; + }, [data, sortConfig]); + + if (loading) return

Loading...

; + if (error) return

Error: {error}

; + + const requestSort = (key: string) => { + let direction: 'ascending' | 'descending' = 'ascending'; + if (sortConfig && sortConfig.key === key && sortConfig.direction === 'ascending') { + direction = 'descending'; + } + setSortConfig({ key, direction }); + }; + + const formatDate = (dateString: string): string => { + const date = new Date(dateString); + const year = date.getFullYear(); + const month = date.getMonth() + 1; + const day = date.getDate(); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const timezoneOffset = dateString.slice(-6); + return `${day}.${month}.${year} ${hours}:${minutes} ${timezoneOffset} GMT`; + }; + + return ( +
+

Created LXCs

+ +

+
+

{summary?.total_entries} results found

+

Status Legend: 🔄 installing {summary?.status_count["installing"] ?? 0} | ✔️ completed {summary?.status_count["done"] ?? 0} | ❌ failed {summary?.status_count["failed"] ?? 0} | ❓ unknown

+
+
+
+ + + + + + + + + + + + + + + + + + + {sortedData.map((item, index) => ( + + + + + + + + + + + + + + + ))} + +
requestSort('status')}>Status requestSort('type')}>Type requestSort('nsapp')}>Application requestSort('os_type')}>OS requestSort('os_version')}>OS Version requestSort('disk_size')}>Disk Size requestSort('core_count')}>Core Count requestSort('ram_size')}>RAM Size requestSort('method')}>Method requestSort('pve_version')}>PVE Version requestSort('error')}>Error Message requestSort('created_at')}>Created At
+ {item.status === "done" ? ( + "✔️" + ) : item.status === "failed" ? ( + "❌" + ) : item.status === "installing" ? ( + "🔄" + ) : ( + item.status + )} + {item.type === "lxc" ? ( + "📦" + ) : item.type === "vm" ? ( + "🖥️" + ) : ( + item.type + )}{item.nsapp}{item.os_type}{item.os_version}{item.disk_size}{item.core_count}{item.ram_size}{item.method}{item.pve_version}{item.error}{formatDate(item.created_at)}
+
+
+
+ + Page {currentPage} + + +
+
+ ); +}; + +export default DataFetcher; From 18a2726dfc347d4dd2732ad33e01ebce00f0d1b9 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Wed, 12 Mar 2025 11:27:43 +0100 Subject: [PATCH 09/10] Add Curl back to api --- misc/api.func | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/misc/api.func b/misc/api.func index 15bde49..e21b11f 100644 --- a/misc/api.func +++ b/misc/api.func @@ -16,7 +16,7 @@ post_to_api() { return fi - local API_URL="http://api.community-scripts.org/upload" + local API_URL="http://api.community-scripts.org/dev/upload" local pve_version="not found" pve_version=$(pveversion | awk -F'[/ ]' '{print $2}') @@ -39,6 +39,10 @@ post_to_api() { EOF ) + RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ + -H "Content-Type: application/json" \ + -d "$JSON_PAYLOAD") || true + } post_to_api_vm() { @@ -59,7 +63,7 @@ post_to_api_vm() { return fi - local API_URL="http://api.community-scripts.org/upload" + local API_URL="http://api.community-scripts.org/dev/upload" local pve_version="not found" pve_version=$(pveversion | awk -F'[/ ]' '{print $2}') @@ -84,6 +88,10 @@ post_to_api_vm() { EOF ) + RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ + -H "Content-Type: application/json" \ + -d "$JSON_PAYLOAD") || true + } POST_UPDATE_DONE=false @@ -96,7 +104,7 @@ post_update_to_api() { if [ "$POST_UPDATE_DONE" = true ]; then return 0 fi - local API_URL="http://api.community-scripts.org/upload/updatestatus" + local API_URL="http://api.community-scripts.org/dev/upload/updatestatus" local status="${1:-failed}" local error="${2:-No error message}" @@ -108,7 +116,9 @@ post_update_to_api() { } EOF ) - + RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ + -H "Content-Type: application/json" \ + -d "$JSON_PAYLOAD") || true POST_UPDATE_DONE=true } From 096558679d890f27ebbd02a8712df3855f239fa2 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Wed, 12 Mar 2025 11:32:05 +0100 Subject: [PATCH 10/10] Revert "Add Curl back to api" This reverts commit 18a2726dfc347d4dd2732ad33e01ebce00f0d1b9. --- misc/api.func | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/misc/api.func b/misc/api.func index e21b11f..15bde49 100644 --- a/misc/api.func +++ b/misc/api.func @@ -16,7 +16,7 @@ post_to_api() { return fi - local API_URL="http://api.community-scripts.org/dev/upload" + local API_URL="http://api.community-scripts.org/upload" local pve_version="not found" pve_version=$(pveversion | awk -F'[/ ]' '{print $2}') @@ -39,10 +39,6 @@ post_to_api() { EOF ) - RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ - -H "Content-Type: application/json" \ - -d "$JSON_PAYLOAD") || true - } post_to_api_vm() { @@ -63,7 +59,7 @@ post_to_api_vm() { return fi - local API_URL="http://api.community-scripts.org/dev/upload" + local API_URL="http://api.community-scripts.org/upload" local pve_version="not found" pve_version=$(pveversion | awk -F'[/ ]' '{print $2}') @@ -88,10 +84,6 @@ post_to_api_vm() { EOF ) - RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ - -H "Content-Type: application/json" \ - -d "$JSON_PAYLOAD") || true - } POST_UPDATE_DONE=false @@ -104,7 +96,7 @@ post_update_to_api() { if [ "$POST_UPDATE_DONE" = true ]; then return 0 fi - local API_URL="http://api.community-scripts.org/dev/upload/updatestatus" + local API_URL="http://api.community-scripts.org/upload/updatestatus" local status="${1:-failed}" local error="${2:-No error message}" @@ -116,9 +108,7 @@ post_update_to_api() { } EOF ) - RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ - -H "Content-Type: application/json" \ - -d "$JSON_PAYLOAD") || true + POST_UPDATE_DONE=true }