Compare commits
3 Commits
v0.1.18
...
8383cc88c8
| Author | SHA1 | Date | |
|---|---|---|---|
| 8383cc88c8 | |||
| 89ffce20da | |||
| 2e7741f6fe |
@@ -117,7 +117,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform ${{ env.DOCKER_PLATFORMS }} \
|
--platform ${{ env.DOCKER_PLATFORMS }} \
|
||||||
--build-arg VERSION=${{ needs.set-tag.outputs.tag_name }} \
|
|
||||||
-t ${{ env.REGISTRY_URL }}/watcher/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.set-tag.outputs.tag_name }} \
|
-t ${{ env.REGISTRY_URL }}/watcher/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.set-tag.outputs.tag_name }} \
|
||||||
--push .
|
--push .
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,6 @@ RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false
|
|||||||
|
|
||||||
# 2. Laufzeit-Phase: ASP.NET Core Runtime
|
# 2. Laufzeit-Phase: ASP.NET Core Runtime
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||||
|
|
||||||
# Build-Argument für Version (wird zur Build-Zeit vom CI/CD gesetzt)
|
|
||||||
ARG VERSION=latest
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build /app/publish .
|
COPY --from=build /app/publish .
|
||||||
|
|
||||||
@@ -32,8 +28,5 @@ EXPOSE 5000
|
|||||||
ENV ASPNETCORE_URLS=http://*:5000
|
ENV ASPNETCORE_URLS=http://*:5000
|
||||||
ENV ASPNETCORE_ENVIRONMENT=Development
|
ENV ASPNETCORE_ENVIRONMENT=Development
|
||||||
|
|
||||||
# Version als Environment Variable setzen
|
|
||||||
ENV WATCHER_VERSION=${VERSION}
|
|
||||||
|
|
||||||
# Anwendung starten
|
# Anwendung starten
|
||||||
ENTRYPOINT ["dotnet", "Watcher.dll"]
|
ENTRYPOINT ["dotnet", "Watcher.dll"]
|
||||||
|
|||||||
@@ -1,412 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Watcher Database Test Data Population Script
|
|
||||||
Füllt die SQLite-Datenbank mit realistischen Testdaten für lokale Entwicklung
|
|
||||||
"""
|
|
||||||
|
|
||||||
import sqlite3
|
|
||||||
import random
|
|
||||||
from datetime import datetime, timedelta
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Datenbankpfad
|
|
||||||
DB_PATH = "Watcher\persistence\watcher.db"
|
|
||||||
|
|
||||||
# Prüfe ob Datenbank existiert
|
|
||||||
if not os.path.exists(DB_PATH):
|
|
||||||
print(f"❌ Datenbank nicht gefunden: {DB_PATH}")
|
|
||||||
print("Bitte stelle sicher, dass die Anwendung einmal gestartet wurde, um die Datenbank zu erstellen.")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
print(f"📊 Verbinde mit Datenbank: {DB_PATH}")
|
|
||||||
conn = sqlite3.connect(DB_PATH)
|
|
||||||
cursor = conn.cursor()
|
|
||||||
|
|
||||||
# Lösche vorhandene Daten (optional - auskommentieren wenn bestehende Daten behalten werden sollen)
|
|
||||||
print("\n🗑️ Lösche vorhandene Testdaten...")
|
|
||||||
cursor.execute("DELETE FROM ContainerMetrics")
|
|
||||||
cursor.execute("DELETE FROM Metrics")
|
|
||||||
cursor.execute("DELETE FROM LogEvents")
|
|
||||||
cursor.execute("DELETE FROM Containers")
|
|
||||||
cursor.execute("DELETE FROM Images")
|
|
||||||
cursor.execute("DELETE FROM Tags")
|
|
||||||
cursor.execute("DELETE FROM Servers")
|
|
||||||
# Users werden NICHT gelöscht
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
print("✅ Alte Daten gelöscht (Users bleiben erhalten)\n")
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# 2. SERVERS - Test-Server erstellen
|
|
||||||
# ============================================================================
|
|
||||||
print("\n🖥️ Erstelle Server...")
|
|
||||||
|
|
||||||
servers_data = [
|
|
||||||
{
|
|
||||||
"name": "Production-Web-01",
|
|
||||||
"ip": "192.168.1.10",
|
|
||||||
"type": "Ubuntu 22.04",
|
|
||||||
"description": "Haupt-Webserver für Production",
|
|
||||||
"cpu_type": "Intel Core i7-12700K",
|
|
||||||
"cpu_cores": 12,
|
|
||||||
"gpu_type": None,
|
|
||||||
"ram_size": 34359738368, # 32 GB in Bytes
|
|
||||||
"disk_space": "512 GB NVMe SSD",
|
|
||||||
"is_online": True
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Dev-Server",
|
|
||||||
"ip": "192.168.1.20",
|
|
||||||
"type": "Debian 12",
|
|
||||||
"description": "Entwicklungs- und Testserver",
|
|
||||||
"cpu_type": "AMD Ryzen 9 5900X",
|
|
||||||
"cpu_cores": 12,
|
|
||||||
"gpu_type": None,
|
|
||||||
"ram_size": 68719476736, # 64 GB in Bytes
|
|
||||||
"disk_space": "1 TB NVMe SSD",
|
|
||||||
"is_online": True
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "GPU-Server-ML",
|
|
||||||
"ip": "192.168.1.30",
|
|
||||||
"type": "Ubuntu 22.04 LTS",
|
|
||||||
"description": "Machine Learning Training Server",
|
|
||||||
"cpu_type": "AMD Ryzen Threadripper 3970X",
|
|
||||||
"cpu_cores": 32,
|
|
||||||
"gpu_type": "NVIDIA RTX 4090",
|
|
||||||
"ram_size": 137438953472, # 128 GB in Bytes
|
|
||||||
"disk_space": "2 TB NVMe SSD",
|
|
||||||
"is_online": True
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Backup-Server",
|
|
||||||
"ip": "192.168.1.40",
|
|
||||||
"type": "Ubuntu 20.04",
|
|
||||||
"description": "Backup und Storage Server",
|
|
||||||
"cpu_type": "Intel Xeon E5-2680 v4",
|
|
||||||
"cpu_cores": 14,
|
|
||||||
"gpu_type": None,
|
|
||||||
"ram_size": 17179869184, # 16 GB in Bytes
|
|
||||||
"disk_space": "10 TB HDD RAID5",
|
|
||||||
"is_online": False
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Docker-Host-01",
|
|
||||||
"ip": "192.168.1.50",
|
|
||||||
"type": "Ubuntu 22.04",
|
|
||||||
"description": "Docker Container Host",
|
|
||||||
"cpu_type": "Intel Xeon Gold 6248R",
|
|
||||||
"cpu_cores": 24,
|
|
||||||
"gpu_type": None,
|
|
||||||
"ram_size": 68719476736, # 64 GB in Bytes
|
|
||||||
"disk_space": "2 TB NVMe SSD",
|
|
||||||
"is_online": True
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
server_ids = []
|
|
||||||
for server in servers_data:
|
|
||||||
last_seen = datetime.utcnow() - timedelta(minutes=random.randint(0, 30)) if server["is_online"] else datetime.utcnow() - timedelta(hours=random.randint(2, 48))
|
|
||||||
|
|
||||||
cursor.execute("""
|
|
||||||
INSERT INTO Servers (
|
|
||||||
Name, IPAddress, Type, Description,
|
|
||||||
CpuType, CpuCores, GpuType, RamSize, DiskSpace,
|
|
||||||
CPU_Load_Warning, CPU_Load_Critical,
|
|
||||||
CPU_Temp_Warning, CPU_Temp_Critical,
|
|
||||||
RAM_Load_Warning, RAM_Load_Critical,
|
|
||||||
GPU_Load_Warning, GPU_Load_Critical,
|
|
||||||
GPU_Temp_Warning, GPU_Temp_Critical,
|
|
||||||
Disk_Usage_Warning, Disk_Usage_Critical,
|
|
||||||
DISK_Temp_Warning, DISK_Temp_Critical,
|
|
||||||
CreatedAt, IsOnline, LastSeen, IsVerified
|
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
||||||
""", (
|
|
||||||
server["name"], server["ip"], server["type"], server["description"],
|
|
||||||
server["cpu_type"], server["cpu_cores"], server["gpu_type"], server["ram_size"], server["disk_space"],
|
|
||||||
75.0, 90.0, # CPU Load
|
|
||||||
80.0, 90.0, # CPU Temp
|
|
||||||
85.0, 95.0, # RAM Load
|
|
||||||
75.0, 90.0, # GPU Load
|
|
||||||
70.0, 80.0, # GPU Temp
|
|
||||||
75.0, 90.0, # Disk Usage
|
|
||||||
34.0, 36.0, # Disk Temp
|
|
||||||
datetime.utcnow() - timedelta(days=random.randint(30, 365)),
|
|
||||||
server["is_online"], last_seen, True
|
|
||||||
))
|
|
||||||
server_ids.append(cursor.lastrowid)
|
|
||||||
print(f" ✓ Server '{server['name']}' erstellt (ID: {cursor.lastrowid})")
|
|
||||||
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# 3. METRICS - Server-Metriken erstellen (letzte 48 Stunden)
|
|
||||||
# ============================================================================
|
|
||||||
print("\n📈 Erstelle Server-Metriken (letzte 48 Stunden)...")
|
|
||||||
|
|
||||||
metrics_count = 0
|
|
||||||
for server_id in server_ids:
|
|
||||||
# Finde den Server
|
|
||||||
cursor.execute("SELECT IsOnline FROM Servers WHERE Id = ?", (server_id,))
|
|
||||||
is_online = cursor.fetchone()[0]
|
|
||||||
|
|
||||||
if not is_online:
|
|
||||||
continue # Keine Metriken für offline Server
|
|
||||||
|
|
||||||
# Erstelle Metriken für die letzten 48 Stunden (alle 5 Minuten)
|
|
||||||
start_time = datetime.utcnow() - timedelta(hours=48)
|
|
||||||
current_time = start_time
|
|
||||||
|
|
||||||
# Basis-Werte für realistische Schwankungen
|
|
||||||
base_cpu = random.uniform(20, 40)
|
|
||||||
base_ram = random.uniform(40, 60)
|
|
||||||
base_gpu = random.uniform(10, 30) if server_id == server_ids[2] else 0 # Nur GPU-Server
|
|
||||||
|
|
||||||
while current_time <= datetime.utcnow():
|
|
||||||
# Realistische Schwankungen
|
|
||||||
cpu_load = max(0, min(100, base_cpu + random.gauss(0, 15)))
|
|
||||||
cpu_temp = 30 + (cpu_load * 0.5) + random.gauss(0, 3)
|
|
||||||
|
|
||||||
ram_load = max(0, min(100, base_ram + random.gauss(0, 10)))
|
|
||||||
|
|
||||||
gpu_load = max(0, min(100, base_gpu + random.gauss(0, 20))) if base_gpu > 0 else 0
|
|
||||||
gpu_temp = 25 + (gpu_load * 0.6) + random.gauss(0, 3) if gpu_load > 0 else 0
|
|
||||||
gpu_vram_usage = gpu_load * 0.8 if gpu_load > 0 else 0
|
|
||||||
|
|
||||||
disk_usage = random.uniform(40, 75)
|
|
||||||
disk_temp = random.uniform(28, 35)
|
|
||||||
|
|
||||||
net_in = random.uniform(1000000, 10000000) # 1-10 Mbps in Bits
|
|
||||||
net_out = random.uniform(500000, 5000000) # 0.5-5 Mbps in Bits
|
|
||||||
|
|
||||||
cursor.execute("""
|
|
||||||
INSERT INTO Metrics (
|
|
||||||
ServerId, Timestamp,
|
|
||||||
CPU_Load, CPU_Temp,
|
|
||||||
GPU_Load, GPU_Temp, GPU_Vram_Size, GPU_Vram_Usage,
|
|
||||||
RAM_Size, RAM_Load,
|
|
||||||
DISK_Size, DISK_Usage, DISK_Temp,
|
|
||||||
NET_In, NET_Out
|
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
||||||
""", (
|
|
||||||
server_id, current_time,
|
|
||||||
cpu_load, cpu_temp,
|
|
||||||
gpu_load, gpu_temp, 24.0, gpu_vram_usage, # 24 GB VRAM
|
|
||||||
64.0, ram_load,
|
|
||||||
512.0, disk_usage, disk_temp,
|
|
||||||
net_in, net_out
|
|
||||||
))
|
|
||||||
|
|
||||||
metrics_count += 1
|
|
||||||
current_time += timedelta(minutes=5)
|
|
||||||
|
|
||||||
print(f" ✓ Server {server_id}: {metrics_count} Metriken erstellt")
|
|
||||||
|
|
||||||
conn.commit()
|
|
||||||
print(f"✅ Insgesamt {metrics_count} Metriken erstellt")
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# 4. IMAGES - Docker Images
|
|
||||||
# ============================================================================
|
|
||||||
print("\n🐳 Erstelle Docker Images...")
|
|
||||||
|
|
||||||
images_data = [
|
|
||||||
("nginx", "latest"),
|
|
||||||
("nginx", "alpine"),
|
|
||||||
("postgres", "15"),
|
|
||||||
("postgres", "14-alpine"),
|
|
||||||
("redis", "7-alpine"),
|
|
||||||
("node", "18-alpine"),
|
|
||||||
("python", "3.11-slim"),
|
|
||||||
("mysql", "8.0"),
|
|
||||||
("traefik", "v2.10"),
|
|
||||||
("portainer", "latest")
|
|
||||||
]
|
|
||||||
|
|
||||||
image_ids = {}
|
|
||||||
for name, tag in images_data:
|
|
||||||
cursor.execute("""
|
|
||||||
INSERT INTO Images (Name, Tag)
|
|
||||||
VALUES (?, ?)
|
|
||||||
""", (name, tag))
|
|
||||||
image_ids[f"{name}:{tag}"] = cursor.lastrowid
|
|
||||||
print(f" ✓ Image '{name}:{tag}' erstellt")
|
|
||||||
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# 5. CONTAINERS - Docker Container
|
|
||||||
# ============================================================================
|
|
||||||
print("\n📦 Erstelle Docker Container...")
|
|
||||||
|
|
||||||
# Nur für Server, die online sind
|
|
||||||
online_server_ids = [sid for sid in server_ids[:2]] # Erste 2 Server haben Container
|
|
||||||
|
|
||||||
containers_data = [
|
|
||||||
# Production-Web-01
|
|
||||||
("nginx-web", "abc123def456", "nginx:latest", online_server_ids[0], True),
|
|
||||||
("postgres-db", "def456ghi789", "postgres:15", online_server_ids[0], True),
|
|
||||||
("redis-cache", "ghi789jkl012", "redis:7-alpine", online_server_ids[0], True),
|
|
||||||
("traefik-proxy", "jkl012mno345", "traefik:v2.10", online_server_ids[0], True),
|
|
||||||
|
|
||||||
# Dev-Server
|
|
||||||
("dev-nginx", "mno345pqr678", "nginx:alpine", online_server_ids[1], True),
|
|
||||||
("dev-postgres", "pqr678stu901", "postgres:14-alpine", online_server_ids[1], False),
|
|
||||||
("dev-redis", "stu901vwx234", "redis:7-alpine", online_server_ids[1], True),
|
|
||||||
("test-app", "vwx234yz567", "node:18-alpine", online_server_ids[1], True),
|
|
||||||
("portainer", "yz567abc890", "portainer:latest", online_server_ids[1], True),
|
|
||||||
]
|
|
||||||
|
|
||||||
container_ids = []
|
|
||||||
for name, container_id, image, server_id, is_running in containers_data:
|
|
||||||
cursor.execute("""
|
|
||||||
INSERT INTO Containers (Name, ContainerId, Image, ServerId, IsRunning)
|
|
||||||
VALUES (?, ?, ?, ?, ?)
|
|
||||||
""", (name, container_id, image, server_id, is_running))
|
|
||||||
container_ids.append(cursor.lastrowid)
|
|
||||||
status = "🟢 Running" if is_running else "🔴 Stopped"
|
|
||||||
print(f" ✓ Container '{name}' erstellt - {status}")
|
|
||||||
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# 6. CONTAINER METRICS - Container-Metriken (letzte 24 Stunden)
|
|
||||||
# ============================================================================
|
|
||||||
print("\n📊 Erstelle Container-Metriken (letzte 24 Stunden)...")
|
|
||||||
|
|
||||||
container_metrics_count = 0
|
|
||||||
for container_id in container_ids:
|
|
||||||
# Prüfe ob Container läuft
|
|
||||||
cursor.execute("SELECT IsRunning FROM Containers WHERE Id = ?", (container_id,))
|
|
||||||
is_running = cursor.fetchone()[0]
|
|
||||||
|
|
||||||
if not is_running:
|
|
||||||
continue # Keine Metriken für gestoppte Container
|
|
||||||
|
|
||||||
# Erstelle Metriken für die letzten 24 Stunden (alle 5 Minuten)
|
|
||||||
start_time = datetime.utcnow() - timedelta(hours=24)
|
|
||||||
current_time = start_time
|
|
||||||
|
|
||||||
# Basis-Werte für Container (meist niedriger als Host)
|
|
||||||
base_cpu = random.uniform(5, 15)
|
|
||||||
base_ram = random.uniform(10, 30)
|
|
||||||
|
|
||||||
while current_time <= datetime.utcnow():
|
|
||||||
cpu_load = max(0, min(100, base_cpu + random.gauss(0, 8)))
|
|
||||||
cpu_temp = 30 + (cpu_load * 0.5) + random.gauss(0, 2)
|
|
||||||
|
|
||||||
ram_load = max(0, min(100, base_ram + random.gauss(0, 5)))
|
|
||||||
ram_size = random.uniform(0.5, 4.0) # Container nutzen weniger RAM
|
|
||||||
|
|
||||||
cursor.execute("""
|
|
||||||
INSERT INTO ContainerMetrics (
|
|
||||||
ContainerId, Timestamp,
|
|
||||||
CPU_Load, CPU_Temp,
|
|
||||||
RAM_Size, RAM_Load
|
|
||||||
) VALUES (?, ?, ?, ?, ?, ?)
|
|
||||||
""", (
|
|
||||||
container_id, current_time,
|
|
||||||
cpu_load, cpu_temp,
|
|
||||||
ram_size, ram_load
|
|
||||||
))
|
|
||||||
|
|
||||||
container_metrics_count += 1
|
|
||||||
current_time += timedelta(minutes=5)
|
|
||||||
|
|
||||||
conn.commit()
|
|
||||||
print(f"✅ Insgesamt {container_metrics_count} Container-Metriken erstellt")
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# 7. LOG EVENTS - Log-Einträge erstellen
|
|
||||||
# ============================================================================
|
|
||||||
print("\n📝 Erstelle Log Events...")
|
|
||||||
|
|
||||||
log_messages = [
|
|
||||||
("Info", "Server erfolgreich gestartet", None, None),
|
|
||||||
("Info", "Backup abgeschlossen", server_ids[3], None),
|
|
||||||
("Warning", "CPU-Auslastung über 80%", server_ids[0], None),
|
|
||||||
("Info", "Container gestartet", server_ids[0], container_ids[0]),
|
|
||||||
("Error", "Datenbank-Verbindung fehlgeschlagen", server_ids[1], container_ids[5]),
|
|
||||||
("Warning", "Speicherplatz unter 25%", server_ids[1], None),
|
|
||||||
("Info", "Update installiert", server_ids[2], None),
|
|
||||||
("Info", "Container neu gestartet", server_ids[0], container_ids[2]),
|
|
||||||
("Warning", "GPU-Temperatur über 75°C", server_ids[2], None),
|
|
||||||
("Info", "Netzwerk-Check erfolgreich", server_ids[0], None),
|
|
||||||
]
|
|
||||||
|
|
||||||
for level, message, server_id, container_id in log_messages:
|
|
||||||
timestamp = datetime.utcnow() - timedelta(hours=random.randint(0, 48))
|
|
||||||
cursor.execute("""
|
|
||||||
INSERT INTO LogEvents (Timestamp, Message, Level, ServerId, ContainerId)
|
|
||||||
VALUES (?, ?, ?, ?, ?)
|
|
||||||
""", (timestamp, message, level, server_id, container_id))
|
|
||||||
print(f" ✓ Log: [{level}] {message}")
|
|
||||||
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# 8. TAGS - Tags für Server/Container
|
|
||||||
# ============================================================================
|
|
||||||
print("\n🏷️ Erstelle Tags...")
|
|
||||||
|
|
||||||
tags_data = ["production", "development", "backup", "docker", "monitoring", "critical"]
|
|
||||||
|
|
||||||
for tag_name in tags_data:
|
|
||||||
cursor.execute("""
|
|
||||||
INSERT INTO Tags (Name)
|
|
||||||
VALUES (?)
|
|
||||||
""", (tag_name,))
|
|
||||||
print(f" ✓ Tag '{tag_name}' erstellt")
|
|
||||||
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# Abschluss
|
|
||||||
# ============================================================================
|
|
||||||
print("\n" + "="*60)
|
|
||||||
print("✅ Testdaten erfolgreich erstellt!")
|
|
||||||
print("="*60)
|
|
||||||
|
|
||||||
# Statistiken ausgeben
|
|
||||||
cursor.execute("SELECT COUNT(*) FROM Servers")
|
|
||||||
server_count = cursor.fetchone()[0]
|
|
||||||
|
|
||||||
cursor.execute("SELECT COUNT(*) FROM Containers")
|
|
||||||
container_count = cursor.fetchone()[0]
|
|
||||||
|
|
||||||
cursor.execute("SELECT COUNT(*) FROM Metrics")
|
|
||||||
metrics_count = cursor.fetchone()[0]
|
|
||||||
|
|
||||||
cursor.execute("SELECT COUNT(*) FROM ContainerMetrics")
|
|
||||||
container_metrics_count = cursor.fetchone()[0]
|
|
||||||
|
|
||||||
cursor.execute("SELECT COUNT(*) FROM LogEvents")
|
|
||||||
log_count = cursor.fetchone()[0]
|
|
||||||
|
|
||||||
cursor.execute("SELECT COUNT(*) FROM Images")
|
|
||||||
image_count = cursor.fetchone()[0]
|
|
||||||
|
|
||||||
cursor.execute("SELECT COUNT(*) FROM Tags")
|
|
||||||
tag_count = cursor.fetchone()[0]
|
|
||||||
|
|
||||||
print(f"""
|
|
||||||
📊 STATISTIK:
|
|
||||||
🖥️ Server: {server_count}
|
|
||||||
📦 Container: {container_count}
|
|
||||||
📈 Server-Metriken: {metrics_count}
|
|
||||||
📊 Container-Metriken: {container_metrics_count}
|
|
||||||
📝 Log Events: {log_count}
|
|
||||||
🐳 Images: {image_count}
|
|
||||||
🏷️ Tags: {tag_count}
|
|
||||||
|
|
||||||
💡 HINWEIS:
|
|
||||||
- User-Tabelle wurde nicht verändert
|
|
||||||
- Metriken wurden für die letzten 48 Stunden generiert
|
|
||||||
- Server 'Backup-Server' ist offline (für Tests)
|
|
||||||
- Container 'dev-postgres' ist gestoppt (für Tests)
|
|
||||||
- Die Datenbank befindet sich unter: {DB_PATH}
|
|
||||||
""")
|
|
||||||
|
|
||||||
# Verbindung schließen
|
|
||||||
conn.close()
|
|
||||||
print("🔒 Datenbankverbindung geschlossen\n")
|
|
||||||
117
Tests/test.json
Normal file
117
Tests/test.json
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
{
|
||||||
|
"server_id": 1,
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"cpu_load": 0.0
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"net_in": null,
|
||||||
|
"net_out": null
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
"ram_load": 0.0
|
||||||
|
},
|
||||||
|
"container_id": "aaaaaaaa",
|
||||||
|
"status": {
|
||||||
|
"status": "exited"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"cpu_load": 0.0
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"net_in": null,
|
||||||
|
"net_out": null
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
"ram_load": 0.0
|
||||||
|
},
|
||||||
|
"container_id": "aaaaaaaa",
|
||||||
|
"status": {
|
||||||
|
"status": "exited"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"cpu_load": 0.0
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"net_in": null,
|
||||||
|
"net_out": null
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
"ram_load": 0.0
|
||||||
|
},
|
||||||
|
"container_id": "aaaaaaaa",
|
||||||
|
"status": {
|
||||||
|
"status": "exited"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"cpu_load": 0.0
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"net_in": null,
|
||||||
|
"net_out": null
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
"ram_load": 0.0
|
||||||
|
},
|
||||||
|
"container_id": "aaaaaaaa",
|
||||||
|
"status": {
|
||||||
|
"status": "exited"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"cpu_load": 0.0
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"net_in": null,
|
||||||
|
"net_out": null
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
"ram_load": 0.0
|
||||||
|
},
|
||||||
|
"container_id": "aaaaaaaa",
|
||||||
|
"status": {
|
||||||
|
"status": "exited"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"cpu_load": 0.0
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"net_in": null,
|
||||||
|
"net_out": null
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
"ram_load": 0.0
|
||||||
|
},
|
||||||
|
"container_id": "aaaaaaaa",
|
||||||
|
"status": {
|
||||||
|
"status": "exited"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"cpu_load": 0.0
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"net_in": null,
|
||||||
|
"net_out": null
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
"ram_load": 0.0
|
||||||
|
},
|
||||||
|
"container_id": "aaaaaaaa",
|
||||||
|
"status": {
|
||||||
|
"status": "exited"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,19 +1,8 @@
|
|||||||
# Application Version
|
|
||||||
# Bei lokalem Development wird "development" angezeigt, im Docker-Container die Image-Version
|
|
||||||
WATCHER_VERSION=development
|
|
||||||
|
|
||||||
# Update Check
|
# OIDC Einstellungen
|
||||||
# Überprüft täglich, ob eine neue Version verfügbar ist
|
AUTHENTICATION__USELOCAL=true
|
||||||
UPDATE_CHECK_ENABLED=true
|
AUTHENTICATION__POCKETID__ENABLED=false
|
||||||
UPDATE_CHECK_INTERVAL_HOURS=24
|
AUTHENTICATION__POCKETID__AUTHORITY=https://id.domain.app
|
||||||
UPDATE_CHECK_REPOSITORY_URL=https://git.triggermeelmo.com/api/v1/repos/Watcher/watcher/releases/latest
|
AUTHENTICATION__POCKETID__CLIENTID=
|
||||||
|
AUTHENTICATION__POCKETID__CLIENTSECRET=
|
||||||
# Data Retention Policy
|
AUTHENTICATION__POCKETID__CALLBACKPATH=/signin-oidc
|
||||||
# Wie lange sollen Metriken gespeichert werden (in Tagen)?
|
|
||||||
METRIC_RETENTION_DAYS=30
|
|
||||||
|
|
||||||
# Wie oft soll der Cleanup-Prozess laufen (in Stunden)?
|
|
||||||
METRIC_CLEANUP_INTERVAL_HOURS=24
|
|
||||||
|
|
||||||
# Soll der Cleanup-Service aktiviert sein?
|
|
||||||
METRIC_CLEANUP_ENABLED=true
|
|
||||||
|
|||||||
@@ -1,20 +1,35 @@
|
|||||||
|
using System.Net.Mail;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using Watcher.Data;
|
using Watcher.Data;
|
||||||
using Watcher.ViewModels;
|
using Watcher.ViewModels;
|
||||||
|
|
||||||
namespace Watcher.Controllers;
|
namespace Watcher.Controllers;
|
||||||
|
|
||||||
|
public class AppSettings
|
||||||
|
{
|
||||||
|
public Boolean oidc { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class AuthController : Controller
|
public class AuthController : Controller
|
||||||
{
|
{
|
||||||
private readonly AppDbContext _context;
|
private readonly AppDbContext _context;
|
||||||
|
private readonly AppSettings _settings;
|
||||||
|
|
||||||
|
// Logging einbinden
|
||||||
private readonly ILogger<AuthController> _logger;
|
private readonly ILogger<AuthController> _logger;
|
||||||
|
|
||||||
public AuthController(AppDbContext context, ILogger<AuthController> logger)
|
|
||||||
|
public AuthController(AppDbContext context, IOptions<AppSettings> options, ILogger<AuthController> logger)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_settings = options.Value;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +43,7 @@ public class AuthController : Controller
|
|||||||
ReturnUrl = returnUrl
|
ReturnUrl = returnUrl
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ViewBag.oidc = _settings.oidc;
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,15 +88,32 @@ public class AuthController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Login mit OIDC-Provider
|
||||||
|
public IActionResult SignIn()
|
||||||
|
{
|
||||||
|
return Challenge(new AuthenticationProperties
|
||||||
|
{
|
||||||
|
RedirectUri = "/Home/Index"
|
||||||
|
}, "oidc");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Logout
|
// Logout
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Logout()
|
public async Task<IActionResult> Logout()
|
||||||
{
|
{
|
||||||
|
var props = new AuthenticationProperties
|
||||||
|
{
|
||||||
|
RedirectUri = Url.Action("Login", "Auth")
|
||||||
|
};
|
||||||
|
|
||||||
await HttpContext.SignOutAsync("Cookies");
|
await HttpContext.SignOutAsync("Cookies");
|
||||||
|
await HttpContext.SignOutAsync("oidc", props);
|
||||||
|
|
||||||
_logger.LogInformation("User abgemeldet");
|
_logger.LogInformation("User abgemeldet");
|
||||||
|
|
||||||
return RedirectToAction("Login", "Auth");
|
return Redirect("/"); // nur als Fallback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,7 @@ public class ContainerController : Controller
|
|||||||
|
|
||||||
public async Task<IActionResult> Overview()
|
public async Task<IActionResult> Overview()
|
||||||
{
|
{
|
||||||
// Container mit Server-Informationen laden und nach Server sortieren
|
var containers = await _context.Containers.ToListAsync();
|
||||||
var containers = await _context.Containers
|
|
||||||
.Include(c => c.Server)
|
|
||||||
.OrderBy(c => c.Server.Name)
|
|
||||||
.ThenBy(c => c.Name)
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
var servers = await _context.Servers.ToListAsync();
|
var servers = await _context.Servers.ToListAsync();
|
||||||
|
|
||||||
var viewModel = new ContainerOverviewViewModel
|
var viewModel = new ContainerOverviewViewModel
|
||||||
@@ -37,4 +31,25 @@ public class ContainerController : Controller
|
|||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> RestartContainer(string container_id)
|
||||||
|
{
|
||||||
|
//Befehl an Agent schicken??
|
||||||
|
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> StopContainer(string container_id)
|
||||||
|
{
|
||||||
|
//Befehl an Agent schicken??
|
||||||
|
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> UpdateContainer(string container_id)
|
||||||
|
{
|
||||||
|
//Befehl an Agent schicken??
|
||||||
|
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Microsoft.CodeAnalysis;
|
|||||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
using Microsoft.Data.Sqlite;
|
using Microsoft.Data.Sqlite;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using Watcher.Data;
|
using Watcher.Data;
|
||||||
using Watcher.Models;
|
using Watcher.Models;
|
||||||
using Watcher.ViewModels;
|
using Watcher.ViewModels;
|
||||||
@@ -89,7 +90,8 @@ public class DockerServiceDto
|
|||||||
|
|
||||||
public class DockerServiceMetricDto
|
public class DockerServiceMetricDto
|
||||||
{
|
{
|
||||||
|
public required int Server_id { get; set; } // Vom Watcher-Server zugewiesene ID des Hosts
|
||||||
|
public required JsonElement Containers { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
@@ -244,14 +246,6 @@ public class MonitoringController : Controller
|
|||||||
return BadRequest(new { error = "Invalid Payload", details = errors });
|
return BadRequest(new { error = "Invalid Payload", details = errors });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prüfen, ob der Server existiert
|
|
||||||
var serverExists = await _context.Servers.AnyAsync(s => s.Id == dto.Server_id);
|
|
||||||
if (!serverExists)
|
|
||||||
{
|
|
||||||
_logger.LogError($"Server with ID {dto.Server_id} does not exist.");
|
|
||||||
return BadRequest(new { error = "Server not found", details = $"Server with ID {dto.Server_id} does not exist. Please register the server first." });
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Container> newContainers =
|
List<Container> newContainers =
|
||||||
JsonSerializer.Deserialize<List<Container>>(dto.Containers.GetRawText())
|
JsonSerializer.Deserialize<List<Container>>(dto.Containers.GetRawText())
|
||||||
?? new List<Container>();
|
?? new List<Container>();
|
||||||
@@ -337,17 +331,20 @@ public class MonitoringController : Controller
|
|||||||
return BadRequest(new { error = "Invalid Payload", details = errors });
|
return BadRequest(new { error = "Invalid Payload", details = errors });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Liste an Metrics aus der dto erstellen
|
// Liste der eingegangenen Metric
|
||||||
List<ContainerMetric> metrics = new List<ContainerMetric>();
|
List<ContainerMetric> metrics = new List<ContainerMetric>();
|
||||||
|
|
||||||
|
// Json Parser -> Metric Objekt erstellen
|
||||||
|
|
||||||
|
|
||||||
// Metrics in die Datenbank eintragen
|
// Metrics in die Datenbank eintragen
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (ContainerMetric m in metrics)
|
foreach (ContainerMetric cm in metrics)
|
||||||
{
|
{
|
||||||
_context.ContainerMetrics.Add(m);
|
_context.ContainerMetrics.Add(cm);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
// _logger.LogInformation(m. + " added for Host " + c.ServerId);
|
_logger.LogInformation(cm.ContainerId + " Metric received");
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -378,61 +375,52 @@ public class MonitoringController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("cpu-usage")]
|
[HttpGet("cpu-usage")]
|
||||||
public async Task<IActionResult> GetCpuUsageData(int serverId, int hours = 1)
|
public async Task<IActionResult> GetCpuUsageData(int serverId)
|
||||||
{
|
{
|
||||||
var startTime = DateTime.UtcNow.AddHours(-hours);
|
var oneDayAgo = DateTime.UtcNow.AddDays(-1);
|
||||||
var metrics = await _context.Metrics
|
var data = await _context.Metrics
|
||||||
.Where(m => m.Timestamp >= startTime && m.ServerId == serverId)
|
.Where(m => m.Timestamp >= oneDayAgo && m.ServerId == serverId)
|
||||||
.OrderBy(m => m.Timestamp)
|
.OrderBy(m => m.Timestamp)
|
||||||
.ToListAsync();
|
.Select(m => new
|
||||||
|
|
||||||
// Timestamp-Format basierend auf Zeitbereich anpassen
|
|
||||||
string format = hours > 1 ? "dd.MM HH:mm" : "HH:mm";
|
|
||||||
var data = metrics.Select(m => new
|
|
||||||
{
|
{
|
||||||
label = m.Timestamp.ToLocalTime().ToString(format),
|
label = m.Timestamp.ToUniversalTime().ToString("o"),
|
||||||
data = m.CPU_Load
|
data = m.CPU_Load
|
||||||
}).ToList();
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
return Ok(data);
|
return Ok(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("ram-usage")]
|
[HttpGet("ram-usage")]
|
||||||
public async Task<IActionResult> GetRamUsageData(int serverId, int hours = 1)
|
public async Task<IActionResult> GetRamUsageData(int serverId)
|
||||||
{
|
{
|
||||||
var startTime = DateTime.UtcNow.AddHours(-hours);
|
var oneDayAgo = DateTime.UtcNow.AddDays(-1);
|
||||||
var metrics = await _context.Metrics
|
var data = await _context.Metrics
|
||||||
.Where(m => m.Timestamp >= startTime && m.ServerId == serverId)
|
.Where(m => m.Timestamp >= oneDayAgo && m.ServerId == serverId)
|
||||||
.OrderBy(m => m.Timestamp)
|
.OrderBy(m => m.Timestamp)
|
||||||
.ToListAsync();
|
.Select(m => new
|
||||||
|
|
||||||
// Timestamp-Format basierend auf Zeitbereich anpassen
|
|
||||||
string format = hours > 1 ? "dd.MM HH:mm" : "HH:mm";
|
|
||||||
var data = metrics.Select(m => new
|
|
||||||
{
|
{
|
||||||
label = m.Timestamp.ToLocalTime().ToString(format),
|
label = m.Timestamp.ToUniversalTime().ToString("o"),
|
||||||
data = m.RAM_Load
|
data = m.RAM_Load
|
||||||
}).ToList();
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
return Ok(data);
|
return Ok(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("gpu-usage")]
|
[HttpGet("gpu-usage")]
|
||||||
public async Task<IActionResult> GetGpuUsageData(int serverId, int hours = 1)
|
public async Task<IActionResult> GetGpuUsageData(int serverId)
|
||||||
{
|
{
|
||||||
var startTime = DateTime.UtcNow.AddHours(-hours);
|
var oneDayAgo = DateTime.UtcNow.AddDays(-1);
|
||||||
var metrics = await _context.Metrics
|
var data = await _context.Metrics
|
||||||
.Where(m => m.Timestamp >= startTime && m.ServerId == serverId)
|
.Where(m => m.Timestamp >= oneDayAgo && m.ServerId == serverId)
|
||||||
.OrderBy(m => m.Timestamp)
|
.OrderBy(m => m.Timestamp)
|
||||||
.ToListAsync();
|
.Select(m => new
|
||||||
|
|
||||||
// Timestamp-Format basierend auf Zeitbereich anpassen
|
|
||||||
string format = hours > 1 ? "dd.MM HH:mm" : "HH:mm";
|
|
||||||
var data = metrics.Select(m => new
|
|
||||||
{
|
{
|
||||||
label = m.Timestamp.ToLocalTime().ToString(format),
|
label = m.Timestamp.ToUniversalTime().ToString("o"),
|
||||||
data = m.GPU_Load
|
data = m.GPU_Load
|
||||||
}).ToList();
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
return Ok(data);
|
return Ok(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Watcher.Data;
|
using Watcher.Data;
|
||||||
using Watcher.Services;
|
|
||||||
using Watcher.ViewModels;
|
using Watcher.ViewModels;
|
||||||
|
|
||||||
namespace Watcher.Controllers;
|
namespace Watcher.Controllers;
|
||||||
@@ -12,13 +11,11 @@ public class SystemController : Controller
|
|||||||
{
|
{
|
||||||
private readonly AppDbContext _context;
|
private readonly AppDbContext _context;
|
||||||
private readonly ILogger<SystemController> _logger;
|
private readonly ILogger<SystemController> _logger;
|
||||||
private readonly IVersionService _versionService;
|
|
||||||
|
|
||||||
public SystemController(AppDbContext context, ILogger<SystemController> logger, IVersionService versionService)
|
public SystemController(AppDbContext context, ILogger<SystemController> logger)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_versionService = versionService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit-Form anzeigen
|
// Edit-Form anzeigen
|
||||||
@@ -26,32 +23,10 @@ public class SystemController : Controller
|
|||||||
//public async Task<IActionResult> Settings()
|
//public async Task<IActionResult> Settings()
|
||||||
public IActionResult Settings()
|
public IActionResult Settings()
|
||||||
{
|
{
|
||||||
ViewBag.DbProvider = "SQLite";
|
ViewBag.DbProvider = "Microsoft.EntityFrameworkCore.Sqlite";
|
||||||
ViewBag.mail = "test@mail.com";
|
ViewBag.mail = "test@mail.com";
|
||||||
ViewBag.IdentityProvider = "Local";
|
ViewBag.IdentityProvider = "Local";
|
||||||
ViewBag.ServerVersion = _versionService.GetVersion();
|
ViewBag.ServerVersion = "v0.1.0";
|
||||||
|
|
||||||
// Datenbankgröße ermitteln
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dbPath = "./persistence/watcher.db";
|
|
||||||
if (System.IO.File.Exists(dbPath))
|
|
||||||
{
|
|
||||||
var fileInfo = new System.IO.FileInfo(dbPath);
|
|
||||||
var sizeInMiB = fileInfo.Length / (1024.0 * 1024.0);
|
|
||||||
ViewBag.DatabaseSize = $"{sizeInMiB:F2} MiB";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ViewBag.DatabaseSize = "Nicht gefunden";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Fehler beim Ermitteln der Datenbankgröße.");
|
|
||||||
ViewBag.DatabaseSize = "Fehler beim Laden";
|
|
||||||
}
|
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,12 +33,14 @@ public class UserController : Controller
|
|||||||
var username = user.Username;
|
var username = user.Username;
|
||||||
var mail = user.Email;
|
var mail = user.Email;
|
||||||
var Id = user.Id;
|
var Id = user.Id;
|
||||||
|
var IdProvider = user.IdentityProvider;
|
||||||
|
|
||||||
// Anzeigedaten an View übergeben
|
// Anzeigedaten an View übergeben
|
||||||
ViewBag.Claims = claims;
|
ViewBag.Claims = claims;
|
||||||
ViewBag.Name = username;
|
ViewBag.Name = username;
|
||||||
ViewBag.Mail = mail;
|
ViewBag.Mail = mail;
|
||||||
ViewBag.Id = Id;
|
ViewBag.Id = Id;
|
||||||
|
ViewBag.IdProvider = IdProvider;
|
||||||
|
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
|
|||||||
@@ -34,12 +34,25 @@ public class AppDbContext : DbContext
|
|||||||
{
|
{
|
||||||
if (!optionsBuilder.IsConfigured)
|
if (!optionsBuilder.IsConfigured)
|
||||||
{
|
{
|
||||||
// Nur SQLite wird unterstützt
|
var provider = _configuration["Database:Provider"];
|
||||||
|
|
||||||
|
if (provider == "MySql")
|
||||||
|
{
|
||||||
|
var connStr = _configuration.GetConnectionString("MySql")
|
||||||
|
?? _configuration["Database:ConnectionStrings:MySql"];
|
||||||
|
optionsBuilder.UseMySql(connStr, ServerVersion.AutoDetect(connStr));
|
||||||
|
}
|
||||||
|
else if (provider == "Sqlite")
|
||||||
|
{
|
||||||
var connStr = _configuration.GetConnectionString("Sqlite")
|
var connStr = _configuration.GetConnectionString("Sqlite")
|
||||||
?? _configuration["Database:ConnectionStrings:Sqlite"]
|
?? _configuration["Database:ConnectionStrings:Sqlite"];
|
||||||
?? "Data Source=./persistence/watcher.db";
|
|
||||||
optionsBuilder.UseSqlite(connStr);
|
optionsBuilder.UseSqlite(connStr);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Unsupported database provider configured.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
300
Watcher/Migrations/20250617153602_InitialMigration.Designer.cs
generated
Normal file
300
Watcher/Migrations/20250617153602_InitialMigration.Designer.cs
generated
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20250617153602_InitialMigration")]
|
||||||
|
partial class InitialMigration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.6")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<string>("Hostname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<double>("Value")
|
||||||
|
.HasColumnType("double");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("double");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<string>("PocketId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("PreferredUsername")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Image", "Image")
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
|
b.Navigation("Image");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
261
Watcher/Migrations/20250617153602_InitialMigration.cs
Normal file
261
Watcher/Migrations/20250617153602_InitialMigration.cs
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitialMigration : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterDatabase()
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Images",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Tag = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Images", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Tags",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Tags", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Users",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
PocketId = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
PreferredUsername = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Email = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastLogin = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Users", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Containers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Status = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ImageId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
Hostname = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Type = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
IsRunning = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||||
|
TagId = table.Column<int>(type: "int", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Containers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Containers_Images_ImageId",
|
||||||
|
column: x => x.ImageId,
|
||||||
|
principalTable: "Images",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Containers_Tags_TagId",
|
||||||
|
column: x => x.TagId,
|
||||||
|
principalTable: "Tags",
|
||||||
|
principalColumn: "Id");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Servers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
IPAddress = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
Type = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
IsOnline = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||||
|
LastSeen = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
Description = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CpuType = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CpuCores = table.Column<int>(type: "int", nullable: false),
|
||||||
|
GpuType = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
RamSize = table.Column<double>(type: "double", nullable: false),
|
||||||
|
TagId = table.Column<int>(type: "int", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Servers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Servers_Tags_TagId",
|
||||||
|
column: x => x.TagId,
|
||||||
|
principalTable: "Tags",
|
||||||
|
principalColumn: "Id");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "LogEvents",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Timestamp = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
Message = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Level = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ServerId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
ContainerId = table.Column<int>(type: "int", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_LogEvents", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_LogEvents_Containers_ContainerId",
|
||||||
|
column: x => x.ContainerId,
|
||||||
|
principalTable: "Containers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_LogEvents_Servers_ServerId",
|
||||||
|
column: x => x.ServerId,
|
||||||
|
principalTable: "Servers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Metrics",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Timestamp = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
Type = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Value = table.Column<double>(type: "double", nullable: false),
|
||||||
|
ServerId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
ContainerId = table.Column<int>(type: "int", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Metrics", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Metrics_Containers_ContainerId",
|
||||||
|
column: x => x.ContainerId,
|
||||||
|
principalTable: "Containers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Metrics_Servers_ServerId",
|
||||||
|
column: x => x.ServerId,
|
||||||
|
principalTable: "Servers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Containers_ImageId",
|
||||||
|
table: "Containers",
|
||||||
|
column: "ImageId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Containers_TagId",
|
||||||
|
table: "Containers",
|
||||||
|
column: "TagId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_LogEvents_ContainerId",
|
||||||
|
table: "LogEvents",
|
||||||
|
column: "ContainerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_LogEvents_ServerId",
|
||||||
|
table: "LogEvents",
|
||||||
|
column: "ServerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Metrics_ContainerId",
|
||||||
|
table: "Metrics",
|
||||||
|
column: "ContainerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Metrics_ServerId",
|
||||||
|
table: "Metrics",
|
||||||
|
column: "ServerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Servers_TagId",
|
||||||
|
table: "Servers",
|
||||||
|
column: "TagId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "LogEvents");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Images");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Tags");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
298
Watcher/Migrations/20250617165126_ServerPrimaryKey.Designer.cs
generated
Normal file
298
Watcher/Migrations/20250617165126_ServerPrimaryKey.Designer.cs
generated
Normal file
@@ -0,0 +1,298 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20250617165126_ServerPrimaryKey")]
|
||||||
|
partial class ServerPrimaryKey
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Hostname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("Value")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PocketId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PreferredUsername")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Image", "Image")
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
|
b.Navigation("Image");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
785
Watcher/Migrations/20250617165126_ServerPrimaryKey.cs
Normal file
785
Watcher/Migrations/20250617165126_ServerPrimaryKey.cs
Normal file
@@ -0,0 +1,785 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class ServerPrimaryKey : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "PreferredUsername",
|
||||||
|
table: "Users",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "PocketId",
|
||||||
|
table: "Users",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "LastLogin",
|
||||||
|
table: "Users",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "datetime(6)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Email",
|
||||||
|
table: "Users",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Users",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Tags",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Tags",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Type",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "TagId",
|
||||||
|
table: "Servers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<double>(
|
||||||
|
name: "RamSize",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(double),
|
||||||
|
oldType: "double");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "LastSeen",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "datetime(6)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsOnline",
|
||||||
|
table: "Servers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "tinyint(1)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "IPAddress",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "GpuType",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Description",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "CreatedAt",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "datetime(6)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "CpuType",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "CpuCores",
|
||||||
|
table: "Servers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Servers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<double>(
|
||||||
|
name: "Value",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(double),
|
||||||
|
oldType: "double");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Type",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "Timestamp",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "datetime(6)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ServerId",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ContainerId",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "Timestamp",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "datetime(6)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ServerId",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Message",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Level",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ContainerId",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Tag",
|
||||||
|
table: "Images",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Images",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Images",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Type",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "TagId",
|
||||||
|
table: "Containers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Status",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsRunning",
|
||||||
|
table: "Containers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "tinyint(1)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ImageId",
|
||||||
|
table: "Containers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Hostname",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "CreatedAt",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "datetime(6)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Containers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "PreferredUsername",
|
||||||
|
table: "Users",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "PocketId",
|
||||||
|
table: "Users",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "LastLogin",
|
||||||
|
table: "Users",
|
||||||
|
type: "datetime(6)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Email",
|
||||||
|
table: "Users",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Users",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Tags",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Tags",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Type",
|
||||||
|
table: "Servers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "TagId",
|
||||||
|
table: "Servers",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<double>(
|
||||||
|
name: "RamSize",
|
||||||
|
table: "Servers",
|
||||||
|
type: "double",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(double),
|
||||||
|
oldType: "REAL");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Servers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "LastSeen",
|
||||||
|
table: "Servers",
|
||||||
|
type: "datetime(6)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsOnline",
|
||||||
|
table: "Servers",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "INTEGER");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "IPAddress",
|
||||||
|
table: "Servers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "GpuType",
|
||||||
|
table: "Servers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Description",
|
||||||
|
table: "Servers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "CreatedAt",
|
||||||
|
table: "Servers",
|
||||||
|
type: "datetime(6)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "CpuType",
|
||||||
|
table: "Servers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "CpuCores",
|
||||||
|
table: "Servers",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Servers",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<double>(
|
||||||
|
name: "Value",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "double",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(double),
|
||||||
|
oldType: "REAL");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Type",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "Timestamp",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "datetime(6)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ServerId",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ContainerId",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "Timestamp",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "datetime(6)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ServerId",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Message",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Level",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ContainerId",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "LogEvents",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Tag",
|
||||||
|
table: "Images",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Images",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Images",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Type",
|
||||||
|
table: "Containers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "TagId",
|
||||||
|
table: "Containers",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Status",
|
||||||
|
table: "Containers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Containers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsRunning",
|
||||||
|
table: "Containers",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "INTEGER");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ImageId",
|
||||||
|
table: "Containers",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Hostname",
|
||||||
|
table: "Containers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "CreatedAt",
|
||||||
|
table: "Containers",
|
||||||
|
type: "datetime(6)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Id",
|
||||||
|
table: "Containers",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER")
|
||||||
|
.Annotation("Sqlite:Autoincrement", true)
|
||||||
|
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
306
Watcher/Migrations/20250617174242_UserPasswordAdded.Designer.cs
generated
Normal file
306
Watcher/Migrations/20250617174242_UserPasswordAdded.Designer.cs
generated
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20250617174242_UserPasswordAdded")]
|
||||||
|
partial class UserPasswordAdded
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Hostname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("Value")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PocketId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PreferredUsername")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Image", "Image")
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
|
b.Navigation("Image");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
Watcher/Migrations/20250617174242_UserPasswordAdded.cs
Normal file
40
Watcher/Migrations/20250617174242_UserPasswordAdded.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class UserPasswordAdded : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "IdentityProvider",
|
||||||
|
table: "Users",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Password",
|
||||||
|
table: "Users",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IdentityProvider",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Password",
|
||||||
|
table: "Users");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
316
Watcher/Migrations/20250621124832_DB-Update Issue#32.Designer.cs
generated
Normal file
316
Watcher/Migrations/20250621124832_DB-Update Issue#32.Designer.cs
generated
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20250621124832_DB-Update Issue#32")]
|
||||||
|
partial class DBUpdateIssue32
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Hostname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_In")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_Out")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Image", "Image")
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
|
b.Navigation("Image");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
251
Watcher/Migrations/20250621124832_DB-Update Issue#32.cs
Normal file
251
Watcher/Migrations/20250621124832_DB-Update Issue#32.cs
Normal file
@@ -0,0 +1,251 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class DBUpdateIssue32 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Metrics_Containers_ContainerId",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Metrics_Servers_ServerId",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Metrics_ContainerId",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Metrics_ServerId",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PocketId",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ContainerId",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Type",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "PreferredUsername",
|
||||||
|
table: "Users",
|
||||||
|
newName: "Username");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Value",
|
||||||
|
table: "Metrics",
|
||||||
|
newName: "RAM_Size");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "OIDC_Id",
|
||||||
|
table: "Users",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "CPU_Load",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "CPU_Temp",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "DISK_Size",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "DISK_Temp",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "DISK_Usage",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "GPU_Load",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "GPU_Temp",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "GPU_Vram_Size",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "GPU_Vram_Usage",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "NET_In",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "NET_Out",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "RAM_Load",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "OIDC_Id",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CPU_Load",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CPU_Temp",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DISK_Size",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DISK_Temp",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DISK_Usage",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GPU_Load",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GPU_Temp",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GPU_Vram_Size",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GPU_Vram_Usage",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "NET_In",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "NET_Out",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "RAM_Load",
|
||||||
|
table: "Metrics");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Username",
|
||||||
|
table: "Users",
|
||||||
|
newName: "PreferredUsername");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "RAM_Size",
|
||||||
|
table: "Metrics",
|
||||||
|
newName: "Value");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "PocketId",
|
||||||
|
table: "Users",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ContainerId",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Type",
|
||||||
|
table: "Metrics",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Metrics_ContainerId",
|
||||||
|
table: "Metrics",
|
||||||
|
column: "ContainerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Metrics_ServerId",
|
||||||
|
table: "Metrics",
|
||||||
|
column: "ServerId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Metrics_Containers_ContainerId",
|
||||||
|
table: "Metrics",
|
||||||
|
column: "ContainerId",
|
||||||
|
principalTable: "Containers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Metrics_Servers_ServerId",
|
||||||
|
table: "Metrics",
|
||||||
|
column: "ServerId",
|
||||||
|
principalTable: "Servers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
319
Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.Designer.cs
generated
Normal file
319
Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.Designer.cs
generated
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20250621125157_DB-Update Issue#32 IsVerified-Servers")]
|
||||||
|
partial class DBUpdateIssue32IsVerifiedServers
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Hostname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_In")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_Out")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsVerified")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Image", "Image")
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
|
b.Navigation("Image");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class DBUpdateIssue32IsVerifiedServers : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "IsVerified",
|
||||||
|
table: "Servers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IsVerified",
|
||||||
|
table: "Servers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
332
Watcher/Migrations/20250710090920_container-attribute.Designer.cs
generated
Normal file
332
Watcher/Migrations/20250710090920_container-attribute.Designer.cs
generated
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20250710090920_container-attribute")]
|
||||||
|
partial class containerattribute
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("ExposedPort")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Health")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("HostServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Image")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("InternalPort")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("HostServerId");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_In")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_Out")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsVerified")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Server", "HostServer")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("HostServerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Image", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
|
b.Navigation("HostServer");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
119
Watcher/Migrations/20250710090920_container-attribute.cs
Normal file
119
Watcher/Migrations/20250710090920_container-attribute.cs
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class containerattribute : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Hostname",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Type",
|
||||||
|
table: "Containers",
|
||||||
|
newName: "Health");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ExposedPort",
|
||||||
|
table: "Containers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "HostServerId",
|
||||||
|
table: "Containers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Image",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "InternalPort",
|
||||||
|
table: "Containers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Containers_HostServerId",
|
||||||
|
table: "Containers",
|
||||||
|
column: "HostServerId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Containers_Servers_HostServerId",
|
||||||
|
table: "Containers",
|
||||||
|
column: "HostServerId",
|
||||||
|
principalTable: "Servers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Containers_Servers_HostServerId",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Containers_HostServerId",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ExposedPort",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "HostServerId",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Image",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "InternalPort",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Health",
|
||||||
|
table: "Containers",
|
||||||
|
newName: "Type");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Hostname",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
335
Watcher/Migrations/20250730113936_DiskSpace-ServerAttribute.Designer.cs
generated
Normal file
335
Watcher/Migrations/20250730113936_DiskSpace-ServerAttribute.Designer.cs
generated
Normal file
@@ -0,0 +1,335 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20250730113936_DiskSpace-ServerAttribute")]
|
||||||
|
partial class DiskSpaceServerAttribute
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("ExposedPort")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Health")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("HostServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Image")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("InternalPort")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("HostServerId");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_In")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_Out")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("DiskSpace")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsVerified")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Server", "HostServer")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("HostServerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Image", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
|
b.Navigation("HostServer");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class DiskSpaceServerAttribute : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "DiskSpace",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DiskSpace",
|
||||||
|
table: "Servers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
377
Watcher/Migrations/20250730172010_MeasurementWarnings.Designer.cs
generated
Normal file
377
Watcher/Migrations/20250730172010_MeasurementWarnings.Designer.cs
generated
Normal file
@@ -0,0 +1,377 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20250730172010_MeasurementWarnings")]
|
||||||
|
partial class MeasurementWarnings
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("ExposedPort")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Health")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("HostServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Image")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("InternalPort")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("HostServerId");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_In")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_Out")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("DiskSpace")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("Disk_Usage_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("Disk_Usage_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsVerified")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Server", "HostServer")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("HostServerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Image", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
|
b.Navigation("HostServer");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
172
Watcher/Migrations/20250730172010_MeasurementWarnings.cs
Normal file
172
Watcher/Migrations/20250730172010_MeasurementWarnings.cs
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class MeasurementWarnings : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "CPU_Load_Critical",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "CPU_Load_Warning",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "CPU_Temp_Critical",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "CPU_Temp_Warning",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "DISK_Temp_Critical",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "DISK_Temp_Warning",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "Disk_Usage_Critical",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "Disk_Usage_Warning",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "GPU_Load_Critical",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "GPU_Load_Warning",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "GPU_Temp_Critical",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "GPU_Temp_Warning",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "RAM_Load_Critical",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<double>(
|
||||||
|
name: "RAM_Load_Warning",
|
||||||
|
table: "Servers",
|
||||||
|
type: "REAL",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CPU_Load_Critical",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CPU_Load_Warning",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CPU_Temp_Critical",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CPU_Temp_Warning",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DISK_Temp_Critical",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DISK_Temp_Warning",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Disk_Usage_Critical",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Disk_Usage_Warning",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GPU_Load_Critical",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GPU_Load_Warning",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GPU_Temp_Critical",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GPU_Temp_Warning",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "RAM_Load_Critical",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "RAM_Load_Warning",
|
||||||
|
table: "Servers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,8 +11,8 @@ using Watcher.Data;
|
|||||||
namespace Watcher.Migrations
|
namespace Watcher.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AppDbContext))]
|
[DbContext(typeof(AppDbContext))]
|
||||||
[Migration("20251105183329_InitialMigration")]
|
[Migration("20251003135555_ContainerUpdate")]
|
||||||
partial class InitialMigration
|
partial class ContainerUpdate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -27,12 +27,10 @@ namespace Watcher.Migrations
|
|||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("ContainerId")
|
b.Property<string>("ContainerId")
|
||||||
.HasColumnType("TEXT")
|
.HasColumnType("TEXT");
|
||||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
|
||||||
|
|
||||||
b.Property<string>("Image")
|
b.Property<string>("Image")
|
||||||
.HasColumnType("TEXT")
|
.HasColumnType("TEXT");
|
||||||
.HasAnnotation("Relational:JsonPropertyName", "image");
|
|
||||||
|
|
||||||
b.Property<int?>("ImageId")
|
b.Property<int?>("ImageId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
@@ -41,12 +39,10 @@ namespace Watcher.Migrations
|
|||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.HasColumnType("TEXT")
|
.HasColumnType("TEXT");
|
||||||
.HasAnnotation("Relational:JsonPropertyName", "name");
|
|
||||||
|
|
||||||
b.Property<int>("ServerId")
|
b.Property<int>("ServerId")
|
||||||
.HasColumnType("INTEGER")
|
.HasColumnType("INTEGER");
|
||||||
.HasAnnotation("Relational:JsonPropertyName", "Server_id");
|
|
||||||
|
|
||||||
b.Property<int?>("TagId")
|
b.Property<int?>("TagId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
@@ -60,35 +56,6 @@ namespace Watcher.Migrations
|
|||||||
b.ToTable("Containers");
|
b.ToTable("Containers");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Watcher.Models.ContainerMetric", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<double>("CPU_Load")
|
|
||||||
.HasColumnType("REAL");
|
|
||||||
|
|
||||||
b.Property<double>("CPU_Temp")
|
|
||||||
.HasColumnType("REAL");
|
|
||||||
|
|
||||||
b.Property<int?>("ContainerId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<double>("RAM_Load")
|
|
||||||
.HasColumnType("REAL");
|
|
||||||
|
|
||||||
b.Property<double>("RAM_Size")
|
|
||||||
.HasColumnType("REAL");
|
|
||||||
|
|
||||||
b.Property<DateTime>("Timestamp")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("ContainerMetrics");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Watcher.Models.Image", b =>
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -315,16 +282,22 @@ namespace Watcher.Migrations
|
|||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("LastLogin")
|
b.Property<DateTime>("LastLogin")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Password")
|
b.Property<string>("Password")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Username")
|
b.Property<string>("Username")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
113
Watcher/Migrations/20251003135555_ContainerUpdate.cs
Normal file
113
Watcher/Migrations/20251003135555_ContainerUpdate.cs
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class ContainerUpdate : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Containers_Servers_HostServerId",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Containers_HostServerId",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CreatedAt",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ExposedPort",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Health",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "HostServerId",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Status",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "InternalPort",
|
||||||
|
table: "Containers",
|
||||||
|
newName: "ServerId");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ContainerId",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ContainerId",
|
||||||
|
table: "Containers");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "ServerId",
|
||||||
|
table: "Containers",
|
||||||
|
newName: "InternalPort");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "CreatedAt",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ExposedPort",
|
||||||
|
table: "Containers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Health",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "HostServerId",
|
||||||
|
table: "Containers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Status",
|
||||||
|
table: "Containers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Containers_HostServerId",
|
||||||
|
table: "Containers",
|
||||||
|
column: "HostServerId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Containers_Servers_HostServerId",
|
||||||
|
table: "Containers",
|
||||||
|
column: "HostServerId",
|
||||||
|
principalTable: "Servers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
355
Watcher/Migrations/20251029105954_container-changed.Designer.cs
generated
Normal file
355
Watcher/Migrations/20251029105954_container-changed.Designer.cs
generated
Normal file
@@ -0,0 +1,355 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20251029105954_container-changed")]
|
||||||
|
partial class containerchanged
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ContainerId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Image")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_In")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_Out")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("DiskSpace")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("Disk_Usage_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("Disk_Usage_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsVerified")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Image", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Watcher/Migrations/20251029105954_container-changed.cs
Normal file
22
Watcher/Migrations/20251029105954_container-changed.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class containerchanged : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
355
Watcher/Migrations/20251029125404_ContainerMetrics-Added.Designer.cs
generated
Normal file
355
Watcher/Migrations/20251029125404_ContainerMetrics-Added.Designer.cs
generated
Normal file
@@ -0,0 +1,355 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Watcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20251029125404_ContainerMetrics-Added")]
|
||||||
|
partial class ContainerMetricsAdded
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ContainerId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Image")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRunning")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("ContainerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ContainerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("LogEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Vram_Usage")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_In")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("NET_Out")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Size")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Timestamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Metrics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Load_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("CPU_Temp_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int>("CpuCores")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("CpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("DISK_Temp_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("DiskSpace")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("Disk_Usage_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("Disk_Usage_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Load_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("GPU_Temp_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<string>("GpuType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IPAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOnline")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsVerified")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastSeen")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load_Critical")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RAM_Load_Warning")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<double>("RamSize")
|
||||||
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
b.Property<int?>("TagId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
|
b.ToTable("Servers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Image", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Containers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Container", "Container")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContainerId");
|
||||||
|
|
||||||
|
b.HasOne("Watcher.Models.Server", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
|
||||||
|
b.Navigation("Container");
|
||||||
|
|
||||||
|
b.Navigation("Server");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
|
.WithMany("Servers")
|
||||||
|
.HasForeignKey("TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Containers");
|
||||||
|
|
||||||
|
b.Navigation("Servers");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Watcher/Migrations/20251029125404_ContainerMetrics-Added.cs
Normal file
22
Watcher/Migrations/20251029125404_ContainerMetrics-Added.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class ContainerMetricsAdded : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,8 +11,8 @@ using Watcher.Data;
|
|||||||
namespace Watcher.Migrations
|
namespace Watcher.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AppDbContext))]
|
[DbContext(typeof(AppDbContext))]
|
||||||
[Migration("20251105201056_AddContainerServerNavigation")]
|
[Migration("20251030093420_ContainerMetricChange")]
|
||||||
partial class AddContainerServerNavigation
|
partial class ContainerMetricChange
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -55,8 +55,6 @@ namespace Watcher.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ImageId");
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
b.HasIndex("ServerId");
|
|
||||||
|
|
||||||
b.HasIndex("TagId");
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
b.ToTable("Containers");
|
b.ToTable("Containers");
|
||||||
@@ -69,19 +67,28 @@ namespace Watcher.Migrations
|
|||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<double>("CPU_Load")
|
b.Property<double>("CPU_Load")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("REAL")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "cpu_load");
|
||||||
b.Property<double>("CPU_Temp")
|
|
||||||
.HasColumnType("REAL");
|
|
||||||
|
|
||||||
b.Property<int?>("ContainerId")
|
b.Property<int?>("ContainerId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "container_id");
|
||||||
|
|
||||||
|
b.Property<double>("NET_in")
|
||||||
|
.HasColumnType("REAL")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "net_in");
|
||||||
|
|
||||||
|
b.Property<double>("NET_out")
|
||||||
|
.HasColumnType("REAL")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "net_out");
|
||||||
|
|
||||||
b.Property<double>("RAM_Load")
|
b.Property<double>("RAM_Load")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("REAL")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "ram_load");
|
||||||
|
|
||||||
b.Property<double>("RAM_Size")
|
b.Property<int?>("ServerId")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("INTEGER")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "server_id");
|
||||||
|
|
||||||
b.Property<DateTime>("Timestamp")
|
b.Property<DateTime>("Timestamp")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@@ -317,16 +324,22 @@ namespace Watcher.Migrations
|
|||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("LastLogin")
|
b.Property<DateTime>("LastLogin")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Password")
|
b.Property<string>("Password")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Username")
|
b.Property<string>("Username")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
@@ -340,17 +353,9 @@ namespace Watcher.Migrations
|
|||||||
.WithMany("Containers")
|
.WithMany("Containers")
|
||||||
.HasForeignKey("ImageId");
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
b.HasOne("Watcher.Models.Server", "Server")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ServerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Watcher.Models.Tag", null)
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
.WithMany("Containers")
|
.WithMany("Containers")
|
||||||
.HasForeignKey("TagId");
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
b.Navigation("Server");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
41
Watcher/Migrations/20251030093420_ContainerMetricChange.cs
Normal file
41
Watcher/Migrations/20251030093420_ContainerMetricChange.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Watcher.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class ContainerMetricChange : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ContainerMetrics",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Timestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
ContainerId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||||
|
ServerId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||||
|
CPU_Load = table.Column<double>(type: "REAL", nullable: false),
|
||||||
|
RAM_Load = table.Column<double>(type: "REAL", nullable: false),
|
||||||
|
NET_in = table.Column<double>(type: "REAL", nullable: false),
|
||||||
|
NET_out = table.Column<double>(type: "REAL", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ContainerMetrics", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ContainerMetrics");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,257 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Watcher.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class InitialMigration : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "ContainerMetrics",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Timestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
||||||
ContainerId = table.Column<int>(type: "INTEGER", nullable: true),
|
|
||||||
CPU_Load = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
CPU_Temp = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
RAM_Size = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
RAM_Load = table.Column<double>(type: "REAL", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_ContainerMetrics", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Images",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Name = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
Tag = table.Column<string>(type: "TEXT", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Images", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Metrics",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Timestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
||||||
ServerId = table.Column<int>(type: "INTEGER", nullable: true),
|
|
||||||
CPU_Load = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
CPU_Temp = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
GPU_Load = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
GPU_Temp = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
GPU_Vram_Size = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
GPU_Vram_Usage = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
RAM_Size = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
RAM_Load = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
DISK_Size = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
DISK_Usage = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
DISK_Temp = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
NET_In = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
NET_Out = table.Column<double>(type: "REAL", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Metrics", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Tags",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Name = table.Column<string>(type: "TEXT", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Tags", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Users",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Username = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
|
|
||||||
Email = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
LastLogin = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
||||||
Password = table.Column<string>(type: "TEXT", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Users", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Containers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
ServerId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
||||||
ContainerId = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
Image = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
Name = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
IsRunning = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
||||||
ImageId = table.Column<int>(type: "INTEGER", nullable: true),
|
|
||||||
TagId = table.Column<int>(type: "INTEGER", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Containers", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Containers_Images_ImageId",
|
|
||||||
column: x => x.ImageId,
|
|
||||||
principalTable: "Images",
|
|
||||||
principalColumn: "Id");
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Containers_Tags_TagId",
|
|
||||||
column: x => x.TagId,
|
|
||||||
principalTable: "Tags",
|
|
||||||
principalColumn: "Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Servers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
|
||||||
IPAddress = table.Column<string>(type: "TEXT", nullable: false),
|
|
||||||
Type = table.Column<string>(type: "TEXT", nullable: false),
|
|
||||||
Description = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
CpuType = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
CpuCores = table.Column<int>(type: "INTEGER", nullable: false),
|
|
||||||
GpuType = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
RamSize = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
DiskSpace = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
CPU_Load_Warning = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
CPU_Load_Critical = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
CPU_Temp_Warning = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
CPU_Temp_Critical = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
RAM_Load_Warning = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
RAM_Load_Critical = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
GPU_Load_Warning = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
GPU_Load_Critical = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
GPU_Temp_Warning = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
GPU_Temp_Critical = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
Disk_Usage_Warning = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
Disk_Usage_Critical = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
DISK_Temp_Warning = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
DISK_Temp_Critical = table.Column<double>(type: "REAL", nullable: false),
|
|
||||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
||||||
IsOnline = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
||||||
LastSeen = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
||||||
IsVerified = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
||||||
TagId = table.Column<int>(type: "INTEGER", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Servers", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Servers_Tags_TagId",
|
|
||||||
column: x => x.TagId,
|
|
||||||
principalTable: "Tags",
|
|
||||||
principalColumn: "Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "LogEvents",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Timestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
||||||
Message = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
Level = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
ServerId = table.Column<int>(type: "INTEGER", nullable: true),
|
|
||||||
ContainerId = table.Column<int>(type: "INTEGER", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_LogEvents", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_LogEvents_Containers_ContainerId",
|
|
||||||
column: x => x.ContainerId,
|
|
||||||
principalTable: "Containers",
|
|
||||||
principalColumn: "Id");
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_LogEvents_Servers_ServerId",
|
|
||||||
column: x => x.ServerId,
|
|
||||||
principalTable: "Servers",
|
|
||||||
principalColumn: "Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Containers_ImageId",
|
|
||||||
table: "Containers",
|
|
||||||
column: "ImageId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Containers_TagId",
|
|
||||||
table: "Containers",
|
|
||||||
column: "TagId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_LogEvents_ContainerId",
|
|
||||||
table: "LogEvents",
|
|
||||||
column: "ContainerId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_LogEvents_ServerId",
|
|
||||||
table: "LogEvents",
|
|
||||||
column: "ServerId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Servers_TagId",
|
|
||||||
table: "Servers",
|
|
||||||
column: "TagId");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "ContainerMetrics");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "LogEvents");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Metrics");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Users");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Containers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Servers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Images");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Tags");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Watcher.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class AddContainerServerNavigation : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Containers_ServerId",
|
|
||||||
table: "Containers",
|
|
||||||
column: "ServerId");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Containers_Servers_ServerId",
|
|
||||||
table: "Containers",
|
|
||||||
column: "ServerId",
|
|
||||||
principalTable: "Servers",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Containers_Servers_ServerId",
|
|
||||||
table: "Containers");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_Containers_ServerId",
|
|
||||||
table: "Containers");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -52,8 +52,6 @@ namespace Watcher.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ImageId");
|
b.HasIndex("ImageId");
|
||||||
|
|
||||||
b.HasIndex("ServerId");
|
|
||||||
|
|
||||||
b.HasIndex("TagId");
|
b.HasIndex("TagId");
|
||||||
|
|
||||||
b.ToTable("Containers");
|
b.ToTable("Containers");
|
||||||
@@ -66,19 +64,28 @@ namespace Watcher.Migrations
|
|||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<double>("CPU_Load")
|
b.Property<double>("CPU_Load")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("REAL")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "cpu_load");
|
||||||
b.Property<double>("CPU_Temp")
|
|
||||||
.HasColumnType("REAL");
|
|
||||||
|
|
||||||
b.Property<int?>("ContainerId")
|
b.Property<int?>("ContainerId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "container_id");
|
||||||
|
|
||||||
|
b.Property<double>("NET_in")
|
||||||
|
.HasColumnType("REAL")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "net_in");
|
||||||
|
|
||||||
|
b.Property<double>("NET_out")
|
||||||
|
.HasColumnType("REAL")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "net_out");
|
||||||
|
|
||||||
b.Property<double>("RAM_Load")
|
b.Property<double>("RAM_Load")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("REAL")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "ram_load");
|
||||||
|
|
||||||
b.Property<double>("RAM_Size")
|
b.Property<int?>("ServerId")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("INTEGER")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "server_id");
|
||||||
|
|
||||||
b.Property<DateTime>("Timestamp")
|
b.Property<DateTime>("Timestamp")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@@ -314,16 +321,22 @@ namespace Watcher.Migrations
|
|||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IdentityProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("LastLogin")
|
b.Property<DateTime>("LastLogin")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OIDC_Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Password")
|
b.Property<string>("Password")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Username")
|
b.Property<string>("Username")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
@@ -337,17 +350,9 @@ namespace Watcher.Migrations
|
|||||||
.WithMany("Containers")
|
.WithMany("Containers")
|
||||||
.HasForeignKey("ImageId");
|
.HasForeignKey("ImageId");
|
||||||
|
|
||||||
b.HasOne("Watcher.Models.Server", "Server")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ServerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Watcher.Models.Tag", null)
|
b.HasOne("Watcher.Models.Tag", null)
|
||||||
.WithMany("Containers")
|
.WithMany("Containers")
|
||||||
.HasForeignKey("TagId");
|
.HasForeignKey("TagId");
|
||||||
|
|
||||||
b.Navigation("Server");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||||
|
|||||||
@@ -5,13 +5,9 @@ namespace Watcher.Models;
|
|||||||
public class Container
|
public class Container
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("Server_id")]
|
[JsonPropertyName("Server_id")]
|
||||||
public int ServerId { get; set; }
|
public int ServerId { get; set; }
|
||||||
|
|
||||||
// Navigation Property
|
|
||||||
public Server Server { get; set; } = null!;
|
|
||||||
|
|
||||||
[JsonPropertyName("id")]
|
[JsonPropertyName("id")]
|
||||||
public String? ContainerId { get; set; }
|
public String? ContainerId { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Watcher.Models;
|
namespace Watcher.Models;
|
||||||
|
|
||||||
public class ContainerMetric
|
public class ContainerMetric
|
||||||
@@ -6,19 +8,26 @@ public class ContainerMetric
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public DateTime Timestamp { get; set; }
|
public DateTime Timestamp { get; set; }
|
||||||
|
|
||||||
|
// allgemeine Conainer Informationen
|
||||||
// Zuordnung zu einem Container -- Foreign Key
|
[JsonPropertyName("container_id")]
|
||||||
public int? ContainerId { get; set; }
|
public int? ContainerId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("server_id")]
|
||||||
|
public int? ServerId { get; set; }
|
||||||
|
|
||||||
// CPU-Daten
|
// CPU-Daten
|
||||||
|
[JsonPropertyName("cpu_load")]
|
||||||
public double CPU_Load { get; set; } = 0.0; // %
|
public double CPU_Load { get; set; } = 0.0; // %
|
||||||
|
|
||||||
public double CPU_Temp { get; set; } = 0.0; // deg C
|
|
||||||
|
|
||||||
// RAM-Daten
|
// RAM-Daten
|
||||||
public double RAM_Size { get; set; } = 0.0; // GB
|
[JsonPropertyName("ram_load")]
|
||||||
|
|
||||||
public double RAM_Load { get; set; } = 0.0; // %
|
public double RAM_Load { get; set; } = 0.0; // %
|
||||||
|
|
||||||
|
// Network-Daten
|
||||||
|
[JsonPropertyName("net_in")]
|
||||||
|
public double NET_in { get; set; } = 0.0; // Bit
|
||||||
|
|
||||||
|
[JsonPropertyName("net_out")]
|
||||||
|
public double NET_out { get; set; } = 0.0; // Bit
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,18 +7,16 @@ public class User
|
|||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; } // PK
|
||||||
|
public string? OIDC_Id { get; set; } = null!;
|
||||||
|
public string Username { get; set; } = null!;
|
||||||
|
public string? Email { get; set; }
|
||||||
|
public DateTime LastLogin { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[StringLength(50)]
|
public string IdentityProvider { get; set; } = "local";
|
||||||
public string Username { get; set; } = null!;
|
|
||||||
|
|
||||||
[EmailAddress]
|
|
||||||
public string? Email { get; set; }
|
|
||||||
|
|
||||||
public DateTime LastLogin { get; set; } = DateTime.UtcNow;
|
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
public string Password { get; set; } = string.Empty;
|
public String? Password { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
|
||||||
@@ -6,6 +7,8 @@ using Serilog;
|
|||||||
using Watcher.Data;
|
using Watcher.Data;
|
||||||
using Watcher.Models;
|
using Watcher.Models;
|
||||||
using Watcher.Services;
|
using Watcher.Services;
|
||||||
|
//using Watcher.Services;
|
||||||
|
//using Watcher.Workers;
|
||||||
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
@@ -35,14 +38,10 @@ builder.Services.AddHttpContextAccessor();
|
|||||||
// Storage Singleton
|
// Storage Singleton
|
||||||
builder.Services.AddSingleton<IDashboardStore, DashboardStore>();
|
builder.Services.AddSingleton<IDashboardStore, DashboardStore>();
|
||||||
builder.Services.AddSingleton<ISystemStore, SystemStore>();
|
builder.Services.AddSingleton<ISystemStore, SystemStore>();
|
||||||
builder.Services.AddSingleton<IVersionService, VersionService>();
|
|
||||||
builder.Services.AddSingleton<IUpdateCheckStore, UpdateCheckStore>();
|
|
||||||
|
|
||||||
// Background Services
|
// Background Services
|
||||||
builder.Services.AddHostedService<NetworkCheck>();
|
builder.Services.AddHostedService<NetworkCheck>();
|
||||||
builder.Services.AddHostedService<DatabaseCheck>();
|
builder.Services.AddHostedService<DatabaseCheck>();
|
||||||
builder.Services.AddHostedService<MetricCleanupService>();
|
|
||||||
builder.Services.AddHostedService<UpdateCheckService>();
|
|
||||||
|
|
||||||
// Swagger API-Dokumentation
|
// Swagger API-Dokumentation
|
||||||
builder.Services.AddSwaggerGen(options =>
|
builder.Services.AddSwaggerGen(options =>
|
||||||
@@ -63,27 +62,108 @@ var configuration = builder.Configuration;
|
|||||||
|
|
||||||
|
|
||||||
// ---------- DB-Kontext ----------
|
// ---------- DB-Kontext ----------
|
||||||
// Nur SQLite wird unterstützt
|
var dbProvider = configuration["Database:Provider"] ?? "MySQL";
|
||||||
var sqliteConnectionString = configuration.GetConnectionString("Sqlite")
|
var connectionString = configuration["Database:ConnectionString"];
|
||||||
?? configuration["Database:ConnectionStrings:Sqlite"]
|
|
||||||
?? "Data Source=./persistence/watcher.db";
|
|
||||||
|
|
||||||
builder.Services.AddDbContext<AppDbContext>((serviceProvider, options) =>
|
builder.Services.AddDbContext<AppDbContext>((serviceProvider, options) =>
|
||||||
{
|
{
|
||||||
options.UseSqlite(sqliteConnectionString);
|
var config = serviceProvider.GetRequiredService<IConfiguration>();
|
||||||
|
var provider = dbProvider;
|
||||||
|
|
||||||
|
if (provider == "MySql")
|
||||||
|
{
|
||||||
|
var connStr = config.GetConnectionString("MySql") ?? config["Database:ConnectionStrings:MySql"];
|
||||||
|
options.UseMySql(connStr, ServerVersion.AutoDetect(connStr));
|
||||||
|
}
|
||||||
|
else if (provider == "Sqlite")
|
||||||
|
{
|
||||||
|
var connStr = config.GetConnectionString("Sqlite") ?? config["Database:ConnectionStrings:Sqlite"];
|
||||||
|
options.UseSqlite(connStr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Unsupported database provider configured.");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// ---------- Authentifizierung konfigurieren ----------
|
// ---------- Authentifizierung konfigurieren ----------
|
||||||
// Nur Cookie-basierte lokale Authentifizierung
|
// PocketID nur konfigurieren, wenn aktiviert
|
||||||
builder.Services.AddAuthentication("Cookies")
|
var pocketIdSection = builder.Configuration.GetSection("Authentication:PocketID");
|
||||||
.AddCookie("Cookies", options =>
|
var pocketIdEnabled = pocketIdSection.GetValue<bool>("Enabled");
|
||||||
|
|
||||||
|
|
||||||
|
var auth = builder.Services.AddAuthentication("Cookies");
|
||||||
|
auth.AddCookie("Cookies", options =>
|
||||||
{
|
{
|
||||||
options.LoginPath = "/Auth/Login";
|
options.LoginPath = "/Auth/Login";
|
||||||
options.AccessDeniedPath = "/Auth/AccessDenied";
|
options.AccessDeniedPath = "/Auth/AccessDenied";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
builder.Services.AddAuthentication()
|
||||||
|
.AddOpenIdConnect("oidc", options =>
|
||||||
|
{
|
||||||
|
options.Authority = pocketIdSection["Authority"];
|
||||||
|
options.ClientId = pocketIdSection["ClientId"];
|
||||||
|
options.ClientSecret = pocketIdSection["ClientSecret"];
|
||||||
|
options.ResponseType = "code";
|
||||||
|
options.CallbackPath = pocketIdSection["CallbackPath"];
|
||||||
|
options.SaveTokens = true;
|
||||||
|
|
||||||
|
options.GetClaimsFromUserInfoEndpoint = true;
|
||||||
|
|
||||||
|
options.Scope.Clear();
|
||||||
|
options.Scope.Add("openid");
|
||||||
|
options.Scope.Add("profile");
|
||||||
|
options.Scope.Add("email");
|
||||||
|
|
||||||
|
options.Events = new OpenIdConnectEvents
|
||||||
|
{
|
||||||
|
OnTokenValidated = async ctx =>
|
||||||
|
{
|
||||||
|
var db = ctx.HttpContext.RequestServices.GetRequiredService<AppDbContext>();
|
||||||
|
|
||||||
|
var principal = ctx.Principal;
|
||||||
|
#pragma warning disable CS8602 // Dereference of a possibly null reference.
|
||||||
|
|
||||||
|
var pocketId = principal.FindFirst("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")?.Value;
|
||||||
|
#pragma warning restore CS8602 // Dereference of a possibly null reference.
|
||||||
|
|
||||||
|
var preferredUsername = principal.FindFirst("preferred_username")?.Value;
|
||||||
|
var email = principal.FindFirst("email")?.Value;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(pocketId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var user = await db.Users.FirstOrDefaultAsync(u => u.OIDC_Id == pocketId);
|
||||||
|
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
user = new User
|
||||||
|
{
|
||||||
|
OIDC_Id = pocketId,
|
||||||
|
Username = preferredUsername ?? "",
|
||||||
|
Email = email,
|
||||||
|
LastLogin = DateTime.UtcNow,
|
||||||
|
IdentityProvider = "oidc",
|
||||||
|
Password = string.Empty
|
||||||
|
};
|
||||||
|
db.Users.Add(user);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
user.LastLogin = DateTime.UtcNow;
|
||||||
|
user.Username = preferredUsername ?? user.Username;
|
||||||
|
user.Email = email ?? user.Email;
|
||||||
|
db.Users.Update(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
await db.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|
||||||
@@ -95,7 +175,7 @@ using (var scope = app.Services.CreateScope())
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Standard-Admin-User erstellen
|
// Standart-User in Datenbank schreiben
|
||||||
using (var scope = app.Services.CreateScope())
|
using (var scope = app.Services.CreateScope())
|
||||||
{
|
{
|
||||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||||
@@ -104,19 +184,21 @@ using (var scope = app.Services.CreateScope())
|
|||||||
|
|
||||||
if (!db.Users.Any())
|
if (!db.Users.Any())
|
||||||
{
|
{
|
||||||
Console.WriteLine("No users found, creating default admin user...");
|
Console.WriteLine("No users found, creating default user...");
|
||||||
|
|
||||||
var defaultUser = new User
|
var defaultUser = new User
|
||||||
{
|
{
|
||||||
|
OIDC_Id = string.Empty,
|
||||||
Username = "admin",
|
Username = "admin",
|
||||||
Email = "admin@localhost",
|
Email = string.Empty,
|
||||||
LastLogin = DateTime.UtcNow,
|
LastLogin = DateTime.UtcNow,
|
||||||
|
IdentityProvider = "local",
|
||||||
Password = BCrypt.Net.BCrypt.HashPassword("changeme")
|
Password = BCrypt.Net.BCrypt.HashPassword("changeme")
|
||||||
};
|
};
|
||||||
db.Users.Add(defaultUser);
|
db.Users.Add(defaultUser);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
|
|
||||||
Console.WriteLine("Default admin user created (username: admin, password: changeme)");
|
Console.WriteLine("Default user created.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
namespace Watcher.Services;
|
|
||||||
|
|
||||||
public interface IUpdateCheckStore
|
|
||||||
{
|
|
||||||
bool IsUpdateAvailable { get; set; }
|
|
||||||
string? LatestVersion { get; set; }
|
|
||||||
DateTime LastChecked { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace Watcher.Services;
|
|
||||||
|
|
||||||
public interface IVersionService
|
|
||||||
{
|
|
||||||
string GetVersion();
|
|
||||||
}
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Watcher.Data;
|
|
||||||
|
|
||||||
namespace Watcher.Services;
|
|
||||||
|
|
||||||
public class MetricCleanupService : BackgroundService
|
|
||||||
{
|
|
||||||
private readonly ILogger<MetricCleanupService> _logger;
|
|
||||||
private readonly IServiceProvider _serviceProvider;
|
|
||||||
private readonly int _retentionDays;
|
|
||||||
private readonly int _checkIntervalHours;
|
|
||||||
private readonly bool _enabled;
|
|
||||||
|
|
||||||
public MetricCleanupService(
|
|
||||||
ILogger<MetricCleanupService> logger,
|
|
||||||
IServiceProvider serviceProvider,
|
|
||||||
IConfiguration configuration)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
|
|
||||||
// Konfiguration aus Environment Variablen laden
|
|
||||||
_retentionDays = int.TryParse(
|
|
||||||
configuration["DataRetention:MetricRetentionDays"] ??
|
|
||||||
Environment.GetEnvironmentVariable("METRIC_RETENTION_DAYS"),
|
|
||||||
out var days) ? days : 30; // Default: 30 Tage
|
|
||||||
|
|
||||||
_checkIntervalHours = int.TryParse(
|
|
||||||
configuration["DataRetention:CleanupIntervalHours"] ??
|
|
||||||
Environment.GetEnvironmentVariable("METRIC_CLEANUP_INTERVAL_HOURS"),
|
|
||||||
out var hours) ? hours : 24; // Default: 24 Stunden
|
|
||||||
|
|
||||||
_enabled = bool.TryParse(
|
|
||||||
configuration["DataRetention:Enabled"] ??
|
|
||||||
Environment.GetEnvironmentVariable("METRIC_CLEANUP_ENABLED"),
|
|
||||||
out var enabled) ? enabled : true; // Default: aktiviert
|
|
||||||
|
|
||||||
_logger.LogInformation(
|
|
||||||
"MetricCleanupService konfiguriert: Enabled={Enabled}, RetentionDays={Days}, IntervalHours={Hours}",
|
|
||||||
_enabled, _retentionDays, _checkIntervalHours);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
||||||
{
|
|
||||||
if (!_enabled)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("MetricCleanupService ist deaktiviert.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warte 1 Minute nach Start, bevor der erste Cleanup läuft
|
|
||||||
await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken);
|
|
||||||
|
|
||||||
var timer = new PeriodicTimer(TimeSpan.FromHours(_checkIntervalHours));
|
|
||||||
|
|
||||||
while (await timer.WaitForNextTickAsync(stoppingToken))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await CleanupOldMetricsAsync();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Fehler beim Cleanup alter Metriken.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Offset nach Cleanup
|
|
||||||
await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task CleanupOldMetricsAsync()
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Starte Metric Cleanup für Daten älter als {Days} Tage...", _retentionDays);
|
|
||||||
|
|
||||||
using var scope = _serviceProvider.CreateScope();
|
|
||||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
|
||||||
|
|
||||||
var cutoffDate = DateTime.UtcNow.AddDays(-_retentionDays);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Anzahl der zu löschenden Einträge ermitteln
|
|
||||||
var countToDelete = await context.Metrics
|
|
||||||
.Where(m => m.Timestamp < cutoffDate)
|
|
||||||
.CountAsync();
|
|
||||||
|
|
||||||
if (countToDelete == 0)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Keine alten Metriken zum Löschen gefunden.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("Lösche {Count} Metriken vor {Date}...", countToDelete, cutoffDate);
|
|
||||||
|
|
||||||
// Metriken löschen
|
|
||||||
var deletedCount = await context.Metrics
|
|
||||||
.Where(m => m.Timestamp < cutoffDate)
|
|
||||||
.ExecuteDeleteAsync();
|
|
||||||
|
|
||||||
_logger.LogInformation(
|
|
||||||
"Metric Cleanup abgeschlossen: {DeletedCount} Einträge gelöscht.",
|
|
||||||
deletedCount);
|
|
||||||
|
|
||||||
// Optional: ContainerMetrics auch bereinigen
|
|
||||||
var containerMetricsCount = await context.ContainerMetrics
|
|
||||||
.Where(cm => cm.Timestamp < cutoffDate)
|
|
||||||
.CountAsync();
|
|
||||||
|
|
||||||
if (containerMetricsCount > 0)
|
|
||||||
{
|
|
||||||
var deletedContainerMetrics = await context.ContainerMetrics
|
|
||||||
.Where(cm => cm.Timestamp < cutoffDate)
|
|
||||||
.ExecuteDeleteAsync();
|
|
||||||
|
|
||||||
_logger.LogInformation(
|
|
||||||
"ContainerMetrics Cleanup: {DeletedCount} Einträge gelöscht.",
|
|
||||||
deletedContainerMetrics);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Fehler beim Löschen alter Metriken aus der Datenbank.");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace Watcher.Services;
|
|
||||||
|
|
||||||
public class UpdateCheckService : BackgroundService
|
|
||||||
{
|
|
||||||
private readonly ILogger<UpdateCheckService> _logger;
|
|
||||||
private readonly IUpdateCheckStore _updateCheckStore;
|
|
||||||
private readonly IVersionService _versionService;
|
|
||||||
private readonly string _repositoryUrl;
|
|
||||||
private readonly int _checkIntervalHours;
|
|
||||||
private readonly bool _enabled;
|
|
||||||
private readonly HttpClient _httpClient;
|
|
||||||
|
|
||||||
public UpdateCheckService(
|
|
||||||
ILogger<UpdateCheckService> logger,
|
|
||||||
IUpdateCheckStore updateCheckStore,
|
|
||||||
IVersionService versionService,
|
|
||||||
IConfiguration configuration)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_updateCheckStore = updateCheckStore;
|
|
||||||
_versionService = versionService;
|
|
||||||
_httpClient = new HttpClient();
|
|
||||||
|
|
||||||
// Konfiguration aus Environment Variablen laden
|
|
||||||
_repositoryUrl = configuration["UpdateCheck:RepositoryUrl"]
|
|
||||||
?? Environment.GetEnvironmentVariable("UPDATE_CHECK_REPOSITORY_URL")
|
|
||||||
?? "https://git.triggermeelmo.com/api/v1/repos/Watcher/watcher/releases/latest";
|
|
||||||
|
|
||||||
_checkIntervalHours = int.TryParse(
|
|
||||||
configuration["UpdateCheck:CheckIntervalHours"]
|
|
||||||
?? Environment.GetEnvironmentVariable("UPDATE_CHECK_INTERVAL_HOURS"),
|
|
||||||
out var hours) ? hours : 24; // Default: 24 Stunden
|
|
||||||
|
|
||||||
_enabled = bool.TryParse(
|
|
||||||
configuration["UpdateCheck:Enabled"]
|
|
||||||
?? Environment.GetEnvironmentVariable("UPDATE_CHECK_ENABLED"),
|
|
||||||
out var enabled) ? enabled : true; // Default: aktiviert
|
|
||||||
|
|
||||||
_logger.LogInformation(
|
|
||||||
"UpdateCheckService konfiguriert: Enabled={Enabled}, Repository={Repo}, IntervalHours={Hours}",
|
|
||||||
_enabled, _repositoryUrl, _checkIntervalHours);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
||||||
{
|
|
||||||
if (!_enabled)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("UpdateCheckService ist deaktiviert.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warte 2 Minuten nach Start, bevor der erste Check läuft
|
|
||||||
await Task.Delay(TimeSpan.FromMinutes(2), stoppingToken);
|
|
||||||
|
|
||||||
var timer = new PeriodicTimer(TimeSpan.FromHours(_checkIntervalHours));
|
|
||||||
|
|
||||||
while (await timer.WaitForNextTickAsync(stoppingToken))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await CheckForUpdatesAsync();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Fehler beim Update-Check.");
|
|
||||||
}
|
|
||||||
|
|
||||||
await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task CheckForUpdatesAsync()
|
|
||||||
{
|
|
||||||
var currentVersion = _versionService.GetVersion();
|
|
||||||
|
|
||||||
_logger.LogInformation("Starte Update-Check. Aktuelle Version: {Version}", currentVersion);
|
|
||||||
|
|
||||||
// Bei "development" oder "latest" immer als aktuell markieren
|
|
||||||
if (currentVersion == "development" || currentVersion == "latest")
|
|
||||||
{
|
|
||||||
_updateCheckStore.IsUpdateAvailable = false;
|
|
||||||
_updateCheckStore.LatestVersion = currentVersion;
|
|
||||||
_updateCheckStore.LastChecked = DateTime.UtcNow;
|
|
||||||
_logger.LogInformation("Development/Latest Build - keine Update-Prüfung nötig.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Gitea API abfragen
|
|
||||||
var response = await _httpClient.GetAsync(_repositoryUrl);
|
|
||||||
|
|
||||||
if (!response.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Gitea API Fehler: {StatusCode}", response.StatusCode);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var jsonContent = await response.Content.ReadAsStringAsync();
|
|
||||||
var releaseInfo = JsonSerializer.Deserialize<GiteaReleaseResponse>(jsonContent);
|
|
||||||
|
|
||||||
if (releaseInfo?.TagName == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Keine Release-Information gefunden.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var latestVersion = releaseInfo.TagName;
|
|
||||||
_updateCheckStore.LatestVersion = latestVersion;
|
|
||||||
_updateCheckStore.LastChecked = DateTime.UtcNow;
|
|
||||||
|
|
||||||
// Versionsvergleich
|
|
||||||
var isNewer = CompareVersions(latestVersion, currentVersion);
|
|
||||||
_updateCheckStore.IsUpdateAvailable = isNewer;
|
|
||||||
|
|
||||||
if (isNewer)
|
|
||||||
{
|
|
||||||
_logger.LogInformation(
|
|
||||||
"Neue Version verfügbar: {Latest} (aktuell: {Current})",
|
|
||||||
latestVersion, currentVersion);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.LogInformation(
|
|
||||||
"System ist auf dem neuesten Stand: {Version}",
|
|
||||||
currentVersion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Fehler beim Abrufen der Release-Informationen von Gitea.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CompareVersions(string latestVersion, string currentVersion)
|
|
||||||
{
|
|
||||||
// Entferne "v" Prefix falls vorhanden
|
|
||||||
latestVersion = latestVersion.TrimStart('v');
|
|
||||||
currentVersion = currentVersion.TrimStart('v');
|
|
||||||
|
|
||||||
// Versuche semantic versioning zu parsen
|
|
||||||
if (Version.TryParse(latestVersion, out var latest) &&
|
|
||||||
Version.TryParse(currentVersion, out var current))
|
|
||||||
{
|
|
||||||
return latest > current;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback: String-Vergleich
|
|
||||||
return string.Compare(latestVersion, currentVersion, StringComparison.Ordinal) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DTO für Gitea API Response
|
|
||||||
private class GiteaReleaseResponse
|
|
||||||
{
|
|
||||||
public string? TagName { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
namespace Watcher.Services;
|
|
||||||
|
|
||||||
public class UpdateCheckStore : IUpdateCheckStore
|
|
||||||
{
|
|
||||||
public bool IsUpdateAvailable { get; set; } = false;
|
|
||||||
public string? LatestVersion { get; set; } = null;
|
|
||||||
public DateTime LastChecked { get; set; } = DateTime.MinValue;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
namespace Watcher.Services;
|
|
||||||
|
|
||||||
public class VersionService : IVersionService
|
|
||||||
{
|
|
||||||
private readonly string _version;
|
|
||||||
|
|
||||||
public VersionService(IConfiguration configuration)
|
|
||||||
{
|
|
||||||
// Priorität: Environment Variable > Configuration > Default
|
|
||||||
_version = Environment.GetEnvironmentVariable("WATCHER_VERSION")
|
|
||||||
?? configuration["Application:Version"]
|
|
||||||
?? "development";
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetVersion()
|
|
||||||
{
|
|
||||||
return _version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,180 +8,38 @@
|
|||||||
<link rel="stylesheet" href="~/css/services-overview.css" />
|
<link rel="stylesheet" href="~/css/services-overview.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<div class="container-fluid mt-4">
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div >
|
||||||
<h4><i class="bi bi-box-seam me-2"></i>Container & Services</h4>
|
<table class="ServiceList">
|
||||||
<span class="badge bg-primary">@Model.Containers.Count Container</span>
|
<tr>
|
||||||
</div>
|
<th>Container-ID</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Image</th>
|
||||||
|
<th>Host-ID</th>
|
||||||
|
<th>Aktionen</th>
|
||||||
|
|
||||||
@if (!Model.Containers.Any())
|
</tr>
|
||||||
|
@foreach (Container container in Model.Containers)
|
||||||
{
|
{
|
||||||
<div class="alert alert-info">
|
<tr class="ServiceRow">
|
||||||
<i class="bi bi-info-circle me-2"></i>Keine Container gefunden. Container werden automatisch von den Agents erkannt.
|
<td>@container.ContainerId</td>
|
||||||
</div>
|
<td>@container.Name</td>
|
||||||
}
|
<td>@container.Image</td>
|
||||||
else
|
<td><a class="ServiceEntry" href="/Server/Details/@container.ServerId">@container.ServerId</a></td>
|
||||||
{
|
<td>
|
||||||
var groupedContainers = Model.Containers.GroupBy(c => c.Server?.Name ?? "Unbekannt");
|
<a asp-action="#" asp-route-id="#" class="btn btn-outline-primary">
|
||||||
|
<i class="bi bi-pencil-square me-1"></i> Neustart
|
||||||
foreach (var serverGroup in groupedContainers.OrderBy(g => g.Key))
|
|
||||||
{
|
|
||||||
<div class="mb-4">
|
|
||||||
<h5 class="text-muted mb-3">
|
|
||||||
<i class="bi bi-hdd-network me-2"></i>@serverGroup.Key
|
|
||||||
<span class="badge bg-secondary ms-2">@serverGroup.Count()</span>
|
|
||||||
</h5>
|
|
||||||
|
|
||||||
<div class="row g-3">
|
|
||||||
@foreach (var container in serverGroup)
|
|
||||||
{
|
|
||||||
<div class="col-12 col-lg-6 col-xl-4">
|
|
||||||
<div class="card container-card shadow-sm">
|
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
|
||||||
<div class="d-flex align-items-center">
|
|
||||||
<i class="bi bi-box me-2 text-primary"></i>
|
|
||||||
<strong>@container.Name</strong>
|
|
||||||
</div>
|
|
||||||
<span class="badge @(container.IsRunning ? "bg-success" : "bg-danger")">
|
|
||||||
<i class="bi @(container.IsRunning ? "bi-play-fill" : "bi-stop-fill")"></i>
|
|
||||||
@(container.IsRunning ? "Running" : "Stopped")
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="container-info">
|
|
||||||
<div class="info-row">
|
|
||||||
<span class="info-label"><i class="bi bi-tag me-1"></i>ID:</span>
|
|
||||||
<span class="info-value">@(container.ContainerId != null && container.ContainerId.Length > 12 ? container.ContainerId.Substring(0, 12) : container.ContainerId)</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-row">
|
|
||||||
<span class="info-label"><i class="bi bi-image me-1"></i>Image:</span>
|
|
||||||
<span class="info-value">@container.Image</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-row">
|
|
||||||
<span class="info-label"><i class="bi bi-server me-1"></i>Host:</span>
|
|
||||||
<span class="info-value">
|
|
||||||
<a href="/Server/Details/@container.ServerId" class="text-decoration-none">
|
|
||||||
@container.Server?.Name
|
|
||||||
</a>
|
</a>
|
||||||
</span>
|
<a asp-action="#" asp-route-id="#" class="btn btn-outline-primary">
|
||||||
</div>
|
<i class="bi bi-pencil-square me-1"></i> Stop
|
||||||
|
</a>
|
||||||
|
<a asp-action="#" asp-route-id="#" class="btn btn-outline-primary">
|
||||||
|
<i class="bi bi-pencil-square me-1"></i> Update
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Action Buttons -->
|
|
||||||
<div class="action-buttons mt-3 d-flex gap-2">
|
|
||||||
<button class="btn btn-sm btn-outline-warning flex-fill" onclick="restartContainer('@container.ContainerId')">
|
|
||||||
<i class="bi bi-arrow-clockwise"></i> Restart
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-sm btn-outline-danger flex-fill" onclick="stopContainer('@container.ContainerId')">
|
|
||||||
<i class="bi bi-stop-circle"></i> Stop
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-sm btn-outline-info flex-fill" onclick="updateContainer('@container.ContainerId')">
|
|
||||||
<i class="bi bi-arrow-up-circle"></i> Update
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Expandable Metrics Section -->
|
|
||||||
<div class="mt-3">
|
|
||||||
<button class="btn btn-sm btn-outline-secondary w-100 toggle-metrics"
|
|
||||||
data-container-id="@container.Id"
|
|
||||||
onclick="toggleMetrics(this, @container.Id)">
|
|
||||||
<i class="bi bi-graph-up me-1"></i>
|
|
||||||
Metriken anzeigen
|
|
||||||
<i class="bi bi-chevron-down float-end"></i>
|
|
||||||
</button>
|
|
||||||
<div class="metrics-panel collapse" id="metrics-@container.Id">
|
|
||||||
<div class="metrics-content mt-3 p-3 rounded">
|
|
||||||
<div class="metric-item">
|
|
||||||
<div class="d-flex justify-content-between mb-1">
|
|
||||||
<small><i class="bi bi-cpu me-1"></i>CPU</small>
|
|
||||||
<small class="text-muted"><span class="metric-value">--</span>%</small>
|
|
||||||
</div>
|
|
||||||
<div class="progress" style="height: 8px;">
|
|
||||||
<div class="progress-bar bg-info" role="progressbar" style="width: 0%"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="metric-item mt-3">
|
|
||||||
<div class="d-flex justify-content-between mb-1">
|
|
||||||
<small><i class="bi bi-memory me-1"></i>RAM</small>
|
|
||||||
<small class="text-muted"><span class="metric-value">--</span> MB</small>
|
|
||||||
</div>
|
|
||||||
<div class="progress" style="height: 8px;">
|
|
||||||
<div class="progress-bar bg-success" role="progressbar" style="width: 0%"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="metric-item mt-3">
|
|
||||||
<div class="d-flex justify-content-between mb-1">
|
|
||||||
<small><i class="bi bi-ethernet me-1"></i>Network</small>
|
|
||||||
<small class="text-muted">
|
|
||||||
<i class="bi bi-arrow-down text-success"></i> <span class="metric-value">--</span> MB/s
|
|
||||||
<i class="bi bi-arrow-up text-primary ms-2"></i> <span class="metric-value">--</span> MB/s
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="text-center mt-3">
|
|
||||||
<small class="text-muted">
|
|
||||||
<i class="bi bi-info-circle me-1"></i>
|
|
||||||
Metriken werden in Echtzeit aktualisiert
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
<script>
|
|
||||||
function toggleMetrics(button, containerId) {
|
|
||||||
const panel = document.getElementById('metrics-' + containerId);
|
|
||||||
const icon = button.querySelector('.float-end');
|
|
||||||
|
|
||||||
if (panel.classList.contains('show')) {
|
|
||||||
panel.classList.remove('show');
|
|
||||||
button.innerHTML = '<i class="bi bi-graph-up me-1"></i>Metriken anzeigen<i class="bi bi-chevron-down float-end"></i>';
|
|
||||||
} else {
|
|
||||||
panel.classList.add('show');
|
|
||||||
button.innerHTML = '<i class="bi bi-graph-up me-1"></i>Metriken verbergen<i class="bi bi-chevron-up float-end"></i>';
|
|
||||||
// Hier könnten echte Metriken geladen werden
|
|
||||||
loadContainerMetrics(containerId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadContainerMetrics(containerId) {
|
|
||||||
// Placeholder für zukünftige API-Calls
|
|
||||||
console.log('Loading metrics for container:', containerId);
|
|
||||||
// TODO: Echte Metriken vom Backend laden
|
|
||||||
}
|
|
||||||
|
|
||||||
function restartContainer(containerId) {
|
|
||||||
if (confirm('Container wirklich neu starten?')) {
|
|
||||||
console.log('Restarting container:', containerId);
|
|
||||||
// TODO: API Call zum Neustarten
|
|
||||||
alert('Restart-Funktion wird implementiert');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopContainer(containerId) {
|
|
||||||
if (confirm('Container wirklich stoppen?')) {
|
|
||||||
console.log('Stopping container:', containerId);
|
|
||||||
// TODO: API Call zum Stoppen
|
|
||||||
alert('Stop-Funktion wird implementiert');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateContainer(containerId) {
|
|
||||||
if (confirm('Container-Image aktualisieren?')) {
|
|
||||||
console.log('Updating container:', containerId);
|
|
||||||
// TODO: API Call zum Updaten
|
|
||||||
alert('Update-Funktion wird implementiert');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@using Microsoft.IdentityModel.Tokens
|
||||||
@model Watcher.ViewModels.DashboardViewModel
|
@model Watcher.ViewModels.DashboardViewModel
|
||||||
|
|
||||||
@{
|
@{
|
||||||
@@ -57,7 +58,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="fw-bold mb-3"><i class="bi bi-heart-pulse me-2 text-danger"></i>Systemstatus</h5>
|
<h5 class="fw-bold mb-3"><i class="bi bi-heart-pulse me-2 text-danger"></i>Systemstatus</h5>
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(Model.NetworkStatus))
|
@if (!Model.NetworkStatus.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
@if (Model.NetworkStatus == "online")
|
@if (Model.NetworkStatus == "online")
|
||||||
{
|
{
|
||||||
@@ -80,7 +81,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(Model.DatabaseStatus))
|
@if (!Model.DatabaseStatus.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
@if (Model.DatabaseStatus == "ok")
|
@if (Model.DatabaseStatus == "ok")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,187 +11,50 @@
|
|||||||
<div id="server-cards-container">
|
<div id="server-cards-container">
|
||||||
|
|
||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
<!-- Server Overview Card -->
|
<div class="card shadow-sm">
|
||||||
<div class="card shadow-sm mb-4">
|
<div class="card-header d-flex justify-content-between align-items-center">
|
||||||
<div class="card-header d-flex justify-content-between align-items-center border-bottom">
|
|
||||||
<h5 class="mb-0">
|
<h5 class="mb-0">
|
||||||
<i class="bi bi-hdd-network me-2 text-primary"></i>@Model.Name
|
<i class="bi bi-hdd-network me-2 text-primary"></i>@Model.Name
|
||||||
</h5>
|
</h5>
|
||||||
<div class="d-flex gap-2 align-items-center">
|
<span class="badge @(Model.IsOnline ? "bg-success" : "bg-danger")">
|
||||||
<span class="badge @(Model.IsOnline ? "bg-success" : "bg-danger") px-3 py-2">
|
|
||||||
<i class="bi @(Model.IsOnline ? "bi-check-circle" : "bi-x-circle") me-1"></i>
|
<i class="bi @(Model.IsOnline ? "bi-check-circle" : "bi-x-circle") me-1"></i>
|
||||||
@(Model.IsOnline ? "Online" : "Offline")
|
@(Model.IsOnline ? "Online" : "Offline")
|
||||||
</span>
|
</span>
|
||||||
<a asp-action="EditServer" asp-route-id="@Model.Id" class="btn btn-sm btn-outline-primary">
|
</div>
|
||||||
|
|
||||||
|
<div class="infocard row g-4 mb-4">
|
||||||
|
<div class="info col-6 text-text col-lg-3">
|
||||||
|
<div><i class="bi bi-globe me-1"></i><strong>IP:</strong> @Model.IPAddress</div>
|
||||||
|
<div><i class="bi bi-pc-display me-1"></i><strong>Typ:</strong> @Model.Type</div>
|
||||||
|
<div><i class="bi bi-calendar-check me-1"></i><strong>Erstellt:</strong>
|
||||||
|
@Model.CreatedAt.ToLocalTime().ToString("dd.MM.yyyy HH:mm")</div>
|
||||||
|
<div><i class="bi bi-clock me-1"></i><strong>Last-Seen:</strong>
|
||||||
|
@Model.LastSeen.ToLocalTime().ToString("dd.MM.yyyy HH:mm")</div>
|
||||||
|
</div>
|
||||||
|
<div class="hardware col-6 text-text col-lg-3">
|
||||||
|
<div><i class="bi bi-cpu me-1"></i><strong>CPU:</strong> @(Model.CpuType ?? "not found") </div>
|
||||||
|
<div><i class="bi bi-cpu me-1"></i><strong>CPU-Kerne: </strong> @Model.CpuCores </div>
|
||||||
|
<div><i class="bi bi-gpu-card me-1"></i><strong>GPU:</strong> @(Model.GpuType ?? "not found")
|
||||||
|
</div>
|
||||||
|
<div><i class="bi bi-memory me-1"></i><strong>RAM:</strong> @(Model.RamSize) </div>
|
||||||
|
<div><i class="bi bi-hdd me-1"></i><strong>Disk Space:</strong> ... </div>
|
||||||
|
</div>
|
||||||
|
<div class="hardware col-6 text-text col-lg-3">
|
||||||
|
<div class="card-footer text-end">
|
||||||
|
<a asp-action="EditServer" asp-route-id="@Model.Id" class="btn btn-outline-primary me-2">
|
||||||
<i class="bi bi-pencil"></i> Bearbeiten
|
<i class="bi bi-pencil"></i> Bearbeiten
|
||||||
</a>
|
</a>
|
||||||
<form asp-action="Delete" asp-route-id="@Model.Id" method="post" class="d-inline m-0"
|
<form asp-action="Delete" asp-route-id="@Model.Id" method="post" class="d-inline"
|
||||||
onsubmit="return confirm('Diesen Server wirklich löschen?');">
|
onsubmit="return confirm('Diesen Server wirklich löschen?');">
|
||||||
<button type="submit" class="btn btn-sm btn-outline-danger">
|
<button type="submit" class="btn btn-outline-danger">
|
||||||
<i class="bi bi-trash"></i> Löschen
|
<i class="bi bi-trash"></i> Löschen
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row g-4">
|
|
||||||
<!-- System Information -->
|
|
||||||
<div class="col-12 col-md-6 col-lg-3">
|
|
||||||
<h6 class="text-muted mb-3 pb-2 border-bottom">
|
|
||||||
<i class="bi bi-info-circle me-2"></i>System
|
|
||||||
</h6>
|
|
||||||
<div class="info-list">
|
|
||||||
<div class="info-item">
|
|
||||||
<span class="info-label">
|
|
||||||
<i class="bi bi-globe text-primary me-1"></i>IP-Adresse
|
|
||||||
</span>
|
|
||||||
<span class="info-value">@Model.IPAddress</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-item">
|
|
||||||
<span class="info-label">
|
|
||||||
<i class="bi bi-pc-display text-primary me-1"></i>Typ
|
|
||||||
</span>
|
|
||||||
<span class="info-value">@Model.Type</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-item">
|
|
||||||
<span class="info-label">
|
|
||||||
<i class="bi bi-calendar-check text-primary me-1"></i>Erstellt
|
|
||||||
</span>
|
|
||||||
<span class="info-value">@Model.CreatedAt.ToLocalTime().ToString("dd.MM.yyyy")</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-item">
|
|
||||||
<span class="info-label">
|
|
||||||
<i class="bi bi-clock text-primary me-1"></i>Last Seen
|
|
||||||
</span>
|
|
||||||
<span class="info-value">
|
|
||||||
@{
|
|
||||||
var timeSinceLastSeen = DateTime.UtcNow - Model.LastSeen;
|
|
||||||
if (timeSinceLastSeen.TotalMinutes < 1)
|
|
||||||
{
|
|
||||||
<span class="text-success">Gerade eben</span>
|
|
||||||
}
|
|
||||||
else if (timeSinceLastSeen.TotalMinutes < 60)
|
|
||||||
{
|
|
||||||
<span>vor @((int)timeSinceLastSeen.TotalMinutes) Min</span>
|
|
||||||
}
|
|
||||||
else if (timeSinceLastSeen.TotalHours < 24)
|
|
||||||
{
|
|
||||||
<span>vor @((int)timeSinceLastSeen.TotalHours) Std</span>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<span>@Model.LastSeen.ToLocalTime().ToString("dd.MM.yyyy HH:mm")</span>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Hardware - CPU & GPU -->
|
|
||||||
<div class="col-12 col-md-6 col-lg-3">
|
|
||||||
<h6 class="text-muted mb-3 pb-2 border-bottom">
|
|
||||||
<i class="bi bi-cpu me-2"></i>Prozessor & Grafik
|
|
||||||
</h6>
|
|
||||||
<div class="info-list">
|
|
||||||
<div class="info-item">
|
|
||||||
<span class="info-label">
|
|
||||||
<i class="bi bi-cpu text-info me-1"></i>CPU
|
|
||||||
</span>
|
|
||||||
<span class="info-value">
|
|
||||||
@if (!string.IsNullOrWhiteSpace(Model.CpuType))
|
|
||||||
{
|
|
||||||
@Model.CpuType
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<span class="text-muted">Unbekannt</span>
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-item">
|
|
||||||
<span class="info-label">
|
|
||||||
<i class="bi bi-grid text-info me-1"></i>CPU-Kerne
|
|
||||||
</span>
|
|
||||||
<span class="info-value">
|
|
||||||
@if (Model.CpuCores > 0)
|
|
||||||
{
|
|
||||||
@Model.CpuCores
|
|
||||||
<span class="text-muted">Cores</span>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<span class="text-muted">Unbekannt</span>
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-item">
|
|
||||||
<span class="info-label">
|
|
||||||
<i class="bi bi-gpu-card text-info me-1"></i>GPU
|
|
||||||
</span>
|
|
||||||
<span class="info-value">
|
|
||||||
@if (!string.IsNullOrWhiteSpace(Model.GpuType))
|
|
||||||
{
|
|
||||||
@Model.GpuType
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<span class="text-muted">Keine / Unbekannt</span>
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Hardware - Memory -->
|
|
||||||
<div class="col-12 col-md-6 col-lg-3">
|
|
||||||
<h6 class="text-muted mb-3 pb-2 border-bottom">
|
|
||||||
<i class="bi bi-memory me-2"></i>Speicher
|
|
||||||
</h6>
|
|
||||||
<div class="info-list">
|
|
||||||
<div class="info-item">
|
|
||||||
<span class="info-label">
|
|
||||||
<i class="bi bi-memory text-success me-1"></i>RAM
|
|
||||||
</span>
|
|
||||||
<span class="info-value">
|
|
||||||
@if (Model.RamSize > 0)
|
|
||||||
{
|
|
||||||
var ramGB = Model.RamSize / (1024.0 * 1024.0 * 1024.0);
|
|
||||||
@($"{ramGB:F1} GB")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<span class="text-muted">Unbekannt</span>
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Description -->
|
|
||||||
@if (!string.IsNullOrWhiteSpace(Model.Description))
|
|
||||||
{
|
|
||||||
<div class="col-12 col-lg-3">
|
|
||||||
<h6 class="text-muted mb-3 pb-2 border-bottom">
|
|
||||||
<i class="bi bi-card-text me-2"></i>Beschreibung
|
|
||||||
</h6>
|
|
||||||
<p class="text-muted small mb-0">@Model.Description</p>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-4">
|
|
||||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
||||||
<h6 class="mb-0"><i class="bi bi-graph-up me-1"></i>Metriken</h6>
|
|
||||||
<div class="btn-group btn-group-sm" role="group">
|
|
||||||
<button type="button" class="btn btn-outline-primary active" data-range="1">1 Stunde</button>
|
|
||||||
<button type="button" class="btn btn-outline-primary" data-range="24">24 Stunden</button>
|
|
||||||
<button type="button" class="btn btn-outline-primary" data-range="48">48 Stunden</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -231,13 +94,10 @@
|
|||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'CPU Last (%)',
|
label: 'CPU Last (%)',
|
||||||
data: [],
|
data: [],
|
||||||
borderColor: 'rgba(13, 202, 240, 1)',
|
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
||||||
backgroundColor: 'rgba(13, 202, 240, 0.2)',
|
|
||||||
borderWidth: 2,
|
|
||||||
fill: true,
|
fill: true,
|
||||||
tension: 0.4,
|
tension: 0.3,
|
||||||
pointRadius: 0,
|
pointRadius: 3
|
||||||
pointHoverRadius: 4
|
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
@@ -250,29 +110,14 @@
|
|||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Auslastung in %'
|
text: 'Auslastung in %'
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
color: 'rgba(255, 255, 255, 0.1)'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: false,
|
display: false,
|
||||||
text: 'Zeit'
|
text: 'Zeit'
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
color: 'rgba(255, 255, 255, 0.1)'
|
|
||||||
},
|
|
||||||
ticks: {
|
|
||||||
maxTicksLimit: 12,
|
|
||||||
autoSkip: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -284,13 +129,10 @@
|
|||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'RAM Last (%)',
|
label: 'RAM Last (%)',
|
||||||
data: [],
|
data: [],
|
||||||
borderColor: 'rgba(25, 135, 84, 1)',
|
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
||||||
backgroundColor: 'rgba(25, 135, 84, 0.2)',
|
|
||||||
borderWidth: 2,
|
|
||||||
fill: true,
|
fill: true,
|
||||||
tension: 0.4,
|
tension: 0.3,
|
||||||
pointRadius: 0,
|
pointRadius: 3
|
||||||
pointHoverRadius: 4
|
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
@@ -303,29 +145,14 @@
|
|||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Auslastung in %'
|
text: 'Auslastung in %'
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
color: 'rgba(255, 255, 255, 0.1)'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: false,
|
display: false,
|
||||||
text: 'Zeit'
|
text: 'Zeit'
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
color: 'rgba(255, 255, 255, 0.1)'
|
|
||||||
},
|
|
||||||
ticks: {
|
|
||||||
maxTicksLimit: 12,
|
|
||||||
autoSkip: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -337,13 +164,10 @@
|
|||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'GPU Last (%)',
|
label: 'GPU Last (%)',
|
||||||
data: [],
|
data: [],
|
||||||
borderColor: 'rgba(220, 53, 69, 1)',
|
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
||||||
backgroundColor: 'rgba(220, 53, 69, 0.2)',
|
|
||||||
borderWidth: 2,
|
|
||||||
fill: true,
|
fill: true,
|
||||||
tension: 0.4,
|
tension: 0.3,
|
||||||
pointRadius: 0,
|
pointRadius: 3
|
||||||
pointHoverRadius: 4
|
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
@@ -356,38 +180,21 @@
|
|||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Auslastung in %'
|
text: 'Auslastung in %'
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
color: 'rgba(255, 255, 255, 0.1)'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: false,
|
display: false,
|
||||||
text: 'Zeit'
|
text: 'Zeit'
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
color: 'rgba(255, 255, 255, 0.1)'
|
|
||||||
},
|
|
||||||
ticks: {
|
|
||||||
maxTicksLimit: 12,
|
|
||||||
autoSkip: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let currentHours = 1; // Standard: 1 Stunde
|
|
||||||
|
|
||||||
async function loadCpuData() {
|
async function loadCpuData() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/monitoring/cpu-usage?serverId=@Model.Id&hours=${currentHours}`);
|
const response = await fetch('/monitoring/cpu-usage?serverId=@Model.Id');
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP-Fehler: ${response.status}`);
|
throw new Error(`HTTP-Fehler: ${response.status}`);
|
||||||
}
|
}
|
||||||
@@ -410,7 +217,7 @@
|
|||||||
|
|
||||||
async function loadRamData() {
|
async function loadRamData() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/monitoring/ram-usage?serverId=@Model.Id&hours=${currentHours}`);
|
const response = await fetch('/monitoring/ram-usage?serverId=@Model.Id');
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP-Fehler: ${response.status}`);
|
throw new Error(`HTTP-Fehler: ${response.status}`);
|
||||||
}
|
}
|
||||||
@@ -433,7 +240,7 @@
|
|||||||
|
|
||||||
async function loadGpuData() {
|
async function loadGpuData() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/monitoring/gpu-usage?serverId=@Model.Id&hours=${currentHours}`);
|
const response = await fetch('/monitoring/gpu-usage?serverId=@Model.Id');
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP-Fehler: ${response.status}`);
|
throw new Error(`HTTP-Fehler: ${response.status}`);
|
||||||
}
|
}
|
||||||
@@ -454,27 +261,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button-Handler für Zeitbereich-Wechsel
|
|
||||||
document.querySelectorAll('[data-range]').forEach(button => {
|
|
||||||
button.addEventListener('click', function() {
|
|
||||||
// Alle Buttons deaktivieren
|
|
||||||
document.querySelectorAll('[data-range]').forEach(btn => {
|
|
||||||
btn.classList.remove('active');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Aktuellen Button aktivieren
|
|
||||||
this.classList.add('active');
|
|
||||||
|
|
||||||
// Zeitbereich aktualisieren
|
|
||||||
currentHours = parseInt(this.getAttribute('data-range'));
|
|
||||||
|
|
||||||
// Daten neu laden
|
|
||||||
loadCpuData();
|
|
||||||
loadRamData();
|
|
||||||
loadGpuData();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Initiales Laden
|
// Initiales Laden
|
||||||
loadCpuData();
|
loadCpuData();
|
||||||
loadRamData();
|
loadRamData();
|
||||||
|
|||||||
@@ -1,169 +1,51 @@
|
|||||||
@model IEnumerable<Watcher.Models.Server>
|
@model IEnumerable<Watcher.Models.Server>
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="container py-4">
|
||||||
@foreach (var server in Model)
|
<div class="row g-4">
|
||||||
|
@foreach (var s in Model)
|
||||||
{
|
{
|
||||||
<div class="col-12 col-lg-6 col-xl-4">
|
<div class="col-12">
|
||||||
<div class="card server-card shadow-sm">
|
<div class="card h-100 border-secondary shadow-sm">
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<div class="card-body d-flex flex-column gap-3">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
<i class="bi bi-hdd-network me-2 text-primary"></i>
|
<h5 class="card-title text-text mb-0">
|
||||||
<strong>@server.Name</strong>
|
<i class="bi bi-pc-display me-2 text-text"></i>(#@s.Id) @s.Name
|
||||||
|
</h5>
|
||||||
|
|
||||||
|
<div class="col-md-4 text-text small">
|
||||||
|
<div><i class="bi bi-globe me-1"></i><strong>IP:</strong> @s.IPAddress</div>
|
||||||
|
<div><i class="bi bi-pc-display me-1"></i><strong>Typ:</strong> @s.Type</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="badge @(server.IsOnline ? "bg-success" : "bg-danger")">
|
|
||||||
<i class="bi @(server.IsOnline ? "bi-check-circle" : "bi-x-circle")"></i>
|
<span class="badge @(s.IsOnline ? "bg-success text-light" : "bg-danger text-light")">
|
||||||
@(server.IsOnline ? "Online" : "Offline")
|
<i class="bi @(s.IsOnline ? "bi-check-circle" : "bi-x-circle") me-1"></i>
|
||||||
|
@(s.IsOnline ? "Online" : "Offline")
|
||||||
</span>
|
</span>
|
||||||
</div>
|
<div class="d-flex flex-wrap gap-4">
|
||||||
<div class="card-body">
|
|
||||||
<!-- Server Info -->
|
|
||||||
<div class="server-info">
|
|
||||||
<div class="info-row">
|
|
||||||
<span class="info-label"><i class="bi bi-globe me-1"></i>IP:</span>
|
|
||||||
<span class="info-value">@server.IPAddress</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-row">
|
|
||||||
<span class="info-label"><i class="bi bi-pc-display me-1"></i>Typ:</span>
|
|
||||||
<span class="info-value">@server.Type</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-row">
|
|
||||||
<span class="info-label"><i class="bi bi-cpu me-1"></i>CPU:</span>
|
|
||||||
<span class="info-value">@(server.CpuCores > 0 ? $"{server.CpuCores} Cores" : "N/A")</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-row">
|
|
||||||
<span class="info-label"><i class="bi bi-memory me-1"></i>RAM:</span>
|
|
||||||
<span class="info-value">
|
|
||||||
@if (server.RamSize > 0)
|
|
||||||
{
|
|
||||||
var ramGB = server.RamSize / (1024.0 * 1024.0 * 1024.0);
|
|
||||||
@($"{ramGB:F1} GB")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<text>N/A</text>
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Current Metrics (wenn online) -->
|
<a asp-action="EditServer" asp-route-id="@s.Id" class="btn btn-outline-primary">
|
||||||
@if (server.IsOnline)
|
<i class="bi bi-pencil-square me-1"></i> Bearbeiten
|
||||||
{
|
|
||||||
<div class="mt-3 current-metrics">
|
|
||||||
<h6 class="mb-2"><i class="bi bi-activity me-1"></i>Aktuelle Last</h6>
|
|
||||||
<div class="metric-bars">
|
|
||||||
<div class="metric-bar-item">
|
|
||||||
<div class="d-flex justify-content-between mb-1">
|
|
||||||
<small>CPU</small>
|
|
||||||
<small class="metric-value" data-server-id="@server.Id" data-metric="cpu">--</small>
|
|
||||||
</div>
|
|
||||||
<div class="progress" style="height: 6px;">
|
|
||||||
<div class="progress-bar bg-info server-cpu-bar" role="progressbar" style="width: 0%"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="metric-bar-item mt-2">
|
|
||||||
<div class="d-flex justify-content-between mb-1">
|
|
||||||
<small>RAM</small>
|
|
||||||
<small class="metric-value" data-server-id="@server.Id" data-metric="ram">--</small>
|
|
||||||
</div>
|
|
||||||
<div class="progress" style="height: 6px;">
|
|
||||||
<div class="progress-bar bg-success server-ram-bar" role="progressbar" style="width: 0%"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@if (!string.IsNullOrEmpty(server.GpuType))
|
|
||||||
{
|
|
||||||
<div class="metric-bar-item mt-2">
|
|
||||||
<div class="d-flex justify-content-between mb-1">
|
|
||||||
<small>GPU</small>
|
|
||||||
<small class="metric-value" data-server-id="@server.Id" data-metric="gpu">--</small>
|
|
||||||
</div>
|
|
||||||
<div class="progress" style="height: 6px;">
|
|
||||||
<div class="progress-bar bg-danger server-gpu-bar" role="progressbar" style="width: 0%"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<!-- Action Buttons -->
|
|
||||||
<div class="action-buttons mt-3 d-flex gap-2">
|
|
||||||
<a asp-action="Details" asp-route-id="@server.Id" class="btn btn-sm btn-outline-primary flex-fill">
|
|
||||||
<i class="bi bi-bar-chart-fill"></i> Details
|
|
||||||
</a>
|
</a>
|
||||||
<button class="btn btn-sm btn-outline-warning flex-fill" onclick="rebootServer(@server.Id)">
|
|
||||||
<i class="bi bi-arrow-clockwise"></i> Reboot
|
|
||||||
</button>
|
|
||||||
<a asp-action="EditServer" asp-route-id="@server.Id" class="btn btn-sm btn-outline-secondary flex-fill">
|
|
||||||
<i class="bi bi-pencil"></i> Edit
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Delete Button (separate row) -->
|
<a asp-asp-controller="Server" asp-action="Details" asp-route-id="@s.Id"
|
||||||
<div class="mt-2">
|
class="btn btn-outline-primary">
|
||||||
<form asp-action="Delete" asp-route-id="@server.Id" method="post" class="m-0"
|
<i class="bi bi-bar-chart-fill me-1"></i> Metrics
|
||||||
onsubmit="return confirm('Server @server.Name wirklich löschen?');">
|
</a>
|
||||||
<button type="submit" class="btn btn-sm btn-outline-danger w-100">
|
|
||||||
<i class="bi bi-trash"></i> Server löschen
|
<form asp-action="Delete" asp-controller="Server" asp-route-id="@s.Id" method="post"
|
||||||
|
onsubmit="return confirm('Diesen Server wirklich löschen?');" class="m-0">
|
||||||
|
<button type="submit" class="btn btn-outline-danger">
|
||||||
|
<i class="bi bi-trash me-1"></i> Löschen
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
|
||||||
function rebootServer(serverId) {
|
|
||||||
if (confirm('Server wirklich neu starten?')) {
|
|
||||||
console.log('Rebooting server:', serverId);
|
|
||||||
// TODO: API Call zum Neustarten des Servers
|
|
||||||
alert('Reboot-Funktion wird implementiert');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lade aktuelle Metriken für alle Server
|
|
||||||
async function loadCurrentMetrics() {
|
|
||||||
const metricElements = document.querySelectorAll('.metric-value');
|
|
||||||
|
|
||||||
for (const element of metricElements) {
|
|
||||||
const serverId = element.getAttribute('data-server-id');
|
|
||||||
const metricType = element.getAttribute('data-metric');
|
|
||||||
|
|
||||||
try {
|
|
||||||
let endpoint = '';
|
|
||||||
if (metricType === 'cpu') endpoint = `/monitoring/cpu-usage?serverId=${serverId}&hours=0.1`;
|
|
||||||
else if (metricType === 'ram') endpoint = `/monitoring/ram-usage?serverId=${serverId}&hours=0.1`;
|
|
||||||
else if (metricType === 'gpu') endpoint = `/monitoring/gpu-usage?serverId=${serverId}&hours=0.1`;
|
|
||||||
|
|
||||||
const response = await fetch(endpoint);
|
|
||||||
if (response.ok) {
|
|
||||||
const data = await response.json();
|
|
||||||
if (data && data.length > 0) {
|
|
||||||
const latestValue = data[data.length - 1].data;
|
|
||||||
element.textContent = `${latestValue.toFixed(1)}%`;
|
|
||||||
|
|
||||||
// Update progress bar
|
|
||||||
const card = element.closest('.card');
|
|
||||||
let barClass = '';
|
|
||||||
if (metricType === 'cpu') barClass = '.server-cpu-bar';
|
|
||||||
else if (metricType === 'ram') barClass = '.server-ram-bar';
|
|
||||||
else if (metricType === 'gpu') barClass = '.server-gpu-bar';
|
|
||||||
|
|
||||||
const bar = card.querySelector(barClass);
|
|
||||||
if (bar) {
|
|
||||||
bar.style.width = `${latestValue}%`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error(`Fehler beim Laden der ${metricType}-Metriken für Server ${serverId}:`, err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initial laden und alle 30 Sekunden aktualisieren
|
|
||||||
loadCurrentMetrics();
|
|
||||||
setInterval(loadCurrentMetrics, 30000);
|
|
||||||
</script>
|
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
@using Microsoft.AspNetCore.Authentication
|
@using Microsoft.AspNetCore.Authentication
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using Microsoft.AspNetCore.Http
|
@using Microsoft.AspNetCore.Http
|
||||||
@using Watcher.Services
|
|
||||||
@inject IHttpContextAccessor HttpContextAccessor
|
@inject IHttpContextAccessor HttpContextAccessor
|
||||||
@inject IVersionService VersionService
|
|
||||||
@inject IUpdateCheckStore UpdateCheckStore
|
|
||||||
|
|
||||||
@{
|
@{
|
||||||
var pictureUrl = User.FindFirst("picture")?.Value;
|
var pictureUrl = User.FindFirst("picture")?.Value;
|
||||||
@@ -104,7 +101,7 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<strong>@User.Identity?.Name</strong><br />
|
<strong>@User.Identity?.Name</strong><br />
|
||||||
<small style="color: var(--color-text);">Profil ansehen</small>
|
<small class="text-muted">Profil ansehen</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@@ -113,19 +110,6 @@
|
|||||||
{
|
{
|
||||||
<a class="nav-link p-0 text-primary" href="/Account/Login">Login</a>
|
<a class="nav-link p-0 text-primary" href="/Account/Login">Login</a>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="mt-3 pt-3 border-top border-secondary text-center">
|
|
||||||
<small style="color: var(--color-muted);">
|
|
||||||
@{
|
|
||||||
var statusColor = UpdateCheckStore.IsUpdateAvailable ? "#ffc107" : "#28a745";
|
|
||||||
var statusTitle = UpdateCheckStore.IsUpdateAvailable
|
|
||||||
? $"Update verfügbar: {UpdateCheckStore.LatestVersion}"
|
|
||||||
: "System ist aktuell";
|
|
||||||
}
|
|
||||||
<span style="display: inline-block; width: 8px; height: 8px; background-color: @statusColor; border-radius: 50%; margin-right: 8px;" title="@statusTitle"></span>
|
|
||||||
<i class="bi bi-box me-1"></i>Version: <strong style="color: var(--color-primary);">@VersionService.GetVersion()</strong>
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -12,96 +12,103 @@
|
|||||||
<link rel="stylesheet" href="~/css/settings.css" />
|
<link rel="stylesheet" href="~/css/settings.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<div class="container mt-4">
|
<div class="Settingscontainer">
|
||||||
<h1 class="mb-4">
|
|
||||||
<i class="bi bi-gear-fill me-2"></i>Einstellungen
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<!-- Systemeinformationen Card -->
|
<div class="card shadow mt-5 p-4" style="width: 55%; margin: auto;">
|
||||||
<div class="card settings-card shadow-sm mb-4">
|
<h4><i class="bi bi-pencil-square me-2"></i>Systemeinformationen</h4>
|
||||||
<div class="card-header">
|
|
||||||
<h5 class="mb-0">
|
|
||||||
<i class="bi bi-info-circle me-2"></i>Systemeinformationen
|
|
||||||
</h5>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<!-- System Info Table -->
|
|
||||||
<div class="info-table">
|
|
||||||
<div class="info-row">
|
|
||||||
<div class="info-label">
|
|
||||||
<i class="bi bi-tag me-2"></i>Version
|
|
||||||
</div>
|
|
||||||
<div class="info-value">@ServerVersion</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="info-row">
|
<br>
|
||||||
<div class="info-label">
|
|
||||||
<i class="bi bi-shield-lock me-2"></i>Authentifizierung
|
|
||||||
</div>
|
|
||||||
<div class="info-value">@(ViewBag.IdentityProvider ?? "nicht gefunden")</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="info-row">
|
<h5>Watcher Version: @ServerVersion</h5>
|
||||||
<div class="info-label">
|
|
||||||
<i class="bi bi-database me-2"></i>Datenbank-Engine
|
|
||||||
</div>
|
|
||||||
<div class="info-value">@(DbEngine ?? "nicht gefunden")</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (ViewBag.DatabaseSize != null)
|
|
||||||
{
|
|
||||||
<div class="info-row">
|
|
||||||
<div class="info-label">
|
|
||||||
<i class="bi bi-hdd me-2"></i>Datenbankgröße
|
|
||||||
</div>
|
|
||||||
<div class="info-value">@ViewBag.DatabaseSize</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Datenbank-Backups Section -->
|
|
||||||
@if (DbEngine == "SQLite" || DbEngine == "Microsoft.EntityFrameworkCore.Sqlite")
|
|
||||||
{
|
|
||||||
<hr class="my-4" />
|
<hr class="my-4" />
|
||||||
<h6 class="mb-3">
|
|
||||||
<i class="bi bi-archive me-2"></i>Datenbank-Backups
|
<h5>Authentifizierungsmethode: <strong>@(ViewBag.IdentityProvider ?? "nicht gefunden")</strong></h5>
|
||||||
</h6>
|
|
||||||
<div class="backup-buttons">
|
|
||||||
|
<hr class="my-4" />
|
||||||
|
|
||||||
|
<h5>Datenbank-Engine: <strong>@(DbEngine ?? "nicht gefunden")</strong></h5>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Falls Sqlite verwendet wird können Backups erstellt werden -->
|
||||||
|
@if (DbEngine == "Microsoft.EntityFrameworkCore.Sqlite")
|
||||||
|
{
|
||||||
|
<div class="d-flex gap-2">
|
||||||
<form asp-action="CreateSqlDump" method="post" asp-controller="Database">
|
<form asp-action="CreateSqlDump" method="post" asp-controller="Database">
|
||||||
<button type="submit" class="btn btn-outline-primary">
|
<button type="submit" class="btn btn-db">
|
||||||
<i class="bi bi-plus-circle me-2"></i>Backup erstellen
|
<i class="bi bi-save me-1"></i> Backup erstellen
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form asp-action="ManageSqlDumps" method="post" asp-controller="Database">
|
<form asp-action="ManageSqlDumps" method="post" asp-controller="Database">
|
||||||
<button type="submit" class="btn btn-outline-primary">
|
<button type="submit" class="btn btn-db">
|
||||||
<i class="bi bi-folder2-open me-2"></i>Backups verwalten
|
<i class="bi bi-save me-1"></i> Backups verwalten
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (DbEngine == "Microsoft.EntityFrameworkCore.MySQL")
|
else if (DbEngine == "Microsoft.EntityFrameworkCore.MySQL")
|
||||||
{
|
{
|
||||||
<hr class="my-4" />
|
<p> MySQL Dump aktuell nicht möglich </p>
|
||||||
<div class="alert alert-info">
|
|
||||||
<i class="bi bi-info-circle me-2"></i>MySQL Dump aktuell nicht möglich
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<!-- Status Messages -->
|
<!-- Status für Erstellung eines Backups -->
|
||||||
@if (TempData["DumpMessage"] != null)
|
@if (TempData["DumpMessage"] != null)
|
||||||
{
|
{
|
||||||
<div class="alert alert-success mt-3">
|
<div class="alert alert-success">
|
||||||
<i class="bi bi-check-circle me-2"></i>@TempData["DumpMessage"]
|
<i class="bi bi-check-circle me-1"></i>@TempData["DumpMessage"]
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (TempData["DumpError"] != null)
|
@if (TempData["DumpError"] != null)
|
||||||
{
|
{
|
||||||
<div class="alert alert-danger mt-3">
|
<div class="alert alert-danger">
|
||||||
<i class="bi bi-exclamation-circle me-2"></i>@TempData["DumpError"]
|
<i class="bi bi-exclamation-circle me-1"></i>@TempData["DumpError"]
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card shadow mt-5 p-4" style="width: 55%; margin: auto;">
|
||||||
|
<h4><i class="bi bi-pencil-square me-2"></i>Benachrichtungen</h4>
|
||||||
|
|
||||||
|
<p>Registrierte E-Mail Adresse: <strong>@(ViewBag.mail ?? "nicht gefunden")</strong></p>
|
||||||
|
|
||||||
|
<!-- action="/Notification/UpdateSettings" existiert noch nicht-->
|
||||||
|
<form method="post" action="#">
|
||||||
|
<div class="card p-4 shadow-sm" style="max-width: 500px;">
|
||||||
|
<h5 class="card-title mb-3">
|
||||||
|
<i class="bi bi-bell me-2"></i>Benachrichtigungseinstellungen
|
||||||
|
</h5>
|
||||||
|
|
||||||
|
<div class="form-check form-switch mb-3">
|
||||||
|
<input class="form-check-input" type="checkbox" id="notifyOffline" name="NotifyOffline" checked>
|
||||||
|
<label class="form-check-label" for="notifyOffline">Benachrichtigung bei Server-Offline</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check form-switch mb-3">
|
||||||
|
<input class="form-check-input" type="checkbox" id="notifyUpdates" name="NotifyUpdates">
|
||||||
|
<label class="form-check-label" for="notifyUpdates">Benachrichtigung bei neuen Updates</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check form-switch mb-3">
|
||||||
|
<input class="form-check-input" type="checkbox" id="notifyUser" name="NotifyUser">
|
||||||
|
<label class="form-check-label" for="notifyUser">Benachrichtigung bei neuen Benutzern</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check form-switch mb-3">
|
||||||
|
<input class="form-check-input" type="checkbox" id="notifyMaintenance" name="NotifyMaintenance">
|
||||||
|
<label class="form-check-label" for="notifyMaintenance">Wartungsinformationen erhalten</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-db mt-3">
|
||||||
|
<i class="bi bi-save me-1"></i>Speichern
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<hr class="my-4" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -7,13 +7,20 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<!-- EF Core Design Tools -->
|
||||||
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
|
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
|
||||||
<PackageReference Include="DotNetEnv" Version="3.1.1" />
|
<PackageReference Include="DotNetEnv" Version="3.1.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.8" />
|
||||||
|
|
||||||
|
<!-- Pomelo MySQL EF Core Provider -->
|
||||||
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0" />
|
||||||
|
|
||||||
|
<!-- Auth via OpenID Connect + Cookies -->
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.3.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.3.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.6" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
|
||||||
|
|||||||
@@ -9,8 +9,22 @@
|
|||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
|
|
||||||
"Database": {
|
"Database": {
|
||||||
|
"Provider": "Sqlite",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
|
"MySql": "server=0.0.0.0;port=3306;database=db;user=user;password=password;",
|
||||||
"Sqlite": "Data Source=./persistence/watcher.db"
|
"Sqlite": "Data Source=./persistence/watcher.db"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"Authentication": {
|
||||||
|
"UseLocal": true,
|
||||||
|
"PocketIDEnabled": false,
|
||||||
|
"PocketID": {
|
||||||
|
"Authority": "https://pocketid.triggermeelmo.com",
|
||||||
|
"ClientId": "629a5f42-ab02-4905-8311-cc7b64165cc0",
|
||||||
|
"ClientSecret": "QHUNaRyK2VVYdZVz1cQqv8FEf2qtL6QH",
|
||||||
|
"CallbackPath": "/signin-oidc",
|
||||||
|
"ResponseType": "code"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.form-error {
|
.form-error {
|
||||||
color: var(--color-danger);
|
color: #ff6b6b;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
}
|
}
|
||||||
@@ -1,90 +1,20 @@
|
|||||||
/* Server Details - Info Card */
|
.info {
|
||||||
.info-list {
|
margin: 2rem;
|
||||||
display: flex;
|
margin-top: 3rem;
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-item {
|
.hardware {
|
||||||
display: flex;
|
margin: 2rem;
|
||||||
flex-direction: column;
|
margin-top: 3rem;
|
||||||
gap: 0.25rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-label {
|
|
||||||
font-size: 0.85rem;
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--color-muted) !important;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value {
|
|
||||||
font-size: 0.95rem;
|
|
||||||
font-weight: 400;
|
|
||||||
padding-left: 1.25rem;
|
|
||||||
color: var(--color-text, #f9feff) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All text within info-value should be visible */
|
|
||||||
.info-value,
|
|
||||||
.info-value *,
|
|
||||||
.info-value span,
|
|
||||||
.info-value .text-muted,
|
|
||||||
.info-value .text-success {
|
|
||||||
color: var(--color-text, #f9feff) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value .text-muted {
|
|
||||||
font-style: italic;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Section Headers in Info Card */
|
|
||||||
.card-body h6.text-muted {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--color-text) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-body h6.text-muted i {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Description and other text-muted paragraphs */
|
|
||||||
.card-body p.text-muted {
|
|
||||||
color: var(--color-text) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Graph Container */
|
|
||||||
.graphcontainer {
|
.graphcontainer {
|
||||||
height: 25rem;
|
height: 25rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: var(--color-surface, #212121);
|
background-color: var(--color-surface);
|
||||||
border-radius: 0.375rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.graph {
|
.graph {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 22rem;
|
height: 22rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Responsive adjustments */
|
|
||||||
@media (max-width: 992px) {
|
|
||||||
.info-item {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.card-header .d-flex.gap-2 {
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-header .btn-sm {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
padding: 0.25rem 0.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
/* Server Card Styling */
|
|
||||||
.server-card {
|
|
||||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
||||||
border: 1px solid rgba(0, 0, 0, 0.125);
|
|
||||||
background: var(--color-surface);
|
|
||||||
color: var(--color-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.server-card:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.server-card .card-header {
|
|
||||||
background-color: var(--color-bg);
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.server-card .card-body {
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure all text in server-card uses light color */
|
|
||||||
.server-card,
|
|
||||||
.server-card * {
|
|
||||||
color: var(--color-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allow Bootstrap badge colors to work */
|
|
||||||
.server-card .badge {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allow button colors to work */
|
|
||||||
.server-card .btn {
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Server Info Rows */
|
|
||||||
.server-info {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-row {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 0.4rem 0;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-row:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label {
|
|
||||||
color: var(--color-muted);
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value {
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Current Metrics Section */
|
|
||||||
.current-metrics h6 {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
font-weight: 600;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.metric-bar-item {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.metric-bar-item:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress {
|
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Action Buttons */
|
|
||||||
.action-buttons .btn {
|
|
||||||
font-size: 0.85rem;
|
|
||||||
padding: 0.4rem 0.6rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Responsive Adjustments */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.action-buttons {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-buttons .btn {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Badge Styling */
|
|
||||||
.badge {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
padding: 0.35em 0.65em;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,124 +1,12 @@
|
|||||||
/* Container Card Styling */
|
.ServiceList {
|
||||||
.container-card {
|
width: 80%;
|
||||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
||||||
border: 1px solid rgba(0, 0, 0, 0.125);
|
|
||||||
background: var(--color-surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-card:hover {
|
.ServiceRow {
|
||||||
transform: translateY(-2px);
|
border-style: solid;
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
|
border-color: var(--color-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-card .card-header {
|
.ServiceEntry {
|
||||||
background-color: var(--color-bg);
|
text-decoration: none;
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-card .card-body {
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Container Info Rows */
|
|
||||||
.container-info {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-row {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 0.4rem 0;
|
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-row:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label {
|
|
||||||
color: var(--color-muted);
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value {
|
|
||||||
color: var(--color-text, #f9feff);
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value a {
|
|
||||||
color: var(--color-text);
|
|
||||||
transition: color 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value a:hover {
|
|
||||||
color: var(--color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Action Buttons */
|
|
||||||
.action-buttons .btn {
|
|
||||||
font-size: 0.85rem;
|
|
||||||
padding: 0.4rem 0.6rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Metrics Panel */
|
|
||||||
.metrics-panel {
|
|
||||||
max-height: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
transition: max-height 0.3s ease-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.metrics-panel.show {
|
|
||||||
max-height: 500px;
|
|
||||||
transition: max-height 0.4s ease-in;
|
|
||||||
}
|
|
||||||
|
|
||||||
.metrics-content {
|
|
||||||
background-color: var(--color-bg) !important;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.metric-item {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.metric-item:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress {
|
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Toggle Button */
|
|
||||||
.toggle-metrics {
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggle-metrics:hover {
|
|
||||||
transform: scale(1.02);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Responsive Adjustments */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.action-buttons {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-buttons .btn {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Badge Styling */
|
|
||||||
.badge {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
padding: 0.35em 0.65em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Server Group Header */
|
|
||||||
h5.text-muted {
|
|
||||||
font-weight: 600;
|
|
||||||
border-bottom: 2px solid var(--color-accent);
|
|
||||||
padding-bottom: 0.5rem;
|
|
||||||
}
|
}
|
||||||
@@ -1,158 +1,24 @@
|
|||||||
/* Settings Card Styling - gleicher Stil wie Server Cards */
|
.Settingscontainer {
|
||||||
.settings-card {
|
|
||||||
background: var(--color-surface);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-card:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-card .card-header {
|
|
||||||
background-color: var(--color-bg);
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-card .card-header h5 {
|
|
||||||
color: var(--color-text);
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-card .card-body {
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Info Table Layout - ähnlich wie Server Info Rows */
|
|
||||||
.info-table {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
|
||||||
gap: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-row {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0.75rem;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
||||||
transition: background-color 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-row:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-row:hover {
|
|
||||||
background-color: rgba(255, 255, 255, 0.02);
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label {
|
|
||||||
color: var(--color-muted);
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label i {
|
|
||||||
color: var(--color-accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value {
|
|
||||||
color: var(--color-text);
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Subsection Headers */
|
|
||||||
.settings-card h6 {
|
|
||||||
color: var(--color-text);
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Backup Buttons */
|
|
||||||
.backup-buttons {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.75rem;
|
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
/* Wichtig: erlaubt Umbruch */
|
||||||
|
gap: 1rem;
|
||||||
|
/* optionaler Abstand */
|
||||||
}
|
}
|
||||||
|
|
||||||
.backup-buttons form {
|
.Settingscontainer>* {
|
||||||
flex: 1;
|
flex: 1 1 calc(50% - 0.5rem);
|
||||||
min-width: 200px;
|
/* 2 Elemente pro Zeile, inkl. Gap */
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.backup-buttons .btn {
|
.btn-db {
|
||||||
width: 100%;
|
background-color: var(--color-primary);
|
||||||
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Button Styling */
|
.btn-db:hover {
|
||||||
.settings-card .btn {
|
background-color: var(--color-accent);
|
||||||
font-weight: 500;
|
border: none;
|
||||||
font-size: 0.85rem;
|
|
||||||
padding: 0.5rem 0.75rem;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-card .btn-outline-primary {
|
|
||||||
border-color: var(--color-accent) !important;
|
|
||||||
color: var(--color-accent) !important;
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-card .btn-outline-primary:hover {
|
|
||||||
background-color: var(--color-accent) !important;
|
|
||||||
border-color: var(--color-accent) !important;
|
|
||||||
color: white !important;
|
|
||||||
transform: translateY(-1px);
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-card .btn-outline-primary:active,
|
|
||||||
.settings-card .btn-outline-primary:focus,
|
|
||||||
.settings-card .btn-outline-primary:focus-visible {
|
|
||||||
background-color: var(--color-accent) !important;
|
|
||||||
border-color: var(--color-accent) !important;
|
|
||||||
color: white !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* HR Styling */
|
|
||||||
.settings-card hr {
|
|
||||||
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
margin: 1.5rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Alert Styling */
|
|
||||||
.alert {
|
|
||||||
border-radius: 0.375rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Responsive */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.info-row {
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 0.5rem;
|
|
||||||
padding: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.backup-buttons {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.backup-buttons form {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
--color-text: #f9feff;
|
--color-text: #f9feff;
|
||||||
--color-muted: #c0c0c0;
|
--color-muted: #c0c0c0;
|
||||||
--color-success: #14a44d;
|
--color-success: #14a44d;
|
||||||
--color-success-hover: #0f8c3c;
|
|
||||||
--color-danger: #ff6b6b;
|
--color-danger: #ff6b6b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,30 +54,9 @@ a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-pocketid:hover {
|
.btn-pocketid:hover {
|
||||||
background-color: var(--color-success-hover);
|
background-color: #0f8c3c;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
border-top: 1px solid var(--color-accent);
|
border-top: 1px solid var(--color-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bootstrap Overrides für Dark Theme */
|
|
||||||
.text-muted {
|
|
||||||
color: var(--color-muted) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-light {
|
|
||||||
background-color: var(--color-surface) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-text {
|
|
||||||
color: var(--color-text) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-primary-emphasis {
|
|
||||||
color: var(--color-primary) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.border-secondary {
|
|
||||||
border-color: rgba(255, 255, 255, 0.2) !important;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
.table {
|
.table {
|
||||||
color: var(--color-text);
|
color: red;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.picture {
|
.picture {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
watcher:
|
watcher:
|
||||||
image: git.triggermeelmo.com/watcher/watcher-server:${IMAGE_VERSION:-latest}
|
image: git.triggermeelmo.com/watcher/watcher-server:v0.1.0
|
||||||
container_name: watcher
|
container_name: watcher
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
@@ -8,17 +8,6 @@ services:
|
|||||||
memory: 200M
|
memory: 200M
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
env_file: .env
|
||||||
environment:
|
|
||||||
# Application Version (wird aus Image-Tag übernommen)
|
|
||||||
- WATCHER_VERSION=${IMAGE_VERSION:-latest}
|
|
||||||
# Update Check
|
|
||||||
- UPDATE_CHECK_ENABLED=true
|
|
||||||
- UPDATE_CHECK_INTERVAL_HOURS=24
|
|
||||||
- UPDATE_CHECK_REPOSITORY_URL=https://git.triggermeelmo.com/api/v1/repos/Watcher/watcher/releases/latest
|
|
||||||
# Data Retention Policy
|
|
||||||
- METRIC_RETENTION_DAYS=30
|
|
||||||
- METRIC_CLEANUP_INTERVAL_HOURS=24
|
|
||||||
- METRIC_CLEANUP_ENABLED=true
|
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user