Fix jwt-token

This commit is contained in:
2025-09-19 14:20:37 +02:00
parent 32245f1132
commit 0c82db822c
2 changed files with 100 additions and 20 deletions

View File

@@ -109,9 +109,9 @@ const Dashboard = () => {
]; ];
const deviceStatusData = [ const deviceStatusData = [
{ name: 'Online', value: overview?.device_status?.online || 0, color: '#22c55e' }, { name: t('dashboard.online'), value: overview?.device_status?.online || 0, color: '#22c55e' },
{ name: 'Offline', value: overview?.device_status?.offline || 0, color: '#ef4444' }, { name: t('dashboard.offline'), value: overview?.device_status?.offline || 0, color: '#ef4444' },
{ name: 'Inactive', value: overview?.device_status?.inactive || 0, color: '#6b7280' } { name: t('dashboard.inactive'), value: overview?.device_status?.inactive || 0, color: '#6b7280' }
]; ];
return ( return (
@@ -165,7 +165,7 @@ const Dashboard = () => {
{/* Detection Timeline */} {/* Detection Timeline */}
<div className="bg-white p-6 rounded-lg shadow"> <div className="bg-white p-6 rounded-lg shadow">
<h3 className="text-lg font-medium text-gray-900 mb-4"> <h3 className="text-lg font-medium text-gray-900 mb-4">
Detections Timeline (24h) {t('dashboard.detectionsTimeline24h')}
</h3> </h3>
<div className="h-64"> <div className="h-64">
<ResponsiveContainer width="100%" height="100%"> <ResponsiveContainer width="100%" height="100%">
@@ -236,7 +236,7 @@ const Dashboard = () => {
{deviceActivity.length > 0 && ( {deviceActivity.length > 0 && (
<div className="bg-white p-6 rounded-lg shadow"> <div className="bg-white p-6 rounded-lg shadow">
<h3 className="text-lg font-medium text-gray-900 mb-4"> <h3 className="text-lg font-medium text-gray-900 mb-4">
Device Activity (24h) {t('dashboard.deviceActivity24h')}
</h3> </h3>
<div className="h-64"> <div className="h-64">
<ResponsiveContainer width="100%" height="100%"> <ResponsiveContainer width="100%" height="100%">
@@ -262,7 +262,7 @@ const Dashboard = () => {
{/* Recent Activity */} {/* Recent Activity */}
<div className="bg-white rounded-lg shadow"> <div className="bg-white rounded-lg shadow">
<div className="px-6 py-4 border-b border-gray-200"> <div className="px-6 py-4 border-b border-gray-200">
<h3 className="text-lg font-medium text-gray-900">Recent Activity</h3> <h3 className="text-lg font-medium text-gray-900">{t('dashboard.recentActivity')}</h3>
</div> </div>
<div className="divide-y divide-gray-200 max-h-96 overflow-y-auto"> <div className="divide-y divide-gray-200 max-h-96 overflow-y-auto">
{recentActivity.map((activity, index) => ( {recentActivity.map((activity, index) => (
@@ -274,9 +274,9 @@ const Dashboard = () => {
<div className="flex-1 min-w-0"> <div className="flex-1 min-w-0">
<p className="text-sm text-gray-900"> <p className="text-sm text-gray-900">
{activity.type === 'detection' ? ( {activity.type === 'detection' ? (
<>Drone {activity.data.drone_id} detected by {activity.data.device_name}</> <>{t('dashboard.droneDetected')} {activity.data.drone_id} {activity.data.device_name}</>
) : ( ) : (
<>Heartbeat from {activity.data.device_name}</> <>{t('dashboard.heartbeatFrom')} {activity.data.device_name}</>
)} )}
</p> </p>
<p className="text-xs text-gray-500"> <p className="text-xs text-gray-500">
@@ -288,7 +288,7 @@ const Dashboard = () => {
))} ))}
{recentActivity.length === 0 && ( {recentActivity.length === 0 && (
<div className="px-6 py-8 text-center text-gray-500"> <div className="px-6 py-8 text-center text-gray-500">
No recent activity {t('dashboard.noRecentActivity')}
</div> </div>
)} )}
</div> </div>
@@ -297,14 +297,14 @@ const Dashboard = () => {
{/* Real-time Detections */} {/* Real-time Detections */}
<div className="bg-white rounded-lg shadow"> <div className="bg-white rounded-lg shadow">
<div className="px-6 py-4 border-b border-gray-200 flex items-center justify-between"> <div className="px-6 py-4 border-b border-gray-200 flex items-center justify-between">
<h3 className="text-lg font-medium text-gray-900">Live Detections</h3> <h3 className="text-lg font-medium text-gray-900">{t('dashboard.liveDetections')}</h3>
<div className={`flex items-center space-x-2 px-2 py-1 rounded-full text-xs ${ <div className={`flex items-center space-x-2 px-2 py-1 rounded-full text-xs ${
connected ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800' connected ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
}`}> }`}>
<div className={`w-2 h-2 rounded-full ${ <div className={`w-2 h-2 rounded-full ${
connected ? 'bg-green-400' : 'bg-red-400' connected ? 'bg-green-400' : 'bg-red-400'
}`} /> }`} />
<span>{connected ? 'Live' : 'Disconnected'}</span> <span>{connected ? t('dashboard.live') : t('dashboard.disconnected')}</span>
</div> </div>
</div> </div>
<div className="divide-y divide-gray-200 max-h-96 overflow-y-auto"> <div className="divide-y divide-gray-200 max-h-96 overflow-y-auto">
@@ -314,7 +314,7 @@ const Dashboard = () => {
<div className="flex-shrink-0 w-2 h-2 rounded-full bg-red-400 animate-pulse" /> <div className="flex-shrink-0 w-2 h-2 rounded-full bg-red-400 animate-pulse" />
<div className="flex-1 min-w-0"> <div className="flex-1 min-w-0">
<p className="text-sm text-gray-900"> <p className="text-sm text-gray-900">
Drone {detection.drone_id} detected {t('dashboard.droneDetected')} {detection.drone_id}
</p> </p>
<p className="text-xs text-gray-500"> <p className="text-xs text-gray-500">
{detection.device.name || `Device ${detection.device_id}`} {detection.device.name || `Device ${detection.device_id}`}
@@ -330,7 +330,7 @@ const Dashboard = () => {
))} ))}
{recentDetections.length === 0 && ( {recentDetections.length === 0 && (
<div className="px-6 py-8 text-center text-gray-500"> <div className="px-6 py-8 text-center text-gray-500">
No recent detections {t('dashboard.noRecentDetections')}
</div> </div>
)} )}
</div> </div>
@@ -346,7 +346,7 @@ const Dashboard = () => {
{/* Movement Summary Stats */} {/* Movement Summary Stats */}
<div className="bg-white rounded-lg shadow p-6"> <div className="bg-white rounded-lg shadow p-6">
<h3 className="text-lg font-medium text-gray-900 mb-4"> <h3 className="text-lg font-medium text-gray-900 mb-4">
Movement Tracking {t('dashboard.movementTracking')}
</h3> </h3>
<div className="space-y-4"> <div className="space-y-4">

View File

@@ -12,8 +12,9 @@ const translations = {
}, },
dashboard: { dashboard: {
title: 'System Overview', title: 'System Overview',
online: 'Connected', online: 'Online',
offline: 'Disconnected', offline: 'Offline',
inactive: 'Inactive',
recentDetections: 'Recent Detections', recentDetections: 'Recent Detections',
systemHealth: 'System Health', systemHealth: 'System Health',
connectedDevices: 'Connected Devices', connectedDevices: 'Connected Devices',
@@ -26,9 +27,48 @@ const translations = {
notificationsDisabled: 'Notifications Disabled', notificationsDisabled: 'Notifications Disabled',
detectionHistory: 'Detection History', detectionHistory: 'Detection History',
deviceStatus: 'Device Status', deviceStatus: 'Device Status',
deviceActivity: 'Device Activity',
deviceActivity24h: 'Device Activity (24h)',
detectionsTimeline24h: 'Detections Timeline (24h)',
lastHour: 'Last Hour', lastHour: 'Last Hour',
last24Hours: 'Last 24 Hours', last24Hours: 'Last 24 Hours',
thisWeek: 'This Week' thisWeek: 'This Week',
connected: 'Connected',
disconnected: 'Disconnected',
healthy: 'Healthy',
warning: 'Warning',
critical: 'Critical',
operational: 'Operational',
maintenance: 'Maintenance',
failed: 'Failed',
pending: 'Pending',
approved: 'Approved',
rejected: 'Rejected',
active: 'Active',
disabled: 'Disabled',
statistics: 'Statistics',
overview: 'Overview',
summary: 'Summary',
quickStats: 'Quick Statistics',
systemOverview: 'System Overview',
recentActivity: 'Recent Activity',
liveDetections: 'Live Detections',
live: 'Live',
noRecentActivity: 'No recent activity',
noRecentDetections: 'No recent detections',
droneDetected: 'Drone detected',
heartbeatFrom: 'Heartbeat from',
movementTracking: 'Movement Tracking',
criticalAlerts: 'Critical Alerts',
veryCloseApproaches: 'Very close approaches',
highPriority: 'High Priority',
approachingDrones: 'Approaching drones',
mediumPriority: 'Medium Priority',
movementChanges: 'Movement changes',
totalTracked: 'Total Tracked',
events: 'events',
lastAlert: 'Last Alert',
none: 'None'
}, },
detections: { detections: {
title: 'Drone Detections', title: 'Drone Detections',
@@ -221,8 +261,9 @@ const translations = {
}, },
dashboard: { dashboard: {
title: 'Systemöversikt', title: 'Systemöversikt',
online: 'Ansluten', online: 'Online',
offline: 'Frånkopplad', offline: 'Offline',
inactive: 'Inaktiv',
recentDetections: 'Senaste detekteringar', recentDetections: 'Senaste detekteringar',
systemHealth: 'Systemhälsa', systemHealth: 'Systemhälsa',
connectedDevices: 'Anslutna enheter', connectedDevices: 'Anslutna enheter',
@@ -235,9 +276,48 @@ const translations = {
notificationsDisabled: 'Aviseringar inaktiverade', notificationsDisabled: 'Aviseringar inaktiverade',
detectionHistory: 'Detekteringshistorik', detectionHistory: 'Detekteringshistorik',
deviceStatus: 'Enhetsstatus', deviceStatus: 'Enhetsstatus',
deviceActivity: 'Enhetsaktivitet',
deviceActivity24h: 'Enhetsaktivitet (24h)',
detectionsTimeline24h: 'Detekteringshistorik (24h)',
lastHour: 'Senaste timmen', lastHour: 'Senaste timmen',
last24Hours: 'Senaste 24 timmarna', last24Hours: 'Senaste 24 timmarna',
thisWeek: 'Denna vecka' thisWeek: 'Denna vecka',
connected: 'Ansluten',
disconnected: 'Frånkopplad',
healthy: 'Frisk',
warning: 'Varning',
critical: 'Kritisk',
operational: 'Operativ',
maintenance: 'Underhåll',
failed: 'Misslyckad',
pending: 'Väntar',
approved: 'Godkänd',
rejected: 'Avvisad',
active: 'Aktiv',
disabled: 'Inaktiverad',
statistics: 'Statistik',
overview: 'Översikt',
summary: 'Sammanfattning',
quickStats: 'Snabbstatistik',
systemOverview: 'Systemöversikt',
recentActivity: 'Senaste aktivitet',
liveDetections: 'Live-detekteringar',
live: 'Live',
noRecentActivity: 'Ingen senaste aktivitet',
noRecentDetections: 'Inga senaste detekteringar',
droneDetected: 'Drönare detekterad',
heartbeatFrom: 'Heartbeat från',
movementTracking: 'Rörelsespårning',
criticalAlerts: 'Kritiska larm',
veryCloseApproaches: 'Mycket nära närmanden',
highPriority: 'Hög prioritet',
approachingDrones: 'Närmande drönare',
mediumPriority: 'Medel prioritet',
movementChanges: 'Rörelseförändringar',
totalTracked: 'Totalt spårade',
events: 'händelser',
lastAlert: 'Senaste larm',
none: 'Ingen'
}, },
detections: { detections: {
title: 'Drönaredetekteringar', title: 'Drönaredetekteringar',