feat: implement Phase 6 — Software Deployment

Backend:
- SoftwarePackage model (Name, Version, OsType, PackageManager, PackageName, InstallerUrl, Checksum, SilentArgs)
- RmmDbContext: SoftwarePackages DbSet + unique index on (Name, Version, OsType)
- SoftwarePackagesController: full CRUD with OsType filter
- DeployController: POST /api/v1/deploy creates InstallSoftware/UninstallSoftware TaskItem
- EF Migration: AddSoftwarePackages (20260319130448)

Go Agent:
- internal/deployer/deployer.go: Install() and Uninstall() with:
  - Chocolatey (Windows), apt/dnf (Linux), auto-detect
  - Direct installer fallback: HTTP download + SHA256 verify + silent install
  - Supports .msi, .exe (Windows) and .deb, .rpm (Linux)
- main.go: COMMAND_TYPE_INSTALL_SOFTWARE and COMMAND_TYPE_UNINSTALL_SOFTWARE routed to deployer

Frontend:
- SoftwarePage: Katalog tab (CRUD, OS filter, smart package manager select) + Deploy tab
- api/types.ts: SoftwarePackage, PackageManager, DeployRequest/Response types
- api/client.ts: softwarePackagesApi and deployApi
- App.tsx: Software nav item with Package icon

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-03-19 14:06:40 +01:00
parent eb114f68e2
commit 84629dfbcf
13 changed files with 1491 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ import (
"nexusrmm.local/agent/internal/collector"
"nexusrmm.local/agent/internal/config"
"nexusrmm.local/agent/internal/connection"
"nexusrmm.local/agent/internal/deployer"
"nexusrmm.local/agent/internal/executor"
pb "nexusrmm.local/agent/pkg/proto"
)
@@ -128,6 +129,10 @@ func executeCommand(ctx context.Context, client *connection.GrpcClient, agentID
switch cmd.Type {
case pb.CommandType_COMMAND_TYPE_SHELL:
result = executor.Execute(ctx, cmd.Payload, 300)
case pb.CommandType_COMMAND_TYPE_INSTALL_SOFTWARE:
result = deployer.Install(ctx, cmd.Payload)
case pb.CommandType_COMMAND_TYPE_UNINSTALL_SOFTWARE:
result = deployer.Uninstall(ctx, cmd.Payload)
default:
result = &executor.Result{ExitCode: -1, Stderr: fmt.Sprintf("unknown command type: %v", cmd.Type)}
}

View File

@@ -0,0 +1,185 @@
package deployer
import (
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"runtime"
"strings"
"nexusrmm.local/agent/internal/executor"
)
// Payload wird vom Backend als JSON im cmd.Payload-Feld gesendet.
type Payload struct {
PackageName string `json:"packageName"`
PackageManager string `json:"packageManager"` // "choco", "apt", "dnf", "direct"
InstallerUrl string `json:"installerUrl"`
Checksum string `json:"checksum"` // SHA256 (hex, optional)
SilentArgs string `json:"silentArgs"`
DisplayName string `json:"displayName"`
Version string `json:"version"`
}
// Install installiert ein Software-Paket auf dem aktuellen System.
func Install(ctx context.Context, payloadJSON string) *executor.Result {
payload, err := parsePayload(payloadJSON)
if err != nil {
return errorResult(fmt.Sprintf("Ungültiges Payload-JSON: %v", err))
}
switch payload.PackageManager {
case "choco":
return installWithChoco(ctx, payload.PackageName)
case "apt":
return installWithApt(ctx, payload.PackageName)
case "dnf":
return installWithDnf(ctx, payload.PackageName)
case "direct":
return installDirect(ctx, *payload)
default:
// Auto-detect
return installAutoDetect(ctx, *payload)
}
}
// Uninstall deinstalliert ein Software-Paket.
func Uninstall(ctx context.Context, payloadJSON string) *executor.Result {
payload, err := parsePayload(payloadJSON)
if err != nil {
return errorResult(fmt.Sprintf("Ungültiges Payload-JSON: %v", err))
}
switch payload.PackageManager {
case "choco":
return executor.Execute(ctx, fmt.Sprintf("choco uninstall %s -y", payload.PackageName), 600)
case "apt":
return executor.Execute(ctx, fmt.Sprintf("apt-get remove -y %s", payload.PackageName), 600)
case "dnf":
return executor.Execute(ctx, fmt.Sprintf("dnf remove -y %s", payload.PackageName), 600)
default:
return installAutoDetect(ctx, *payload)
}
}
func installWithChoco(ctx context.Context, packageName string) *executor.Result {
return executor.Execute(ctx,
fmt.Sprintf("choco install %s -y --no-progress", packageName), 600)
}
func installWithApt(ctx context.Context, packageName string) *executor.Result {
return executor.Execute(ctx,
fmt.Sprintf("DEBIAN_FRONTEND=noninteractive apt-get install -y %s", packageName), 600)
}
func installWithDnf(ctx context.Context, packageName string) *executor.Result {
return executor.Execute(ctx,
fmt.Sprintf("dnf install -y %s", packageName), 600)
}
func installAutoDetect(ctx context.Context, payload Payload) *executor.Result {
if runtime.GOOS == "windows" {
// Versuche choco, dann winget als Fallback
if isCommandAvailable("choco") {
return installWithChoco(ctx, payload.PackageName)
}
if payload.InstallerUrl != "" {
return installDirect(ctx, payload)
}
return errorResult("Kein unterstützter Paketmanager auf Windows verfügbar (choco nicht gefunden)")
}
// Linux
if isCommandAvailable("apt-get") {
return installWithApt(ctx, payload.PackageName)
}
if isCommandAvailable("dnf") {
return installWithDnf(ctx, payload.PackageName)
}
if payload.InstallerUrl != "" {
return installDirect(ctx, payload)
}
return errorResult("Kein unterstützter Paketmanager auf Linux verfügbar")
}
func installDirect(ctx context.Context, payload Payload) *executor.Result {
if payload.InstallerUrl == "" {
return errorResult("Direct-Install: Keine InstallerUrl angegeben")
}
// Temp-Datei herunterladen
tmpFile, err := os.CreateTemp("", "nexusrmm-install-*")
if err != nil {
return errorResult(fmt.Sprintf("Temp-Datei konnte nicht erstellt werden: %v", err))
}
tmpPath := tmpFile.Name()
defer os.Remove(tmpPath)
resp, err := http.Get(payload.InstallerUrl)
if err != nil {
tmpFile.Close()
return errorResult(fmt.Sprintf("Download fehlgeschlagen: %v", err))
}
defer resp.Body.Close()
hasher := sha256.New()
writer := io.MultiWriter(tmpFile, hasher)
if _, err := io.Copy(writer, resp.Body); err != nil {
tmpFile.Close()
return errorResult(fmt.Sprintf("Download-Fehler beim Schreiben: %v", err))
}
tmpFile.Close()
// Checksum prüfen
if payload.Checksum != "" {
actualHash := hex.EncodeToString(hasher.Sum(nil))
expected := strings.ToLower(payload.Checksum)
if actualHash != expected {
return errorResult(fmt.Sprintf("Prüfsummen-Fehler: erwartet %s, erhalten %s", expected, actualHash))
}
}
// Installer ausführen
ext := strings.ToLower(filepath.Ext(payload.InstallerUrl))
var installCmd string
switch {
case runtime.GOOS == "windows" && ext == ".msi":
installCmd = fmt.Sprintf("msiexec /i \"%s\" /quiet /norestart %s", tmpPath, payload.SilentArgs)
case runtime.GOOS == "windows" && (ext == ".exe"):
installCmd = fmt.Sprintf("\"%s\" %s", tmpPath, payload.SilentArgs)
case runtime.GOOS == "linux" && (ext == ".deb"):
installCmd = fmt.Sprintf("dpkg -i \"%s\"", tmpPath)
case runtime.GOOS == "linux" && (ext == ".rpm"):
installCmd = fmt.Sprintf("rpm -i \"%s\"", tmpPath)
default:
installCmd = fmt.Sprintf("\"%s\" %s", tmpPath, payload.SilentArgs)
}
return executor.Execute(ctx, installCmd, 1200)
}
func isCommandAvailable(name string) bool {
result := executor.Execute(context.Background(), "which "+name+" || where "+name, 5)
return result.Success || result.ExitCode == 0
}
func parsePayload(payloadJSON string) (*Payload, error) {
var p Payload
if err := json.Unmarshal([]byte(payloadJSON), &p); err != nil {
return nil, err
}
return &p, nil
}
func errorResult(msg string) *executor.Result {
return &executor.Result{
ExitCode: -1,
Stderr: msg,
Success: false,
}
}

View File

@@ -0,0 +1,63 @@
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
using NexusRMM.Core.Models;
using NexusRMM.Infrastructure.Data;
namespace NexusRMM.Api.Controllers;
[ApiController]
[Route("api/v1/deploy")]
public class DeployController : ControllerBase
{
private readonly RmmDbContext _db;
public DeployController(RmmDbContext db) => _db = db;
/// <summary>
/// Startet Software-Deployment auf einem Agent.
/// Erstellt einen TaskItem mit Typ InstallSoftware/UninstallSoftware.
/// </summary>
[HttpPost]
public async Task<IActionResult> Deploy([FromBody] DeployRequest req)
{
var agent = await _db.Agents.FindAsync(req.AgentId);
if (agent is null) return NotFound(new { error = "Agent nicht gefunden" });
var pkg = await _db.SoftwarePackages.FindAsync(req.PackageId);
if (pkg is null) return NotFound(new { error = "Paket nicht gefunden" });
var payload = new
{
packageName = pkg.PackageName,
packageManager = pkg.PackageManager,
installerUrl = pkg.InstallerUrl ?? "",
checksum = pkg.Checksum ?? "",
silentArgs = pkg.SilentArgs ?? "",
displayName = pkg.Name,
version = pkg.Version,
};
var task = new TaskItem
{
Id = Guid.NewGuid(),
AgentId = req.AgentId,
Type = req.Action == "uninstall" ? TaskType.UninstallSoftware : TaskType.InstallSoftware,
Payload = JsonSerializer.SerializeToElement(payload),
CreatedAt = DateTime.UtcNow,
};
_db.Tasks.Add(task);
await _db.SaveChangesAsync();
return CreatedAtAction(nameof(Deploy), new { id = task.Id }, new
{
task.Id,
task.AgentId,
task.Type,
task.Status,
PackageName = pkg.Name,
Version = pkg.Version,
});
}
}
public record DeployRequest(Guid AgentId, int PackageId, string Action); // Action: "install" | "uninstall"

View File

@@ -0,0 +1,85 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using NexusRMM.Core.Models;
using NexusRMM.Infrastructure.Data;
namespace NexusRMM.Api.Controllers;
[ApiController]
[Route("api/v1/software-packages")]
public class SoftwarePackagesController : ControllerBase
{
private readonly RmmDbContext _db;
public SoftwarePackagesController(RmmDbContext db) => _db = db;
[HttpGet]
public async Task<IActionResult> GetAll([FromQuery] OsType? osType = null)
{
var q = _db.SoftwarePackages.AsQueryable();
if (osType.HasValue) q = q.Where(p => p.OsType == osType.Value);
return Ok(await q.OrderBy(p => p.Name).ToListAsync());
}
[HttpGet("{id:int}")]
public async Task<IActionResult> GetById(int id)
{
var pkg = await _db.SoftwarePackages.FindAsync(id);
return pkg is null ? NotFound() : Ok(pkg);
}
[HttpPost]
public async Task<IActionResult> Create([FromBody] CreateSoftwarePackageRequest req)
{
var pkg = new SoftwarePackage
{
Name = req.Name,
Version = req.Version,
OsType = req.OsType,
PackageManager = req.PackageManager,
PackageName = req.PackageName,
InstallerUrl = req.InstallerUrl,
Checksum = req.Checksum,
SilentArgs = req.SilentArgs,
};
_db.SoftwarePackages.Add(pkg);
await _db.SaveChangesAsync();
return CreatedAtAction(nameof(GetById), new { id = pkg.Id }, pkg);
}
[HttpPut("{id:int}")]
public async Task<IActionResult> Update(int id, [FromBody] CreateSoftwarePackageRequest req)
{
var pkg = await _db.SoftwarePackages.FindAsync(id);
if (pkg is null) return NotFound();
pkg.Name = req.Name;
pkg.Version = req.Version;
pkg.OsType = req.OsType;
pkg.PackageManager = req.PackageManager;
pkg.PackageName = req.PackageName;
pkg.InstallerUrl = req.InstallerUrl;
pkg.Checksum = req.Checksum;
pkg.SilentArgs = req.SilentArgs;
await _db.SaveChangesAsync();
return Ok(pkg);
}
[HttpDelete("{id:int}")]
public async Task<IActionResult> Delete(int id)
{
var pkg = await _db.SoftwarePackages.FindAsync(id);
if (pkg is null) return NotFound();
_db.SoftwarePackages.Remove(pkg);
await _db.SaveChangesAsync();
return NoContent();
}
}
public record CreateSoftwarePackageRequest(
string Name,
string Version,
OsType OsType,
string PackageManager,
string PackageName,
string? InstallerUrl,
string? Checksum,
string? SilentArgs);

View File

@@ -0,0 +1,26 @@
namespace NexusRMM.Core.Models;
public class SoftwarePackage
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
public OsType OsType { get; set; }
/// <summary>Paketmanager: "choco", "apt", "dnf", "direct"</summary>
public string PackageManager { get; set; } = "choco";
/// <summary>Paketname für den Paketmanager (z.B. "7zip" für choco)</summary>
public string PackageName { get; set; } = string.Empty;
/// <summary>Optionale direkte Download-URL (für Fallback)</summary>
public string? InstallerUrl { get; set; }
/// <summary>SHA256-Prüfsumme der Installer-Datei</summary>
public string? Checksum { get; set; }
/// <summary>Silent-Install-Parameter für direkten Installer</summary>
public string? SilentArgs { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}

View File

@@ -13,6 +13,7 @@ public class RmmDbContext : DbContext
public DbSet<Ticket> Tickets => Set<Ticket>();
public DbSet<AlertRule> AlertRules => Set<AlertRule>();
public DbSet<Alert> Alerts => Set<Alert>();
public DbSet<SoftwarePackage> SoftwarePackages => Set<SoftwarePackage>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -58,5 +59,11 @@ public class RmmDbContext : DbContext
e.HasOne(a => a.Rule).WithMany(r => r.Alerts).HasForeignKey(a => a.RuleId);
e.HasOne(a => a.Agent).WithMany(a => a.Alerts).HasForeignKey(a => a.AgentId);
});
modelBuilder.Entity<SoftwarePackage>(e =>
{
e.HasKey(p => p.Id);
e.HasIndex(p => new { p.Name, p.Version, p.OsType }).IsUnique();
});
}
}

View File

@@ -0,0 +1,368 @@
// <auto-generated />
using System;
using System.Text.Json;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NexusRMM.Infrastructure.Data;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace NexusRMM.Infrastructure.Migrations
{
[DbContext(typeof(RmmDbContext))]
[Migration("20260319130448_AddSoftwarePackages")]
partial class AddSoftwarePackages
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("NexusRMM.Core.Models.Agent", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AgentVersion")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("EnrolledAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Hostname")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IpAddress")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("LastSeen")
.HasColumnType("timestamp with time zone");
b.Property<string>("MacAddress")
.IsRequired()
.HasColumnType("text");
b.Property<string>("MeshAgentId")
.HasColumnType("text");
b.Property<int>("OsType")
.HasColumnType("integer");
b.Property<string>("OsVersion")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Status")
.HasColumnType("integer");
b.PrimitiveCollection<string>("Tags")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("Hostname");
b.HasIndex("MacAddress");
b.ToTable("Agents");
});
modelBuilder.Entity("NexusRMM.Core.Models.AgentMetric", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Guid>("AgentId")
.HasColumnType("uuid");
b.Property<JsonElement>("Metrics")
.HasColumnType("jsonb");
b.Property<DateTime>("Timestamp")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("AgentId");
b.HasIndex("Timestamp");
b.ToTable("AgentMetrics");
});
modelBuilder.Entity("NexusRMM.Core.Models.Alert", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<bool>("Acknowledged")
.HasColumnType("boolean");
b.Property<Guid>("AgentId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Message")
.IsRequired()
.HasColumnType("text");
b.Property<int>("RuleId")
.HasColumnType("integer");
b.Property<int>("Severity")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AgentId");
b.HasIndex("CreatedAt");
b.HasIndex("RuleId");
b.ToTable("Alerts");
});
modelBuilder.Entity("NexusRMM.Core.Models.AlertRule", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("MetricPath")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Operator")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Severity")
.HasColumnType("integer");
b.Property<double>("Threshold")
.HasColumnType("double precision");
b.HasKey("Id");
b.ToTable("AlertRules");
});
modelBuilder.Entity("NexusRMM.Core.Models.SoftwarePackage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Checksum")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("InstallerUrl")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("OsType")
.HasColumnType("integer");
b.Property<string>("PackageManager")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PackageName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SilentArgs")
.HasColumnType("text");
b.Property<string>("Version")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Name", "Version", "OsType")
.IsUnique();
b.ToTable("SoftwarePackages");
});
modelBuilder.Entity("NexusRMM.Core.Models.TaskItem", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AgentId")
.HasColumnType("uuid");
b.Property<DateTime?>("CompletedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<JsonElement?>("Payload")
.HasColumnType("jsonb");
b.Property<JsonElement?>("Result")
.HasColumnType("jsonb");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<int>("Type")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AgentId");
b.ToTable("Tasks");
});
modelBuilder.Entity("NexusRMM.Core.Models.Ticket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<Guid?>("AgentId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Priority")
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("AgentId");
b.ToTable("Tickets");
});
modelBuilder.Entity("NexusRMM.Core.Models.AgentMetric", b =>
{
b.HasOne("NexusRMM.Core.Models.Agent", "Agent")
.WithMany("Metrics")
.HasForeignKey("AgentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Agent");
});
modelBuilder.Entity("NexusRMM.Core.Models.Alert", b =>
{
b.HasOne("NexusRMM.Core.Models.Agent", "Agent")
.WithMany("Alerts")
.HasForeignKey("AgentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("NexusRMM.Core.Models.AlertRule", "Rule")
.WithMany("Alerts")
.HasForeignKey("RuleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Agent");
b.Navigation("Rule");
});
modelBuilder.Entity("NexusRMM.Core.Models.TaskItem", b =>
{
b.HasOne("NexusRMM.Core.Models.Agent", "Agent")
.WithMany("Tasks")
.HasForeignKey("AgentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Agent");
});
modelBuilder.Entity("NexusRMM.Core.Models.Ticket", b =>
{
b.HasOne("NexusRMM.Core.Models.Agent", "Agent")
.WithMany("Tickets")
.HasForeignKey("AgentId");
b.Navigation("Agent");
});
modelBuilder.Entity("NexusRMM.Core.Models.Agent", b =>
{
b.Navigation("Alerts");
b.Navigation("Metrics");
b.Navigation("Tasks");
b.Navigation("Tickets");
});
modelBuilder.Entity("NexusRMM.Core.Models.AlertRule", b =>
{
b.Navigation("Alerts");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace NexusRMM.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddSoftwarePackages : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SoftwarePackages",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Version = table.Column<string>(type: "text", nullable: false),
OsType = table.Column<int>(type: "integer", nullable: false),
PackageManager = table.Column<string>(type: "text", nullable: false),
PackageName = table.Column<string>(type: "text", nullable: false),
InstallerUrl = table.Column<string>(type: "text", nullable: true),
Checksum = table.Column<string>(type: "text", nullable: true),
SilentArgs = table.Column<string>(type: "text", nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SoftwarePackages", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_SoftwarePackages_Name_Version_OsType",
table: "SoftwarePackages",
columns: new[] { "Name", "Version", "OsType" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SoftwarePackages");
}
}
}

View File

@@ -175,6 +175,53 @@ namespace NexusRMM.Infrastructure.Migrations
b.ToTable("AlertRules");
});
modelBuilder.Entity("NexusRMM.Core.Models.SoftwarePackage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Checksum")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("InstallerUrl")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("OsType")
.HasColumnType("integer");
b.Property<string>("PackageManager")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PackageName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SilentArgs")
.HasColumnType("text");
b.Property<string>("Version")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Name", "Version", "OsType")
.IsUnique();
b.ToTable("SoftwarePackages");
});
modelBuilder.Entity("NexusRMM.Core.Models.TaskItem", b =>
{
b.Property<Guid>("Id")

View File

@@ -1,10 +1,11 @@
import { useState } from 'react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { LayoutDashboard, Ticket, Bell, Menu, X } from 'lucide-react'
import { LayoutDashboard, Ticket, Bell, Package, Menu, X } from 'lucide-react'
import { DashboardPage } from './pages/DashboardPage'
import { AgentDetailPage } from './pages/AgentDetailPage'
import TicketsPage from './pages/TicketsPage'
import AlertsPage from './pages/AlertsPage'
import SoftwarePage from './pages/SoftwarePage'
import { cn } from './lib/utils'
const queryClient = new QueryClient({
@@ -16,7 +17,7 @@ const queryClient = new QueryClient({
},
})
type Page = 'dashboard' | 'agent-detail' | 'tickets' | 'alerts'
type Page = 'dashboard' | 'agent-detail' | 'tickets' | 'alerts' | 'software'
interface NavItem {
id: Page
@@ -28,6 +29,7 @@ const navItems: NavItem[] = [
{ id: 'dashboard', label: 'Dashboard', icon: <LayoutDashboard size={18} /> },
{ id: 'tickets', label: 'Tickets', icon: <Ticket size={18} /> },
{ id: 'alerts', label: 'Alerts', icon: <Bell size={18} /> },
{ id: 'software', label: 'Software', icon: <Package size={18} /> },
]
function AppContent() {
@@ -110,6 +112,7 @@ function AppContent() {
)}
{page === 'tickets' && <TicketsPage />}
{page === 'alerts' && <AlertsPage />}
{page === 'software' && <SoftwarePage />}
</main>
</div>
)

View File

@@ -10,6 +10,10 @@ import type {
AlertItem,
CreateAlertRuleRequest,
UpdateAlertRuleRequest,
SoftwarePackage,
CreateSoftwarePackageRequest,
DeployRequest,
DeployResponse,
} from './types'
const BASE_URL = '/api/v1'
@@ -73,3 +77,23 @@ export const alertsApi = {
acknowledge: (id: number) =>
request<{ id: number; acknowledged: boolean }>(`/alerts/${id}/acknowledge`, { method: 'POST' }),
}
// Software Packages
export const softwarePackagesApi = {
list: (osType?: string) => {
const param = osType ? `?osType=${osType}` : ''
return request<SoftwarePackage[]>(`/software-packages${param}`)
},
create: (data: CreateSoftwarePackageRequest) =>
request<SoftwarePackage>('/software-packages', { method: 'POST', body: JSON.stringify(data) }),
update: (id: number, data: CreateSoftwarePackageRequest) =>
request<SoftwarePackage>(`/software-packages/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
delete: (id: number) =>
request<void>(`/software-packages/${id}`, { method: 'DELETE' }),
}
// Deploy
export const deployApi = {
deploy: (data: DeployRequest) =>
request<DeployResponse>('/deploy', { method: 'POST', body: JSON.stringify(data) }),
}

View File

@@ -132,3 +132,44 @@ export interface UpdateAlertRuleRequest {
severity?: AlertSeverity
enabled?: boolean
}
export type PackageManager = 'choco' | 'apt' | 'dnf' | 'direct'
export interface SoftwarePackage {
id: number
name: string
version: string
osType: OsType
packageManager: PackageManager
packageName: string
installerUrl: string | null
checksum: string | null
silentArgs: string | null
createdAt: string
}
export interface CreateSoftwarePackageRequest {
name: string
version: string
osType: OsType
packageManager: PackageManager
packageName: string
installerUrl?: string
checksum?: string
silentArgs?: string
}
export interface DeployRequest {
agentId: string
packageId: number
action: 'install' | 'uninstall'
}
export interface DeployResponse {
id: string
agentId: string
type: string
status: string
packageName: string
version: string
}

View File

@@ -0,0 +1,585 @@
import { useState } from 'react'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { Package, Plus, Trash2, Edit, Rocket, X } from 'lucide-react'
import { softwarePackagesApi, deployApi } from '../api/client'
import type { SoftwarePackage, OsType, PackageManager, CreateSoftwarePackageRequest } from '../api/types'
import { cn } from '../lib/utils'
export default function SoftwarePage() {
const [activeTab, setActiveTab] = useState<'catalog' | 'deploy'>('catalog')
const [filterOs, setFilterOs] = useState<'All' | OsType>('All')
const [isCreateModalOpen, setIsCreateModalOpen] = useState(false)
const [editingPackage, setEditingPackage] = useState<SoftwarePackage | null>(null)
const [successMessage, setSuccessMessage] = useState('')
const [errorMessage, setErrorMessage] = useState('')
const queryClient = useQueryClient()
// Fetch packages
const { data: packages = [], isLoading } = useQuery({
queryKey: ['software-packages', filterOs],
queryFn: () => softwarePackagesApi.list(filterOs === 'All' ? undefined : filterOs),
})
// Mutations
const createMutation = useMutation({
mutationFn: (data: CreateSoftwarePackageRequest) => softwarePackagesApi.create(data),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['software-packages'] })
setIsCreateModalOpen(false)
setEditingPackage(null)
setSuccessMessage('Paket erfolgreich erstellt')
setTimeout(() => setSuccessMessage(''), 3000)
},
onError: (error: Error) => {
setErrorMessage(error.message)
setTimeout(() => setErrorMessage(''), 3000)
},
})
const updateMutation = useMutation({
mutationFn: (data: { id: number; body: CreateSoftwarePackageRequest }) =>
softwarePackagesApi.update(data.id, data.body),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['software-packages'] })
setIsCreateModalOpen(false)
setEditingPackage(null)
setSuccessMessage('Paket erfolgreich aktualisiert')
setTimeout(() => setSuccessMessage(''), 3000)
},
onError: (error: Error) => {
setErrorMessage(error.message)
setTimeout(() => setErrorMessage(''), 3000)
},
})
const deleteMutation = useMutation({
mutationFn: (id: number) => softwarePackagesApi.delete(id),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['software-packages'] })
setSuccessMessage('Paket erfolgreich gelöscht')
setTimeout(() => setSuccessMessage(''), 3000)
},
onError: (error: Error) => {
setErrorMessage(error.message)
setTimeout(() => setErrorMessage(''), 3000)
},
})
const deployMutation = useMutation({
mutationFn: (data: { agentId: string; packageId: number; action: 'install' | 'uninstall' }) =>
deployApi.deploy(data),
onSuccess: () => {
setSuccessMessage('Deployment-Task erfolgreich erstellt')
setTimeout(() => setSuccessMessage(''), 3000)
},
onError: (error: Error) => {
setErrorMessage(error.message)
setTimeout(() => setErrorMessage(''), 3000)
},
})
const handleDelete = (id: number, name: string) => {
if (window.confirm(`Paket "${name}" wirklich löschen?`)) {
deleteMutation.mutate(id)
}
}
const handleEdit = (pkg: SoftwarePackage) => {
setEditingPackage(pkg)
setIsCreateModalOpen(true)
}
const handleOpenCreate = () => {
setEditingPackage(null)
setIsCreateModalOpen(true)
}
return (
<div className="min-h-screen bg-gray-50 p-8">
<div className="max-w-7xl mx-auto">
{/* Header */}
<div className="mb-8">
<div className="flex items-center gap-3 mb-2">
<Package className="text-blue-600" size={28} />
<h1 className="text-3xl font-bold">Software-Verwaltung</h1>
</div>
<p className="text-gray-600">Verwalte Software-Pakete und deploye sie auf Agenten</p>
</div>
{/* Tabs */}
<div className="flex gap-4 mb-6 border-b">
<button
onClick={() => setActiveTab('catalog')}
className={cn(
'px-4 py-2 font-medium text-sm border-b-2 transition-colors',
activeTab === 'catalog'
? 'border-blue-600 text-blue-600'
: 'border-transparent text-gray-600 hover:text-gray-900'
)}
>
Katalog
</button>
<button
onClick={() => setActiveTab('deploy')}
className={cn(
'px-4 py-2 font-medium text-sm border-b-2 transition-colors',
activeTab === 'deploy'
? 'border-blue-600 text-blue-600'
: 'border-transparent text-gray-600 hover:text-gray-900'
)}
>
Deployen
</button>
</div>
{/* Messages */}
{successMessage && (
<div className="mb-4 p-3 bg-green-100 text-green-800 rounded-lg">{successMessage}</div>
)}
{errorMessage && (
<div className="mb-4 p-3 bg-red-100 text-red-800 rounded-lg">{errorMessage}</div>
)}
{/* Tab Content */}
{activeTab === 'catalog' && (
<div>
{/* Filter and Create Button */}
<div className="flex items-center justify-between mb-6">
<div className="flex gap-2">
{(['All', 'Windows', 'Linux'] as const).map((os) => (
<button
key={os}
onClick={() => setFilterOs(os)}
className={cn(
'px-4 py-2 rounded-lg font-medium transition-colors',
filterOs === os
? 'bg-blue-600 text-white'
: 'bg-white text-gray-700 border border-gray-300 hover:bg-gray-50'
)}
>
{os}
</button>
))}
</div>
<button
onClick={handleOpenCreate}
className="flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors"
>
<Plus size={18} />
Neues Paket
</button>
</div>
{/* Table */}
{isLoading ? (
<div className="text-center py-8 text-gray-500">Laden...</div>
) : packages.length === 0 ? (
<div className="text-center py-8 text-gray-500">
Keine Pakete {filterOs !== 'All' && `für ${filterOs}`} vorhanden
</div>
) : (
<div className="bg-white rounded-lg shadow overflow-x-auto">
<table className="w-full">
<thead className="bg-gray-100 border-b">
<tr>
<th className="px-6 py-3 text-left text-sm font-semibold text-gray-900">Name</th>
<th className="px-6 py-3 text-left text-sm font-semibold text-gray-900">Version</th>
<th className="px-6 py-3 text-left text-sm font-semibold text-gray-900">OS</th>
<th className="px-6 py-3 text-left text-sm font-semibold text-gray-900">
Paketmanager
</th>
<th className="px-6 py-3 text-left text-sm font-semibold text-gray-900">Paketname</th>
<th className="px-6 py-3 text-right text-sm font-semibold text-gray-900">Aktionen</th>
</tr>
</thead>
<tbody>
{packages.map((pkg) => (
<tr key={pkg.id} className="border-b hover:bg-gray-50 transition-colors">
<td className="px-6 py-4 font-medium text-gray-900">{pkg.name}</td>
<td className="px-6 py-4 text-gray-600">{pkg.version}</td>
<td className="px-6 py-4">
<span
className={cn(
'px-3 py-1 rounded-full text-sm font-medium text-white',
pkg.osType === 'Windows' ? 'bg-blue-600' : 'bg-green-600'
)}
>
{pkg.osType}
</span>
</td>
<td className="px-6 py-4 text-gray-600">{pkg.packageManager}</td>
<td className="px-6 py-4 text-gray-600 font-mono text-sm">{pkg.packageName}</td>
<td className="px-6 py-4 flex justify-end gap-3">
<button
onClick={() => handleEdit(pkg)}
className="p-2 text-blue-600 hover:bg-blue-50 rounded transition-colors"
title="Bearbeiten"
>
<Edit size={18} />
</button>
<button
onClick={() => handleDelete(pkg.id, pkg.name)}
className="p-2 text-red-600 hover:bg-red-50 rounded transition-colors"
title="Löschen"
>
<Trash2 size={18} />
</button>
</td>
</tr>
))}
</tbody>
</table>
</div>
)}
</div>
)}
{activeTab === 'deploy' && <DeployTab packages={packages} deployMutation={deployMutation} />}
</div>
{/* Create/Edit Modal */}
{isCreateModalOpen && (
<CreatePackageModal
package={editingPackage}
isOpen={isCreateModalOpen}
onClose={() => {
setIsCreateModalOpen(false)
setEditingPackage(null)
}}
onSubmit={(data) => {
if (editingPackage) {
updateMutation.mutate({ id: editingPackage.id, body: data })
} else {
createMutation.mutate(data)
}
}}
isLoading={createMutation.isPending || updateMutation.isPending}
/>
)}
</div>
)
}
interface CreatePackageModalProps {
package: SoftwarePackage | null
isOpen: boolean
onClose: () => void
onSubmit: (data: CreateSoftwarePackageRequest) => void
isLoading: boolean
}
function CreatePackageModal({
package: editingPackage,
isOpen,
onClose,
onSubmit,
isLoading,
}: CreatePackageModalProps) {
const [formData, setFormData] = useState<CreateSoftwarePackageRequest>(
editingPackage
? {
name: editingPackage.name,
version: editingPackage.version,
osType: editingPackage.osType,
packageManager: editingPackage.packageManager,
packageName: editingPackage.packageName,
installerUrl: editingPackage.installerUrl ?? undefined,
checksum: editingPackage.checksum ?? undefined,
silentArgs: editingPackage.silentArgs ?? undefined,
}
: {
name: '',
version: '',
osType: 'Windows',
packageManager: 'choco',
packageName: '',
}
)
const getAvailablePackageManagers = (): PackageManager[] => {
if (formData.osType === 'Windows') {
return ['choco', 'direct']
} else {
return ['apt', 'dnf', 'direct']
}
}
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault()
onSubmit(formData)
}
const handleOsChange = (newOs: OsType) => {
const availableManagers = newOs === 'Windows' ? ['choco', 'direct'] : ['apt', 'dnf', 'direct']
const newManager =
availableManagers.includes(formData.packageManager as PackageManager)
? (formData.packageManager as PackageManager)
: (availableManagers[0] as PackageManager)
setFormData((prev) => ({
...prev,
osType: newOs,
packageManager: newManager,
}))
}
if (!isOpen) return null
return (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
<div className="bg-white rounded-lg shadow-lg max-w-md w-full max-h-[90vh] overflow-y-auto">
<div className="flex items-center justify-between p-6 border-b sticky top-0 bg-white">
<h2 className="text-xl font-bold">
{editingPackage ? 'Paket bearbeiten' : 'Neues Paket'}
</h2>
<button onClick={onClose} className="text-gray-500 hover:text-gray-700">
<X size={24} />
</button>
</div>
<form onSubmit={handleSubmit} className="p-6 space-y-4">
{/* Name */}
<div>
<label className="block text-sm font-medium text-gray-900 mb-1">Name *</label>
<input
type="text"
required
value={formData.name}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
</div>
{/* Version */}
<div>
<label className="block text-sm font-medium text-gray-900 mb-1">Version *</label>
<input
type="text"
required
placeholder="z.B. 1.0.0"
value={formData.version}
onChange={(e) => setFormData({ ...formData, version: e.target.value })}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
</div>
{/* OS */}
<div>
<label className="block text-sm font-medium text-gray-900 mb-1">Betriebssystem *</label>
<select
required
value={formData.osType}
onChange={(e) => handleOsChange(e.target.value as OsType)}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
>
<option value="Windows">Windows</option>
<option value="Linux">Linux</option>
</select>
</div>
{/* Package Manager */}
<div>
<label className="block text-sm font-medium text-gray-900 mb-1">Paketmanager *</label>
<select
required
value={formData.packageManager}
onChange={(e) => setFormData({ ...formData, packageManager: e.target.value as PackageManager })}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
>
{getAvailablePackageManagers().map((pm) => (
<option key={pm} value={pm}>
{pm}
</option>
))}
</select>
</div>
{/* Package Name */}
<div>
<label className="block text-sm font-medium text-gray-900 mb-1">Paketname *</label>
<input
type="text"
required
placeholder="Name wie im Paketmanager"
value={formData.packageName}
onChange={(e) => setFormData({ ...formData, packageName: e.target.value })}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
</div>
{/* Installer URL (nur für "direct") */}
{formData.packageManager === 'direct' && (
<div>
<label className="block text-sm font-medium text-gray-900 mb-1">Installer URL</label>
<input
type="url"
placeholder="https://..."
value={formData.installerUrl || ''}
onChange={(e) => setFormData({ ...formData, installerUrl: e.target.value || undefined })}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
</div>
)}
{/* Checksum (nur für "direct") */}
{formData.packageManager === 'direct' && (
<div>
<label className="block text-sm font-medium text-gray-900 mb-1">SHA256-Prüfsumme</label>
<input
type="text"
placeholder="SHA256 hash"
value={formData.checksum || ''}
onChange={(e) => setFormData({ ...formData, checksum: e.target.value || undefined })}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-xs"
/>
</div>
)}
{/* Silent Args (nur für "direct") */}
{formData.packageManager === 'direct' && (
<div>
<label className="block text-sm font-medium text-gray-900 mb-1">Silent-Argumente</label>
<input
type="text"
placeholder="/S, --silent, etc."
value={formData.silentArgs || ''}
onChange={(e) => setFormData({ ...formData, silentArgs: e.target.value || undefined })}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
</div>
)}
{/* Buttons */}
<div className="flex gap-3 pt-4">
<button
type="button"
onClick={onClose}
className="flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors font-medium"
>
Abbrechen
</button>
<button
type="submit"
disabled={isLoading}
className="flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium disabled:opacity-50"
>
{isLoading ? 'Speichern...' : editingPackage ? 'Aktualisieren' : 'Erstellen'}
</button>
</div>
</form>
</div>
</div>
)
}
interface DeployTabProps {
packages: SoftwarePackage[]
deployMutation: any
}
function DeployTab({ packages, deployMutation }: DeployTabProps) {
const [selectedPackageId, setSelectedPackageId] = useState<number | ''>('')
const [agentId, setAgentId] = useState('')
const [action, setAction] = useState<'install' | 'uninstall'>('install')
const handleDeploy = (e: React.FormEvent) => {
e.preventDefault()
if (!selectedPackageId || !agentId) return
deployMutation.mutate({
agentId,
packageId: selectedPackageId as number,
action,
})
}
return (
<div className="max-w-lg">
<div className="bg-white rounded-lg shadow p-6">
<form onSubmit={handleDeploy} className="space-y-4">
{/* Package Selection */}
<div>
<label className="block text-sm font-medium text-gray-900 mb-2">Paket auswählen *</label>
<select
required
value={selectedPackageId}
onChange={(e) => setSelectedPackageId(e.target.value ? Number(e.target.value) : '')}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
>
<option value="">-- Paket auswählen --</option>
{packages.map((pkg) => (
<option key={pkg.id} value={pkg.id}>
{pkg.name} ({pkg.version}) - {pkg.osType}
</option>
))}
</select>
</div>
{/* Agent ID */}
<div>
<label className="block text-sm font-medium text-gray-900 mb-2">Agent-ID *</label>
<input
type="text"
required
placeholder="UUID des Agenten (aus Dashboard kopieren)"
value={agentId}
onChange={(e) => setAgentId(e.target.value)}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm"
/>
<p className="mt-1 text-xs text-gray-500">
Finde die Agent-ID im Agent-Dashboard oder Agent-Details
</p>
</div>
{/* Action */}
<div>
<label className="block text-sm font-medium text-gray-900 mb-2">Aktion *</label>
<div className="space-y-2">
<label className="flex items-center gap-3 cursor-pointer">
<input
type="radio"
name="action"
value="install"
checked={action === 'install'}
onChange={() => setAction('install')}
className="w-4 h-4"
/>
<span className="text-gray-900">Installieren</span>
</label>
<label className="flex items-center gap-3 cursor-pointer">
<input
type="radio"
name="action"
value="uninstall"
checked={action === 'uninstall'}
onChange={() => setAction('uninstall')}
className="w-4 h-4"
/>
<span className="text-gray-900">Deinstallieren</span>
</label>
</div>
</div>
{/* Submit */}
<button
type="submit"
disabled={deployMutation.isPending || !selectedPackageId || !agentId}
className="w-full flex items-center justify-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium disabled:opacity-50 disabled:cursor-not-allowed"
>
<Rocket size={18} />
{deployMutation.isPending ? 'Wird deployed...' : 'Deploy starten'}
</button>
{/* Info */}
<div className="mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg text-sm text-blue-900">
<p className="font-medium mb-1">Hinweis:</p>
<p>
Die Task wird erstellt und der Agent führt sie beim nächsten Heartbeat aus (ca. 1-2 Minuten).
Überwache den Task-Fortschritt im Agent-Dashboard.
</p>
</div>
</form>
</div>
</div>
)
}