mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-21 15:09:21 +00:00
I should really commit more often instead of sending over one massive commit
Blame my ADHD brain Sorry - Now we have the server working properly in automation using BullMQ and Redis - It also presents an API endpoint that is used to accept connections for websockets by agents (WS or WSS) - Updated the docker-compose.yml and its documentation
This commit is contained in:
@@ -68,6 +68,11 @@ export const dashboardAPI = {
|
||||
const url = `/dashboard/package-trends${queryString ? `?${queryString}` : ""}`;
|
||||
return api.get(url);
|
||||
},
|
||||
getPackageSpikeAnalysis: (params = {}) => {
|
||||
const queryString = new URLSearchParams(params).toString();
|
||||
const url = `/dashboard/package-spike-analysis${queryString ? `?${queryString}` : ""}`;
|
||||
return api.get(url);
|
||||
},
|
||||
getRecentUsers: () => api.get("/dashboard/recent-users"),
|
||||
getRecentCollection: () => api.get("/dashboard/recent-collection"),
|
||||
};
|
||||
@@ -82,8 +87,12 @@ export const adminHostsAPI = {
|
||||
api.post(`/hosts/${hostId}/regenerate-credentials`),
|
||||
updateGroup: (hostId, hostGroupId) =>
|
||||
api.put(`/hosts/${hostId}/group`, { hostGroupId }),
|
||||
updateGroups: (hostId, groupIds) =>
|
||||
api.put(`/hosts/${hostId}/groups`, { groupIds }),
|
||||
bulkUpdateGroup: (hostIds, hostGroupId) =>
|
||||
api.put("/hosts/bulk/group", { hostIds, hostGroupId }),
|
||||
bulkUpdateGroups: (hostIds, groupIds) =>
|
||||
api.put("/hosts/bulk/groups", { hostIds, groupIds }),
|
||||
toggleAutoUpdate: (hostId, autoUpdate) =>
|
||||
api.patch(`/hosts/${hostId}/auto-update`, { auto_update: autoUpdate }),
|
||||
updateFriendlyName: (hostId, friendlyName) =>
|
||||
|
||||
@@ -1,43 +1,104 @@
|
||||
import { Monitor, Server } from "lucide-react";
|
||||
import { DiWindows } from "react-icons/di";
|
||||
// Import OS icons from react-icons
|
||||
// Import OS icons from react-icons Simple Icons - using only confirmed available icons
|
||||
import {
|
||||
SiAlmalinux,
|
||||
SiAlpinelinux,
|
||||
SiArchlinux,
|
||||
SiCentos,
|
||||
SiDebian,
|
||||
SiDeepin,
|
||||
SiElementary,
|
||||
SiFedora,
|
||||
SiGentoo,
|
||||
SiKalilinux,
|
||||
SiLinux,
|
||||
SiLinuxmint,
|
||||
SiMacos,
|
||||
SiManjaro,
|
||||
SiOpensuse,
|
||||
SiOracle,
|
||||
SiParrotsecurity,
|
||||
SiPopos,
|
||||
SiRedhat,
|
||||
SiRockylinux,
|
||||
SiSlackware,
|
||||
SiSolus,
|
||||
SiSuse,
|
||||
SiTails,
|
||||
SiUbuntu,
|
||||
SiZorin,
|
||||
} from "react-icons/si";
|
||||
|
||||
/**
|
||||
* OS Icon mapping utility
|
||||
* Maps operating system types to appropriate react-icons components
|
||||
* Now uses specific icons based on actual OS names from /etc/os-release
|
||||
*/
|
||||
export const getOSIcon = (osType) => {
|
||||
if (!osType) return Monitor;
|
||||
|
||||
const os = osType.toLowerCase();
|
||||
|
||||
// Linux distributions with authentic react-icons
|
||||
if (os.includes("ubuntu")) return SiUbuntu;
|
||||
// Ubuntu and Ubuntu variants
|
||||
if (os.includes("ubuntu")) {
|
||||
// For Ubuntu variants, use generic Ubuntu icon as fallback
|
||||
return SiUbuntu;
|
||||
}
|
||||
|
||||
// Pop!_OS
|
||||
if (os.includes("pop") || os.includes("pop!_os")) return SiPopos;
|
||||
|
||||
// Linux Mint
|
||||
if (os.includes("mint") || os.includes("linuxmint")) return SiLinuxmint;
|
||||
|
||||
// Elementary OS
|
||||
if (os.includes("elementary")) return SiElementary;
|
||||
|
||||
// Debian
|
||||
if (os.includes("debian")) return SiDebian;
|
||||
if (
|
||||
os.includes("centos") ||
|
||||
os.includes("rhel") ||
|
||||
os.includes("red hat") ||
|
||||
os.includes("almalinux") ||
|
||||
os.includes("rocky")
|
||||
)
|
||||
return SiCentos;
|
||||
if (os === "ol" || os.includes("oraclelinux") || os.includes("oracle linux"))
|
||||
return SiLinux; // Use generic Linux icon for Oracle Linux
|
||||
|
||||
// Rocky Linux
|
||||
if (os.includes("rocky")) return SiRockylinux;
|
||||
|
||||
// AlmaLinux
|
||||
if (os.includes("alma") || os.includes("almalinux")) return SiAlmalinux;
|
||||
|
||||
// CentOS
|
||||
if (os.includes("centos")) return SiCentos;
|
||||
|
||||
// Red Hat Enterprise Linux
|
||||
if (os.includes("rhel") || os.includes("red hat")) return SiRedhat;
|
||||
|
||||
// Fedora
|
||||
if (os.includes("fedora")) return SiFedora;
|
||||
|
||||
// Oracle Linux
|
||||
if (os === "ol" || os.includes("oraclelinux") || os.includes("oracle linux"))
|
||||
return SiOracle;
|
||||
|
||||
// SUSE distributions
|
||||
if (os.includes("opensuse")) return SiOpensuse;
|
||||
if (os.includes("suse")) return SiSuse;
|
||||
|
||||
// Arch-based distributions
|
||||
if (os.includes("arch")) return SiArchlinux;
|
||||
if (os.includes("manjaro")) return SiManjaro;
|
||||
if (os.includes("endeavour") || os.includes("endeavouros"))
|
||||
return SiArchlinux; // Fallback to Arch
|
||||
if (os.includes("garuda")) return SiArchlinux; // Fallback to Arch
|
||||
if (os.includes("blackarch")) return SiArchlinux; // Fallback to Arch
|
||||
|
||||
// Other distributions
|
||||
if (os.includes("alpine")) return SiAlpinelinux;
|
||||
if (os.includes("suse") || os.includes("opensuse")) return SiLinux; // SUSE uses generic Linux icon
|
||||
if (os.includes("gentoo")) return SiGentoo;
|
||||
if (os.includes("slackware")) return SiSlackware;
|
||||
if (os.includes("zorin")) return SiZorin;
|
||||
if (os.includes("deepin")) return SiDeepin;
|
||||
if (os.includes("solus")) return SiSolus;
|
||||
if (os.includes("tails")) return SiTails;
|
||||
if (os.includes("parrot")) return SiParrotsecurity;
|
||||
if (os.includes("kali")) return SiKalilinux;
|
||||
|
||||
// Generic Linux
|
||||
if (os.includes("linux")) return SiLinux;
|
||||
@@ -70,27 +131,83 @@ export const getOSColor = (osType) => {
|
||||
/**
|
||||
* OS Display name utility
|
||||
* Provides clean, formatted OS names for display
|
||||
* Updated to handle more distributions from /etc/os-release
|
||||
*/
|
||||
export const getOSDisplayName = (osType) => {
|
||||
if (!osType) return "Unknown";
|
||||
|
||||
const os = osType.toLowerCase();
|
||||
|
||||
// Linux distributions
|
||||
if (os.includes("ubuntu")) return "Ubuntu";
|
||||
// Ubuntu and variants
|
||||
if (os.includes("ubuntu")) {
|
||||
if (os.includes("kubuntu")) return "Kubuntu";
|
||||
if (os.includes("lubuntu")) return "Lubuntu";
|
||||
if (os.includes("xubuntu")) return "Xubuntu";
|
||||
if (os.includes("ubuntu mate") || os.includes("ubuntumate"))
|
||||
return "Ubuntu MATE";
|
||||
if (os.includes("ubuntu budgie") || os.includes("ubuntubudgie"))
|
||||
return "Ubuntu Budgie";
|
||||
if (os.includes("ubuntu studio") || os.includes("ubuntustudio"))
|
||||
return "Ubuntu Studio";
|
||||
if (os.includes("ubuntu kylin") || os.includes("ubuntukylin"))
|
||||
return "Ubuntu Kylin";
|
||||
return "Ubuntu";
|
||||
}
|
||||
|
||||
// Pop!_OS
|
||||
if (os.includes("pop") || os.includes("pop!_os")) return "Pop!_OS";
|
||||
|
||||
// Linux Mint
|
||||
if (os.includes("mint") || os.includes("linuxmint")) return "Linux Mint";
|
||||
|
||||
// Elementary OS
|
||||
if (os.includes("elementary")) return "Elementary OS";
|
||||
|
||||
// Debian
|
||||
if (os.includes("debian")) return "Debian";
|
||||
if (os.includes("centos")) return "CentOS";
|
||||
if (os.includes("almalinux")) return "AlmaLinux";
|
||||
|
||||
// Rocky Linux
|
||||
if (os.includes("rocky")) return "Rocky Linux";
|
||||
if (os === "ol" || os.includes("oraclelinux") || os.includes("oracle linux"))
|
||||
return "Oracle Linux";
|
||||
|
||||
// AlmaLinux
|
||||
if (os.includes("alma") || os.includes("almalinux")) return "AlmaLinux";
|
||||
|
||||
// CentOS
|
||||
if (os.includes("centos")) return "CentOS";
|
||||
|
||||
// Red Hat Enterprise Linux
|
||||
if (os.includes("rhel") || os.includes("red hat"))
|
||||
return "Red Hat Enterprise Linux";
|
||||
|
||||
// Fedora
|
||||
if (os.includes("fedora")) return "Fedora";
|
||||
if (os.includes("arch")) return "Arch Linux";
|
||||
if (os.includes("suse")) return "SUSE Linux";
|
||||
|
||||
// Oracle Linux
|
||||
if (os === "ol" || os.includes("oraclelinux") || os.includes("oracle linux"))
|
||||
return "Oracle Linux";
|
||||
|
||||
// SUSE distributions
|
||||
if (os.includes("opensuse")) return "openSUSE";
|
||||
if (os.includes("suse")) return "SUSE Linux";
|
||||
|
||||
// Arch-based distributions
|
||||
if (os.includes("arch")) return "Arch Linux";
|
||||
if (os.includes("manjaro")) return "Manjaro";
|
||||
if (os.includes("endeavour") || os.includes("endeavouros"))
|
||||
return "EndeavourOS";
|
||||
if (os.includes("garuda")) return "Garuda Linux";
|
||||
if (os.includes("blackarch")) return "BlackArch Linux";
|
||||
|
||||
// Other distributions
|
||||
if (os.includes("alpine")) return "Alpine Linux";
|
||||
if (os.includes("gentoo")) return "Gentoo";
|
||||
if (os.includes("slackware")) return "Slackware";
|
||||
if (os.includes("zorin")) return "Zorin OS";
|
||||
if (os.includes("deepin")) return "Deepin";
|
||||
if (os.includes("solus")) return "Solus";
|
||||
if (os.includes("tails")) return "Tails";
|
||||
if (os.includes("parrot")) return "Parrot Security";
|
||||
if (os.includes("kali")) return "Kali Linux";
|
||||
|
||||
// Generic Linux
|
||||
if (os.includes("linux")) return "Linux";
|
||||
|
||||
Reference in New Issue
Block a user