chore: initialize repository with deployment baseline
This commit is contained in:
80
entities/AuditLog.json
Normal file
80
entities/AuditLog.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "Backup",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"vm_id": {
|
||||
"type": "string",
|
||||
"title": "VM ID"
|
||||
},
|
||||
"vm_name": {
|
||||
"type": "string",
|
||||
"title": "VM Name"
|
||||
},
|
||||
"node": {
|
||||
"type": "string",
|
||||
"title": "Node"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"pending",
|
||||
"running",
|
||||
"completed",
|
||||
"failed",
|
||||
"expired"
|
||||
],
|
||||
"title": "Status"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"full",
|
||||
"incremental",
|
||||
"snapshot"
|
||||
],
|
||||
"title": "Backup Type"
|
||||
},
|
||||
"size_mb": {
|
||||
"type": "number",
|
||||
"title": "Size (MB)"
|
||||
},
|
||||
"storage": {
|
||||
"type": "string",
|
||||
"title": "Storage Location"
|
||||
},
|
||||
"schedule": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"manual",
|
||||
"daily",
|
||||
"weekly",
|
||||
"monthly"
|
||||
],
|
||||
"title": "Schedule"
|
||||
},
|
||||
"retention_days": {
|
||||
"type": "number",
|
||||
"title": "Retention Days"
|
||||
},
|
||||
"started_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"title": "Started At"
|
||||
},
|
||||
"completed_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"title": "Completed At"
|
||||
},
|
||||
"notes": {
|
||||
"type": "string",
|
||||
"title": "Notes"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"vm_id",
|
||||
"vm_name",
|
||||
"status",
|
||||
"type"
|
||||
]
|
||||
}
|
||||
72
entities/Backup.json
Normal file
72
entities/Backup.json
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "BillingPlan",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"title": "Plan Name"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string",
|
||||
"title": "Slug"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"title": "Description"
|
||||
},
|
||||
"price_monthly": {
|
||||
"type": "number",
|
||||
"title": "Monthly Price"
|
||||
},
|
||||
"price_hourly": {
|
||||
"type": "number",
|
||||
"title": "Hourly Price"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"NGN",
|
||||
"USD",
|
||||
"GHS",
|
||||
"KES",
|
||||
"ZAR"
|
||||
],
|
||||
"title": "Currency"
|
||||
},
|
||||
"cpu_cores": {
|
||||
"type": "number",
|
||||
"title": "CPU Cores"
|
||||
},
|
||||
"ram_mb": {
|
||||
"type": "number",
|
||||
"title": "RAM (MB)"
|
||||
},
|
||||
"disk_gb": {
|
||||
"type": "number",
|
||||
"title": "Disk (GB)"
|
||||
},
|
||||
"bandwidth_gb": {
|
||||
"type": "number",
|
||||
"title": "Bandwidth (GB)"
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean",
|
||||
"title": "Active"
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "Features"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"price_monthly",
|
||||
"currency",
|
||||
"cpu_cores",
|
||||
"ram_mb",
|
||||
"disk_gb"
|
||||
]
|
||||
}
|
||||
83
entities/BillingPlan.json
Normal file
83
entities/BillingPlan.json
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"name": "Invoice",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"invoice_number": {
|
||||
"type": "string",
|
||||
"title": "Invoice Number"
|
||||
},
|
||||
"tenant_id": {
|
||||
"type": "string",
|
||||
"title": "Tenant ID"
|
||||
},
|
||||
"tenant_name": {
|
||||
"type": "string",
|
||||
"title": "Tenant Name"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"draft",
|
||||
"pending",
|
||||
"paid",
|
||||
"overdue",
|
||||
"cancelled",
|
||||
"refunded"
|
||||
],
|
||||
"title": "Status"
|
||||
},
|
||||
"amount": {
|
||||
"type": "number",
|
||||
"title": "Amount"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"NGN",
|
||||
"USD",
|
||||
"GHS",
|
||||
"KES",
|
||||
"ZAR"
|
||||
],
|
||||
"title": "Currency"
|
||||
},
|
||||
"due_date": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"title": "Due Date"
|
||||
},
|
||||
"paid_date": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"title": "Paid Date"
|
||||
},
|
||||
"payment_provider": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"paystack",
|
||||
"flutterwave",
|
||||
"manual"
|
||||
],
|
||||
"title": "Payment Provider"
|
||||
},
|
||||
"payment_reference": {
|
||||
"type": "string",
|
||||
"title": "Payment Reference"
|
||||
},
|
||||
"line_items": {
|
||||
"type": "string",
|
||||
"title": "Line Items JSON"
|
||||
},
|
||||
"notes": {
|
||||
"type": "string",
|
||||
"title": "Notes"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"invoice_number",
|
||||
"tenant_id",
|
||||
"status",
|
||||
"amount",
|
||||
"currency"
|
||||
]
|
||||
}
|
||||
95
entities/FirewallRule.json
Normal file
95
entities/FirewallRule.json
Normal file
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"name": "UsageRecord",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"vm_id": {
|
||||
"type": "string",
|
||||
"title": "VM ID"
|
||||
},
|
||||
"vm_name": {
|
||||
"type": "string",
|
||||
"title": "VM Name"
|
||||
},
|
||||
"tenant_id": {
|
||||
"type": "string",
|
||||
"title": "Tenant ID"
|
||||
},
|
||||
"tenant_name": {
|
||||
"type": "string",
|
||||
"title": "Tenant Name"
|
||||
},
|
||||
"billing_plan_id": {
|
||||
"type": "string",
|
||||
"title": "Billing Plan ID"
|
||||
},
|
||||
"plan_name": {
|
||||
"type": "string",
|
||||
"title": "Plan Name"
|
||||
},
|
||||
"hours_used": {
|
||||
"type": "number",
|
||||
"title": "Hours Used"
|
||||
},
|
||||
"price_per_hour": {
|
||||
"type": "number",
|
||||
"title": "Price Per Hour"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"NGN",
|
||||
"USD",
|
||||
"GHS",
|
||||
"KES",
|
||||
"ZAR"
|
||||
],
|
||||
"title": "Currency"
|
||||
},
|
||||
"total_cost": {
|
||||
"type": "number",
|
||||
"title": "Total Cost"
|
||||
},
|
||||
"period_start": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"title": "Period Start"
|
||||
},
|
||||
"period_end": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"title": "Period End"
|
||||
},
|
||||
"billed": {
|
||||
"type": "boolean",
|
||||
"title": "Billed"
|
||||
},
|
||||
"invoice_id": {
|
||||
"type": "string",
|
||||
"title": "Invoice ID"
|
||||
},
|
||||
"cpu_hours": {
|
||||
"type": "number",
|
||||
"title": "CPU Hours"
|
||||
},
|
||||
"ram_gb_hours": {
|
||||
"type": "number",
|
||||
"title": "RAM GB-Hours"
|
||||
},
|
||||
"disk_gb_hours": {
|
||||
"type": "number",
|
||||
"title": "Disk GB-Hours"
|
||||
},
|
||||
"network_gb": {
|
||||
"type": "number",
|
||||
"title": "Network GB Used"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"vm_id",
|
||||
"vm_name",
|
||||
"hours_used",
|
||||
"price_per_hour",
|
||||
"currency",
|
||||
"total_cost"
|
||||
]
|
||||
}
|
||||
83
entities/Invoice.json
Normal file
83
entities/Invoice.json
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"name": "Invoice",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"invoice_number": {
|
||||
"type": "string",
|
||||
"title": "Invoice Number"
|
||||
},
|
||||
"tenant_id": {
|
||||
"type": "string",
|
||||
"title": "Tenant ID"
|
||||
},
|
||||
"tenant_name": {
|
||||
"type": "string",
|
||||
"title": "Tenant Name"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"draft",
|
||||
"pending",
|
||||
"paid",
|
||||
"overdue",
|
||||
"cancelled",
|
||||
"refunded"
|
||||
],
|
||||
"title": "Status"
|
||||
},
|
||||
"amount": {
|
||||
"type": "number",
|
||||
"title": "Amount"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"NGN",
|
||||
"USD",
|
||||
"GHS",
|
||||
"KES",
|
||||
"ZAR"
|
||||
],
|
||||
"title": "Currency"
|
||||
},
|
||||
"due_date": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"title": "Due Date"
|
||||
},
|
||||
"paid_date": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"title": "Paid Date"
|
||||
},
|
||||
"payment_provider": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"paystack",
|
||||
"flutterwave",
|
||||
"manual"
|
||||
],
|
||||
"title": "Payment Provider"
|
||||
},
|
||||
"payment_reference": {
|
||||
"type": "string",
|
||||
"title": "Payment Reference"
|
||||
},
|
||||
"line_items": {
|
||||
"type": "string",
|
||||
"title": "Line Items JSON"
|
||||
},
|
||||
"notes": {
|
||||
"type": "string",
|
||||
"title": "Notes"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"invoice_number",
|
||||
"tenant_id",
|
||||
"status",
|
||||
"amount",
|
||||
"currency"
|
||||
]
|
||||
}
|
||||
95
entities/ProxmoxNode.json
Normal file
95
entities/ProxmoxNode.json
Normal file
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"name": "Tenant",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"title": "Organization Name"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string",
|
||||
"title": "Slug"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"active",
|
||||
"suspended",
|
||||
"trial",
|
||||
"cancelled"
|
||||
],
|
||||
"title": "Status"
|
||||
},
|
||||
"plan": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"starter",
|
||||
"professional",
|
||||
"enterprise",
|
||||
"custom"
|
||||
],
|
||||
"title": "Plan"
|
||||
},
|
||||
"owner_email": {
|
||||
"type": "string",
|
||||
"title": "Owner Email"
|
||||
},
|
||||
"member_emails": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "Member Emails"
|
||||
},
|
||||
"vm_limit": {
|
||||
"type": "number",
|
||||
"title": "VM Limit"
|
||||
},
|
||||
"cpu_limit": {
|
||||
"type": "number",
|
||||
"title": "CPU Limit"
|
||||
},
|
||||
"ram_limit_mb": {
|
||||
"type": "number",
|
||||
"title": "RAM Limit (MB)"
|
||||
},
|
||||
"disk_limit_gb": {
|
||||
"type": "number",
|
||||
"title": "Disk Limit (GB)"
|
||||
},
|
||||
"balance": {
|
||||
"type": "number",
|
||||
"title": "Balance"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"NGN",
|
||||
"USD",
|
||||
"GHS",
|
||||
"KES",
|
||||
"ZAR"
|
||||
],
|
||||
"title": "Currency"
|
||||
},
|
||||
"payment_provider": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"paystack",
|
||||
"flutterwave",
|
||||
"manual"
|
||||
],
|
||||
"title": "Payment Provider"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"title": "Metadata JSON"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"status",
|
||||
"plan",
|
||||
"owner_email"
|
||||
]
|
||||
}
|
||||
88
entities/SecurityEvent.json
Normal file
88
entities/SecurityEvent.json
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"name": "FirewallRule",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"title": "Rule Name"
|
||||
},
|
||||
"direction": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"inbound",
|
||||
"outbound",
|
||||
"both"
|
||||
],
|
||||
"title": "Direction"
|
||||
},
|
||||
"action": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"allow",
|
||||
"deny",
|
||||
"rate_limit",
|
||||
"log"
|
||||
],
|
||||
"title": "Action"
|
||||
},
|
||||
"protocol": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"tcp",
|
||||
"udp",
|
||||
"icmp",
|
||||
"any"
|
||||
],
|
||||
"title": "Protocol"
|
||||
},
|
||||
"source_ip": {
|
||||
"type": "string",
|
||||
"title": "Source IP / CIDR"
|
||||
},
|
||||
"destination_ip": {
|
||||
"type": "string",
|
||||
"title": "Destination IP / CIDR"
|
||||
},
|
||||
"port_range": {
|
||||
"type": "string",
|
||||
"title": "Port Range"
|
||||
},
|
||||
"priority": {
|
||||
"type": "number",
|
||||
"title": "Priority"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"title": "Enabled"
|
||||
},
|
||||
"applies_to": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"all_nodes",
|
||||
"all_vms",
|
||||
"specific_node",
|
||||
"specific_vm"
|
||||
],
|
||||
"title": "Applies To"
|
||||
},
|
||||
"target_id": {
|
||||
"type": "string",
|
||||
"title": "Target Node/VM ID"
|
||||
},
|
||||
"hit_count": {
|
||||
"type": "number",
|
||||
"title": "Hit Count"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"title": "Description"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"direction",
|
||||
"action",
|
||||
"protocol",
|
||||
"enabled"
|
||||
]
|
||||
}
|
||||
109
entities/Tenant.json
Normal file
109
entities/Tenant.json
Normal file
@@ -0,0 +1,109 @@
|
||||
{
|
||||
"name": "VirtualMachine",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"title": "VM Name"
|
||||
},
|
||||
"vmid": {
|
||||
"type": "number",
|
||||
"title": "VM ID"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"running",
|
||||
"stopped",
|
||||
"paused",
|
||||
"migrating",
|
||||
"error"
|
||||
],
|
||||
"title": "Status"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"qemu",
|
||||
"lxc"
|
||||
],
|
||||
"title": "Type"
|
||||
},
|
||||
"node": {
|
||||
"type": "string",
|
||||
"title": "Proxmox Node"
|
||||
},
|
||||
"tenant_id": {
|
||||
"type": "string",
|
||||
"title": "Tenant ID"
|
||||
},
|
||||
"os_template": {
|
||||
"type": "string",
|
||||
"title": "OS Template"
|
||||
},
|
||||
"cpu_cores": {
|
||||
"type": "number",
|
||||
"title": "CPU Cores"
|
||||
},
|
||||
"ram_mb": {
|
||||
"type": "number",
|
||||
"title": "RAM (MB)"
|
||||
},
|
||||
"disk_gb": {
|
||||
"type": "number",
|
||||
"title": "Disk (GB)"
|
||||
},
|
||||
"ip_address": {
|
||||
"type": "string",
|
||||
"title": "IP Address"
|
||||
},
|
||||
"cpu_usage": {
|
||||
"type": "number",
|
||||
"title": "CPU Usage %"
|
||||
},
|
||||
"ram_usage": {
|
||||
"type": "number",
|
||||
"title": "RAM Usage %"
|
||||
},
|
||||
"disk_usage": {
|
||||
"type": "number",
|
||||
"title": "Disk Usage %"
|
||||
},
|
||||
"network_in": {
|
||||
"type": "number",
|
||||
"title": "Network In (MB)"
|
||||
},
|
||||
"network_out": {
|
||||
"type": "number",
|
||||
"title": "Network Out (MB)"
|
||||
},
|
||||
"uptime_seconds": {
|
||||
"type": "number",
|
||||
"title": "Uptime (seconds)"
|
||||
},
|
||||
"billing_plan_id": {
|
||||
"type": "string",
|
||||
"title": "Billing Plan ID"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "Tags"
|
||||
},
|
||||
"notes": {
|
||||
"type": "string",
|
||||
"title": "Notes"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"status",
|
||||
"type",
|
||||
"node",
|
||||
"cpu_cores",
|
||||
"ram_mb",
|
||||
"disk_gb"
|
||||
]
|
||||
}
|
||||
37
entities/UsageRecord.json
Normal file
37
entities/UsageRecord.json
Normal file
@@ -0,0 +1,37 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Outlet } from 'react-router-dom';
|
||||
import { useAuth } from '@/lib/AuthContext';
|
||||
import UserNotRegisteredError from '@/components/UserNotRegisteredError';
|
||||
|
||||
const DefaultFallback = () => (
|
||||
<div className="fixed inset-0 flex items-center justify-center">
|
||||
<div className="w-8 h-8 border-4 border-slate-200 border-t-slate-800 rounded-full animate-spin"></div>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default function ProtectedRoute({ fallback = <DefaultFallback />, unauthenticatedElement }) {
|
||||
const { isAuthenticated, isLoadingAuth, authChecked, authError, checkUserAuth } = useAuth();
|
||||
|
||||
useEffect(() => {
|
||||
if (!authChecked && !isLoadingAuth) {
|
||||
checkUserAuth();
|
||||
}
|
||||
}, [authChecked, isLoadingAuth, checkUserAuth]);
|
||||
|
||||
if (isLoadingAuth || !authChecked) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
if (authError) {
|
||||
if (authError.type === 'user_not_registered') {
|
||||
return <UserNotRegisteredError />;
|
||||
}
|
||||
return unauthenticatedElement;
|
||||
}
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return unauthenticatedElement;
|
||||
}
|
||||
|
||||
return <Outlet />;
|
||||
}
|
||||
63
entities/VirtualMachine.json
Normal file
63
entities/VirtualMachine.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "AuditLog",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"type": "string",
|
||||
"title": "Action"
|
||||
},
|
||||
"resource_type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"vm",
|
||||
"tenant",
|
||||
"user",
|
||||
"backup",
|
||||
"invoice",
|
||||
"node",
|
||||
"system"
|
||||
],
|
||||
"title": "Resource Type"
|
||||
},
|
||||
"resource_id": {
|
||||
"type": "string",
|
||||
"title": "Resource ID"
|
||||
},
|
||||
"resource_name": {
|
||||
"type": "string",
|
||||
"title": "Resource Name"
|
||||
},
|
||||
"actor_email": {
|
||||
"type": "string",
|
||||
"title": "Actor Email"
|
||||
},
|
||||
"actor_role": {
|
||||
"type": "string",
|
||||
"title": "Actor Role"
|
||||
},
|
||||
"severity": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"info",
|
||||
"warning",
|
||||
"error",
|
||||
"critical"
|
||||
],
|
||||
"title": "Severity"
|
||||
},
|
||||
"details": {
|
||||
"type": "string",
|
||||
"title": "Details JSON"
|
||||
},
|
||||
"ip_address": {
|
||||
"type": "string",
|
||||
"title": "IP Address"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action",
|
||||
"resource_type",
|
||||
"actor_email",
|
||||
"severity"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user