From d9c725935624096bcf58c4d8bd1ed034ec73e07b Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Thu, 26 Mar 2026 16:41:11 +0000 Subject: [PATCH] Refactor code for improved readability and consistency - Simplified arrow function syntax in MasterPassword.tsx and DashboardAPI.ts - Consolidated logger.debug statements in PublicDashboard.ts and DashboardDomainAPI.ts - Reformatted multi-line statements for better clarity in various files - Updated migration files for consistent naming conventions and formatting - Enhanced code structure in DashboardDomainService.ts and MonitorTelemetryMonitor.ts - Incremented version number to 10.0.40 --- App/FeatureSet/BaseAPI/Index.ts | 5 +- .../Dashboard/Canvas/BlankCanvas.tsx | 24 +++- .../Canvas/ComponentSettingsSideOver.tsx | 3 +- .../Components/DashboardBaseComponent.tsx | 6 +- .../Components/DashboardChartComponent.tsx | 4 +- .../Components/DashboardGaugeComponent.tsx | 80 +++++++---- .../DashboardLogStreamComponent.tsx | 56 ++++---- .../Components/DashboardTableComponent.tsx | 25 +++- .../Components/DashboardTextComponent.tsx | 5 +- .../Components/DashboardValueComponent.tsx | 12 +- .../Dashboard/Toolbar/DashboardToolbar.tsx | 16 ++- .../Form/Monitor/CriteriaFilter.tsx | 64 +++++---- .../KubernetesMonitorStepForm.tsx | 6 +- .../Form/Monitor/MonitorCriteriaInstance.tsx | 12 +- .../Workspace/WorkspaceSummaryTable.tsx | 11 +- .../Pages/Dashboards/View/CustomDomains.tsx | 87 +++++------- .../src/Pages/Dashboards/View/SideMenu.tsx | 4 +- .../src/Pages/StatusPages/View/Resources.tsx | 3 +- .../src/Pages/Workflow/View/Builder.tsx | 4 +- App/FeatureSet/Frontend/Index.ts | 6 +- .../Notification/API/BroadcastEmail.ts | 6 +- App/FeatureSet/PublicDashboard/src/App.tsx | 15 +-- .../src/Components/DashboardCanvas.tsx | 6 +- .../Pages/DashboardView/DashboardViewPage.tsx | 41 +++--- .../Pages/MasterPassword/MasterPassword.tsx | 5 +- .../src/Server/Utils/PublicDashboard.ts | 4 +- .../PublicDashboard/src/Utils/API.ts | 3 +- .../src/Utils/PublicDashboard.ts | 6 +- .../PublicDashboard/src/Utils/RouteMap.ts | 5 +- .../src/Pages/Overview/Overview.tsx | 3 +- .../Models/DatabaseModels/DashboardDomain.ts | 3 +- Common/Server/API/DashboardAPI.ts | 55 ++------ Common/Server/API/DashboardDomainAPI.ts | 21 +-- .../1774524742177-MigrationName.ts | 127 +++++++++++++----- .../1774524742178-MigrationName.ts | 19 +-- .../Postgres/SchemaMigrations/Index.ts | 2 +- .../Server/Services/DashboardDomainService.ts | 16 +-- .../WorkspaceNotificationSummaryService.ts | 2 +- .../Utils/Monitor/MonitorCriteriaEvaluator.ts | 36 ++--- .../MicrosoftTeams/MicrosoftTeams.ts | 6 +- Common/Server/Utils/Workspace/Slack/Slack.ts | 6 +- .../Workflow/ComponentSettingsModal.tsx | 24 +++- .../Components/Workflow/ComponentsModal.tsx | 21 +-- Common/UI/Config.ts | 3 +- .../Components/DashboardChartComponent.ts | 3 +- .../Components/DashboardGaugeComponent.ts | 6 +- VERSION | 2 +- .../MonitorTelemetryMonitor.ts | 15 ++- 48 files changed, 474 insertions(+), 420 deletions(-) diff --git a/App/FeatureSet/BaseAPI/Index.ts b/App/FeatureSet/BaseAPI/Index.ts index ef7b42ed48..5c92e46bd5 100644 --- a/App/FeatureSet/BaseAPI/Index.ts +++ b/App/FeatureSet/BaseAPI/Index.ts @@ -2075,10 +2075,7 @@ const BaseAPIFeatureSet: FeatureSet = { new StatusPageDomainAPI().getRouter(), ); - app.use( - `/${APP_NAME.toLocaleLowerCase()}`, - new DashboardAPI().getRouter(), - ); + app.use(`/${APP_NAME.toLocaleLowerCase()}`, new DashboardAPI().getRouter()); app.use( `/${APP_NAME.toLocaleLowerCase()}`, diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Canvas/BlankCanvas.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Canvas/BlankCanvas.tsx index 110a833022..eb9f45f4d5 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Canvas/BlankCanvas.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Canvas/BlankCanvas.tsx @@ -22,16 +22,30 @@ const BlankCanvasElement: FunctionComponent = ( if (!props.isEditMode && props.dashboardViewConfig.components.length === 0) { return (
-
- - + +
-

No widgets yet

+

+ No widgets yet +

- Click Edit to start adding charts, values, gauges, and more to this dashboard. + Click Edit to start adding + charts, values, gauges, and more to this dashboard.

); diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Canvas/ComponentSettingsSideOver.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Canvas/ComponentSettingsSideOver.tsx index 24d6d3f6c5..87fa5c87f3 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Canvas/ComponentSettingsSideOver.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Canvas/ComponentSettingsSideOver.tsx @@ -88,7 +88,8 @@ const ComponentSettingsSideOver: FunctionComponent = ( {component.componentType} Widget - {component.widthInDashboardUnits} x {component.heightInDashboardUnits} units + {component.widthInDashboardUnits} x{" "} + {component.heightInDashboardUnits} units diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardBaseComponent.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardBaseComponent.tsx index 263a5f1b1f..947ef43d6f 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardBaseComponent.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardBaseComponent.tsx @@ -77,7 +77,8 @@ const DashboardBaseComponentElement: FunctionComponent = ( } if (props.isSelected && props.isEditMode) { - className += " !border-blue-400 ring-2 ring-blue-50 shadow-lg shadow-blue-100/50"; + className += + " !border-blue-400 ring-2 ring-blue-50 shadow-lg shadow-blue-100/50"; } if (!props.isEditMode) { @@ -386,7 +387,8 @@ const DashboardBaseComponentElement: FunctionComponent = ( widthOfComponent + (SpaceBetweenUnitsInPx - 2) * (widthOfComponent - 1) }px`, - boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.03)", + boxShadow: + "0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.03)", }} key={component.componentId?.toString() || Math.random().toString()} ref={dashboardComponentRef} diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardChartComponent.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardChartComponent.tsx index 0952c5485a..8c1a1414a6 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardChartComponent.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardChartComponent.tsx @@ -171,9 +171,7 @@ const DashboardChartComponentElement: FunctionComponent = ( -

- {error} -

+

{error}

); } diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardGaugeComponent.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardGaugeComponent.tsx index beef06d8dc..6e2a7af8c2 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardGaugeComponent.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardGaugeComponent.tsx @@ -21,8 +21,9 @@ const DashboardGaugeComponentElement: FunctionComponent = ( const [metricResults, setMetricResults] = React.useState< Array >([]); - const [aggregationType, setAggregationType] = - React.useState(AggregationType.Avg); + const [aggregationType, setAggregationType] = React.useState( + AggregationType.Avg, + ); const [error, setError] = React.useState(null); const [isLoading, setIsLoading] = React.useState(true); @@ -132,8 +133,18 @@ const DashboardGaugeComponentElement: FunctionComponent = ( return (
- - + +

{error}

@@ -152,8 +163,18 @@ const DashboardGaugeComponentElement: FunctionComponent = ( return (
- - + +

@@ -211,10 +232,7 @@ const DashboardGaugeComponentElement: FunctionComponent = ( // Determine color based on thresholds let gaugeColor: string = "#10b981"; // green - if ( - criticalThreshold !== undefined && - aggregatedValue >= criticalThreshold - ) { + if (criticalThreshold !== undefined && aggregatedValue >= criticalThreshold) { gaugeColor = "#ef4444"; // red } else if ( warningThreshold !== undefined && @@ -322,7 +340,9 @@ const DashboardGaugeComponentElement: FunctionComponent = ( - + @@ -350,21 +370,19 @@ const DashboardGaugeComponentElement: FunctionComponent = ( /> )} {/* Threshold markers */} - {thresholdMarkers.map( - (marker: ThresholdMarker, index: number) => { - return ( - - ); - }, - )} + {thresholdMarkers.map((marker: ThresholdMarker, index: number) => { + return ( + + ); + })} {/* Needle tip dot at current position */} {percentage > 0 && ( = ( className="flex justify-between w-full px-2 mt-0.5" style={{ maxWidth: `${gaugeSize + 10}px` }} > - + {minValue} - + {maxValue}

diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardLogStreamComponent.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardLogStreamComponent.tsx index 6f9804179d..80992ec35b 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardLogStreamComponent.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardLogStreamComponent.tsx @@ -14,7 +14,10 @@ import InBetween from "Common/Types/BaseDatabase/InBetween"; import SortOrder from "Common/Types/BaseDatabase/SortOrder"; import OneUptimeDate from "Common/Types/Date"; import Query from "Common/Types/BaseDatabase/Query"; -import { queryStringToFilter, LogFilter } from "Common/Types/Log/LogQueryToFilter"; +import { + queryStringToFilter, + LogFilter, +} from "Common/Types/Log/LogQueryToFilter"; export interface ComponentProps extends DashboardBaseComponentProps { component: DashboardLogStreamComponent; @@ -31,13 +34,21 @@ const getSeverityColor: (severity: string) => SeverityColor = ( ): SeverityColor => { const lower: string = severity.toLowerCase(); if (lower === "fatal") { - return { dot: "bg-purple-500", text: "text-purple-700", bg: "bg-purple-50" }; + return { + dot: "bg-purple-500", + text: "text-purple-700", + bg: "bg-purple-50", + }; } if (lower === "error") { return { dot: "bg-red-500", text: "text-red-700", bg: "bg-red-50" }; } if (lower === "warning") { - return { dot: "bg-yellow-500", text: "text-yellow-700", bg: "bg-yellow-50" }; + return { + dot: "bg-yellow-500", + text: "text-yellow-700", + bg: "bg-yellow-50", + }; } if (lower === "information") { return { dot: "bg-blue-500", text: "text-blue-700", bg: "bg-blue-50" }; @@ -115,26 +126,25 @@ const DashboardLogStreamComponentElement: FunctionComponent = ( } } - const listResult: ListResult = - await AnalyticsModelAPI.getList({ - modelType: Log, - query: query, - limit: maxRows, - skip: 0, - select: { - time: true, - severityText: true, - body: true, - serviceId: true, - traceId: true, - spanId: true, - attributes: true, - }, - sort: { - time: SortOrder.Descending, - }, - requestOptions: {}, - }); + const listResult: ListResult = await AnalyticsModelAPI.getList({ + modelType: Log, + query: query, + limit: maxRows, + skip: 0, + select: { + time: true, + severityText: true, + body: true, + serviceId: true, + traceId: true, + spanId: true, + attributes: true, + }, + sort: { + time: SortOrder.Descending, + }, + requestOptions: {}, + }); setLogs(listResult.data); setError(""); diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardTableComponent.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardTableComponent.tsx index 35686c6634..856138732e 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardTableComponent.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardTableComponent.tsx @@ -124,7 +124,11 @@ const DashboardTableComponentElement: FunctionComponent = (
{Array.from({ length: 5 }).map((_: unknown, i: number) => { return ( -
+
@@ -185,20 +189,27 @@ const DashboardTableComponentElement: FunctionComponent = ( - - - + {displayData.map((item: AggregatedModel, index: number) => { - const roundedValue: number = - Math.round(item.value * 100) / 100; + const roundedValue: number = Math.round(item.value * 100) / 100; const barWidth: number = maxDataValue > 0 ? (Math.abs(roundedValue) / maxDataValue) * 100 diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardTextComponent.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardTextComponent.tsx index 5f0e321f38..d0ec6193aa 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardTextComponent.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardTextComponent.tsx @@ -19,7 +19,10 @@ const DashboardTextComponentElement: FunctionComponent = ( } const textClassName: string = `flex items-center justify-center h-full text-gray-800 leading-snug ${props.component.arguments.isBold ? "font-semibold" : "font-normal"} ${props.component.arguments.isItalic ? "italic" : ""} ${props.component.arguments.isUnderline ? "underline decoration-gray-300 underline-offset-4" : ""}`; - const textHeightInxPx: number = Math.min(props.dashboardComponentHeightInPx * 0.35, 64); + const textHeightInxPx: number = Math.min( + props.dashboardComponentHeightInPx * 0.35, + 64, + ); return (
diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardValueComponent.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardValueComponent.tsx index 5c0c388ca2..998b4168f1 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardValueComponent.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Components/DashboardValueComponent.tsx @@ -302,10 +302,7 @@ const DashboardValueComponentElement: FunctionComponent = ( const criticalThreshold: number | undefined = props.component.arguments.criticalThreshold; - if ( - criticalThreshold !== undefined && - aggregatedValue >= criticalThreshold - ) { + if (criticalThreshold !== undefined && aggregatedValue >= criticalThreshold) { valueColorClass = "text-red-600"; bgStyle = { background: @@ -393,8 +390,7 @@ const DashboardValueComponentElement: FunctionComponent = ( 0 ? `${valueHeightInPx * 0.3}px` : "", + fontSize: valueHeightInPx > 0 ? `${valueHeightInPx * 0.3}px` : "", }} > {unit ? ` ${unit}` : ""} @@ -407,7 +403,9 @@ const DashboardValueComponentElement: FunctionComponent = ( className={`flex items-center gap-0.5 mt-0.5 ${ trendDirection === "up" ? "text-emerald-500" : "text-red-500" }`} - style={{ fontSize: `${Math.max(Math.min(titleHeightInPx, 12), 10)}px` }} + style={{ + fontSize: `${Math.max(Math.min(titleHeightInPx, 12), 10)}px`, + }} > {trendDirection === "up" ? "\u2191" : "\u2193"} diff --git a/App/FeatureSet/Dashboard/src/Components/Dashboard/Toolbar/DashboardToolbar.tsx b/App/FeatureSet/Dashboard/src/Components/Dashboard/Toolbar/DashboardToolbar.tsx index 5d893ce5f0..146e558313 100644 --- a/App/FeatureSet/Dashboard/src/Components/Dashboard/Toolbar/DashboardToolbar.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Dashboard/Toolbar/DashboardToolbar.tsx @@ -32,7 +32,9 @@ export interface ComponentProps { onAutoRefreshIntervalChange: (interval: AutoRefreshInterval) => void; isRefreshing?: boolean | undefined; variables?: Array | undefined; - onVariableValueChange?: ((variableId: string, value: string) => void) | undefined; + onVariableValueChange?: + | ((variableId: string, value: string) => void) + | undefined; canResetZoom?: boolean | undefined; onResetZoom?: (() => void) | undefined; } @@ -46,17 +48,18 @@ const DashboardToolbar: FunctionComponent = ( const isSaving: boolean = props.isSaving; - const hasComponents: boolean = !!( + const hasComponents: boolean = Boolean( props.dashboardViewConfig && - props.dashboardViewConfig.components && - props.dashboardViewConfig.components.length > 0 + props.dashboardViewConfig.components && + props.dashboardViewConfig.components.length > 0, ); return (
{/* Accent top bar */} @@ -82,7 +85,8 @@ const DashboardToolbar: FunctionComponent = ( )} {hasComponents && !isEditMode && ( - {props.dashboardViewConfig.components.length} widget{props.dashboardViewConfig.components.length !== 1 ? "s" : ""} + {props.dashboardViewConfig.components.length} widget + {props.dashboardViewConfig.components.length !== 1 ? "s" : ""} )} {/* Refreshing indicator */} diff --git a/App/FeatureSet/Dashboard/src/Components/Form/Monitor/CriteriaFilter.tsx b/App/FeatureSet/Dashboard/src/Components/Form/Monitor/CriteriaFilter.tsx index 0b9a27270b..84e31bc9a8 100644 --- a/App/FeatureSet/Dashboard/src/Components/Form/Monitor/CriteriaFilter.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Form/Monitor/CriteriaFilter.tsx @@ -88,7 +88,11 @@ const CriteriaFilterElement: FunctionComponent = ( // Auto-select MetricValue for metric-only monitor types (Kubernetes, Metrics) useEffect(() => { - if (isMetricOnly && criteriaFilter && criteriaFilter.checkOn !== CheckOn.MetricValue) { + if ( + isMetricOnly && + criteriaFilter && + criteriaFilter.checkOn !== CheckOn.MetricValue + ) { props.onChange?.({ ...criteriaFilter, checkOn: CheckOn.MetricValue, @@ -194,24 +198,26 @@ const CriteriaFilterElement: FunctionComponent = (
{/* Hide Filter Type dropdown for metric-only monitors since MetricValue is the only option */} {!isMetricOnly && ( -
- - { - return i.value === criteriaFilter?.checkOn; - })} - options={checkOnOptions} - onChange={(value: DropdownValue | Array | null) => { - props.onChange?.({ - checkOn: value?.toString() as CheckOn, - filterType: undefined, - value: undefined, - evaluateOverTime: false, - evaluateOverTimeOptions: undefined, - }); - }} - /> -
+
+ + { + return i.value === criteriaFilter?.checkOn; + })} + options={checkOnOptions} + onChange={( + value: DropdownValue | Array | null, + ) => { + props.onChange?.({ + checkOn: value?.toString() as CheckOn, + filterType: undefined, + value: undefined, + evaluateOverTime: false, + evaluateOverTimeOptions: undefined, + }); + }} + /> +
)} {criteriaFilter?.checkOn && @@ -239,7 +245,11 @@ const CriteriaFilterElement: FunctionComponent = (
= (
= (
= (
= ( const clusterIdentifier: string = monitorStepKubernetesMonitor.clusterIdentifier; - // Get a dummy monitor step from the template to extract the kubernetes config - // Build even without a cluster so the metricViewConfig is populated for the METRIC dropdown + /* + * Get a dummy monitor step from the template to extract the kubernetes config + * Build even without a cluster so the metricViewConfig is populated for the METRIC dropdown + */ const dummyStep: MonitorStep = template.getMonitorStep({ clusterIdentifier: clusterIdentifier || "", onlineMonitorStatusId: ObjectID.generate(), diff --git a/App/FeatureSet/Dashboard/src/Components/Form/Monitor/MonitorCriteriaInstance.tsx b/App/FeatureSet/Dashboard/src/Components/Form/Monitor/MonitorCriteriaInstance.tsx index 8701bc5bb8..521c46e2a0 100644 --- a/App/FeatureSet/Dashboard/src/Components/Form/Monitor/MonitorCriteriaInstance.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Form/Monitor/MonitorCriteriaInstance.tsx @@ -248,12 +248,14 @@ const MonitorCriteriaInstanceElement: FunctionComponent = ( {/* Filters Section - Collapsible */} = (
= ( }, title: "What to Include", description: - "Choose which sections appear in the summary. Select \"All\" to include everything, or pick specific sections.", + 'Choose which sections appear in the summary. Select "All" to include everything, or pick specific sections.', fieldType: FormFieldSchemaType.CustomComponent, required: false, stepId: "content", @@ -503,8 +503,9 @@ const WorkspaceSummaryTable: FunctionComponent = ( elementProps: CustomElementProps, ): ReactElement => { const currentItems: Array = - (value.summaryItems as Array) || - [WorkspaceNotificationSummaryItem.All]; + (value.summaryItems as Array) || [ + WorkspaceNotificationSummaryItem.All, + ]; const isAllSelected: boolean = currentItems.includes( WorkspaceNotificationSummaryItem.All, @@ -542,9 +543,7 @@ const WorkspaceSummaryTable: FunctionComponent = ( key={item} title={item} disabled={isAllSelected} - value={ - isAllSelected || currentItems.includes(item) - } + value={isAllSelected || currentItems.includes(item)} onChange={(checked: boolean) => { if (elementProps.onChange) { let newItems: Array = diff --git a/App/FeatureSet/Dashboard/src/Pages/Dashboards/View/CustomDomains.tsx b/App/FeatureSet/Dashboard/src/Pages/Dashboards/View/CustomDomains.tsx index 11c45dff7a..bd5936b9f0 100644 --- a/App/FeatureSet/Dashboard/src/Pages/Dashboards/View/CustomDomains.tsx +++ b/App/FeatureSet/Dashboard/src/Pages/Dashboards/View/CustomDomains.tsx @@ -42,15 +42,13 @@ const DashboardCustomDomains: FunctionComponent = ( const [selectedDashboardDomain, setSelectedDashboardDomain] = useState(null); - const [verifyCnameLoading, setVerifyCnameLoading] = - useState(false); + const [verifyCnameLoading, setVerifyCnameLoading] = useState(false); const [orderSslLoading, setOrderSslLoading] = useState(false); const [error, setError] = useState(""); - const [showOrderSSLModal, setShowOrderSSLModal] = - useState(false); + const [showOrderSSLModal, setShowOrderSSLModal] = useState(false); return ( @@ -72,9 +70,7 @@ const DashboardCustomDomains: FunctionComponent = ( description: `Important: Please add a CNAME record pointing to ${DashboardCNameRecord} for these domains for this to work.`, }} refreshToggle={refreshToggle} - onBeforeCreate={( - item: DashboardDomain, - ): Promise => { + onBeforeCreate={(item: DashboardDomain): Promise => { if (!props.currentProject || !props.currentProject._id) { throw new BadDataException("Project ID cannot be null"); } @@ -272,9 +268,7 @@ const DashboardCustomDomains: FunctionComponent = ( if (!item.isCnameVerified) { return ( - - Action Required: - {" "} + Action Required:{" "} Please add your CNAME record. ); @@ -283,8 +277,8 @@ const DashboardCustomDomains: FunctionComponent = ( if (item.isCustomCertificate) { return ( - No action is required. Please allow 30 minutes for - the certificate to be provisioned. + No action is required. Please allow 30 minutes for the + certificate to be provisioned. ); } @@ -292,9 +286,7 @@ const DashboardCustomDomains: FunctionComponent = ( if (!item.isSslOrdered) { return ( - - Action Required: - {" "} + Action Required:{" "} Please order SSL certificate. ); @@ -304,16 +296,16 @@ const DashboardCustomDomains: FunctionComponent = ( return ( No action is required. This SSL certificate will be - provisioned in 1 hour. If this does not happen. - Please contact support. + provisioned in 1 hour. If this does not happen. Please + contact support. ); } return ( - Certificate Provisioned. We will automatically renew - this certificate. No action required.{" "} + Certificate Provisioned. We will automatically renew this + certificate. No action required.{" "} ); }, @@ -328,8 +320,8 @@ const DashboardCustomDomains: FunctionComponent = ( DashboardCNameRecord ? (
- Please add CNAME record to your domain. Details of - the CNAME records are: + Please add CNAME record to your domain. Details of the CNAME + records are:

@@ -356,14 +348,13 @@ const DashboardCustomDomains: FunctionComponent = ( ) : (
- Custom Domains not enabled for this OneUptime - installation. Please contact your server admin to - enable this feature. To enable this feature, if you - are using Docker compose, the - DASHBOARD_CNAME_RECORD environment variable - must be set when starting the OneUptime cluster. If - you are using Helm and Kubernetes then set - dashboard.cnameRecord in the values.yaml file. + Custom Domains not enabled for this OneUptime installation. + Please contact your server admin to enable this feature. To + enable this feature, if you are using Docker compose, the + DASHBOARD_CNAME_RECORD environment variable must be + set when starting the OneUptime cluster. If you are using + Helm and Kubernetes then set dashboard.cnameRecord in the + values.yaml file.
) @@ -381,13 +372,9 @@ const DashboardCustomDomains: FunctionComponent = ( setVerifyCnameLoading(true); setError(""); - const response: - | HTTPResponse - | HTTPErrorResponse = + const response: HTTPResponse | HTTPErrorResponse = await API.get({ - url: URL.fromString( - APP_API_URL.toString(), - ).addRoute( + url: URL.fromString(APP_API_URL.toString()).addRoute( `/${ new DashboardDomain().crudApiPath }/verify-cname/${selectedDashboardDomain?.id?.toString()}`, @@ -401,9 +388,7 @@ const DashboardCustomDomains: FunctionComponent = ( } setShowCnameModal(false); - setRefreshToggle( - OneUptimeDate.getCurrentDate().toString(), - ); + setRefreshToggle(OneUptimeDate.getCurrentDate().toString()); setSelectedDashboardDomain(null); } catch (err) { setError(API.getFriendlyMessage(err)); @@ -420,18 +405,16 @@ const DashboardCustomDomains: FunctionComponent = ( description={ DashboardCNameRecord ? (
- Please click on the button below to order SSL for this - domain. We will use LetsEncrypt to order a certificate. - This process is secure and completely free. The - certificate takes 3 hours to provision after its been - ordered. + Please click on the button below to order SSL for this domain. + We will use LetsEncrypt to order a certificate. This process + is secure and completely free. The certificate takes 3 hours + to provision after its been ordered.
) : (
- Custom Domains not enabled for this OneUptime - installation. Please contact your server admin to - enable this feature. + Custom Domains not enabled for this OneUptime installation. + Please contact your server admin to enable this feature.
) @@ -449,13 +432,9 @@ const DashboardCustomDomains: FunctionComponent = ( setOrderSslLoading(true); setError(""); - const response: - | HTTPResponse - | HTTPErrorResponse = + const response: HTTPResponse | HTTPErrorResponse = await API.get({ - url: URL.fromString( - APP_API_URL.toString(), - ).addRoute( + url: URL.fromString(APP_API_URL.toString()).addRoute( `/${ new DashboardDomain().crudApiPath }/order-ssl/${selectedDashboardDomain?.id?.toString()}`, @@ -469,9 +448,7 @@ const DashboardCustomDomains: FunctionComponent = ( } setShowOrderSSLModal(false); - setRefreshToggle( - OneUptimeDate.getCurrentDate().toString(), - ); + setRefreshToggle(OneUptimeDate.getCurrentDate().toString()); setSelectedDashboardDomain(null); } catch (err) { setError(API.getFriendlyMessage(err)); diff --git a/App/FeatureSet/Dashboard/src/Pages/Dashboards/View/SideMenu.tsx b/App/FeatureSet/Dashboard/src/Pages/Dashboards/View/SideMenu.tsx index 813937585e..a1e4385c38 100644 --- a/App/FeatureSet/Dashboard/src/Pages/Dashboards/View/SideMenu.tsx +++ b/App/FeatureSet/Dashboard/src/Pages/Dashboards/View/SideMenu.tsx @@ -59,9 +59,7 @@ const DashboardSideMenu: FunctionComponent = ( link={{ title: "Authentication", to: RouteUtil.populateRouteParams( - RouteMap[ - PageMap.DASHBOARD_VIEW_AUTHENTICATION_SETTINGS - ] as Route, + RouteMap[PageMap.DASHBOARD_VIEW_AUTHENTICATION_SETTINGS] as Route, { modelId: props.modelId }, ), }} diff --git a/App/FeatureSet/Dashboard/src/Pages/StatusPages/View/Resources.tsx b/App/FeatureSet/Dashboard/src/Pages/StatusPages/View/Resources.tsx index 937f30ad95..40e3305906 100644 --- a/App/FeatureSet/Dashboard/src/Pages/StatusPages/View/Resources.tsx +++ b/App/FeatureSet/Dashboard/src/Pages/StatusPages/View/Resources.tsx @@ -242,7 +242,8 @@ const StatusPageDelete: FunctionComponent = ( title: "Show Status History Chart", fieldType: FormFieldSchemaType.Toggle, required: false, - description: "Show resource status history chart. The number of days is configured in Status Page Settings.", + description: + "Show resource status history chart. The number of days is configured in Status Page Settings.", defaultValue: true, stepId: "advanced", }, diff --git a/App/FeatureSet/Dashboard/src/Pages/Workflow/View/Builder.tsx b/App/FeatureSet/Dashboard/src/Pages/Workflow/View/Builder.tsx index e467b79063..382f00d674 100644 --- a/App/FeatureSet/Dashboard/src/Pages/Workflow/View/Builder.tsx +++ b/App/FeatureSet/Dashboard/src/Pages/Workflow/View/Builder.tsx @@ -278,7 +278,9 @@ const Delete: FunctionComponent = (): ReactElement => { boxShadow: "0 1px 2px 0 rgba(0, 0, 0, 0.03)", }} > -
+
void = (): void => { return next(); } - // Check if this custom domain belongs to a PublicDashboard. - // If so, serve the PublicDashboard SPA instead of StatusPage. + /* + * Check if this custom domain belongs to a PublicDashboard. + * If so, serve the PublicDashboard SPA instead of StatusPage. + */ const requestHostname: string = getRequestHostname(req); if (requestHostname && (await isDashboardDomain(requestHostname))) { diff --git a/App/FeatureSet/Notification/API/BroadcastEmail.ts b/App/FeatureSet/Notification/API/BroadcastEmail.ts index eb7c714259..85b2e8e5ff 100644 --- a/App/FeatureSet/Notification/API/BroadcastEmail.ts +++ b/App/FeatureSet/Notification/API/BroadcastEmail.ts @@ -163,8 +163,10 @@ router.post( MarkdownContentType.Email, ); - // Send response immediately so the request doesn't timeout. - // Emails are sent in the background. + /* + * Send response immediately so the request doesn't timeout. + * Emails are sent in the background. + */ Response.sendJsonObjectResponse(req, res, { message: "Broadcast email job has been started. Emails will be sent in the background.", diff --git a/App/FeatureSet/PublicDashboard/src/App.tsx b/App/FeatureSet/PublicDashboard/src/App.tsx index d834ceec92..c2a86b4c02 100644 --- a/App/FeatureSet/PublicDashboard/src/App.tsx +++ b/App/FeatureSet/PublicDashboard/src/App.tsx @@ -4,7 +4,6 @@ import RouteParams from "./Utils/RouteParams"; import PublicDashboardUtil from "./Utils/PublicDashboard"; import { PUBLIC_DASHBOARD_API_URL } from "./Utils/Config"; import API from "./Utils/API"; -import Route from "Common/Types/API/Route"; import URL from "Common/Types/API/URL"; import { JSONObject } from "Common/Types/JSON"; import ObjectID from "Common/Types/ObjectID"; @@ -42,13 +41,12 @@ const MasterPassword: React.LazyExoticComponent< }); }); -const NotFoundPage: React.LazyExoticComponent< - AllPagesModule["NotFoundPage"] -> = lazy(() => { - return import("./Pages/AllPages").then((m: AllPagesModule) => { - return { default: m.NotFoundPage }; +const NotFoundPage: React.LazyExoticComponent = + lazy(() => { + return import("./Pages/AllPages").then((m: AllPagesModule) => { + return { default: m.NotFoundPage }; + }); }); -}); const ForbiddenPage: React.LazyExoticComponent< AllPagesModule["ForbiddenPage"] @@ -123,8 +121,7 @@ const App: () => JSX.Element = () => { }); if (response.data) { - const name: string = - (response.data["name"] as string) || "Dashboard"; + const name: string = (response.data["name"] as string) || "Dashboard"; setDashboardName(name); document.title = name; diff --git a/App/FeatureSet/PublicDashboard/src/Components/DashboardCanvas.tsx b/App/FeatureSet/PublicDashboard/src/Components/DashboardCanvas.tsx index 1b4c718e0f..75052e4308 100644 --- a/App/FeatureSet/PublicDashboard/src/Components/DashboardCanvas.tsx +++ b/App/FeatureSet/PublicDashboard/src/Components/DashboardCanvas.tsx @@ -1,5 +1,7 @@ -// Re-export the DashboardCanvas from the Dashboard FeatureSet -// The PublicDashboard app reuses the same canvas rendering logic +/* + * Re-export the DashboardCanvas from the Dashboard FeatureSet + * The PublicDashboard app reuses the same canvas rendering logic + */ export { default, type ComponentProps, diff --git a/App/FeatureSet/PublicDashboard/src/Pages/DashboardView/DashboardViewPage.tsx b/App/FeatureSet/PublicDashboard/src/Pages/DashboardView/DashboardViewPage.tsx index b7c428f9b7..3104f73775 100644 --- a/App/FeatureSet/PublicDashboard/src/Pages/DashboardView/DashboardViewPage.tsx +++ b/App/FeatureSet/PublicDashboard/src/Pages/DashboardView/DashboardViewPage.tsx @@ -33,7 +33,6 @@ import MoreMenuItem from "Common/UI/Components/MoreMenu/MoreMenuItem"; import IconProp from "Common/Types/Icon/IconProp"; import Button, { ButtonStyleType } from "Common/UI/Components/Button/Button"; import DashboardVariableSelector from "./DashboardVariableSelector"; -import DashboardBaseComponent from "Common/Types/Dashboard/DashboardComponents/DashboardBaseComponent"; import NavBar from "Common/UI/Components/Navbar/NavBar"; import NavBarItem from "Common/UI/Components/Navbar/NavBarItem"; import PageMap from "../../Utils/PageMap"; @@ -97,10 +96,10 @@ const DashboardViewPage: FunctionComponent = ( const [error, setError] = useState(null); const [isLoading, setIsLoading] = useState(true); - const hasComponents: boolean = !!( + const hasComponents: boolean = Boolean( dashboardViewConfig && - dashboardViewConfig.components && - dashboardViewConfig.components.length > 0 + dashboardViewConfig.components && + dashboardViewConfig.components.length > 0, ); const fetchDashboardViewConfig: PromiseVoidFunction = @@ -159,7 +158,9 @@ const DashboardViewPage: FunctionComponent = ( // Auto-refresh const triggerRefresh: () => void = useCallback(() => { setIsRefreshing(true); - setRefreshTick((prev: number) => prev + 1); + setRefreshTick((prev: number) => { + return prev + 1; + }); setTimeout(() => { setIsRefreshing(false); }, 500); @@ -224,9 +225,7 @@ const DashboardViewPage: FunctionComponent = (
- + = (
@@ -341,10 +339,7 @@ const DashboardViewPage: FunctionComponent = ( { - setTimeRangeStack([ - ...timeRangeStack, - startAndEndDate, - ]); + setTimeRangeStack([...timeRangeStack, startAndEndDate]); setStartAndEndDate(newRange); }} /> @@ -360,14 +355,12 @@ const DashboardViewPage: FunctionComponent = ( value: string, ) => { setDashboardVariables( - dashboardVariables.map( - (v: DashboardVariable) => { - if (v.id === variableId) { - return { ...v, currentValue: value }; - } - return v; - }, - ), + dashboardVariables.map((v: DashboardVariable) => { + if (v.id === variableId) { + return { ...v, currentValue: value }; + } + return v; + }), ); }} /> @@ -390,9 +383,7 @@ const DashboardViewPage: FunctionComponent = ( }} dashboardTotalWidth={dashboardTotalWidth} startAndEndDate={startAndEndDate} - onStartAndEndDateChange={( - newRange: RangeStartAndEndDateTime, - ) => { + onStartAndEndDateChange={(newRange: RangeStartAndEndDateTime) => { setTimeRangeStack([...timeRangeStack, startAndEndDate]); setStartAndEndDate(newRange); }} diff --git a/App/FeatureSet/PublicDashboard/src/Pages/MasterPassword/MasterPassword.tsx b/App/FeatureSet/PublicDashboard/src/Pages/MasterPassword/MasterPassword.tsx index 45ea1f8039..efce43a1fb 100644 --- a/App/FeatureSet/PublicDashboard/src/Pages/MasterPassword/MasterPassword.tsx +++ b/App/FeatureSet/PublicDashboard/src/Pages/MasterPassword/MasterPassword.tsx @@ -150,10 +150,7 @@ const MasterPasswordPage: FunctionComponent = ( maxPrimaryButtonWidth={true} isLoading={isSubmitting} error={formError || undefined} - onSubmit={( - values: JSONObject, - onSubmitSuccessful?: () => void, - ) => { + onSubmit={(values: JSONObject, onSubmitSuccessful?: () => void) => { void handleFormSubmit(values, onSubmitSuccessful); }} footer={<>} diff --git a/App/FeatureSet/PublicDashboard/src/Server/Utils/PublicDashboard.ts b/App/FeatureSet/PublicDashboard/src/Server/Utils/PublicDashboard.ts index 40e2b95574..aff6dd9685 100644 --- a/App/FeatureSet/PublicDashboard/src/Server/Utils/PublicDashboard.ts +++ b/App/FeatureSet/PublicDashboard/src/Server/Utils/PublicDashboard.ts @@ -40,9 +40,7 @@ export const getPublicDashboardData: ( req.hostname?.toString() || req.headers["host"]?.toString() || ""; if (host) { dashboardIdOrDomain = host; - logger.debug( - `Found domain in request headers: ${dashboardIdOrDomain}`, - ); + logger.debug(`Found domain in request headers: ${dashboardIdOrDomain}`); } } diff --git a/App/FeatureSet/PublicDashboard/src/Utils/API.ts b/App/FeatureSet/PublicDashboard/src/Utils/API.ts index 0f4ad8ee09..1f359210e4 100644 --- a/App/FeatureSet/PublicDashboard/src/Utils/API.ts +++ b/App/FeatureSet/PublicDashboard/src/Utils/API.ts @@ -6,8 +6,7 @@ import BaseAPI from "Common/UI/Utils/API/API"; export default class API extends BaseAPI { public static override getDefaultHeaders(): Headers { - const dashboardId: ObjectID | null = - PublicDashboardUtil.getDashboardId(); + const dashboardId: ObjectID | null = PublicDashboardUtil.getDashboardId(); if (!dashboardId) { return {}; diff --git a/App/FeatureSet/PublicDashboard/src/Utils/PublicDashboard.ts b/App/FeatureSet/PublicDashboard/src/Utils/PublicDashboard.ts index d13db424a3..e68deb3f24 100644 --- a/App/FeatureSet/PublicDashboard/src/Utils/PublicDashboard.ts +++ b/App/FeatureSet/PublicDashboard/src/Utils/PublicDashboard.ts @@ -23,7 +23,8 @@ export default class PublicDashboardUtil { } public static setRequiresMasterPassword(value: boolean): void { - const storageKey: string = PublicDashboardUtil.getRequiresMasterPasswordStorageKey(); + const storageKey: string = + PublicDashboardUtil.getRequiresMasterPasswordStorageKey(); LocalStorage.setItem(storageKey, value); if (!value) { @@ -32,7 +33,8 @@ export default class PublicDashboardUtil { } public static requiresMasterPassword(): boolean { - const storageKey: string = PublicDashboardUtil.getRequiresMasterPasswordStorageKey(); + const storageKey: string = + PublicDashboardUtil.getRequiresMasterPasswordStorageKey(); return Boolean(LocalStorage.getItem(storageKey)); } diff --git a/App/FeatureSet/PublicDashboard/src/Utils/RouteMap.ts b/App/FeatureSet/PublicDashboard/src/Utils/RouteMap.ts index 60fa962d60..ccbb674797 100644 --- a/App/FeatureSet/PublicDashboard/src/Utils/RouteMap.ts +++ b/App/FeatureSet/PublicDashboard/src/Utils/RouteMap.ts @@ -34,10 +34,7 @@ export class RouteUtil { const id: ObjectID = LocalStorage.getItem("dashboardId") as ObjectID; if (id) { - route = tempRoute.addRouteParam( - RouteParams.DashboardId, - id.toString(), - ); + route = tempRoute.addRouteParam(RouteParams.DashboardId, id.toString()); } return tempRoute; diff --git a/App/FeatureSet/StatusPage/src/Pages/Overview/Overview.tsx b/App/FeatureSet/StatusPage/src/Pages/Overview/Overview.tsx index a468e1f6e4..65244cdb6b 100644 --- a/App/FeatureSet/StatusPage/src/Pages/Overview/Overview.tsx +++ b/App/FeatureSet/StatusPage/src/Pages/Overview/Overview.tsx @@ -126,8 +126,7 @@ const Overview: FunctionComponent = ( scheduledMaintenanceStateTimelines, setScheduledMaintenanceStateTimelines, ] = useState>([]); - const uptimeHistoryDays: number = - statusPage?.showUptimeHistoryInDays || 90; + const uptimeHistoryDays: number = statusPage?.showUptimeHistoryInDays || 90; const startDate: Date = OneUptimeDate.getSomeDaysAgo(uptimeHistoryDays); const endDate: Date = OneUptimeDate.getCurrentDate(); const [currentStatus, setCurrentStatus] = useState( diff --git a/Common/Models/DatabaseModels/DashboardDomain.ts b/Common/Models/DatabaseModels/DashboardDomain.ts index aadbb0c0c4..33a890ef8e 100644 --- a/Common/Models/DatabaseModels/DashboardDomain.ts +++ b/Common/Models/DatabaseModels/DashboardDomain.ts @@ -224,8 +224,7 @@ export default class DashboardDomain extends BaseModel { type: TableColumnType.Entity, modelType: Dashboard, title: "Dashboard", - description: - "Relation to Dashboard Resource in which this object belongs", + description: "Relation to Dashboard Resource in which this object belongs", }) @ManyToOne( () => { diff --git a/Common/Server/API/DashboardAPI.ts b/Common/Server/API/DashboardAPI.ts index 95f522a48b..270980222b 100644 --- a/Common/Server/API/DashboardAPI.ts +++ b/Common/Server/API/DashboardAPI.ts @@ -34,11 +34,7 @@ export default class DashboardAPI extends BaseAPI< .getCrudApiPath() ?.toString()}/seo/:dashboardIdOrDomain`, UserMiddleware.getUserMiddleware, - async ( - req: ExpressRequest, - res: ExpressResponse, - next: NextFunction, - ) => { + async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => { try { const dashboardIdOrDomain: string = req.params[ "dashboardIdOrDomain" @@ -46,10 +42,7 @@ export default class DashboardAPI extends BaseAPI< let dashboardId: ObjectID | null = null; - if ( - dashboardIdOrDomain && - dashboardIdOrDomain.includes(".") - ) { + if (dashboardIdOrDomain && dashboardIdOrDomain.includes(".")) { // This is a domain - resolve to dashboard ID const dashboardDomain: DashboardDomain | null = await DashboardDomainService.findOneBy({ @@ -114,8 +107,7 @@ export default class DashboardAPI extends BaseAPI< _id: dashboard._id?.toString() || "", title: dashboard.name || "Dashboard", description: - dashboard.description || - "View dashboard metrics and insights.", + dashboard.description || "View dashboard metrics and insights.", }); } catch (err) { next(err); @@ -125,20 +117,12 @@ export default class DashboardAPI extends BaseAPI< // Domain resolution endpoint this.router.post( - `${new this.entityType() - .getCrudApiPath() - ?.toString()}/domain`, + `${new this.entityType().getCrudApiPath()?.toString()}/domain`, UserMiddleware.getUserMiddleware, - async ( - req: ExpressRequest, - res: ExpressResponse, - next: NextFunction, - ) => { + async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => { try { if (!req.body["domain"]) { - throw new BadDataException( - "domain is required in request body", - ); + throw new BadDataException("domain is required in request body"); } const domain: string = req.body["domain"] as string; @@ -160,9 +144,7 @@ export default class DashboardAPI extends BaseAPI< }); if (!dashboardDomain) { - throw new BadDataException( - "No dashboard found with this domain", - ); + throw new BadDataException("No dashboard found with this domain"); } const objectId: ObjectID = dashboardDomain.dashboardId!; @@ -182,11 +164,7 @@ export default class DashboardAPI extends BaseAPI< .getCrudApiPath() ?.toString()}/metadata/:dashboardId`, UserMiddleware.getUserMiddleware, - async ( - req: ExpressRequest, - res: ExpressResponse, - next: NextFunction, - ) => { + async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => { try { const dashboardId: ObjectID = new ObjectID( req.params["dashboardId"] as string, @@ -214,11 +192,9 @@ export default class DashboardAPI extends BaseAPI< return Response.sendJsonObjectResponse(req, res, { _id: dashboard._id?.toString() || "", name: dashboard.name || "Dashboard", - description: - dashboard.description || "", + description: dashboard.description || "", isPublicDashboard: dashboard.isPublicDashboard || false, - enableMasterPassword: - dashboard.enableMasterPassword || false, + enableMasterPassword: dashboard.enableMasterPassword || false, }); } catch (err) { next(err); @@ -231,11 +207,7 @@ export default class DashboardAPI extends BaseAPI< .getCrudApiPath() ?.toString()}/master-password/:dashboardId`, UserMiddleware.getUserMiddleware, - async ( - req: ExpressRequest, - res: ExpressResponse, - next: NextFunction, - ) => { + async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => { try { if (!req.params["dashboardId"]) { throw new BadDataException("Dashboard ID not found"); @@ -277,10 +249,7 @@ export default class DashboardAPI extends BaseAPI< ); } - if ( - !dashboard.enableMasterPassword || - !dashboard.masterPassword - ) { + if (!dashboard.enableMasterPassword || !dashboard.masterPassword) { throw new BadDataException( "Master password has not been configured for this dashboard.", ); diff --git a/Common/Server/API/DashboardDomainAPI.ts b/Common/Server/API/DashboardDomainAPI.ts index 48cc4f867b..79c364a3bd 100644 --- a/Common/Server/API/DashboardDomainAPI.ts +++ b/Common/Server/API/DashboardDomainAPI.ts @@ -29,11 +29,7 @@ export default class DashboardDomainAPI extends BaseAPI< this.router.get( `${new this.entityType().getCrudApiPath()?.toString()}/verify-cname/:id`, UserMiddleware.getUserMiddleware, - async ( - req: ExpressRequest, - res: ExpressResponse, - next: NextFunction, - ) => { + async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => { try { if (!DashboardCNameRecord) { return Response.sendErrorResponse( @@ -101,8 +97,9 @@ export default class DashboardDomainAPI extends BaseAPI< ); } - const isValid: boolean = - await DashboardDomainService.isCnameValid(domain.fullDomain!); + const isValid: boolean = await DashboardDomainService.isCnameValid( + domain.fullDomain!, + ); if (!isValid) { return Response.sendErrorResponse( @@ -125,11 +122,7 @@ export default class DashboardDomainAPI extends BaseAPI< this.router.get( `${new this.entityType().getCrudApiPath()?.toString()}/order-ssl/:id`, UserMiddleware.getUserMiddleware, - async ( - req: ExpressRequest, - res: ExpressResponse, - next: NextFunction, - ) => { + async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => { try { if (!DashboardCNameRecord) { return Response.sendErrorResponse( @@ -230,9 +223,7 @@ export default class DashboardDomainAPI extends BaseAPI< await DashboardDomainService.orderCert(domain); - logger.debug( - "SSL Provisioned for domain - " + domain.fullDomain, - ); + logger.debug("SSL Provisioned for domain - " + domain.fullDomain); return Response.sendEmptySuccessResponse(req, res); } catch (e) { diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.ts index 4a03f534f6..e3ce9bec66 100644 --- a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.ts +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.ts @@ -1,42 +1,97 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class MigrationName1774524742177 implements MigrationInterface { - name = 'MigrationName1774524742177' + name = "MigrationName1774524742177"; - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE "DashboardDomain" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "domainId" uuid NOT NULL, "dashboardId" uuid NOT NULL, "subdomain" character varying(100) NOT NULL, "fullDomain" character varying(100) NOT NULL, "createdByUserId" uuid, "cnameVerificationToken" character varying(100) NOT NULL, "isCnameVerified" boolean NOT NULL DEFAULT false, "isSslOrdered" boolean NOT NULL DEFAULT false, "isSslProvisioned" boolean NOT NULL DEFAULT false, "deletedByUserId" uuid, "customCertificate" text, "customCertificateKey" text, "isCustomCertificate" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_3897ff3212d5d8ddbdeca684bf6" PRIMARY KEY ("_id"))`); - await queryRunner.query(`CREATE INDEX "IDX_8c0e357d0490d45c89ee673005" ON "DashboardDomain" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_0f58973f28172817bf9c1b34e7" ON "DashboardDomain" ("domainId") `); - await queryRunner.query(`CREATE INDEX "IDX_601f68ad16b421ede8b06b3f40" ON "DashboardDomain" ("dashboardId") `); - await queryRunner.query(`ALTER TABLE "Dashboard" ADD "isPublicDashboard" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "Dashboard" ADD "enableMasterPassword" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "Dashboard" ADD "masterPassword" character varying(64)`); - await queryRunner.query(`ALTER TABLE "Dashboard" ADD "ipWhitelist" text`); - await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`); - await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`); - await queryRunner.query(`ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_8c0e357d0490d45c89ee673005c" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_0f58973f28172817bf9c1b34e73" FOREIGN KEY ("domainId") REFERENCES "Domain"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_601f68ad16b421ede8b06b3f40c" FOREIGN KEY ("dashboardId") REFERENCES "Dashboard"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_de80950ba9f0d034f5c47940b3c" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_de0c87b9c94b5dfeb21f1ce106f" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_de0c87b9c94b5dfeb21f1ce106f"`); - await queryRunner.query(`ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_de80950ba9f0d034f5c47940b3c"`); - await queryRunner.query(`ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_601f68ad16b421ede8b06b3f40c"`); - await queryRunner.query(`ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_0f58973f28172817bf9c1b34e73"`); - await queryRunner.query(`ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_8c0e357d0490d45c89ee673005c"`); - await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`); - await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`); - await queryRunner.query(`ALTER TABLE "Dashboard" DROP COLUMN "ipWhitelist"`); - await queryRunner.query(`ALTER TABLE "Dashboard" DROP COLUMN "masterPassword"`); - await queryRunner.query(`ALTER TABLE "Dashboard" DROP COLUMN "enableMasterPassword"`); - await queryRunner.query(`ALTER TABLE "Dashboard" DROP COLUMN "isPublicDashboard"`); - await queryRunner.query(`DROP INDEX "public"."IDX_601f68ad16b421ede8b06b3f40"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0f58973f28172817bf9c1b34e7"`); - await queryRunner.query(`DROP INDEX "public"."IDX_8c0e357d0490d45c89ee673005"`); - await queryRunner.query(`DROP TABLE "DashboardDomain"`); - } + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "DashboardDomain" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "domainId" uuid NOT NULL, "dashboardId" uuid NOT NULL, "subdomain" character varying(100) NOT NULL, "fullDomain" character varying(100) NOT NULL, "createdByUserId" uuid, "cnameVerificationToken" character varying(100) NOT NULL, "isCnameVerified" boolean NOT NULL DEFAULT false, "isSslOrdered" boolean NOT NULL DEFAULT false, "isSslProvisioned" boolean NOT NULL DEFAULT false, "deletedByUserId" uuid, "customCertificate" text, "customCertificateKey" text, "isCustomCertificate" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_3897ff3212d5d8ddbdeca684bf6" PRIMARY KEY ("_id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8c0e357d0490d45c89ee673005" ON "DashboardDomain" ("projectId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0f58973f28172817bf9c1b34e7" ON "DashboardDomain" ("domainId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_601f68ad16b421ede8b06b3f40" ON "DashboardDomain" ("dashboardId") `, + ); + await queryRunner.query( + `ALTER TABLE "Dashboard" ADD "isPublicDashboard" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "Dashboard" ADD "enableMasterPassword" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "Dashboard" ADD "masterPassword" character varying(64)`, + ); + await queryRunner.query(`ALTER TABLE "Dashboard" ADD "ipWhitelist" text`); + await queryRunner.query( + `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`, + ); + await queryRunner.query( + `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`, + ); + await queryRunner.query( + `ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_8c0e357d0490d45c89ee673005c" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_0f58973f28172817bf9c1b34e73" FOREIGN KEY ("domainId") REFERENCES "Domain"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_601f68ad16b421ede8b06b3f40c" FOREIGN KEY ("dashboardId") REFERENCES "Dashboard"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_de80950ba9f0d034f5c47940b3c" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "DashboardDomain" ADD CONSTRAINT "FK_de0c87b9c94b5dfeb21f1ce106f" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + } + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_de0c87b9c94b5dfeb21f1ce106f"`, + ); + await queryRunner.query( + `ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_de80950ba9f0d034f5c47940b3c"`, + ); + await queryRunner.query( + `ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_601f68ad16b421ede8b06b3f40c"`, + ); + await queryRunner.query( + `ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_0f58973f28172817bf9c1b34e73"`, + ); + await queryRunner.query( + `ALTER TABLE "DashboardDomain" DROP CONSTRAINT "FK_8c0e357d0490d45c89ee673005c"`, + ); + await queryRunner.query( + `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`, + ); + await queryRunner.query( + `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`, + ); + await queryRunner.query( + `ALTER TABLE "Dashboard" DROP COLUMN "ipWhitelist"`, + ); + await queryRunner.query( + `ALTER TABLE "Dashboard" DROP COLUMN "masterPassword"`, + ); + await queryRunner.query( + `ALTER TABLE "Dashboard" DROP COLUMN "enableMasterPassword"`, + ); + await queryRunner.query( + `ALTER TABLE "Dashboard" DROP COLUMN "isPublicDashboard"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_601f68ad16b421ede8b06b3f40"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_0f58973f28172817bf9c1b34e7"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_8c0e357d0490d45c89ee673005"`, + ); + await queryRunner.query(`DROP TABLE "DashboardDomain"`); + } } diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.ts index fb1cf2a9ea..3b0dcf97b7 100644 --- a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.ts +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.ts @@ -1,14 +1,17 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class MigrationName1774524742178 implements MigrationInterface { - name = 'MigrationName1774524742178' + name = "MigrationName1774524742178"; - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "StatusPage" ADD "showUptimeHistoryInDays" integer NOT NULL DEFAULT 90`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "StatusPage" DROP COLUMN "showUptimeHistoryInDays"`); - } + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "StatusPage" ADD "showUptimeHistoryInDays" integer NOT NULL DEFAULT 90`, + ); + } + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "StatusPage" DROP COLUMN "showUptimeHistoryInDays"`, + ); + } } diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts index b169716371..71df276d99 100644 --- a/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts @@ -547,5 +547,5 @@ export default [ MigrationName1774355321449, MigrationName1774357353502, MigrationName1774524742177, - MigrationName1774524742178 + MigrationName1774524742178, ]; diff --git a/Common/Server/Services/DashboardDomainService.ts b/Common/Server/Services/DashboardDomainService.ts index 65db0089c0..0d539f554f 100644 --- a/Common/Server/Services/DashboardDomainService.ts +++ b/Common/Server/Services/DashboardDomainService.ts @@ -34,9 +34,7 @@ export class Service extends DatabaseService { const domain: DomainModel | null = await DomainService.findOneBy({ query: { _id: - createBy.data.domainId?.toString() || - createBy.data.domain?._id || - "", + createBy.data.domainId?.toString() || createBy.data.domain?._id || "", }, select: { domain: true, isVerified: true }, props: { @@ -175,9 +173,7 @@ export class Service extends DatabaseService { }, }); - logger.debug( - "SSL ordered for domain: " + dashboardDomain.fullDomain, - ); + logger.debug("SSL ordered for domain: " + dashboardDomain.fullDomain); await this.updateOneById({ id: dashboardDomain.id!, @@ -308,9 +304,7 @@ export class Service extends DatabaseService { const token: string = dashboardDomain.cnameVerificationToken!; - logger.debug( - "Checking for CNAME " + fullDomain + " with token " + token, - ); + logger.debug("Checking for CNAME " + fullDomain + " with token " + token); try { const result: HTTPErrorResponse | HTTPResponse = @@ -643,9 +637,7 @@ export class Service extends DatabaseService { try { await this.orderCert(domain); } catch (err) { - logger.error( - "Cannot order cert for domain: " + domain.fullDomain, - ); + logger.error("Cannot order cert for domain: " + domain.fullDomain); logger.error(err); } } diff --git a/Common/Server/Services/WorkspaceNotificationSummaryService.ts b/Common/Server/Services/WorkspaceNotificationSummaryService.ts index 3f8c46885f..e3af26c7f1 100644 --- a/Common/Server/Services/WorkspaceNotificationSummaryService.ts +++ b/Common/Server/Services/WorkspaceNotificationSummaryService.ts @@ -1448,7 +1448,7 @@ export class Service extends DatabaseService { for (const [, td] of tlMap) { // For ack: if not explicitly acknowledged but resolved, use resolve time as ack time const eventTime: Date | undefined = - kind === "ack" ? (td.ackAt || td.resolvedAt) : td.resolvedAt; + kind === "ack" ? td.ackAt || td.resolvedAt : td.resolvedAt; if (eventTime && td.declaredAt) { total += OneUptimeDate.getMinutesBetweenTwoDates( td.declaredAt, diff --git a/Common/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts b/Common/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts index ea8e335bbe..7b9ee2d106 100644 --- a/Common/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +++ b/Common/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts @@ -682,7 +682,9 @@ ${contextBlock} // Cluster context const clusterDetails: Array = []; clusterDetails.push(`- Cluster: ${breakdown.clusterName}`); - clusterDetails.push(`- Metric: ${breakdown.metricFriendlyName} (\`${breakdown.metricName}\`)`); + clusterDetails.push( + `- Metric: ${breakdown.metricFriendlyName} (\`${breakdown.metricName}\`)`, + ); if (breakdown.attributes["k8s.namespace.name"]) { clusterDetails.push( @@ -695,23 +697,15 @@ ${contextBlock} ); // Affected resources - if ( - breakdown.affectedResources && - breakdown.affectedResources.length > 0 - ) { + if (breakdown.affectedResources && breakdown.affectedResources.length > 0) { const resourceLines: Array = []; // Sort by metric value descending (worst first) const sortedResources: Array = [ ...breakdown.affectedResources, - ].sort( - ( - a: KubernetesAffectedResource, - b: KubernetesAffectedResource, - ) => { - return b.metricValue - a.metricValue; - }, - ); + ].sort((a: KubernetesAffectedResource, b: KubernetesAffectedResource) => { + return b.metricValue - a.metricValue; + }); // Show top 10 affected resources const resourcesToShow: Array = @@ -798,9 +792,7 @@ ${contextBlock} metricName === "k8s.pod.phase" && breakdown.attributes["k8s.pod.phase"] === "Pending" ) { - lines.push( - `Pods are stuck in Pending phase and unable to be scheduled.`, - ); + lines.push(`Pods are stuck in Pending phase and unable to be scheduled.`); lines.push( `Common causes: insufficient CPU/memory resources on nodes, node affinity/taint restrictions preventing scheduling, PersistentVolumeClaim pending, or resource quota exceeded.`, ); @@ -811,7 +803,7 @@ ${contextBlock} } } else if ( metricName === "k8s.node.condition_ready" || - metricName.includes("node") && metricName.includes("condition") + (metricName.includes("node") && metricName.includes("condition")) ) { lines.push(`One or more nodes have transitioned to a NotReady state.`); if (topResource.nodeName) { @@ -827,7 +819,7 @@ ${contextBlock} ); } else if ( metricName === "k8s.node.cpu.utilization" || - metricName.includes("cpu") && metricName.includes("utilization") + (metricName.includes("cpu") && metricName.includes("utilization")) ) { lines.push(`Node CPU utilization has exceeded the configured threshold.`); if (topResource.nodeName) { @@ -843,7 +835,7 @@ ${contextBlock} ); } else if ( metricName === "k8s.node.memory.usage" || - metricName.includes("memory") && metricName.includes("usage") + (metricName.includes("memory") && metricName.includes("usage")) ) { lines.push( `Node memory utilization has exceeded the configured threshold.`, @@ -879,7 +871,7 @@ ${contextBlock} ); } else if ( metricName === "k8s.job.failed_pods" || - metricName.includes("job") && metricName.includes("fail") + (metricName.includes("job") && metricName.includes("fail")) ) { lines.push(`Kubernetes Job has failed pods.`); if (topResource.workloadName) { @@ -916,9 +908,7 @@ ${contextBlock} metricName === "k8s.daemonset.misscheduled_nodes" || metricName.includes("daemonset") ) { - lines.push( - `DaemonSet has misscheduled or unavailable nodes.`, - ); + lines.push(`DaemonSet has misscheduled or unavailable nodes.`); if (topResource.workloadName) { lines.push( `DaemonSet \`${topResource.workloadName}\` has **${topResource.metricValue}** misscheduled node(s).`, diff --git a/Common/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts b/Common/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts index b7b182817c..c3bbefa79d 100644 --- a/Common/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +++ b/Common/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts @@ -1023,8 +1023,10 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase { logger.debug("Sending message to Microsoft Teams with data:"); logger.debug(data); - // Teams adaptive cards have a ~28KB payload limit. - // Split message blocks into chunks of 40 to avoid hitting the limit. + /* + * Teams adaptive cards have a ~28KB payload limit. + * Split message blocks into chunks of 40 to avoid hitting the limit. + */ const maxBlocksPerCard: number = 40; const allMessageBlocks: Array = data.workspaceMessagePayload.messageBlocks; diff --git a/Common/Server/Utils/Workspace/Slack/Slack.ts b/Common/Server/Utils/Workspace/Slack/Slack.ts index c9fd697421..4f2ffb9d70 100644 --- a/Common/Server/Utils/Workspace/Slack/Slack.ts +++ b/Common/Server/Utils/Workspace/Slack/Slack.ts @@ -1140,11 +1140,7 @@ export default class SlackUtil extends WorkspaceBase { blocks: blocks, }); } else { - for ( - let i: number = 0; - i < blocks.length; - i += maxBlocksPerMessage - ) { + for (let i: number = 0; i < blocks.length; i += maxBlocksPerMessage) { const chunk: Array = blocks.slice( i, i + maxBlocksPerMessage, diff --git a/Common/UI/Components/Workflow/ComponentSettingsModal.tsx b/Common/UI/Components/Workflow/ComponentSettingsModal.tsx index d98bbf6735..ffdc90af87 100644 --- a/Common/UI/Components/Workflow/ComponentSettingsModal.tsx +++ b/Common/UI/Components/Workflow/ComponentSettingsModal.tsx @@ -95,7 +95,11 @@ const ComponentSettingsModal: FunctionComponent = ( > = ( > = ( > = ( > = ( {/* Component cards grid */}
{categoryComponents.map( - ( - componentMetadata: ComponentMetadata, - j: number, - ) => { + (componentMetadata: ComponentMetadata, j: number) => { const isSelected: boolean = selectedComponentMetadata !== null && selectedComponentMetadata.id === @@ -178,9 +175,7 @@ const ComponentsModal: FunctionComponent = (
{ - setSelectedComponentMetadata( - componentMetadata, - ); + setSelectedComponentMetadata(componentMetadata); }} className="cursor-pointer transition-all duration-150" style={{ @@ -219,9 +214,7 @@ const ComponentsModal: FunctionComponent = ( = ( style={{ fontSize: "0.8125rem", fontWeight: 600, - color: isSelected - ? "#4338ca" - : "#1e293b", + color: isSelected ? "#4338ca" : "#1e293b", margin: 0, lineHeight: "1.25rem", }} @@ -246,9 +237,7 @@ const ComponentsModal: FunctionComponent = (

= export const StatusPageCNameRecord: string = env("STATUS_PAGE_CNAME_RECORD") || ""; -export const DashboardCNameRecord: string = - env("DASHBOARD_CNAME_RECORD") || ""; +export const DashboardCNameRecord: string = env("DASHBOARD_CNAME_RECORD") || ""; export const AnalyticsKey: string = env("ANALYTICS_KEY") || ""; export const AnalyticsHost: string = env("ANALYTICS_HOST"); diff --git a/Common/Utils/Dashboard/Components/DashboardChartComponent.ts b/Common/Utils/Dashboard/Components/DashboardChartComponent.ts index 1e794727a8..703a454470 100644 --- a/Common/Utils/Dashboard/Components/DashboardChartComponent.ts +++ b/Common/Utils/Dashboard/Components/DashboardChartComponent.ts @@ -80,8 +80,7 @@ export default class DashboardChartComponentUtil extends DashboardBaseComponentU componentArguments.push({ name: "Additional Queries", - description: - "Add multiple metric queries to overlay on the same chart", + description: "Add multiple metric queries to overlay on the same chart", required: false, type: ComponentInputType.MetricsQueryConfigs, id: "metricQueryConfigs", diff --git a/Common/Utils/Dashboard/Components/DashboardGaugeComponent.ts b/Common/Utils/Dashboard/Components/DashboardGaugeComponent.ts index 9903a18e9e..93cb7cd6fa 100644 --- a/Common/Utils/Dashboard/Components/DashboardGaugeComponent.ts +++ b/Common/Utils/Dashboard/Components/DashboardGaugeComponent.ts @@ -76,8 +76,7 @@ export default class DashboardGaugeComponentUtil extends DashboardBaseComponentU componentArguments.push({ name: "Warning Threshold", - description: - "Values above this threshold will be shown in yellow", + description: "Values above this threshold will be shown in yellow", required: false, type: ComponentInputType.Number, id: "warningThreshold", @@ -86,8 +85,7 @@ export default class DashboardGaugeComponentUtil extends DashboardBaseComponentU componentArguments.push({ name: "Critical Threshold", - description: - "Values above this threshold will be shown in red", + description: "Values above this threshold will be shown in red", required: false, type: ComponentInputType.Number, id: "criticalThreshold", diff --git a/VERSION b/VERSION index faa1f27f65..ff2c1b8aff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.0.39 \ No newline at end of file +10.0.40 \ No newline at end of file diff --git a/Worker/Jobs/TelemetryMonitor/MonitorTelemetryMonitor.ts b/Worker/Jobs/TelemetryMonitor/MonitorTelemetryMonitor.ts index 0e21c42a26..54fa476ad0 100644 --- a/Worker/Jobs/TelemetryMonitor/MonitorTelemetryMonitor.ts +++ b/Worker/Jobs/TelemetryMonitor/MonitorTelemetryMonitor.ts @@ -488,7 +488,8 @@ const monitorKubernetes: MonitorKubernetesFunction = async (data: { if (resourceFilters.workloadName && resourceFilters.workloadType) { const workloadType: string = resourceFilters.workloadType.toLowerCase(); - attributes[`resource.k8s.${workloadType}.name`] = resourceFilters.workloadName; + attributes[`resource.k8s.${workloadType}.name`] = + resourceFilters.workloadName; } } @@ -569,10 +570,14 @@ const monitorKubernetes: MonitorKubernetesFunction = async (data: { if (metricAttrs["resource.k8s.deployment.name"]) { workloadType = "Deployment"; - workloadName = metricAttrs["resource.k8s.deployment.name"] as string; + workloadName = metricAttrs[ + "resource.k8s.deployment.name" + ] as string; } else if (metricAttrs["resource.k8s.statefulset.name"]) { workloadType = "StatefulSet"; - workloadName = metricAttrs["resource.k8s.statefulset.name"] as string; + workloadName = metricAttrs[ + "resource.k8s.statefulset.name" + ] as string; } else if (metricAttrs["resource.k8s.daemonset.name"]) { workloadType = "DaemonSet"; workloadName = metricAttrs["resource.k8s.daemonset.name"] as string; @@ -584,7 +589,9 @@ const monitorKubernetes: MonitorKubernetesFunction = async (data: { workloadName = metricAttrs["resource.k8s.cronjob.name"] as string; } else if (metricAttrs["resource.k8s.replicaset.name"]) { workloadType = "ReplicaSet"; - workloadName = metricAttrs["resource.k8s.replicaset.name"] as string; + workloadName = metricAttrs[ + "resource.k8s.replicaset.name" + ] as string; } // Build unique key for deduplication

+ Timestamp + Value -