Fix jwt-token

This commit is contained in:
2025-09-19 13:57:59 +02:00
parent 9afdbd6357
commit e820f68b05
3 changed files with 125 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import { useSocket } from '../contexts/SocketContext'; import { useSocket } from '../contexts/SocketContext';
import MovementAlertsPanel from '../components/MovementAlertsPanel'; import MovementAlertsPanel from '../components/MovementAlertsPanel';
import api from '../services/api'; import api from '../services/api';
import { t } from '../utils/tempTranslations'; // Temporary translation system
import { import {
ServerIcon, ServerIcon,
ExclamationTriangleIcon, ExclamationTriangleIcon,
@@ -71,7 +72,7 @@ const Dashboard = () => {
const stats = [ const stats = [
{ {
id: 1, id: 1,
name: 'Total Devices', name: t('dashboard.totalDetections'),
stat: overview?.summary?.total_devices || 0, stat: overview?.summary?.total_devices || 0,
icon: ServerIcon, icon: ServerIcon,
change: null, change: null,
@@ -80,7 +81,7 @@ const Dashboard = () => {
}, },
{ {
id: 2, id: 2,
name: 'Online Devices', name: t('dashboard.connectedDevices'),
stat: overview?.summary?.online_devices || 0, stat: overview?.summary?.online_devices || 0,
icon: SignalIcon, icon: SignalIcon,
change: null, change: null,
@@ -89,7 +90,7 @@ const Dashboard = () => {
}, },
{ {
id: 3, id: 3,
name: 'Recent Detections', name: t('dashboard.recentDetections'),
stat: overview?.summary?.recent_detections || 0, stat: overview?.summary?.recent_detections || 0,
icon: ExclamationTriangleIcon, icon: ExclamationTriangleIcon,
change: null, change: null,
@@ -98,7 +99,7 @@ const Dashboard = () => {
}, },
{ {
id: 4, id: 4,
name: 'Unique Drones', name: t('dashboard.activeAlerts'),
stat: overview?.summary?.unique_drones_detected || 0, stat: overview?.summary?.unique_drones_detected || 0,
icon: EyeIcon, icon: EyeIcon,
change: null, change: null,
@@ -119,7 +120,7 @@ const Dashboard = () => {
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div> <div>
<h3 className="text-lg leading-6 font-medium text-gray-900"> <h3 className="text-lg leading-6 font-medium text-gray-900">
System Overview {t('dashboard.title')}
</h3> </h3>
</div> </div>
<div className="flex items-center space-x-4"> <div className="flex items-center space-x-4">

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import api from '../services/api'; import api from '../services/api';
import { format } from 'date-fns'; import { format } from 'date-fns';
import { t } from '../utils/tempTranslations'; // Temporary translation system
import { import {
MagnifyingGlassIcon, MagnifyingGlassIcon,
FunnelIcon, FunnelIcon,
@@ -80,7 +81,7 @@ const Detections = () => {
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div> <div>
<h3 className="text-lg leading-6 font-medium text-gray-900"> <h3 className="text-lg leading-6 font-medium text-gray-900">
Drone Detections {t('detections.title')}
</h3> </h3>
<p className="mt-1 text-sm text-gray-500"> <p className="mt-1 text-sm text-gray-500">
History of all drone detections from your devices History of all drone detections from your devices
@@ -260,7 +261,7 @@ const Detections = () => {
{detections.length === 0 && !loading && ( {detections.length === 0 && !loading && (
<div className="text-center py-12"> <div className="text-center py-12">
<MagnifyingGlassIcon className="mx-auto h-12 w-12 text-gray-400" /> <MagnifyingGlassIcon className="mx-auto h-12 w-12 text-gray-400" />
<h3 className="mt-2 text-sm font-medium text-gray-900">No detections found</h3> <h3 className="mt-2 text-sm font-medium text-gray-900">{t('detections.noDetections')}</h3>
<p className="mt-1 text-sm text-gray-500"> <p className="mt-1 text-sm text-gray-500">
Try adjusting your search filters. Try adjusting your search filters.
</p> </p>

View File

@@ -10,12 +10,68 @@ const translations = {
logout: 'Logout' logout: 'Logout'
}, },
dashboard: { dashboard: {
title: 'System Overview',
online: 'Connected', online: 'Connected',
offline: 'Disconnected', offline: 'Disconnected',
recentDetections: 'Recent' recentDetections: 'Recent Detections',
systemHealth: 'System Health',
connectedDevices: 'Connected Devices',
activeAlerts: 'Active Alerts',
totalDetections: 'Total Detections',
noData: 'No data available',
loading: 'Loading...'
},
detections: {
title: 'Drone Detections',
noDetections: 'No detections found',
loading: 'Loading detections...',
timestamp: 'Timestamp',
type: 'Type',
confidence: 'Confidence',
location: 'Location',
device: 'Device',
actions: 'Actions'
},
devices: {
title: 'Device Management',
noDevices: 'No devices found',
loading: 'Loading devices...',
name: 'Name',
status: 'Status',
lastSeen: 'Last Seen',
location: 'Location',
actions: 'Actions'
},
alerts: {
title: 'Alert Management',
noAlerts: 'No alerts found',
loading: 'Loading alerts...',
type: 'Type',
priority: 'Priority',
status: 'Status',
created: 'Created',
actions: 'Actions'
},
settings: {
title: 'Settings',
profile: 'Profile',
notifications: 'Notifications',
system: 'System'
}, },
app: { app: {
title: 'UAM-ILS Management Portal' title: 'UAM-ILS Drone Detection System'
},
common: {
loading: 'Loading...',
error: 'Error',
success: 'Success',
cancel: 'Cancel',
save: 'Save',
delete: 'Delete',
edit: 'Edit',
view: 'View',
close: 'Close',
refresh: 'Refresh'
} }
}, },
sv: { sv: {
@@ -28,12 +84,68 @@ const translations = {
logout: 'Logga ut' logout: 'Logga ut'
}, },
dashboard: { dashboard: {
title: 'Systemöversikt',
online: 'Ansluten', online: 'Ansluten',
offline: 'Frånkopplad', offline: 'Frånkopplad',
recentDetections: 'Senaste' recentDetections: 'Senaste detekteringar',
systemHealth: 'Systemhälsa',
connectedDevices: 'Anslutna enheter',
activeAlerts: 'Aktiva larm',
totalDetections: 'Totala detekteringar',
noData: 'Ingen data tillgänglig',
loading: 'Laddar...'
},
detections: {
title: 'Drönaredetekteringar',
noDetections: 'Inga detekteringar hittades',
loading: 'Laddar detekteringar...',
timestamp: 'Tidsstämpel',
type: 'Typ',
confidence: 'Säkerhet',
location: 'Plats',
device: 'Enhet',
actions: 'Åtgärder'
},
devices: {
title: 'Enhetshantering',
noDevices: 'Inga enheter hittades',
loading: 'Laddar enheter...',
name: 'Namn',
status: 'Status',
lastSeen: 'Senast sedd',
location: 'Plats',
actions: 'Åtgärder'
},
alerts: {
title: 'Larmhantering',
noAlerts: 'Inga larm hittades',
loading: 'Laddar larm...',
type: 'Typ',
priority: 'Prioritet',
status: 'Status',
created: 'Skapad',
actions: 'Åtgärder'
},
settings: {
title: 'Inställningar',
profile: 'Profil',
notifications: 'Aviseringar',
system: 'System'
}, },
app: { app: {
title: 'UAM-ILS Förvaltningsportal' title: 'UAM-ILS Drönardetekteringssystem'
},
common: {
loading: 'Laddar...',
error: 'Fel',
success: 'Framgång',
cancel: 'Avbryt',
save: 'Spara',
delete: 'Ta bort',
edit: 'Redigera',
view: 'Visa',
close: 'Stäng',
refresh: 'Uppdatera'
} }
} }
}; };