Fix jwt-token

This commit is contained in:
2025-08-18 06:44:16 +02:00
parent c03385dc2b
commit f002130c1e
7 changed files with 505 additions and 33 deletions

View File

@@ -14,6 +14,8 @@ export const EditAlertModal = ({ rule, onClose, onSuccess }) => {
cooldown_period: 600,
alert_channels: ['sms'],
min_threat_level: '',
drone_types: [],
device_ids: [],
sms_phone_number: '',
webhook_url: ''
});
@@ -30,6 +32,8 @@ export const EditAlertModal = ({ rule, onClose, onSuccess }) => {
cooldown_period: rule.cooldown_period || 600,
alert_channels: rule.alert_channels || ['sms'],
min_threat_level: rule.min_threat_level || '',
drone_types: rule.drone_types || [],
device_ids: rule.device_ids || [],
sms_phone_number: rule.sms_phone_number || '',
webhook_url: rule.webhook_url || ''
});
@@ -53,6 +57,15 @@ export const EditAlertModal = ({ rule, onClose, onSuccess }) => {
}));
};
const handleDroneTypeChange = (droneType, checked) => {
setFormData(prev => ({
...prev,
drone_types: checked
? [...prev.drone_types, droneType]
: prev.drone_types.filter(type => type !== droneType)
}));
};
const handleSubmit = async (e) => {
e.preventDefault();
setSaving(true);
@@ -148,6 +161,37 @@ export const EditAlertModal = ({ rule, onClose, onSuccess }) => {
</div>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">
Drone Types Filter
</label>
<div className="space-y-2">
<div className="text-xs text-gray-500 mb-2">
Leave empty to monitor all drone types
</div>
{[
{ id: 0, name: 'Consumer/Hobby' },
{ id: 1, name: 'Orlan/Military' },
{ id: 2, name: 'Professional/Commercial' },
{ id: 3, name: 'Racing/High-speed' },
{ id: 4, name: 'Unknown/Custom' }
].map(droneType => (
<label key={droneType.id} className="flex items-center">
<input
type="checkbox"
checked={formData.drone_types.includes(droneType.id)}
onChange={(e) => handleDroneTypeChange(droneType.id, e.target.checked)}
className="h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded"
/>
<span className="ml-2 text-sm text-gray-700">
{droneType.name}
{droneType.id === 1 && <span className="text-red-600 font-semibold"> ( High Threat)</span>}
</span>
</label>
))}
</div>
</div>
<div className="grid grid-cols-2 gap-4">
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">