fix: badge and timescaleDB changes

This commit is contained in:
mannilakash committed 2026-04-13 08:29:12 -04:00
1 parent 5791bdd5e7
commit 99a5aa1722
5 files changed
+10 -15

No files matched your search

@@ -22,12 +22,9 @@ export const StrategyBadge = ({ strategy, variant = "body2" }: StrategyBadgeProp
variant={variant}
px={SPACING.XXL}
py={SPACING.SM}
textTransform="capitalize"
sx={{
borderRadius: theme.shape.borderRadius,
backgroundColor: theme.palette.secondary.light,
color: theme.palette.text.primary,
}}
borderRadius={theme.shape.borderRadius}
bgcolor={theme.palette.secondary.light}
color={theme.palette.text.primary}
>
{t(`pages.pageSpeed.strategy.${strategy}`)}
</Typography>
-1
View File
@@ -405,7 +405,6 @@ const CreateMonitorPage = () => {
fieldLabel={t(
"pages.createMonitor.form.general.option.strategy.label"
)}
disabled={isEditMode}
error={!!fieldState.error}
>
<MenuItem value="desktop">
@@ -3,7 +3,7 @@ import type { Pool } from "pg";
export const addStrategyToMonitors = async (pool: Pool) => {
await pool.query(`
ALTER TABLE monitors
ADD COLUMN IF NOT EXISTS strategy TEXT DEFAULT 'desktop';
ADD COLUMN IF NOT EXISTS strategy TEXT DEFAULT NULL;
`);
};
+1 -2
View File
@@ -1,6 +1,6 @@
import { Schema, model, Types } from "mongoose";
import type { Monitor, MonitorMatchMethod, CheckSnapshot } from "@/types/monitor.js";
import { MonitorTypes, MonitorStatuses, PageSpeedStrategies, DefaultPageSpeedStrategy } from "@/types/monitor.js";
import { MonitorTypes, MonitorStatuses, PageSpeedStrategies } from "@/types/monitor.js";
import type {
CheckAudits,
CheckCaptureInfo,
@@ -333,7 +333,6 @@ const MonitorSchema = new Schema<MonitorDocument>(
strategy: {
type: String,
enum: PageSpeedStrategies,
default: DefaultPageSpeedStrategy,
},
group: {
type: String,
@@ -1,6 +1,6 @@
import type { Pool } from "pg";
import type { Monitor, MonitorsSummary, MonitorStatus, MonitorType, MonitorMatchMethod, GeoContinent } from "@/types/monitor.js";
import { DefaultPageSpeedStrategy } from "@/types/monitor.js";
import type { Monitor, MonitorsSummary, MonitorStatus, MonitorType, MonitorMatchMethod, GeoContinent, PageSpeedStrategy } from "@/types/monitor.js";
import type { IMonitorsRepository, TeamQueryConfig, SummaryConfig } from "./IMonitorsRepository.js";
import { AppError } from "@/utils/AppError.js";
@@ -37,7 +37,7 @@ interface MonitorRow {
selected_disks: string[] | null;
game_id: string | null;
grpc_service_name: string | null;
strategy: string | null;
strategy: PageSpeedStrategy | null;
monitor_group: string | null;
geo_check_enabled: boolean;
geo_check_locations: GeoContinent[] | null;
@@ -98,7 +98,7 @@ export class TimescaleMonitorsRepository implements IMonitorsRepository {
monitor.selectedDisks ?? [],
monitor.gameId ?? null,
monitor.grpcServiceName ?? null,
monitor.strategy ?? DefaultPageSpeedStrategy,
monitor.strategy ?? null,
monitor.group ?? null,
monitor.geoCheckEnabled ?? false,
monitor.geoCheckLocations ?? [],
@@ -1037,7 +1037,7 @@ export class TimescaleMonitorsRepository implements IMonitorsRepository {
selectedDisks: row.selected_disks ?? [],
gameId: row.game_id ?? undefined,
grpcServiceName: row.grpc_service_name ?? undefined,
strategy: (row.strategy as Monitor["strategy"]) ?? undefined,
strategy: row.strategy ?? undefined,
group: row.monitor_group,
geoCheckEnabled: row.geo_check_enabled,
geoCheckLocations: row.geo_check_locations ?? [],