From c4f3b47fc7ecd5e27b748a481ed65e0a46168ab9 Mon Sep 17 00:00:00 2001 From: headlessdev Date: Tue, 29 Apr 2025 16:20:34 +0200 Subject: [PATCH] Servers.tsx i18n --- app/dashboard/servers/Servers.tsx | 338 +++++++++++++++--------------- i18n/languages/en.json | 276 ++++++++++++++---------- 2 files changed, 342 insertions(+), 272 deletions(-) diff --git a/app/dashboard/servers/Servers.tsx b/app/dashboard/servers/Servers.tsx index 15ff673..e124c00 100644 --- a/app/dashboard/servers/Servers.tsx +++ b/app/dashboard/servers/Servers.tsx @@ -28,6 +28,8 @@ import { Copy, History, Thermometer, + ChevronLeft, + ChevronRight, } from "lucide-react" import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { @@ -124,7 +126,7 @@ interface MonitoringData { } export default function Servers() { - const t = useTranslations('Servers') + const t = useTranslations() const [host, setHost] = useState(false) const [hostServer, setHostServer] = useState(0) const [name, setName] = useState("") @@ -527,11 +529,11 @@ export default function Servers() { - {t('MyInfrastructure')} + {t('Servers.MyInfrastructure')} - {t('Servers')} + {t('Servers.Title')} @@ -540,11 +542,11 @@ export default function Servers() {
- {t('YourServers')} + {t('Servers.YourServers')}
-
- +
{icon && }
- +
- {t('AddServer.General.ManagementURLTooltip')} + {t('Servers.AddServer.General.ManagementURLTooltip')} @@ -846,7 +848,7 @@ export default function Servers() {
setHost(checked === true)} /> - +
{!host && (
- +
-

{t('AddServer.Monitoring.SetupTitle')}

+

{t('Servers.AddServer.Monitoring.SetupTitle')}

- {t('AddServer.Monitoring.SetupDescription')} + {t('Servers.AddServer.Monitoring.SetupDescription')}

                                     {`services:
@@ -983,8 +985,8 @@ export default function Servers() {
                     
                   
                   
-                    {t('cancel')}
-                    {t('add')}
+                    {t('Common.cancel')}
+                    {t('Common.add')}
                   
                 
               
@@ -993,7 +995,7 @@ export default function Servers() {
           
setSearchTerm(e.target.value)} /> @@ -1016,7 +1018,7 @@ export default function Servers() { {server.online && server.uptime && ( - since {server.uptime} + {t('Common.since', { date: server.uptime })} )}
@@ -1045,13 +1047,13 @@ export default function Servers() {
- OS: {server.os || "-"} + {t('Common.Server.OS')}: {server.os || "-"}
- IP: {server.ip || "Not set"} + {t('Common.Server.IP')}: {server.ip || t('Common.notSet')}
@@ -1059,7 +1061,7 @@ export default function Servers() {
- Host: {getHostServerName(server.hostServer)} + {t('Common.Server.Host')}: {getHostServerName(server.hostServer)}
)} @@ -1069,31 +1071,31 @@ export default function Servers() {
-

Hardware Information

+

{t('Servers.ServerCard.HardwareInformation')}

- CPU: {server.cpu || "-"} + {t('Common.Server.CPU')}: {server.cpu || "-"}
- GPU: {server.gpu || "-"} + {t('Common.Server.GPU')}: {server.gpu || "-"}
- RAM: {server.ram || "-"} + {t('Common.Server.RAM')}: {server.ram || "-"}
- Disk: {server.disk || "-"} + {t('Common.Server.Disk')}: {server.disk || "-"}
@@ -1104,15 +1106,15 @@ export default function Servers() {
-

Resource Usage

+

{t('Servers.ServerCard.ResourceUsage')}

- CPU + {t('Common.Server.CPU')}
- {server.cpuUsage !== null && server.cpuUsage !== undefined ? `${server.cpuUsage}%` : "NO DATA"} + {server.cpuUsage !== null && server.cpuUsage !== undefined ? `${server.cpuUsage}%` : t('Common.noData')}
- RAM + {t('Common.Server.RAM')}
- {server.ramUsage !== null && server.ramUsage !== undefined ? `${server.ramUsage}%` : "NO DATA"} + {server.ramUsage !== null && server.ramUsage !== undefined ? `${server.ramUsage}%` : t('Common.noData')}
- Disk + {t('Common.Server.Disk')}
- {server.diskUsage !== null && server.diskUsage !== undefined ? `${server.diskUsage}%` : "NO DATA"} + {server.diskUsage !== null && server.diskUsage !== undefined ? `${server.diskUsage}%` : t('Common.noData')}
-
-
- - GPU +
+
+ + {t('Common.Server.GPU')} +
+ + {server.online && + server.gpuUsage && + server.gpuUsage !== null && + server.gpuUsage !== undefined && + server.gpuUsage.toString() !== "0" + ? `${server.gpuUsage}%` + : t('Common.noData')} +
- - {server.online && - server.gpuUsage && - server.gpuUsage !== null && - server.gpuUsage !== undefined && - server.gpuUsage.toString() !== "0" - ? `${server.gpuUsage}%` - : "NO DATA"} - -
80 ? "bg-destructive" : server.gpuUsage && server.gpuUsage > 60 ? "bg-amber-500" : "bg-emerald-500"}`} @@ -1180,20 +1182,20 @@ export default function Servers() {
-
-
- - Temp +
+
+ + {t('Common.Server.Temperature')} +
+ + {server.online && + server.temp !== null && + server.temp !== undefined && + server.temp.toString() !== "0" + ? `${server.temp}°C` + : t('Common.noData')} +
- - {server.online && - server.temp !== null && - server.temp !== undefined && - server.temp.toString() !== "0" - ? `${server.temp}°C` - : "NO DATA"} - -
80 ? "bg-destructive" : server.temp && server.temp > 60 ? "bg-amber-500" : "bg-emerald-500"}`} @@ -1214,7 +1216,7 @@ export default function Servers() { @@ -1230,7 +1232,7 @@ export default function Servers() { - Open Management URL + {t('Servers.ServerCard.OpenManagementURL')} )} @@ -1254,7 +1256,7 @@ export default function Servers() { - Edit server + {t('Servers.ServerCard.EditServer')} @@ -1270,7 +1272,7 @@ export default function Servers() { - Hosted VMs + {t('Servers.ServerCard.HostedVMs')} {server.host && (
@@ -1325,21 +1327,21 @@ export default function Servers() { - Edit VM + {t('Servers.EditServer.Title', { name: hostedVM.name })} - General - Hardware + {t('Common.Server.Tabs.General')} + {t('Common.Server.Tabs.Hardware')} - Host + {t('Common.Server.Tabs.Host')}
- +
{ const iconElements = @@ -1426,7 +1428,7 @@ export default function Servers() {
- +
{editIcon && (
- +
- +
- +
- +
- +
- +
- +
- +
{!editHost && (
- + setEditIcon(value)} > - + {editIcon && (
@@ -1765,7 +1767,7 @@ export default function Servers() { { const iconElements = document.querySelectorAll( @@ -1811,14 +1813,14 @@ export default function Servers() {
- +
{editIcon && }
- +
- +
- +
- +
- + - +
{!editHost && (
- +
-

Required Server Setup

+

{t('Servers.EditServer.Monitoring.SetupTitle')}

- To enable monitoring, you need to install Glances on your server. Here's an example Docker Compose configuration: + {t('Servers.EditServer.Monitoring.SetupDescription')}

                                                 {`services:
@@ -1996,8 +1998,8 @@ export default function Servers() {
                                 
                               
                               
-                                Cancel
-                                
+                                {t('Common.cancel')}
+                                
                               
                             
                           
@@ -2013,24 +2015,24 @@ export default function Servers() {
                                   
                                   
                                     
-                                      Delete {server.name}
+                                      {t('Servers.ServerCard.DeleteConfirmation.Title', { name: server.name })}
                                       
-                                        Are you sure you want to delete this server? This action cannot be undone.
+                                        {t('Servers.ServerCard.DeleteConfirmation.Description')}
                                       
                                     
                                     
-                                      Cancel
+                                      {t('Servers.ServerCard.DeleteConfirmation.Cancel')}
                                        deleteApplication(server.id)}
                                       >
-                                        Delete
+                                        {t('Servers.ServerCard.DeleteConfirmation.Delete')}
                                       
                                     
                                   
                                 
                               
-                              Delete server
+                              {t('Servers.ServerCard.DeleteServer')}
                             
                           
                         
@@ -2071,8 +2073,12 @@ export default function Servers() {
{totalItems > 0 - ? `Showing ${((currentPage - 1) * itemsPerPage) + 1}-${Math.min(currentPage * itemsPerPage, totalItems)} of ${totalItems} servers` - : "No servers found"} + ? t('Servers.Pagination.Showing', { + start: ((currentPage - 1) * itemsPerPage) + 1, + end: Math.min(currentPage * itemsPerPage, totalItems), + total: totalItems + }) + : t('Servers.Pagination.NoServers')}
diff --git a/i18n/languages/en.json b/i18n/languages/en.json index dc08316..57b3195 100644 --- a/i18n/languages/en.json +++ b/i18n/languages/en.json @@ -1,114 +1,178 @@ { - "Sidebar": { - "Main Navigation": "Main Navigation", - "Dashboard": "Dashboard", - "My Infrastructure": "My Infrastructure", - "Servers": "Servers", - "Applications": "Applications", - "Uptime": "Uptime", - "Network": "Network", - "Settings": "Settings", - "Logout": "Logout" - }, - "Home": { - "TitleUnder": "Dashboard to manage your entire server infrastructure", - "LoginCardTitle": "Login", - "LoginCardDescription": "Enter your credentials to continue", - "AuthenticationError": "Authentication Error", - "Email": "Email", - "Password": "Password", - "SigninButton": "Sign in", - "SigninButtonSigningIn": "Signing in..." - }, - "Dashboard": { - "Title": "Dashboard", - "Servers": { - "Title": "Servers", - "Description": "Physical and virtual servers overview", - "PhysicalServers": "Physical Servers", - "VirtualServers": "Virtual Servers", - "ManageServers": "Manage Servers" - }, - "Applications": { - "Title": "Applications", - "Description": "Manage your deployed applications", - "OnlineApplications": "Running Applications", - "ViewAllApplications": "View all applications" - }, - "Uptime": { - "Title": "Uptime", - "Description": "Monitor your service availability", - "OnlineApplications": "Online Applications", - "ViewUptimeMetrics": "View uptime metrics" - }, - "Network": { - "Title": "Network", - "Description": "Manage network configuration", - "ActiveConnections": "Active Connections", - "ViewNetworkDetails": "View network details" - } - }, - "Servers": { - "MyInfrastructure": "My Infrastructure", - "Title": "Servers", - "YourServers": "Your Servers", - "ChangeView": "Change View", - "ListView": "List View", - "GridView": "Grid View", - "ItemsPerPage": { - "items": "items", - "item": "item", - "4": "4 items", - "6": "6 items", - "10": "10 items", - "15": "15 items", - "20": "20 items", - "25": "25 items", - "Custom": "Custom (1-100)" - }, + "Common": { + "ChangeView": "Change View", + "ListView": "List View", + "GridView": "Grid View", + "optional": "optional", + "cancel": "Cancel", + "add": "Add", + "since": "since {date}", + "notSet": "Not set", + "noData": "No data", + "ItemsPerPage": { + "items": "items", + "item": "item", + "4": "4 items", + "6": "6 items", + "10": "10 items", + "15": "15 items", + "20": "20 items", + "25": "25 items", + "Custom": "Custom (1-100)" + }, + "Server": { + "CPU": "CPU", + "GPU": "GPU", + "RAM": "RAM", + "Disk": "Disk", + "OS": "OS", + "IP": "IP", + "Host": "Host", + "Temperature": "Temperature", "Tabs": { "General": "General", "Hardware": "Hardware", "Host": "Host", "Monitoring": "Monitoring" - }, - "optional": "optional", - "cancel": "Cancel", - "add": "Add", - "AddServer": { - "Title": "Add a server", - "General": { - "Title": "Add a server", - "CopyServer": "Copy server", - "Icon": "Icon", - "IconPlaceholder": "Select an icon", - "IconSearchPlaceholder": "Search icons...", - "Preview": "Preview", - "Name": "Name", - "OperatingSystem": "Operating System", - "OperatingSystemPlaceholder": "Select OS", - "IPAdress": "IP Adress", - "ManagementURL": "Management URL", - "ManagementURLTooltip": "Link to a web interface (e.g. Proxmox or Portainer) with which the server can be managed" - }, - "Hardware": { - "CPU": "CPU", - "GPU": "GPU", - "RAM": "RAM", - "Storage": "Storage" - }, - "Host": { - "MarkAsHostServer": "Mark as host server", - "SelectHostServer": "Select a host server", - "SelectHostServerPlaceholder": "Select a host server", - "NoHostServer": "No host server" - }, - "Monitoring": { - "Enable": "Enable monitoring", - "URL": "Monitoring URL", - "SetupTitle": "Required Server Setup", - "SetupDescription": "To enable monitoring, you need to install Glances on your server. Here's an example Docker Compose configuration:" - } } + } + }, + "Sidebar": { + "Main Navigation": "Main Navigation", + "Dashboard": "Dashboard", + "My Infrastructure": "My Infrastructure", + "Servers": "Servers", + "Applications": "Applications", + "Uptime": "Uptime", + "Network": "Network", + "Settings": "Settings", + "Logout": "Logout" + }, + "Home": { + "TitleUnder": "Dashboard to manage your entire server infrastructure", + "LoginCardTitle": "Login", + "LoginCardDescription": "Enter your credentials to continue", + "AuthenticationError": "Authentication Error", + "Email": "Email", + "Password": "Password", + "SigninButton": "Sign in", + "SigninButtonSigningIn": "Signing in..." + }, + "Dashboard": { + "Title": "Dashboard", + "Servers": { + "Title": "Servers", + "Description": "Physical and virtual servers overview", + "PhysicalServers": "Physical Servers", + "VirtualServers": "Virtual Servers", + "ManageServers": "Manage Servers" + }, + "Applications": { + "Title": "Applications", + "Description": "Manage your deployed applications", + "OnlineApplications": "Running Applications", + "ViewAllApplications": "View all applications" + }, + "Uptime": { + "Title": "Uptime", + "Description": "Monitor your service availability", + "OnlineApplications": "Online Applications", + "ViewUptimeMetrics": "View uptime metrics" + }, + "Network": { + "Title": "Network", + "Description": "Manage network configuration", + "ActiveConnections": "Active Connections", + "ViewNetworkDetails": "View network details" + } + }, + "Servers": { + "Title": "Servers", + "MyInfrastructure": "My Infrastructure", + "YourServers": "Your Servers", + "AddServer": { + "Title": "Add a server", + "General": { + "Title": "Add a server", + "CopyServer": "Copy server", + "Icon": "Icon", + "IconPlaceholder": "Select an icon", + "IconSearchPlaceholder": "Search icons...", + "Preview": "Preview", + "Name": "Name", + "OperatingSystem": "Operating System", + "OperatingSystemPlaceholder": "Select OS", + "IPAdress": "IP Adress", + "ManagementURL": "Management URL", + "ManagementURLTooltip": "Link to a web interface (e.g. Proxmox or Portainer) with which the server can be managed" + }, + "Host": { + "MarkAsHostServer": "Mark as host server", + "SelectHostServer": "Select a host server", + "SelectHostServerPlaceholder": "Select a host server", + "NoHostServer": "No host server" + }, + "Monitoring": { + "Enable": "Enable monitoring", + "URL": "Monitoring URL", + "SetupTitle": "Required Server Setup", + "SetupDescription": "To enable monitoring, you need to install Glances on your server. Here's an example Docker Compose configuration:" + } + }, + "ServerCard": { + "HardwareInformation": "Hardware Information", + "ViewDetails": "View Details", + "OpenManagementURL": "Open Management URL", + "EditServer": "Edit Server", + "DeleteServer": "Delete Server", + "HostedVMs": "Hosted VMs", + "ResourceUsage": "Resource Usage", + "DeleteConfirmation": { + "Title": "Delete {name}", + "Description": "Are you sure you want to delete this server? This action cannot be undone.", + "Cancel": "Cancel", + "Delete": "Delete" + } + }, + "EditServer": { + "Title": "Edit {name}", + "Save": "Save", + "General": { + "Title": "General", + "Icon": "Icon", + "Name": "Name", + "OperatingSystem": "Operating System", + "IPAddress": "IP Address", + "ManagementURL": "Management URL" + }, + "Hardware": { + "Title": "Hardware", + "CPU": "CPU", + "GPU": "GPU", + "RAM": "RAM", + "Disk": "Disk" + }, + "Host": { + "Title": "Host", + "MarkAsHostServer": "Mark as host server", + "CannotDisableHost": "Cannot be disabled while hosting VMs", + "SelectHostServer": "Select a host server" + }, + "Monitoring": { + "Title": "Monitoring", + "Enable": "Enable monitoring", + "URL": "Monitoring URL", + "SetupTitle": "Required Server Setup", + "SetupDescription": "To enable monitoring, you need to install Glances on your server. Here's an example Docker Compose configuration:" + } + }, + "Pagination": { + "Showing": "Showing {start}-{end} of {total} servers", + "NoServers": "No servers found" + }, + "Search": { + "Placeholder": "Type to search..." + } } -} \ No newline at end of file + } + \ No newline at end of file