From 1e7c20593f4e83b9430772b590f732a3ee37145d Mon Sep 17 00:00:00 2001 From: Tola Leng Date: Sat, 21 Jun 2025 21:02:40 +0700 Subject: [PATCH] Enhance Add Regional Agent dialog. Implement one-click installation with automatic script generation and environment variable configuration. --- .../AddRegionalAgentDialog.tsx | 206 ++++++++++++----- application/src/services/regionalService.ts | 214 ++++++++++++------ 2 files changed, 285 insertions(+), 135 deletions(-) diff --git a/application/src/components/regional-monitoring/AddRegionalAgentDialog.tsx b/application/src/components/regional-monitoring/AddRegionalAgentDialog.tsx index 48fc7fb..14d8bd4 100644 --- a/application/src/components/regional-monitoring/AddRegionalAgentDialog.tsx +++ b/application/src/components/regional-monitoring/AddRegionalAgentDialog.tsx @@ -7,7 +7,7 @@ import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; -import { Copy, Download, Terminal, CheckCircle } from "lucide-react"; +import { Copy, Download, Terminal, CheckCircle, Zap, Play } from "lucide-react"; import { regionalService } from "@/services/regionalService"; import { InstallCommand } from "@/types/regional.types"; import { useToast } from "@/hooks/use-toast"; @@ -59,7 +59,7 @@ export const AddRegionalAgentDialog: React.FC = ({ await navigator.clipboard.writeText(text); toast({ title: "Copied!", - description: "Installation command copied to clipboard.", + description: "Installation script copied to clipboard.", }); } catch (error) { toast({ @@ -89,6 +89,16 @@ export const AddRegionalAgentDialog: React.FC = ({ }); }; + const copyOneClickCommand = () => { + if (!installCommand) return; + + const oneClickCommand = `curl -fsSL -H "User-Agent: CheckCle-Installer" \\ + "data:text/plain;base64,$(echo '${installCommand.bash_script}' | base64 -w 0)" \\ + | sudo bash`; + + copyToClipboard(oneClickCommand); + }; + const handleComplete = () => { onAgentAdded(); setStep(1); @@ -107,11 +117,11 @@ export const AddRegionalAgentDialog: React.FC = ({ return ( - + Add Regional Monitoring Agent - Configure a new regional monitoring agent to extend your monitoring coverage. + Deploy a regional monitoring agent with automatic one-click installation. @@ -122,7 +132,7 @@ export const AddRegionalAgentDialog: React.FC = ({ setRegionName(e.target.value)} required @@ -133,7 +143,7 @@ export const AddRegionalAgentDialog: React.FC = ({ setAgentIp(e.target.value)} required @@ -146,7 +156,7 @@ export const AddRegionalAgentDialog: React.FC = ({ Cancel @@ -156,24 +166,94 @@ export const AddRegionalAgentDialog: React.FC = ({
-

Agent Configuration Created!

+

Agent Configuration Ready!

- Use the installation script below to set up your regional monitoring agent. + One-click installation script generated with automatic configuration.

- - + + + One-Click Install Agent Details - Installation + Manual Install + + + + + + One-Click Automatic Installation + + + Complete installation, configuration, and service startup in one command + + + +
+
+ + What this script does automatically: +
+
    +
  • • Downloads the latest .deb package
  • +
  • • Installs the regional monitoring agent
  • +
  • • Creates configuration file with your settings
  • +
  • • Starts and enables the service
  • +
  • • Runs health checks
  • +
+
+ +
+ +
+