@oneuptime/common 11.0.0 → 11.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/Alert.ts +110 -0
- package/Models/DatabaseModels/CephCluster.ts +964 -0
- package/Models/DatabaseModels/CephClusterLabelRule.ts +514 -0
- package/Models/DatabaseModels/CephClusterOwnerRule.ts +596 -0
- package/Models/DatabaseModels/CephClusterOwnerTeam.ts +487 -0
- package/Models/DatabaseModels/CephClusterOwnerUser.ts +486 -0
- package/Models/DatabaseModels/CephResource.ts +809 -0
- package/Models/DatabaseModels/Host.ts +64 -0
- package/Models/DatabaseModels/Incident.ts +110 -0
- package/Models/DatabaseModels/Index.ts +24 -0
- package/Models/DatabaseModels/ProxmoxCluster.ts +943 -0
- package/Models/DatabaseModels/ProxmoxClusterLabelRule.ts +514 -0
- package/Models/DatabaseModels/ProxmoxClusterOwnerRule.ts +596 -0
- package/Models/DatabaseModels/ProxmoxClusterOwnerTeam.ts +487 -0
- package/Models/DatabaseModels/ProxmoxClusterOwnerUser.ts +486 -0
- package/Models/DatabaseModels/ProxmoxResource.ts +726 -0
- package/Models/DatabaseModels/ScheduledMaintenance.ts +110 -0
- package/Server/API/BillingInvoiceAPI.ts +47 -7
- package/Server/API/CephResourceAPI.ts +134 -0
- package/Server/API/DashboardAPI.ts +46 -0
- package/Server/API/ProjectAPI.ts +15 -0
- package/Server/API/ProxmoxResourceAPI.ts +132 -0
- package/Server/API/ResellerPlanAPI.ts +17 -0
- package/Server/Infrastructure/GlobalCache.ts +8 -2
- package/Server/Infrastructure/Postgres/SchemaMigrations/1781500000000-AddProxmoxAndCephClusterTables.ts +163 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1781600000000-AddProxmoxCephV2Columns.ts +211 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1781600000001-AddProxmoxCephActivityAndRules.ts +590 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1781700000000-AddProxmoxCephV3Columns.ts +64 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Infrastructure/Redis.ts +40 -12
- package/Server/Services/AnalyticsDatabaseService.ts +1 -1
- package/Server/Services/BillingService.ts +109 -21
- package/Server/Services/CephClusterLabelRuleEngineService.ts +200 -0
- package/Server/Services/CephClusterLabelRuleService.ts +14 -0
- package/Server/Services/CephClusterOwnerRuleEngineService.ts +218 -0
- package/Server/Services/CephClusterOwnerRuleService.ts +14 -0
- package/Server/Services/CephClusterOwnerTeamService.ts +10 -0
- package/Server/Services/CephClusterOwnerUserService.ts +10 -0
- package/Server/Services/CephClusterService.ts +401 -0
- package/Server/Services/CephResourceService.ts +383 -0
- package/Server/Services/CloudResourceService.ts +11 -3
- package/Server/Services/DockerHostService.ts +11 -3
- package/Server/Services/ExceptionAggregationService.ts +2 -0
- package/Server/Services/HostService.ts +11 -3
- package/Server/Services/Index.ts +24 -0
- package/Server/Services/KubernetesClusterService.ts +11 -3
- package/Server/Services/LogAggregationService.ts +2 -0
- package/Server/Services/MetricAggregationService.ts +2 -0
- package/Server/Services/OpenTelemetryIngestService.ts +36 -0
- package/Server/Services/ProxmoxClusterLabelRuleEngineService.ts +204 -0
- package/Server/Services/ProxmoxClusterLabelRuleService.ts +14 -0
- package/Server/Services/ProxmoxClusterOwnerRuleEngineService.ts +222 -0
- package/Server/Services/ProxmoxClusterOwnerRuleService.ts +14 -0
- package/Server/Services/ProxmoxClusterOwnerTeamService.ts +10 -0
- package/Server/Services/ProxmoxClusterOwnerUserService.ts +10 -0
- package/Server/Services/ProxmoxClusterService.ts +382 -0
- package/Server/Services/ProxmoxResourceService.ts +404 -0
- package/Server/Services/RumApplicationService.ts +11 -3
- package/Server/Services/ServerlessFunctionService.ts +11 -3
- package/Server/Services/TelemetryUsageBillingService.ts +41 -3
- package/Server/Services/TraceAggregationService.ts +2 -0
- package/Server/Types/AnalyticsDatabase/AggregateBy.ts +8 -23
- package/Server/Utils/Monitor/MonitorAlert.ts +45 -0
- package/Server/Utils/Monitor/MonitorClusterContext.ts +129 -0
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +344 -4
- package/Server/Utils/Monitor/MonitorIncident.ts +130 -7
- package/Server/Utils/Monitor/MonitorMaintenanceSuppression.ts +39 -6
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +3 -1
- package/Server/Utils/Monitor/SeriesResourceLabels.ts +33 -0
- package/Server/Utils/Profiling.ts +37 -2
- package/Server/Utils/Telemetry/EntityRegistry.ts +4 -0
- package/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.ts +1096 -0
- package/Server/Utils/Telemetry/TelemetryEntity.ts +85 -0
- package/Server/Utils/Telemetry.ts +8 -19
- package/Tests/Server/API/BillingInvoiceAPI.test.ts +194 -0
- package/Tests/Server/API/ProjectAPI.test.ts +91 -0
- package/Tests/Server/API/ResellerPlanAPI.test.ts +207 -0
- package/Tests/Server/Infrastructure/GlobalCache.test.ts +100 -0
- package/Tests/Server/Services/BillingService.test.ts +323 -0
- package/Tests/Server/Services/CephResourceService.test.ts +264 -0
- package/Tests/Server/Services/ProxmoxResourceService.test.ts +326 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluator.test.ts +322 -0
- package/Tests/Server/Utils/Monitor/MonitorMaintenanceSuppression.test.ts +13 -0
- package/Tests/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.test.ts +879 -0
- package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +196 -0
- package/Tests/Types/Monitor/CephAlertTemplates.test.ts +1231 -0
- package/Tests/Types/Monitor/ProxmoxAlertTemplates.test.ts +732 -0
- package/Tests/Utils/ModelImportExport.test.ts +366 -0
- package/Tests/Utils/Telemetry/EntityRelationship.test.ts +49 -0
- package/Tests/Utils/Telemetry/HeartbeatAvailability.test.ts +423 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.ts +74 -0
- package/Types/Dashboard/DashboardComponentType.ts +4 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +2 -0
- package/Types/Dashboard/DashboardComponents/DashboardCephOsdListComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardCephPoolListComponent.ts +14 -0
- package/Types/Dashboard/DashboardComponents/DashboardProxmoxGuestListComponent.ts +17 -0
- package/Types/Dashboard/DashboardComponents/DashboardProxmoxNodeListComponent.ts +16 -0
- package/Types/Dashboard/DashboardTemplates.ts +446 -0
- package/Types/Icon/IconProp.ts +2 -0
- package/Types/Monitor/CephAlertTemplates.ts +1647 -0
- package/Types/Monitor/CephMetricCatalog.ts +409 -0
- package/Types/Monitor/MetricMonitor/MetricMonitorResponse.ts +44 -0
- package/Types/Monitor/MonitorStep.ts +64 -0
- package/Types/Monitor/MonitorStepCephMonitor.ts +57 -0
- package/Types/Monitor/MonitorStepProxmoxMonitor.ts +81 -0
- package/Types/Monitor/MonitorType.ts +29 -1
- package/Types/Monitor/ProxmoxAlertTemplates.ts +899 -0
- package/Types/Monitor/ProxmoxMetricCatalog.ts +382 -0
- package/Types/Permission.ts +464 -0
- package/Types/Telemetry/EntityType.ts +11 -0
- package/Types/Telemetry/ServiceType.ts +2 -0
- package/UI/Components/Icon/Icon.tsx +84 -0
- package/UI/Components/ImportExport/ExportModelCard.tsx +90 -0
- package/UI/Components/ImportExport/ImportModelsModal.tsx +239 -0
- package/UI/Components/ModelTable/ModelTable.tsx +294 -143
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +9 -5
- package/UI/Utils/ModelImportExport.ts +207 -0
- package/UI/Utils/Telemetry/Telemetry.ts +16 -21
- package/UI/Utils/TelemetryService.ts +7 -3
- package/Utils/Dashboard/Components/DashboardCephOsdListComponent.ts +63 -0
- package/Utils/Dashboard/Components/DashboardCephPoolListComponent.ts +32 -0
- package/Utils/Dashboard/Components/DashboardCephResourceListShared.ts +61 -0
- package/Utils/Dashboard/Components/DashboardProxmoxGuestListComponent.ts +69 -0
- package/Utils/Dashboard/Components/DashboardProxmoxNodeListComponent.ts +55 -0
- package/Utils/Dashboard/Components/DashboardProxmoxResourceListShared.ts +61 -0
- package/Utils/Dashboard/Components/Index.ts +28 -0
- package/Utils/ModelImportExport.ts +369 -0
- package/Utils/Telemetry/EntityKey.ts +35 -0
- package/Utils/Telemetry/EntityRelationship.ts +6 -0
- package/Utils/Telemetry/HeartbeatAvailability.ts +262 -0
- package/build/dist/Models/DatabaseModels/Alert.js +108 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/CephCluster.js +992 -0
- package/build/dist/Models/DatabaseModels/CephCluster.js.map +1 -0
- package/build/dist/Models/DatabaseModels/CephClusterLabelRule.js +522 -0
- package/build/dist/Models/DatabaseModels/CephClusterLabelRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/CephClusterOwnerRule.js +603 -0
- package/build/dist/Models/DatabaseModels/CephClusterOwnerRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/CephClusterOwnerTeam.js +503 -0
- package/build/dist/Models/DatabaseModels/CephClusterOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/CephClusterOwnerUser.js +502 -0
- package/build/dist/Models/DatabaseModels/CephClusterOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/CephResource.js +846 -0
- package/build/dist/Models/DatabaseModels/CephResource.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Host.js +63 -0
- package/build/dist/Models/DatabaseModels/Host.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Incident.js +108 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +24 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js +967 -0
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ProxmoxClusterLabelRule.js +522 -0
- package/build/dist/Models/DatabaseModels/ProxmoxClusterLabelRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ProxmoxClusterOwnerRule.js +603 -0
- package/build/dist/Models/DatabaseModels/ProxmoxClusterOwnerRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ProxmoxClusterOwnerTeam.js +503 -0
- package/build/dist/Models/DatabaseModels/ProxmoxClusterOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ProxmoxClusterOwnerUser.js +502 -0
- package/build/dist/Models/DatabaseModels/ProxmoxClusterOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ProxmoxResource.js +761 -0
- package/build/dist/Models/DatabaseModels/ProxmoxResource.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +108 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/API/BillingInvoiceAPI.js +35 -5
- package/build/dist/Server/API/BillingInvoiceAPI.js.map +1 -1
- package/build/dist/Server/API/CephResourceAPI.js +98 -0
- package/build/dist/Server/API/CephResourceAPI.js.map +1 -0
- package/build/dist/Server/API/DashboardAPI.js +46 -0
- package/build/dist/Server/API/DashboardAPI.js.map +1 -1
- package/build/dist/Server/API/ProjectAPI.js +11 -0
- package/build/dist/Server/API/ProjectAPI.js.map +1 -1
- package/build/dist/Server/API/ProxmoxResourceAPI.js +95 -0
- package/build/dist/Server/API/ProxmoxResourceAPI.js.map +1 -0
- package/build/dist/Server/API/ResellerPlanAPI.js +17 -3
- package/build/dist/Server/API/ResellerPlanAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/GlobalCache.js +7 -2
- package/build/dist/Server/Infrastructure/GlobalCache.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1781500000000-AddProxmoxAndCephClusterTables.js +76 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1781500000000-AddProxmoxAndCephClusterTables.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1781600000000-AddProxmoxCephV2Columns.js +108 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1781600000000-AddProxmoxCephV2Columns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1781600000001-AddProxmoxCephActivityAndRules.js +253 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1781600000001-AddProxmoxCephActivityAndRules.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1781700000000-AddProxmoxCephV3Columns.js +43 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1781700000000-AddProxmoxCephV3Columns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Redis.js +31 -8
- package/build/dist/Server/Infrastructure/Redis.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/BillingService.js +85 -23
- package/build/dist/Server/Services/BillingService.js.map +1 -1
- package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js +166 -0
- package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/CephClusterLabelRuleService.js +13 -0
- package/build/dist/Server/Services/CephClusterLabelRuleService.js.map +1 -0
- package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js +186 -0
- package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/CephClusterOwnerRuleService.js +13 -0
- package/build/dist/Server/Services/CephClusterOwnerRuleService.js.map +1 -0
- package/build/dist/Server/Services/CephClusterOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/CephClusterOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/CephClusterOwnerUserService.js +9 -0
- package/build/dist/Server/Services/CephClusterOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/CephClusterService.js +353 -0
- package/build/dist/Server/Services/CephClusterService.js.map +1 -0
- package/build/dist/Server/Services/CephResourceService.js +257 -0
- package/build/dist/Server/Services/CephResourceService.js.map +1 -0
- package/build/dist/Server/Services/CloudResourceService.js +10 -2
- package/build/dist/Server/Services/CloudResourceService.js.map +1 -1
- package/build/dist/Server/Services/DockerHostService.js +10 -2
- package/build/dist/Server/Services/DockerHostService.js.map +1 -1
- package/build/dist/Server/Services/ExceptionAggregationService.js +2 -0
- package/build/dist/Server/Services/ExceptionAggregationService.js.map +1 -1
- package/build/dist/Server/Services/HostService.js +10 -2
- package/build/dist/Server/Services/HostService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +24 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/KubernetesClusterService.js +10 -2
- package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
- package/build/dist/Server/Services/LogAggregationService.js +2 -0
- package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
- package/build/dist/Server/Services/MetricAggregationService.js +2 -0
- package/build/dist/Server/Services/MetricAggregationService.js.map +1 -1
- package/build/dist/Server/Services/OpenTelemetryIngestService.js +37 -7
- package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
- package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js +166 -0
- package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/ProxmoxClusterLabelRuleService.js +13 -0
- package/build/dist/Server/Services/ProxmoxClusterLabelRuleService.js.map +1 -0
- package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js +186 -0
- package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/ProxmoxClusterOwnerRuleService.js +13 -0
- package/build/dist/Server/Services/ProxmoxClusterOwnerRuleService.js.map +1 -0
- package/build/dist/Server/Services/ProxmoxClusterOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/ProxmoxClusterOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/ProxmoxClusterOwnerUserService.js +9 -0
- package/build/dist/Server/Services/ProxmoxClusterOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/ProxmoxClusterService.js +337 -0
- package/build/dist/Server/Services/ProxmoxClusterService.js.map +1 -0
- package/build/dist/Server/Services/ProxmoxResourceService.js +285 -0
- package/build/dist/Server/Services/ProxmoxResourceService.js.map +1 -0
- package/build/dist/Server/Services/RumApplicationService.js +10 -2
- package/build/dist/Server/Services/RumApplicationService.js.map +1 -1
- package/build/dist/Server/Services/ServerlessFunctionService.js +10 -2
- package/build/dist/Server/Services/ServerlessFunctionService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryUsageBillingService.js +30 -3
- package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
- package/build/dist/Server/Services/TraceAggregationService.js +2 -0
- package/build/dist/Server/Services/TraceAggregationService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js +8 -25
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +36 -0
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorClusterContext.js +90 -0
- package/build/dist/Server/Utils/Monitor/MonitorClusterContext.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +228 -4
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +103 -8
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js +23 -6
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +3 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +23 -0
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
- package/build/dist/Server/Utils/Profiling.js +24 -3
- package/build/dist/Server/Utils/Profiling.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +4 -0
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.js +854 -0
- package/build/dist/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +62 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry.js +8 -10
- package/build/dist/Server/Utils/Telemetry.js.map +1 -1
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.js +69 -0
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js +4 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardCephOsdListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardCephOsdListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardCephPoolListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardCephPoolListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardProxmoxGuestListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardProxmoxGuestListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardProxmoxNodeListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardProxmoxNodeListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js +394 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/Icon/IconProp.js +2 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/Monitor/CephAlertTemplates.js +1379 -0
- package/build/dist/Types/Monitor/CephAlertTemplates.js.map +1 -0
- package/build/dist/Types/Monitor/CephMetricCatalog.js +353 -0
- package/build/dist/Types/Monitor/CephMetricCatalog.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorStep.js +46 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepCephMonitor.js +34 -0
- package/build/dist/Types/Monitor/MonitorStepCephMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorStepProxmoxMonitor.js +36 -0
- package/build/dist/Types/Monitor/MonitorStepProxmoxMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorType.js +27 -1
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/ProxmoxAlertTemplates.js +743 -0
- package/build/dist/Types/Monitor/ProxmoxAlertTemplates.js.map +1 -0
- package/build/dist/Types/Monitor/ProxmoxMetricCatalog.js +320 -0
- package/build/dist/Types/Monitor/ProxmoxMetricCatalog.js.map +1 -0
- package/build/dist/Types/Permission.js +408 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Telemetry/EntityType.js +11 -0
- package/build/dist/Types/Telemetry/EntityType.js.map +1 -1
- package/build/dist/Types/Telemetry/ServiceType.js +2 -0
- package/build/dist/Types/Telemetry/ServiceType.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +33 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/ImportExport/ExportModelCard.js +50 -0
- package/build/dist/UI/Components/ImportExport/ExportModelCard.js.map +1 -0
- package/build/dist/UI/Components/ImportExport/ImportModelsModal.js +115 -0
- package/build/dist/UI/Components/ImportExport/ImportModelsModal.js.map +1 -0
- package/build/dist/UI/Components/ModelTable/ModelTable.js +166 -74
- package/build/dist/UI/Components/ModelTable/ModelTable.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +5 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
- package/build/dist/UI/Utils/ModelImportExport.js +142 -0
- package/build/dist/UI/Utils/ModelImportExport.js.map +1 -0
- package/build/dist/UI/Utils/Telemetry/Telemetry.js +11 -10
- package/build/dist/UI/Utils/Telemetry/Telemetry.js.map +1 -1
- package/build/dist/UI/Utils/TelemetryService.js +5 -2
- package/build/dist/UI/Utils/TelemetryService.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/DashboardCephOsdListComponent.js +50 -0
- package/build/dist/Utils/Dashboard/Components/DashboardCephOsdListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardCephPoolListComponent.js +27 -0
- package/build/dist/Utils/Dashboard/Components/DashboardCephPoolListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardCephResourceListShared.js +46 -0
- package/build/dist/Utils/Dashboard/Components/DashboardCephResourceListShared.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardProxmoxGuestListComponent.js +55 -0
- package/build/dist/Utils/Dashboard/Components/DashboardProxmoxGuestListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardProxmoxNodeListComponent.js +42 -0
- package/build/dist/Utils/Dashboard/Components/DashboardProxmoxNodeListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardProxmoxResourceListShared.js +46 -0
- package/build/dist/Utils/Dashboard/Components/DashboardProxmoxResourceListShared.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/Index.js +16 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/build/dist/Utils/ModelImportExport.js +257 -0
- package/build/dist/Utils/ModelImportExport.js.map +1 -0
- package/build/dist/Utils/Telemetry/EntityKey.js +27 -0
- package/build/dist/Utils/Telemetry/EntityKey.js.map +1 -1
- package/build/dist/Utils/Telemetry/EntityRelationship.js +3 -0
- package/build/dist/Utils/Telemetry/EntityRelationship.js.map +1 -1
- package/build/dist/Utils/Telemetry/HeartbeatAvailability.js +174 -0
- package/build/dist/Utils/Telemetry/HeartbeatAvailability.js.map +1 -0
- package/package.json +29 -21
|
@@ -3,6 +3,8 @@ import DashboardBaseComponent from "../../../Types/Dashboard/DashboardComponents
|
|
|
3
3
|
import DashboardComponentType from "../../../Types/Dashboard/DashboardComponentType";
|
|
4
4
|
import BadDataException from "../../../Types/Exception/BadDataException";
|
|
5
5
|
import DashboardAlertListComponentUtil from "./DashboardAlertListComponent";
|
|
6
|
+
import DashboardCephOsdListComponentUtil from "./DashboardCephOsdListComponent";
|
|
7
|
+
import DashboardCephPoolListComponentUtil from "./DashboardCephPoolListComponent";
|
|
6
8
|
import DashboardChartComponentUtil from "./DashboardChartComponent";
|
|
7
9
|
import DashboardDockerContainerListComponentUtil from "./DashboardDockerContainerListComponent";
|
|
8
10
|
import DashboardDockerHostListComponentUtil from "./DashboardDockerHostListComponent";
|
|
@@ -22,6 +24,8 @@ import DashboardKubernetesPodListComponentUtil from "./DashboardKubernetesPodLis
|
|
|
22
24
|
import DashboardKubernetesStatefulSetListComponentUtil from "./DashboardKubernetesStatefulSetListComponent";
|
|
23
25
|
import DashboardLogStreamComponentUtil from "./DashboardLogStreamComponent";
|
|
24
26
|
import DashboardMonitorListComponentUtil from "./DashboardMonitorListComponent";
|
|
27
|
+
import DashboardProxmoxGuestListComponentUtil from "./DashboardProxmoxGuestListComponent";
|
|
28
|
+
import DashboardProxmoxNodeListComponentUtil from "./DashboardProxmoxNodeListComponent";
|
|
25
29
|
import DashboardTableComponentUtil from "./DashboardTableComponent";
|
|
26
30
|
import DashboardTextComponentUtil from "./DashboardTextComponent";
|
|
27
31
|
import DashboardTraceChartComponentUtil from "./DashboardTraceChartComponent";
|
|
@@ -193,6 +197,30 @@ export default class DashboardComponentsUtil {
|
|
|
193
197
|
>;
|
|
194
198
|
}
|
|
195
199
|
|
|
200
|
+
if (dashboardComponentType === DashboardComponentType.ProxmoxNodeList) {
|
|
201
|
+
return DashboardProxmoxNodeListComponentUtil.getComponentConfigArguments() as Array<
|
|
202
|
+
ComponentArgument<DashboardBaseComponent>
|
|
203
|
+
>;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (dashboardComponentType === DashboardComponentType.ProxmoxGuestList) {
|
|
207
|
+
return DashboardProxmoxGuestListComponentUtil.getComponentConfigArguments() as Array<
|
|
208
|
+
ComponentArgument<DashboardBaseComponent>
|
|
209
|
+
>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (dashboardComponentType === DashboardComponentType.CephOsdList) {
|
|
213
|
+
return DashboardCephOsdListComponentUtil.getComponentConfigArguments() as Array<
|
|
214
|
+
ComponentArgument<DashboardBaseComponent>
|
|
215
|
+
>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (dashboardComponentType === DashboardComponentType.CephPoolList) {
|
|
219
|
+
return DashboardCephPoolListComponentUtil.getComponentConfigArguments() as Array<
|
|
220
|
+
ComponentArgument<DashboardBaseComponent>
|
|
221
|
+
>;
|
|
222
|
+
}
|
|
223
|
+
|
|
196
224
|
throw new BadDataException(
|
|
197
225
|
`Unknown dashboard component type: ${dashboardComponentType}`,
|
|
198
226
|
);
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import BaseModel, {
|
|
2
|
+
DatabaseBaseModelType,
|
|
3
|
+
} from "../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
4
|
+
import { ColumnAccessControl } from "../Types/BaseDatabase/AccessControl";
|
|
5
|
+
import Select from "../Types/BaseDatabase/Select";
|
|
6
|
+
import { TableColumnMetadata } from "../Types/Database/TableColumn";
|
|
7
|
+
import TableColumnType from "../Types/Database/TableColumnType";
|
|
8
|
+
import OneUptimeDate from "../Types/Date";
|
|
9
|
+
import Dictionary from "../Types/Dictionary";
|
|
10
|
+
import Recurring from "../Types/Events/Recurring";
|
|
11
|
+
import BadDataException from "../Types/Exception/BadDataException";
|
|
12
|
+
import { JSONArray, JSONObject } from "../Types/JSON";
|
|
13
|
+
|
|
14
|
+
export const MODEL_EXPORT_FILE_TYPE: string = "oneuptime-resource-export";
|
|
15
|
+
export const MODEL_EXPORT_SCHEMA_VERSION: number = 1;
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* Columns that are always server-managed and must never be exported or
|
|
19
|
+
* imported, regardless of model metadata.
|
|
20
|
+
*/
|
|
21
|
+
const SYSTEM_COLUMNS: Array<string> = [
|
|
22
|
+
"_id",
|
|
23
|
+
"createdAt",
|
|
24
|
+
"updatedAt",
|
|
25
|
+
"deletedAt",
|
|
26
|
+
"version",
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* Column types that never make sense in an export file: relations to other
|
|
31
|
+
* entities (their ids would not resolve in another project or instance),
|
|
32
|
+
* binary data, and secrets.
|
|
33
|
+
*/
|
|
34
|
+
const EXCLUDED_COLUMN_TYPES: Array<TableColumnType> = [
|
|
35
|
+
TableColumnType.Entity,
|
|
36
|
+
TableColumnType.EntityArray,
|
|
37
|
+
TableColumnType.File,
|
|
38
|
+
TableColumnType.Buffer,
|
|
39
|
+
TableColumnType.Slug,
|
|
40
|
+
TableColumnType.HashedString,
|
|
41
|
+
TableColumnType.Password,
|
|
42
|
+
TableColumnType.OTP,
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* Columns that pass the generic metadata filters but must still never be
|
|
47
|
+
* exported: plain-text credentials and server-managed runtime state that
|
|
48
|
+
* would either leak secrets into export files or seed imported resources
|
|
49
|
+
* with stale state from the source resource.
|
|
50
|
+
*/
|
|
51
|
+
const EXCLUDED_COLUMNS_BY_TABLE: Dictionary<Array<string>> = {
|
|
52
|
+
StatusPage: ["embeddedOverallStatusToken"],
|
|
53
|
+
Monitor: [
|
|
54
|
+
"incomingMonitorRequest",
|
|
55
|
+
"serverMonitorResponse",
|
|
56
|
+
"incomingRequestMonitorHeartbeatCheckedAt",
|
|
57
|
+
"serverMonitorRequestReceivedAt",
|
|
58
|
+
"telemetryMonitorNextMonitorAt",
|
|
59
|
+
"telemetryMonitorLastMonitorAt",
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default class ModelImportExport {
|
|
64
|
+
/*
|
|
65
|
+
* Derives the list of columns that can safely round-trip through an export
|
|
66
|
+
* file from the model's own metadata. A column qualifies when the current
|
|
67
|
+
* caller could both read it and set it on create, it is not computed or
|
|
68
|
+
* server-generated, it holds no secret, and it does not reference another
|
|
69
|
+
* entity (foreign keys of Entity relations are excluded along with the
|
|
70
|
+
* relations themselves).
|
|
71
|
+
*/
|
|
72
|
+
public static getImportExportableColumnNames(
|
|
73
|
+
modelType: DatabaseBaseModelType,
|
|
74
|
+
): Array<string> {
|
|
75
|
+
const model: BaseModel = new modelType();
|
|
76
|
+
|
|
77
|
+
const tenantColumn: string | null = model.getTenantColumn();
|
|
78
|
+
|
|
79
|
+
const foreignKeyColumns: Array<string> = [];
|
|
80
|
+
|
|
81
|
+
for (const columnName of model.getTableColumns().columns) {
|
|
82
|
+
const metadata: TableColumnMetadata | undefined =
|
|
83
|
+
model.getTableColumnMetadata(columnName);
|
|
84
|
+
|
|
85
|
+
if (metadata?.manyToOneRelationColumn) {
|
|
86
|
+
foreignKeyColumns.push(metadata.manyToOneRelationColumn);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const excludedColumnsForTable: Array<string> =
|
|
91
|
+
EXCLUDED_COLUMNS_BY_TABLE[model.tableName || ""] || [];
|
|
92
|
+
|
|
93
|
+
const exportableColumns: Array<string> = [];
|
|
94
|
+
|
|
95
|
+
for (const columnName of model.getTableColumns().columns) {
|
|
96
|
+
if (SYSTEM_COLUMNS.includes(columnName)) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (excludedColumnsForTable.includes(columnName)) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (tenantColumn && columnName === tenantColumn) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (foreignKeyColumns.includes(columnName)) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const metadata: TableColumnMetadata | undefined =
|
|
113
|
+
model.getTableColumnMetadata(columnName);
|
|
114
|
+
|
|
115
|
+
if (!metadata) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (EXCLUDED_COLUMN_TYPES.includes(metadata.type)) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (metadata.computed || metadata.hashed || metadata.encrypted) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (metadata.forceGetDefaultValueOnCreate) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const accessControl: ColumnAccessControl | null =
|
|
132
|
+
model.getColumnAccessControlFor(columnName);
|
|
133
|
+
|
|
134
|
+
if (
|
|
135
|
+
!accessControl ||
|
|
136
|
+
accessControl.read.length === 0 ||
|
|
137
|
+
accessControl.create.length === 0
|
|
138
|
+
) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
exportableColumns.push(columnName);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return exportableColumns;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public static getImportExportSelect<TBaseModel extends BaseModel>(modelType: {
|
|
149
|
+
new (): TBaseModel;
|
|
150
|
+
}): Select<TBaseModel> {
|
|
151
|
+
const select: JSONObject = {};
|
|
152
|
+
|
|
153
|
+
for (const columnName of this.getImportExportableColumnNames(modelType)) {
|
|
154
|
+
select[columnName] = true;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return select as Select<TBaseModel>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public static toExportJSON<TBaseModel extends BaseModel>(
|
|
161
|
+
item: TBaseModel,
|
|
162
|
+
modelType: { new (): TBaseModel },
|
|
163
|
+
): JSONObject {
|
|
164
|
+
const json: JSONObject = BaseModel.toJSON(item, modelType);
|
|
165
|
+
|
|
166
|
+
const exportableColumns: Array<string> =
|
|
167
|
+
this.getImportExportableColumnNames(modelType);
|
|
168
|
+
|
|
169
|
+
const exportJson: JSONObject = {};
|
|
170
|
+
|
|
171
|
+
for (const key of Object.keys(json)) {
|
|
172
|
+
if (exportableColumns.includes(key)) {
|
|
173
|
+
exportJson[key] = json[key];
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return exportJson;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public static buildExportEnvelope<TBaseModel extends BaseModel>(data: {
|
|
181
|
+
modelType: { new (): TBaseModel };
|
|
182
|
+
items: Array<TBaseModel>;
|
|
183
|
+
exportedAt: Date;
|
|
184
|
+
}): JSONObject {
|
|
185
|
+
const model: BaseModel = new data.modelType();
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
fileType: MODEL_EXPORT_FILE_TYPE,
|
|
189
|
+
schemaVersion: MODEL_EXPORT_SCHEMA_VERSION,
|
|
190
|
+
resourceType: model.tableName || "",
|
|
191
|
+
exportedAt: data.exportedAt.toISOString(),
|
|
192
|
+
items: data.items.map((item: TBaseModel) => {
|
|
193
|
+
return this.toExportJSON(item, data.modelType);
|
|
194
|
+
}),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/*
|
|
199
|
+
* Accepts an export envelope, a plain array of items, or a single item
|
|
200
|
+
* object, and returns the list of item JSONs to import. Throws
|
|
201
|
+
* BadDataException with a user-facing message when the payload is not
|
|
202
|
+
* usable for this model type.
|
|
203
|
+
*/
|
|
204
|
+
public static parseImportPayload(data: {
|
|
205
|
+
modelType: DatabaseBaseModelType;
|
|
206
|
+
payload: JSONObject | JSONArray;
|
|
207
|
+
}): Array<JSONObject> {
|
|
208
|
+
const model: BaseModel = new data.modelType();
|
|
209
|
+
const resourceName: string = model.singularName || "resource";
|
|
210
|
+
|
|
211
|
+
let items: JSONArray | null = null;
|
|
212
|
+
|
|
213
|
+
if (Array.isArray(data.payload)) {
|
|
214
|
+
items = data.payload;
|
|
215
|
+
} else if (data.payload && typeof data.payload === "object") {
|
|
216
|
+
if (Array.isArray(data.payload["items"])) {
|
|
217
|
+
const resourceType: unknown = data.payload["resourceType"];
|
|
218
|
+
|
|
219
|
+
if (
|
|
220
|
+
resourceType &&
|
|
221
|
+
model.tableName &&
|
|
222
|
+
resourceType !== model.tableName
|
|
223
|
+
) {
|
|
224
|
+
throw new BadDataException(
|
|
225
|
+
`This file contains ${resourceType.toString()} resources and cannot be imported here. Please select a ${resourceName} export file.`,
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
items = data.payload["items"] as JSONArray;
|
|
230
|
+
} else {
|
|
231
|
+
// a single item object exported by hand.
|
|
232
|
+
items = [data.payload];
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!items) {
|
|
237
|
+
throw new BadDataException(
|
|
238
|
+
`This file is not a valid ${resourceName} export file.`,
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (items.length === 0) {
|
|
243
|
+
throw new BadDataException(
|
|
244
|
+
`This file does not contain any ${resourceName} to import.`,
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
for (const item of items) {
|
|
249
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
250
|
+
throw new BadDataException(
|
|
251
|
+
`This file is not a valid ${resourceName} export file.`,
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return items as Array<JSONObject>;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/*
|
|
260
|
+
* Builds a model instance from an import item, keeping only columns that
|
|
261
|
+
* are importable for this model. Anything else in the file - ids, slugs,
|
|
262
|
+
* timestamps, relations, unknown keys - is dropped so the server create
|
|
263
|
+
* API treats the item as a brand new resource.
|
|
264
|
+
*/
|
|
265
|
+
public static fromImportJSON<TBaseModel extends BaseModel>(data: {
|
|
266
|
+
json: JSONObject;
|
|
267
|
+
modelType: { new (): TBaseModel };
|
|
268
|
+
}): TBaseModel {
|
|
269
|
+
const item: TBaseModel = BaseModel.fromJSON(
|
|
270
|
+
data.json,
|
|
271
|
+
data.modelType,
|
|
272
|
+
) as TBaseModel;
|
|
273
|
+
|
|
274
|
+
const exportableColumns: Array<string> =
|
|
275
|
+
this.getImportExportableColumnNames(data.modelType);
|
|
276
|
+
|
|
277
|
+
for (const columnName of item.getTableColumns().columns) {
|
|
278
|
+
if (exportableColumns.includes(columnName)) {
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if ((item as any)[columnName] !== undefined) {
|
|
283
|
+
item.removeValue(columnName);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
this.normalizeImportItem(item);
|
|
288
|
+
|
|
289
|
+
return item;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/*
|
|
293
|
+
* Model-specific fixups so imported items pass server-side create
|
|
294
|
+
* validation. Currently: recurring scheduled maintenance templates are
|
|
295
|
+
* rejected on create when their first-event dates are in the past (the
|
|
296
|
+
* normal case for an export taken from an established template), so the
|
|
297
|
+
* dates are advanced by the recurrence interval until they are in the
|
|
298
|
+
* future, preserving the offsets between them.
|
|
299
|
+
*/
|
|
300
|
+
private static normalizeImportItem(item: BaseModel): void {
|
|
301
|
+
if (item.tableName !== "ScheduledMaintenanceTemplate") {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const isRecurringEvent: unknown = item.getValue("isRecurringEvent");
|
|
306
|
+
const recurringInterval: unknown = item.getValue("recurringInterval");
|
|
307
|
+
|
|
308
|
+
if (!isRecurringEvent || !recurringInterval) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const dateColumns: Array<string> = [
|
|
313
|
+
"firstEventScheduledAt",
|
|
314
|
+
"firstEventStartsAt",
|
|
315
|
+
"firstEventEndsAt",
|
|
316
|
+
];
|
|
317
|
+
|
|
318
|
+
const dates: Array<Date> = [];
|
|
319
|
+
|
|
320
|
+
for (const dateColumn of dateColumns) {
|
|
321
|
+
const value: unknown = item.getValue(dateColumn);
|
|
322
|
+
|
|
323
|
+
if (value instanceof Date) {
|
|
324
|
+
dates.push(value);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (dates.length === 0) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/*
|
|
333
|
+
* Anchor the advance on the earliest date so every date ends up in the
|
|
334
|
+
* future once shifted by the same amount.
|
|
335
|
+
*/
|
|
336
|
+
const earliestDate: Date = dates.reduce((a: Date, b: Date) => {
|
|
337
|
+
return a.getTime() <= b.getTime() ? a : b;
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
if (OneUptimeDate.isInTheFuture(earliestDate)) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const interval: Recurring =
|
|
345
|
+
recurringInterval instanceof Recurring
|
|
346
|
+
? recurringInterval
|
|
347
|
+
: Recurring.fromJSON(recurringInterval as JSONObject);
|
|
348
|
+
|
|
349
|
+
const nextEarliestDate: Date = Recurring.getNextDate(
|
|
350
|
+
earliestDate,
|
|
351
|
+
interval,
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
const advanceByMs: number =
|
|
355
|
+
nextEarliestDate.getTime() - earliestDate.getTime();
|
|
356
|
+
|
|
357
|
+
if (advanceByMs <= 0) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
for (const dateColumn of dateColumns) {
|
|
362
|
+
const value: unknown = item.getValue(dateColumn);
|
|
363
|
+
|
|
364
|
+
if (value instanceof Date) {
|
|
365
|
+
(item as any)[dateColumn] = new Date(value.getTime() + advanceByMs);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
@@ -149,3 +149,38 @@ export function keyForKubernetesCluster(
|
|
|
149
149
|
identifyingAttributes: { "k8s.cluster.name": clusterIdentifier },
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* `proxmox.cluster.name` is the cluster identity (matches the ProxmoxCluster
|
|
155
|
+
* row's `name`, the project-unique join key written by
|
|
156
|
+
* `findOrCreateByName`; the ingest resolver is name-only — see
|
|
157
|
+
* `TelemetryEntity.proxmoxClusterIdentity`). Pass `ProxmoxCluster.name`.
|
|
158
|
+
*/
|
|
159
|
+
export function keyForProxmoxCluster(
|
|
160
|
+
projectId: string,
|
|
161
|
+
clusterName: string,
|
|
162
|
+
): string {
|
|
163
|
+
return computeEntityKey({
|
|
164
|
+
projectId,
|
|
165
|
+
entityType: EntityType.ProxmoxCluster,
|
|
166
|
+
identifyingAttributes: { "proxmox.cluster.name": clusterName },
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* `ceph.cluster.name` is the cluster identity (matches the CephCluster
|
|
172
|
+
* row's `name`, the project-unique join key written by
|
|
173
|
+
* `findOrCreateByName`; the ingest resolver is name-only —
|
|
174
|
+
* `ceph.cluster.fsid` is descriptive, never identity). Pass
|
|
175
|
+
* `CephCluster.name`.
|
|
176
|
+
*/
|
|
177
|
+
export function keyForCephCluster(
|
|
178
|
+
projectId: string,
|
|
179
|
+
clusterName: string,
|
|
180
|
+
): string {
|
|
181
|
+
return computeEntityKey({
|
|
182
|
+
projectId,
|
|
183
|
+
entityType: EntityType.CephCluster,
|
|
184
|
+
identifyingAttributes: { "ceph.cluster.name": clusterName },
|
|
185
|
+
});
|
|
186
|
+
}
|
|
@@ -57,6 +57,12 @@ const RULES: Record<string, EntityRelationshipType> = {
|
|
|
57
57
|
EntityRelationshipType.MemberOf,
|
|
58
58
|
[`${EntityType.KubernetesDeployment}|${EntityType.KubernetesCluster}`]:
|
|
59
59
|
EntityRelationshipType.MemberOf,
|
|
60
|
+
[`${EntityType.ProxmoxNode}|${EntityType.ProxmoxCluster}`]:
|
|
61
|
+
EntityRelationshipType.MemberOf,
|
|
62
|
+
[`${EntityType.ProxmoxGuest}|${EntityType.ProxmoxNode}`]:
|
|
63
|
+
EntityRelationshipType.RunsOn,
|
|
64
|
+
[`${EntityType.ProxmoxGuest}|${EntityType.ProxmoxCluster}`]:
|
|
65
|
+
EntityRelationshipType.MemberOf,
|
|
60
66
|
};
|
|
61
67
|
|
|
62
68
|
/** The relationship `fromType` → `toType` implies, or null if none. */
|