Disabled console debug log Statements from the production build output
This commit is contained in:
@@ -25,7 +25,7 @@ export function ServiceUptimeHistory({
|
|||||||
const { data: uptimeHistory, isLoading, error } = useQuery({
|
const { data: uptimeHistory, isLoading, error } = useQuery({
|
||||||
queryKey: ['uptimeHistory', serviceId, serviceType, startDate?.toISOString(), endDate?.toISOString()],
|
queryKey: ['uptimeHistory', serviceId, serviceType, startDate?.toISOString(), endDate?.toISOString()],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
console.log(`ServiceUptimeHistory: Fetching for service ${serviceId} of type ${serviceType}`);
|
// console.log(`ServiceUptimeHistory: Fetching for service ${serviceId} of type ${serviceType}`);
|
||||||
return uptimeService.getUptimeHistory(serviceId, 200, startDate, endDate, serviceType);
|
return uptimeService.getUptimeHistory(serviceId, 200, startDate, endDate, serviceType);
|
||||||
},
|
},
|
||||||
enabled: !!serviceId && !!serviceType,
|
enabled: !!serviceId && !!serviceType,
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
|
|||||||
const notificationChannels = form.watch("notificationChannels") || [];
|
const notificationChannels = form.watch("notificationChannels") || [];
|
||||||
const alertTemplate = form.watch("alertTemplate");
|
const alertTemplate = form.watch("alertTemplate");
|
||||||
|
|
||||||
console.log("Current notification values:", {
|
// console.log("Current notification values:", {
|
||||||
notificationStatus,
|
// notificationStatus,
|
||||||
notificationChannels,
|
// notificationChannels,
|
||||||
alertTemplate
|
// alertTemplate
|
||||||
});
|
// });
|
||||||
|
|
||||||
// Fetch alert configurations for notification channels
|
// Fetch alert configurations for notification channels
|
||||||
const { data: alertConfigsData } = useQuery({
|
const { data: alertConfigsData } = useQuery({
|
||||||
@@ -42,16 +42,16 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
|
|||||||
setAlertConfigs(enabledChannels);
|
setAlertConfigs(enabledChannels);
|
||||||
|
|
||||||
// Debug log to check what alert configs are loaded
|
// Debug log to check what alert configs are loaded
|
||||||
console.log("Loaded alert configurations:", enabledChannels);
|
// console.log("Loaded alert configurations:", enabledChannels);
|
||||||
}
|
}
|
||||||
}, [alertConfigsData]);
|
}, [alertConfigsData]);
|
||||||
|
|
||||||
// Log when form values change to debug
|
// Log when form values change to debug
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("Notification values changed:", {
|
// console.log("Notification values changed:", {
|
||||||
notificationStatus: form.getValues("notificationStatus"),
|
// notificationStatus: form.getValues("notificationStatus"),
|
||||||
notificationChannels: form.getValues("notificationChannels")
|
// notificationChannels: form.getValues("notificationChannels")
|
||||||
});
|
// });
|
||||||
}, [form.watch("notificationStatus"), form.watch("notificationChannels")]);
|
}, [form.watch("notificationStatus"), form.watch("notificationChannels")]);
|
||||||
|
|
||||||
const handleChannelAdd = (channelId: string) => {
|
const handleChannelAdd = (channelId: string) => {
|
||||||
@@ -161,7 +161,7 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
|
|||||||
render={({ field }) => {
|
render={({ field }) => {
|
||||||
// Don't convert existing values to "default"
|
// Don't convert existing values to "default"
|
||||||
const displayValue = field.value || "default";
|
const displayValue = field.value || "default";
|
||||||
console.log("Rendering alert template field with value:", displayValue);
|
// console.log("Rendering alert template field with value:", displayValue);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export const ServiceRowActions = ({
|
|||||||
try {
|
try {
|
||||||
if (service.status === "paused") {
|
if (service.status === "paused") {
|
||||||
// Resume monitoring
|
// Resume monitoring
|
||||||
console.log(`Resuming monitoring for service ${service.id} (${service.name}) from dropdown`);
|
// console.log(`Resuming monitoring for service ${service.id} (${service.name}) from dropdown`);
|
||||||
|
|
||||||
// First ensure we update the status
|
// First ensure we update the status
|
||||||
await serviceService.resumeMonitoring(service.id);
|
await serviceService.resumeMonitoring(service.id);
|
||||||
@@ -53,7 +53,7 @@ export const ServiceRowActions = ({
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Pause monitoring
|
// Pause monitoring
|
||||||
console.log(`Pausing monitoring for service ${service.id} (${service.name}) from dropdown`);
|
// console.log(`Pausing monitoring for service ${service.id} (${service.name}) from dropdown`);
|
||||||
await serviceService.pauseMonitoring(service.id);
|
await serviceService.pauseMonitoring(service.id);
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
@@ -65,7 +65,7 @@ export const ServiceRowActions = ({
|
|||||||
// Call the parent handler to refresh the UI
|
// Call the parent handler to refresh the UI
|
||||||
onPauseResume(service);
|
onPauseResume(service);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error toggling monitoring:", error);
|
// console.error("Error toggling monitoring:", error);
|
||||||
toast({
|
toast({
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
title: "Error",
|
title: "Error",
|
||||||
@@ -83,10 +83,10 @@ export const ServiceRowActions = ({
|
|||||||
|
|
||||||
if (onMuteAlerts) {
|
if (onMuteAlerts) {
|
||||||
try {
|
try {
|
||||||
console.log(`Attempting to ${alertsMuted ? 'unmute' : 'mute'} alerts for service ${service.id} (${service.name})`);
|
// console.log(`Attempting to ${alertsMuted ? 'unmute' : 'mute'} alerts for service ${service.id} (${service.name})`);
|
||||||
await onMuteAlerts(service);
|
await onMuteAlerts(service);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error toggling alerts:", error);
|
// console.error("Error toggling alerts:", error);
|
||||||
toast({
|
toast({
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
title: "Error",
|
title: "Error",
|
||||||
|
|||||||
@@ -161,6 +161,6 @@ export function useSystemSettings() {
|
|||||||
isUpdating: updateSettingsMutation.isPending,
|
isUpdating: updateSettingsMutation.isPending,
|
||||||
testEmailConnection: testEmailConnectionMutation.mutate,
|
testEmailConnection: testEmailConnectionMutation.mutate,
|
||||||
isTestingConnection: testEmailConnectionMutation.isPending,
|
isTestingConnection: testEmailConnectionMutation.isPending,
|
||||||
systemName: settings?.system_name || settings?.meta?.appName || 'ReamStack',
|
systemName: settings?.system_name || settings?.meta?.appName || 'CheckCle',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -31,8 +31,8 @@ export async function pauseMonitoring(serviceId: string): Promise<void> {
|
|||||||
|
|
||||||
// We'll skip the notification here since it will be handled by the UI component
|
// We'll skip the notification here since it will be handled by the UI component
|
||||||
// This prevents duplicate notifications for the paused status
|
// This prevents duplicate notifications for the paused status
|
||||||
console.log(`Service ${service.name} paused at ${now}, skipping notification to prevent duplication`);
|
// console.log(`Service ${service.name} paused at ${now}, skipping notification to prevent duplication`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error pausing monitoring:", error);
|
// console.error("Error pausing monitoring:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export async function resumeMonitoring(serviceId: string): Promise<void> {
|
|||||||
// Fetch the current service to get its name for better logging
|
// Fetch the current service to get its name for better logging
|
||||||
const service = await pb.collection('services').getOne(serviceId);
|
const service = await pb.collection('services').getOne(serviceId);
|
||||||
|
|
||||||
console.log(`Resuming service ${service.name} at ${now}`);
|
// console.log(`Resuming service ${service.name} at ${now}`);
|
||||||
|
|
||||||
// First, clear any existing interval just to be safe
|
// First, clear any existing interval just to be safe
|
||||||
const existingInterval = monitoringIntervals.get(serviceId);
|
const existingInterval = monitoringIntervals.get(serviceId);
|
||||||
@@ -57,7 +57,7 @@ export async function resumeMonitoring(serviceId: string): Promise<void> {
|
|||||||
const alertsMuted = service.alerts === "muted" || serviceForNotification.alerts === "muted";
|
const alertsMuted = service.alerts === "muted" || serviceForNotification.alerts === "muted";
|
||||||
|
|
||||||
if (!alertsMuted) {
|
if (!alertsMuted) {
|
||||||
console.log(`Alerts NOT muted for service ${service.name}, sending resume notification`);
|
// console.log(`Alerts NOT muted for service ${service.name}, sending resume notification`);
|
||||||
// Send notification that service has been resumed
|
// Send notification that service has been resumed
|
||||||
await notificationService.sendNotification({
|
await notificationService.sendNotification({
|
||||||
service: serviceForNotification,
|
service: serviceForNotification,
|
||||||
@@ -65,7 +65,7 @@ export async function resumeMonitoring(serviceId: string): Promise<void> {
|
|||||||
timestamp: now
|
timestamp: now
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(`Alerts muted for service ${service.name}, skipping resume notification`);
|
// console.log(`Alerts muted for service ${service.name}, skipping resume notification`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMPORTANT: Wait a brief moment to ensure the status update is processed
|
// IMPORTANT: Wait a brief moment to ensure the status update is processed
|
||||||
@@ -76,6 +76,6 @@ export async function resumeMonitoring(serviceId: string): Promise<void> {
|
|||||||
|
|
||||||
console.log(`Service ${service.name} resumed and ready for monitoring`);
|
console.log(`Service ${service.name} resumed and ready for monitoring`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error resuming service:", error);
|
// console.error("Error resuming service:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,20 +31,20 @@ export const notificationService = {
|
|||||||
try {
|
try {
|
||||||
const { service, status, responseTime } = data;
|
const { service, status, responseTime } = data;
|
||||||
|
|
||||||
console.log(`Preparing to send notification for service: ${service.name}, status: ${status}`);
|
// console.log(`Preparing to send notification for service: ${service.name}, status: ${status}`);
|
||||||
console.log(`Service alerts status: ${service.alerts}`);
|
// console.log(`Service alerts status: ${service.alerts}`);
|
||||||
|
|
||||||
// First check if alerts are muted for this service
|
// First check if alerts are muted for this service
|
||||||
// STRICT equality check against "muted" string value
|
// STRICT equality check against "muted" string value
|
||||||
if (service.alerts === "muted") {
|
if (service.alerts === "muted") {
|
||||||
console.log(`NOTIFICATION BLOCKED: Alerts are muted for service: ${service.name}`);
|
// console.log(`NOTIFICATION BLOCKED: Alerts are muted for service: ${service.name}`);
|
||||||
return true; // Return true as this is expected behavior
|
return true; // Return true as this is expected behavior
|
||||||
}
|
}
|
||||||
|
|
||||||
// For paused status, check if this is a duplicate notification from another source
|
// For paused status, check if this is a duplicate notification from another source
|
||||||
// This helps prevent the double-notification issue
|
// This helps prevent the double-notification issue
|
||||||
if (status === "paused" && data._notificationSource === "duplicate_check") {
|
if (status === "paused" && data._notificationSource === "duplicate_check") {
|
||||||
console.log("NOTIFICATION BLOCKED: Duplicate pause notification detected");
|
// console.log("NOTIFICATION BLOCKED: Duplicate pause notification detected");
|
||||||
return true; // Return true as this is expected behavior
|
return true; // Return true as this is expected behavior
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,20 +62,20 @@ export const notificationService = {
|
|||||||
if (timeSinceLastNotif < NOTIFICATION_COOLDOWN) {
|
if (timeSinceLastNotif < NOTIFICATION_COOLDOWN) {
|
||||||
// Increment count only if we haven't reached max retries
|
// Increment count only if we haven't reached max retries
|
||||||
if (lastNotif.count < maxRetries) {
|
if (lastNotif.count < maxRetries) {
|
||||||
console.log(`DOWN notification for ${service.name}: ${lastNotif.count + 1}/${maxRetries}`);
|
// console.log(`DOWN notification for ${service.name}: ${lastNotif.count + 1}/${maxRetries}`);
|
||||||
lastNotifications[serviceId].count += 1;
|
lastNotifications[serviceId].count += 1;
|
||||||
} else {
|
} else {
|
||||||
console.log(`DOWN notification for ${service.name} skipped: Max retries (${maxRetries}) reached. Next notification after cooldown.`);
|
// console.log(`DOWN notification for ${service.name} skipped: Max retries (${maxRetries}) reached. Next notification after cooldown.`);
|
||||||
return true; // Skip notification but return success
|
return true; // Skip notification but return success
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Reset count after cooldown period
|
// Reset count after cooldown period
|
||||||
console.log(`Cooldown period elapsed for ${service.name}. Resetting notification count.`);
|
// console.log(`Cooldown period elapsed for ${service.name}. Resetting notification count.`);
|
||||||
lastNotifications[serviceId] = { timestamp: now, count: 1 };
|
lastNotifications[serviceId] = { timestamp: now, count: 1 };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// First notification for this service
|
// First notification for this service
|
||||||
console.log(`First DOWN notification for ${service.name}: 1/${maxRetries}`);
|
// console.log(`First DOWN notification for ${service.name}: 1/${maxRetries}`);
|
||||||
lastNotifications[serviceId] = { timestamp: now, count: 1 };
|
lastNotifications[serviceId] = { timestamp: now, count: 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ export const notificationService = {
|
|||||||
|
|
||||||
// Check if notification channel is set
|
// Check if notification channel is set
|
||||||
if (!service.notificationChannel) {
|
if (!service.notificationChannel) {
|
||||||
console.log(`No notification channel set for service: ${service.name}`);
|
// console.log(`No notification channel set for service: ${service.name}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,12 +93,12 @@ export const notificationService = {
|
|||||||
const alertConfigRecord = await pb.collection('alert_configurations').getOne(service.notificationChannel);
|
const alertConfigRecord = await pb.collection('alert_configurations').getOne(service.notificationChannel);
|
||||||
|
|
||||||
if (!alertConfigRecord) {
|
if (!alertConfigRecord) {
|
||||||
console.error(`Alert configuration not found for ID: ${service.notificationChannel}`);
|
// console.error(`Alert configuration not found for ID: ${service.notificationChannel}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alertConfigRecord.enabled) {
|
if (!alertConfigRecord.enabled) {
|
||||||
console.log(`Alert configuration is disabled for service: ${service.name}`);
|
// console.log(`Alert configuration is disabled for service: ${service.name}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ export const notificationService = {
|
|||||||
try {
|
try {
|
||||||
template = await templateService.getTemplate(service.alertTemplate);
|
template = await templateService.getTemplate(service.alertTemplate);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error fetching template for ID: ${service.alertTemplate}`, error);
|
// console.error(`Error fetching template for ID: ${service.alertTemplate}`, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ export const notificationService = {
|
|||||||
message += `\n\nAlert ${retryInfo.count}/${maxRetries}`;
|
message += `\n\nAlert ${retryInfo.count}/${maxRetries}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Prepared notification message: ${message}`);
|
// console.log(`Prepared notification message: ${message}`);
|
||||||
|
|
||||||
// Send notification based on notification type
|
// Send notification based on notification type
|
||||||
const notificationType = alertConfig.notification_type;
|
const notificationType = alertConfig.notification_type;
|
||||||
@@ -156,10 +156,10 @@ export const notificationService = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For other types like discord, slack, etc. (not implemented yet)
|
// For other types like discord, slack, etc. (not implemented yet)
|
||||||
console.log(`Notification type ${notificationType} not implemented yet`);
|
// console.log(`Notification type ${notificationType} not implemented yet`);
|
||||||
return false;
|
return false;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error sending notification:", error);
|
// console.error("Error sending notification:", error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -173,10 +173,10 @@ export const notificationService = {
|
|||||||
? `Service ${serviceName} is UP${responseTime ? ` (Response time: ${responseTime}ms)` : ''}`
|
? `Service ${serviceName} is UP${responseTime ? ` (Response time: ${responseTime}ms)` : ''}`
|
||||||
: `Service ${serviceName} is DOWN`;
|
: `Service ${serviceName} is DOWN`;
|
||||||
|
|
||||||
console.log(`Test notification would have been sent: ${message}`);
|
// console.log(`Test notification would have been sent: ${message}`);
|
||||||
return true; // Just log, don't actually send
|
return true; // Just log, don't actually send
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error in test notification:", error);
|
// console.error("Error in test notification:", error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -187,7 +187,7 @@ export const notificationService = {
|
|||||||
*/
|
*/
|
||||||
resetNotificationCount(serviceId: string): void {
|
resetNotificationCount(serviceId: string): void {
|
||||||
if (lastNotifications[serviceId]) {
|
if (lastNotifications[serviceId]) {
|
||||||
console.log(`Resetting notification count for service ${serviceId}`);
|
// console.log(`Resetting notification count for service ${serviceId}`);
|
||||||
delete lastNotifications[serviceId];
|
delete lastNotifications[serviceId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user