Fix jwt-token
This commit is contained in:
@@ -361,7 +361,14 @@ const Alerts = () => {
|
|||||||
<span className={`px-2 py-1 rounded-full text-xs font-medium ${
|
<span className={`px-2 py-1 rounded-full text-xs font-medium ${
|
||||||
getPriorityColor(rule.priority)
|
getPriorityColor(rule.priority)
|
||||||
}`}>
|
}`}>
|
||||||
{t(`alerts.${rule.priority}`)}
|
{(() => {
|
||||||
|
// DEBUG: Check if priority is an object
|
||||||
|
if (typeof rule.priority === 'object' && rule.priority !== null) {
|
||||||
|
console.error('DEBUG: Priority is an object:', rule.priority, 'for rule:', rule.id);
|
||||||
|
return 'Invalid Priority';
|
||||||
|
}
|
||||||
|
return t(`alerts.${rule.priority}`);
|
||||||
|
})()}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -369,6 +376,15 @@ const Alerts = () => {
|
|||||||
{(() => {
|
{(() => {
|
||||||
// Normalize alert_channels - ensure it's always an array
|
// Normalize alert_channels - ensure it's always an array
|
||||||
let alertChannels = rule.alert_channels || [];
|
let alertChannels = rule.alert_channels || [];
|
||||||
|
|
||||||
|
// DEBUG: Add debugging to catch object rendering
|
||||||
|
if (typeof alertChannels === 'object' && alertChannels !== null) {
|
||||||
|
const hasKeys = Object.keys(alertChannels).some(key => ['sms', 'webhook', 'email'].includes(key));
|
||||||
|
if (hasKeys) {
|
||||||
|
console.log('DEBUG: Found problematic alert_channels object:', alertChannels, 'for rule:', rule.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof alertChannels === 'object' && !Array.isArray(alertChannels)) {
|
if (typeof alertChannels === 'object' && !Array.isArray(alertChannels)) {
|
||||||
// Convert object like {sms: true, webhook: false, email: true} to array
|
// Convert object like {sms: true, webhook: false, email: true} to array
|
||||||
alertChannels = Object.keys(alertChannels).filter(key => alertChannels[key]);
|
alertChannels = Object.keys(alertChannels).filter(key => alertChannels[key]);
|
||||||
@@ -376,14 +392,22 @@ const Alerts = () => {
|
|||||||
if (!Array.isArray(alertChannels)) {
|
if (!Array.isArray(alertChannels)) {
|
||||||
alertChannels = []; // fallback to empty array
|
alertChannels = []; // fallback to empty array
|
||||||
}
|
}
|
||||||
return alertChannels.map((channel, index) => (
|
|
||||||
<span
|
// DEBUG: Ensure we're only rendering strings
|
||||||
key={index}
|
return alertChannels.map((channel, index) => {
|
||||||
className="px-2 py-1 bg-blue-100 text-blue-800 rounded text-xs"
|
if (typeof channel !== 'string') {
|
||||||
>
|
console.error('DEBUG: Non-string channel detected:', channel, typeof channel);
|
||||||
{channel}
|
return null;
|
||||||
</span>
|
}
|
||||||
));
|
return (
|
||||||
|
<span
|
||||||
|
key={index}
|
||||||
|
className="px-2 py-1 bg-blue-100 text-blue-800 rounded text-xs"
|
||||||
|
>
|
||||||
|
{channel}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}).filter(Boolean);
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user