@oneuptime/common 12.0.2 → 12.0.4
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/CephCluster.ts +14 -0
- package/Models/DatabaseModels/CodeRepository.ts +14 -6
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.ts +14 -0
- package/Models/DatabaseModels/DockerHost.ts +14 -0
- package/Models/DatabaseModels/GlobalOidcProject.ts +18 -0
- package/Models/DatabaseModels/GlobalSsoProject.ts +18 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/IoTFleet.ts +14 -0
- package/Models/DatabaseModels/KubernetesCluster.ts +14 -0
- package/Models/DatabaseModels/LogDropFilter.ts +9 -20
- package/Models/DatabaseModels/NetworkDevice.ts +14 -0
- package/Models/DatabaseModels/NetworkInterface.ts +18 -0
- package/Models/DatabaseModels/Project.ts +16 -2
- package/Models/DatabaseModels/ProxmoxCluster.ts +14 -0
- package/Models/DatabaseModels/Service.ts +30 -0
- package/Models/DatabaseModels/StatusPageMonitorRule.ts +911 -0
- package/Models/DatabaseModels/StatusPagePrivateUser.ts +30 -0
- package/Models/DatabaseModels/StatusPageResource.ts +73 -0
- package/Models/DatabaseModels/TraceDropFilter.ts +9 -20
- package/Models/DatabaseModels/User.ts +30 -0
- package/Server/API/AIAgentDataAPI.ts +31 -0
- package/Server/API/BaseAPI.ts +13 -2
- package/Server/API/DashboardAPI.ts +458 -12
- package/Server/API/GitHubAPI.ts +119 -283
- package/Server/API/UserAPI.ts +263 -1
- package/Server/EnvironmentConfig.ts +38 -4
- package/Server/Infrastructure/GlobalCache.ts +152 -0
- package/Server/Infrastructure/Postgres/DataSourceOptions.ts +16 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786005052769-AddStatusPageMonitorRule.ts +123 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786018109307-AddPerUserPasswordSalt.ts +21 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786023262402-WidenHashedStringColumnsForScrypt.ts +68 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786100000000-RestoreServiceLowerNameIndex.ts +100 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786200000000-RestoreDroppedUniqueIndexes.ts +214 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786300000000-QuarantineUnboundGitHubInstallations.ts +69 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +12 -0
- package/Server/Services/AlertStateTimelineService.ts +20 -0
- package/Server/Services/AnalyticsDatabaseService.ts +72 -1
- package/Server/Services/CephClusterService.ts +26 -86
- package/Server/Services/CloudResourceService.ts +23 -83
- package/Server/Services/CodeRepositoryService.ts +105 -2
- package/Server/Services/DatabaseService.ts +296 -2
- package/Server/Services/DockerHostService.ts +19 -79
- package/Server/Services/DockerSwarmClusterService.ts +27 -88
- package/Server/Services/HostService.ts +46 -99
- package/Server/Services/IncidentStateTimelineService.ts +20 -0
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/IoTFleetService.ts +19 -79
- package/Server/Services/KubernetesClusterService.ts +17 -78
- package/Server/Services/LabelService.ts +57 -10
- package/Server/Services/MetricTypeService.ts +84 -0
- package/Server/Services/MonitorService.ts +89 -14
- package/Server/Services/MonitorStatusTimelineService.ts +29 -0
- package/Server/Services/MonitorTemplateService.ts +65 -0
- package/Server/Services/OpenTelemetryIngestService.ts +230 -26
- package/Server/Services/PodmanHostService.ts +19 -79
- package/Server/Services/ProxmoxClusterService.ts +23 -83
- package/Server/Services/RumApplicationService.ts +19 -80
- package/Server/Services/ScheduledMaintenanceStateTimelineService.ts +21 -0
- package/Server/Services/ServerlessFunctionService.ts +24 -85
- package/Server/Services/ServiceService.ts +299 -73
- package/Server/Services/StatusPageMonitorRuleEngineService.ts +752 -0
- package/Server/Services/StatusPageMonitorRuleService.ts +471 -0
- package/Server/Services/TelemetryEntityRelationshipService.ts +1 -0
- package/Server/Services/TelemetryEntityService.ts +1 -0
- package/Server/Services/UserService.ts +184 -0
- package/Server/Utils/AI/Toolbox/CodeTools.ts +45 -4
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +13 -0
- package/Server/Utils/CodeRepository/GitHub/GitHub.ts +157 -4
- package/Server/Utils/CodeRepository/GitHub/GitHubInstallationBinding.ts +130 -0
- package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +170 -39
- package/Server/Utils/Monitor/MonitorResource.ts +63 -36
- package/Server/Utils/Monitor/MonitorStatusTimeline.ts +36 -0
- package/Server/Utils/Monitor/MonitorStepsProjectValidator.ts +148 -127
- package/Server/Utils/Monitor/MonitorStepsReferenceExtractor.ts +434 -0
- package/Server/Utils/PasswordHash.ts +306 -0
- package/Server/Utils/SingleFlight.ts +83 -0
- package/Server/Utils/StatusPage/MonitorRulePatternValidator.ts +46 -0
- package/Server/Utils/Telemetry/EntityRegistry.ts +107 -26
- package/Server/Utils/Telemetry/ResourceHeartbeat.ts +314 -0
- package/Server/Utils/Telemetry/Telemetry.ts +351 -122
- package/Tests/App/Dashboard/OverviewCustomFields.test.tsx +333 -0
- package/Tests/App/Dashboard/UserCustomFields.test.tsx +392 -0
- package/Tests/App/Dashboard/WidgetCatalog.test.ts +2 -0
- package/Tests/Models/DatabaseModels/ColumnTransformerInvariants.test.ts +306 -0
- package/Tests/Models/DatabaseModels/NumberColumnDeserialization.test.ts +333 -0
- package/Tests/Models/DatabaseModels/StatusPageMonitorRuleModel.test.ts +190 -0
- package/Tests/Server/API/AIAgentDataRepositoryToken.test.ts +381 -0
- package/Tests/Server/API/DashboardPublicAttributeValuesAPI.test.ts +943 -0
- package/Tests/Server/API/DashboardPublicMetricsAggregateAPI.test.ts +1296 -0
- package/Tests/Server/API/DashboardPublicResourceListAPI.test.ts +26 -0
- package/Tests/Server/API/DashboardPublicTemplatePayloads.test.ts +598 -0
- package/Tests/Server/API/GitHubAppInstallationBindingAPI.test.ts +539 -0
- package/Tests/Server/API/Helpers.ts +6 -1
- package/Tests/Server/API/UserProjectsAPI.test.ts +852 -0
- package/Tests/Server/Infrastructure/GlobalCache.test.ts +354 -0
- package/Tests/Server/Infrastructure/PostgresLockTimeoutOptions.test.ts +181 -0
- package/Tests/Server/Infrastructure/SemaphoreMutex.test.ts +215 -0
- package/Tests/Server/Services/AddPerUserPasswordSaltMigration.test.ts +178 -0
- package/Tests/Server/Services/AnalyticsDatabasePaginationStability.test.ts +582 -0
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +5 -0
- package/Tests/Server/Services/CodeRepositoryInstallationBinding.test.ts +305 -0
- package/Tests/Server/Services/CodeRepositoryResolutionBinding.test.ts +147 -0
- package/Tests/Server/Services/DatabaseServicePerUserPasswordSalt.test.ts +870 -0
- package/Tests/Server/Services/DatabaseServiceUpdateColumnsIfUnlocked.test.ts +342 -0
- package/Tests/Server/Services/DropFilterSaveValidation.test.ts +245 -0
- package/Tests/Server/Services/HostServiceUpdateLastSeen.test.ts +163 -15
- package/Tests/Server/Services/MetricTypeAttachServices.test.ts +222 -0
- package/Tests/Server/Services/MissingReferenceWriteGuard.test.ts +614 -0
- package/Tests/Server/Services/MonitorStatusTimelineFastPath.test.ts +23 -0
- package/Tests/Server/Services/OpenTelemetryServiceResolutionCache.test.ts +568 -0
- package/Tests/Server/Services/ResourceUpdateLastSeenLivenessFallback.test.ts +305 -56
- package/Tests/Server/Services/RestoreDroppedUniqueIndexesMigration.test.ts +386 -0
- package/Tests/Server/Services/RestoreServiceLowerNameIndexMigration.test.ts +240 -0
- package/Tests/Server/Services/ServiceUpdateLastSeenSplitGates.test.ts +705 -0
- package/Tests/Server/Services/StatusPageMonitorRuleEngineService.test.ts +1719 -0
- package/Tests/Server/Services/StatusPageMonitorRuleHooks.test.ts +1212 -0
- package/Tests/Server/Services/StatusPageMonitorRuleMonitorCreateHook.test.ts +228 -0
- package/Tests/Server/Services/UserServiceFirstMasterAdminElection.test.ts +885 -0
- package/Tests/Server/Services/WidenHashedStringColumnsForScryptMigration.test.ts +220 -0
- package/Tests/Server/Utils/AI/CodeTools.test.ts +47 -1
- package/Tests/Server/Utils/AI/CodeWriteTools.test.ts +10 -0
- package/Tests/Server/Utils/APIKey/AccessPermission.test.ts +267 -0
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +120 -0
- package/Tests/Server/Utils/CodeRepository/GitHubInstallationBinding.test.ts +292 -0
- package/Tests/Server/Utils/Database/ProjectScopedReferenceValidator.test.ts +260 -13
- package/Tests/Server/Utils/EntityRegistryRowFence.test.ts +302 -0
- package/Tests/Server/Utils/GitHubInstallationOwnershipVerification.test.ts +340 -0
- package/Tests/Server/Utils/GitHubWebhookAndTreeCacheIsolation.test.ts +250 -0
- package/Tests/Server/Utils/MetricTypeIndexConvergence.test.ts +598 -0
- package/Tests/Server/Utils/Monitor/MonitorStatusTimelineUnusableStatus.test.ts +154 -0
- package/Tests/Server/Utils/Monitor/MonitorStepsProjectValidator.test.ts +638 -92
- package/Tests/Server/Utils/Monitor/MonitorStepsReferenceExtractor.test.ts +724 -0
- package/Tests/Server/Utils/PasswordHash.test.ts +555 -0
- package/Tests/Server/Utils/SingleFlight.test.ts +221 -0
- package/Tests/Types/Dashboard/NetworkDashboardTemplate.test.ts +793 -0
- package/Tests/Types/Database/BigIntColumnTransformer.test.ts +147 -0
- package/Tests/Types/Database/ColumnLength.test.ts +7 -1
- package/Tests/Types/Database/DatabasePropertyTransformer.test.ts +140 -0
- package/Tests/Types/Database/NumericColumnValue.test.ts +127 -0
- package/Tests/Types/Decimal.test.ts +37 -0
- package/Tests/Types/HashedStringPerUserSalt.test.ts +476 -0
- package/Tests/Types/Monitor/DockerAlertTemplates.test.ts +293 -0
- package/Tests/Types/Monitor/HostAlertTemplates.test.ts +249 -0
- package/Tests/Types/Monitor/IotAlertTemplates.test.ts +320 -0
- package/Tests/Types/Monitor/PodmanAlertTemplates.test.ts +271 -0
- package/Tests/Types/Monitor/SnmpVersionParsing.test.ts +152 -0
- package/Tests/Types/Port.test.ts +38 -0
- package/Tests/UI/Components/CustomFields/CustomFieldsDetail.test.tsx +696 -0
- package/Tests/UI/Components/LogsHistogram.test.tsx +276 -0
- package/Tests/UI/Components/UseLiveLogsRefresh.test.tsx +489 -0
- package/Tests/UI/Components/UseLogsHistogram.test.tsx +500 -0
- package/Tests/UI/Utils/UserProjectsModelAPI.test.ts +714 -0
- package/Tests/Utils/Dashboard/Components/DashboardComponentsUtil.test.ts +120 -0
- package/Tests/Utils/Dashboard/DashboardNetworkMapComponent.test.ts +327 -0
- package/Tests/Utils/TeamMembersByProject.test.ts +655 -0
- package/Types/Dashboard/DashboardComponentType.ts +1 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardNetworkMapComponent.ts +40 -0
- package/Types/Dashboard/DashboardTemplates.ts +397 -0
- package/Types/Database/BigIntColumnTransformer.ts +74 -0
- package/Types/Database/ColumnLength.ts +9 -1
- package/Types/Database/DatabaseProperty.ts +26 -0
- package/Types/Database/NumericColumnValue.ts +128 -0
- package/Types/Database/TableColumn.ts +11 -0
- package/Types/Database/UnsynchronizedIndex.ts +48 -0
- package/Types/Decimal.ts +16 -4
- package/Types/HashedString.ts +139 -4
- package/Types/Permission.ts +48 -0
- package/Types/Port.ts +16 -4
- package/UI/Components/CustomFields/CustomFieldsDetail.tsx +85 -11
- package/UI/Components/LogsViewer/useLiveLogsRefresh.ts +86 -0
- package/UI/Components/LogsViewer/useLogsHistogram.ts +113 -0
- package/UI/Components/Navbar/NavBar.tsx +12 -2
- package/UI/Components/Navbar/NavBarMenuModal.tsx +19 -7
- package/UI/Utils/ModelAPI/UserProjectsModelAPI.ts +257 -0
- package/Utils/Dashboard/Components/DashboardNetworkMapComponent.ts +136 -0
- package/Utils/Dashboard/Components/Index.ts +7 -0
- package/Utils/TeamMembersByProject.ts +237 -0
- package/build/dist/Models/DatabaseModels/CephCluster.js +16 -1
- package/build/dist/Models/DatabaseModels/CephCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/CodeRepository.js +14 -6
- package/build/dist/Models/DatabaseModels/CodeRepository.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js +12 -0
- package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerHost.js +16 -1
- package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalOidcProject.js +16 -1
- package/build/dist/Models/DatabaseModels/GlobalOidcProject.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalSsoProject.js +16 -1
- package/build/dist/Models/DatabaseModels/GlobalSsoProject.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IoTFleet.js +16 -1
- package/build/dist/Models/DatabaseModels/IoTFleet.js.map +1 -1
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js +16 -1
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/LogDropFilter.js +9 -20
- package/build/dist/Models/DatabaseModels/LogDropFilter.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +16 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkInterface.js +16 -1
- package/build/dist/Models/DatabaseModels/NetworkInterface.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +16 -2
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js +16 -1
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Service.js +28 -1
- package/build/dist/Models/DatabaseModels/Service.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageMonitorRule.js +925 -0
- package/build/dist/Models/DatabaseModels/StatusPageMonitorRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/StatusPagePrivateUser.js +32 -0
- package/build/dist/Models/DatabaseModels/StatusPagePrivateUser.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageResource.js +72 -0
- package/build/dist/Models/DatabaseModels/StatusPageResource.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TraceDropFilter.js +9 -20
- package/build/dist/Models/DatabaseModels/TraceDropFilter.js.map +1 -1
- package/build/dist/Models/DatabaseModels/User.js +32 -0
- package/build/dist/Models/DatabaseModels/User.js.map +1 -1
- package/build/dist/Server/API/AIAgentDataAPI.js +21 -2
- package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -1
- package/build/dist/Server/API/BaseAPI.js +11 -1
- package/build/dist/Server/API/BaseAPI.js.map +1 -1
- package/build/dist/Server/API/DashboardAPI.js +343 -10
- package/build/dist/Server/API/DashboardAPI.js.map +1 -1
- package/build/dist/Server/API/GitHubAPI.js +94 -167
- package/build/dist/Server/API/GitHubAPI.js.map +1 -1
- package/build/dist/Server/API/UserAPI.js +187 -2
- package/build/dist/Server/API/UserAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +34 -4
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/GlobalCache.js +120 -0
- package/build/dist/Server/Infrastructure/GlobalCache.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/DataSourceOptions.js +5 -3
- package/build/dist/Server/Infrastructure/Postgres/DataSourceOptions.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786005052769-AddStatusPageMonitorRule.js +48 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786005052769-AddStatusPageMonitorRule.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786018109307-AddPerUserPasswordSalt.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786018109307-AddPerUserPasswordSalt.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786023262402-WidenHashedStringColumnsForScrypt.js +59 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786023262402-WidenHashedStringColumnsForScrypt.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786100000000-RestoreServiceLowerNameIndex.js +93 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786100000000-RestoreServiceLowerNameIndex.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786200000000-RestoreDroppedUniqueIndexes.js +101 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786200000000-RestoreDroppedUniqueIndexes.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786300000000-QuarantineUnboundGitHubInstallations.js +66 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786300000000-QuarantineUnboundGitHubInstallations.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AlertStateTimelineService.js +19 -0
- package/build/dist/Server/Services/AlertStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +57 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/CephClusterService.js +26 -76
- package/build/dist/Server/Services/CephClusterService.js.map +1 -1
- package/build/dist/Server/Services/CloudResourceService.js +23 -73
- package/build/dist/Server/Services/CloudResourceService.js.map +1 -1
- package/build/dist/Server/Services/CodeRepositoryService.js +90 -2
- package/build/dist/Server/Services/CodeRepositoryService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +246 -2
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DockerHostService.js +19 -69
- package/build/dist/Server/Services/DockerHostService.js.map +1 -1
- package/build/dist/Server/Services/DockerSwarmClusterService.js +27 -78
- package/build/dist/Server/Services/DockerSwarmClusterService.js.map +1 -1
- package/build/dist/Server/Services/HostService.js +58 -102
- package/build/dist/Server/Services/HostService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +19 -0
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/IoTFleetService.js +19 -69
- package/build/dist/Server/Services/IoTFleetService.js.map +1 -1
- package/build/dist/Server/Services/KubernetesClusterService.js +17 -68
- package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
- package/build/dist/Server/Services/LabelService.js +42 -7
- package/build/dist/Server/Services/LabelService.js.map +1 -1
- package/build/dist/Server/Services/MetricTypeService.js +74 -0
- package/build/dist/Server/Services/MetricTypeService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +81 -9
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/MonitorStatusTimelineService.js +28 -0
- package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
- package/build/dist/Server/Services/MonitorTemplateService.js +60 -0
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Services/OpenTelemetryIngestService.js +155 -25
- package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
- package/build/dist/Server/Services/PodmanHostService.js +19 -69
- package/build/dist/Server/Services/PodmanHostService.js.map +1 -1
- package/build/dist/Server/Services/ProxmoxClusterService.js +23 -73
- package/build/dist/Server/Services/ProxmoxClusterService.js.map +1 -1
- package/build/dist/Server/Services/RumApplicationService.js +19 -70
- package/build/dist/Server/Services/RumApplicationService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js +20 -0
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/ServerlessFunctionService.js +24 -75
- package/build/dist/Server/Services/ServerlessFunctionService.js.map +1 -1
- package/build/dist/Server/Services/ServiceService.js +236 -61
- package/build/dist/Server/Services/ServiceService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageMonitorRuleEngineService.js +603 -0
- package/build/dist/Server/Services/StatusPageMonitorRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/StatusPageMonitorRuleService.js +401 -0
- package/build/dist/Server/Services/StatusPageMonitorRuleService.js.map +1 -0
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js +1 -0
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryEntityService.js +1 -0
- package/build/dist/Server/Services/TelemetryEntityService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +165 -0
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/CodeTools.js +31 -1
- package/build/dist/Server/Utils/AI/Toolbox/CodeTools.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +13 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js +126 -4
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js.map +1 -1
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHubInstallationBinding.js +136 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHubInstallationBinding.js.map +1 -0
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +105 -29
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +56 -32
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js +30 -3
- package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStepsProjectValidator.js +110 -98
- package/build/dist/Server/Utils/Monitor/MonitorStepsProjectValidator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStepsReferenceExtractor.js +312 -0
- package/build/dist/Server/Utils/Monitor/MonitorStepsReferenceExtractor.js.map +1 -0
- package/build/dist/Server/Utils/PasswordHash.js +237 -0
- package/build/dist/Server/Utils/PasswordHash.js.map +1 -0
- package/build/dist/Server/Utils/SingleFlight.js +76 -0
- package/build/dist/Server/Utils/SingleFlight.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/MonitorRulePatternValidator.js +29 -0
- package/build/dist/Server/Utils/StatusPage/MonitorRulePatternValidator.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +78 -19
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ResourceHeartbeat.js +160 -0
- package/build/dist/Server/Utils/Telemetry/ResourceHeartbeat.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/Telemetry.js +279 -104
- package/build/dist/Server/Utils/Telemetry/Telemetry.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponentType.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardNetworkMapComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardNetworkMapComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js +368 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/Database/BigIntColumnTransformer.js +66 -0
- package/build/dist/Types/Database/BigIntColumnTransformer.js.map +1 -0
- package/build/dist/Types/Database/ColumnLength.js +9 -1
- package/build/dist/Types/Database/ColumnLength.js.map +1 -1
- package/build/dist/Types/Database/DatabaseProperty.js +25 -0
- package/build/dist/Types/Database/DatabaseProperty.js.map +1 -1
- package/build/dist/Types/Database/NumericColumnValue.js +97 -0
- package/build/dist/Types/Database/NumericColumnValue.js.map +1 -0
- package/build/dist/Types/Database/TableColumn.js.map +1 -1
- package/build/dist/Types/Database/UnsynchronizedIndex.js +46 -0
- package/build/dist/Types/Database/UnsynchronizedIndex.js.map +1 -0
- package/build/dist/Types/Decimal.js +14 -3
- package/build/dist/Types/Decimal.js.map +1 -1
- package/build/dist/Types/HashedString.js +95 -5
- package/build/dist/Types/HashedString.js.map +1 -1
- package/build/dist/Types/Permission.js +42 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Port.js +15 -5
- package/build/dist/Types/Port.js.map +1 -1
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js +51 -10
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/useLiveLogsRefresh.js +44 -0
- package/build/dist/UI/Components/LogsViewer/useLiveLogsRefresh.js.map +1 -0
- package/build/dist/UI/Components/LogsViewer/useLogsHistogram.js +75 -0
- package/build/dist/UI/Components/LogsViewer/useLogsHistogram.js.map +1 -0
- package/build/dist/UI/Components/Navbar/NavBar.js +3 -1
- package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js +19 -7
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js.map +1 -1
- package/build/dist/UI/Utils/ModelAPI/UserProjectsModelAPI.js +156 -0
- package/build/dist/UI/Utils/ModelAPI/UserProjectsModelAPI.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardNetworkMapComponent.js +114 -0
- package/build/dist/Utils/Dashboard/Components/DashboardNetworkMapComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/Index.js +4 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/build/dist/Utils/TeamMembersByProject.js +145 -0
- package/build/dist/Utils/TeamMembersByProject.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { describe, expect, test } from "@jest/globals";
|
|
2
|
+
import DashboardComponentsUtil from "../../../../Utils/Dashboard/Components/Index";
|
|
3
|
+
import DashboardComponentType from "../../../../Types/Dashboard/DashboardComponentType";
|
|
4
|
+
import {
|
|
5
|
+
ComponentArgument,
|
|
6
|
+
ComponentInputType,
|
|
7
|
+
} from "../../../../Types/Dashboard/DashboardComponents/ComponentArgument";
|
|
8
|
+
import DashboardBaseComponent from "../../../../Types/Dashboard/DashboardComponents/DashboardBaseComponent";
|
|
9
|
+
import BadDataException from "../../../../Types/Exception/BadDataException";
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* DashboardComponentsUtil.getComponentSettingsArguments is the single dispatch
|
|
13
|
+
* from a widget's type to the config-form fields the dashboard editor renders
|
|
14
|
+
* for it. It is a long if/else chain that ends in `throw BadDataException`, so
|
|
15
|
+
* the failure mode it invites is a real one: add a widget to the
|
|
16
|
+
* DashboardComponentType enum, ship the component util, and forget the branch
|
|
17
|
+
* here — every attempt to configure that widget then throws at runtime with no
|
|
18
|
+
* compiler warning, because the chain has no exhaustiveness check.
|
|
19
|
+
*
|
|
20
|
+
* This suite is that missing exhaustiveness check. It also validates the shape
|
|
21
|
+
* of what every branch returns, so a malformed argument list (a duplicate id
|
|
22
|
+
* that silently drops a form field, an empty label) fails here instead of in
|
|
23
|
+
* the editor.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const ALL_TYPES: Array<DashboardComponentType> = Object.values(
|
|
27
|
+
DashboardComponentType,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const VALID_INPUT_TYPES: Set<string> = new Set<string>(
|
|
31
|
+
Object.values(ComponentInputType),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
describe("DashboardComponentsUtil.getComponentSettingsArguments", () => {
|
|
35
|
+
// Sanity: the enum is non-trivial, so an empty loop can't vacuously pass.
|
|
36
|
+
test("there is more than one dashboard component type to cover", () => {
|
|
37
|
+
expect(ALL_TYPES.length).toBeGreaterThan(1);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test.each(ALL_TYPES)(
|
|
41
|
+
"%s is wired into the dispatcher and returns an argument array",
|
|
42
|
+
(type: DashboardComponentType) => {
|
|
43
|
+
// The whole point: no enum member may fall through to BadDataException.
|
|
44
|
+
const args: Array<ComponentArgument<DashboardBaseComponent>> =
|
|
45
|
+
DashboardComponentsUtil.getComponentSettingsArguments(type);
|
|
46
|
+
expect(Array.isArray(args)).toBe(true);
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
test.each(ALL_TYPES)(
|
|
51
|
+
"every config argument for %s is well-formed",
|
|
52
|
+
(type: DashboardComponentType) => {
|
|
53
|
+
const args: Array<ComponentArgument<DashboardBaseComponent>> =
|
|
54
|
+
DashboardComponentsUtil.getComponentSettingsArguments(type);
|
|
55
|
+
|
|
56
|
+
for (const arg of args) {
|
|
57
|
+
// A blank label renders an unlabeled form field.
|
|
58
|
+
expect(typeof arg.name).toBe("string");
|
|
59
|
+
expect(arg.name.length).toBeGreaterThan(0);
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
* id is the key the entered value is stored under; empty means the
|
|
63
|
+
* value has nowhere to go.
|
|
64
|
+
*/
|
|
65
|
+
expect(typeof arg.id).toBe("string");
|
|
66
|
+
expect(String(arg.id).length).toBeGreaterThan(0);
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* required drives validation; it must be an actual boolean, not
|
|
70
|
+
* undefined coerced as falsy.
|
|
71
|
+
*/
|
|
72
|
+
expect(typeof arg.required).toBe("boolean");
|
|
73
|
+
|
|
74
|
+
// An unknown input type renders no editor at all.
|
|
75
|
+
expect(VALID_INPUT_TYPES.has(arg.type)).toBe(true);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
test.each(ALL_TYPES)(
|
|
81
|
+
"%s has no duplicate argument ids",
|
|
82
|
+
(type: DashboardComponentType) => {
|
|
83
|
+
const args: Array<ComponentArgument<DashboardBaseComponent>> =
|
|
84
|
+
DashboardComponentsUtil.getComponentSettingsArguments(type);
|
|
85
|
+
|
|
86
|
+
const ids: Array<string> = args.map(
|
|
87
|
+
(a: ComponentArgument<DashboardBaseComponent>) => {
|
|
88
|
+
return String(a.id);
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
// A duplicate id means the second field overwrites the first's value.
|
|
92
|
+
expect(new Set<string>(ids).size).toBe(ids.length);
|
|
93
|
+
},
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
test("an unknown component type is rejected with BadDataException", () => {
|
|
97
|
+
expect(() => {
|
|
98
|
+
return DashboardComponentsUtil.getComponentSettingsArguments(
|
|
99
|
+
"NotARealComponentType" as DashboardComponentType,
|
|
100
|
+
);
|
|
101
|
+
}).toThrow(BadDataException);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test("calling twice returns equivalent, independent argument arrays", () => {
|
|
105
|
+
/*
|
|
106
|
+
* The editor may request the arguments repeatedly; each call must yield a
|
|
107
|
+
* fresh array so mutating one rendering cannot corrupt the next.
|
|
108
|
+
*/
|
|
109
|
+
const first: Array<ComponentArgument<DashboardBaseComponent>> =
|
|
110
|
+
DashboardComponentsUtil.getComponentSettingsArguments(
|
|
111
|
+
DashboardComponentType.Text,
|
|
112
|
+
);
|
|
113
|
+
const second: Array<ComponentArgument<DashboardBaseComponent>> =
|
|
114
|
+
DashboardComponentsUtil.getComponentSettingsArguments(
|
|
115
|
+
DashboardComponentType.Text,
|
|
116
|
+
);
|
|
117
|
+
expect(second).toEqual(first);
|
|
118
|
+
expect(second).not.toBe(first);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ComponentArgument,
|
|
3
|
+
ComponentArgumentSection,
|
|
4
|
+
ComponentInputType,
|
|
5
|
+
EntityFilterModelType,
|
|
6
|
+
} from "../../../Types/Dashboard/DashboardComponents/ComponentArgument";
|
|
7
|
+
import DashboardBaseComponent from "../../../Types/Dashboard/DashboardComponents/DashboardBaseComponent";
|
|
8
|
+
import DashboardNetworkMapComponent from "../../../Types/Dashboard/DashboardComponents/DashboardNetworkMapComponent";
|
|
9
|
+
import DashboardComponentType from "../../../Types/Dashboard/DashboardComponentType";
|
|
10
|
+
import { ObjectType } from "../../../Types/JSON";
|
|
11
|
+
import { DropdownOption } from "../../../UI/Components/Dropdown/Dropdown";
|
|
12
|
+
import DashboardComponentsUtil from "../../../Utils/Dashboard/Components/Index";
|
|
13
|
+
import DashboardNetworkMapComponentUtil, {
|
|
14
|
+
DEFAULT_MAX_SITES,
|
|
15
|
+
} from "../../../Utils/Dashboard/Components/DashboardNetworkMapComponent";
|
|
16
|
+
|
|
17
|
+
type ArgumentIds = keyof DashboardNetworkMapComponent["arguments"];
|
|
18
|
+
|
|
19
|
+
function getArguments(): Array<
|
|
20
|
+
ComponentArgument<DashboardNetworkMapComponent>
|
|
21
|
+
> {
|
|
22
|
+
return DashboardNetworkMapComponentUtil.getComponentConfigArguments();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getArgumentById(
|
|
26
|
+
id: ArgumentIds,
|
|
27
|
+
): ComponentArgument<DashboardNetworkMapComponent> {
|
|
28
|
+
const found: ComponentArgument<DashboardNetworkMapComponent> | undefined =
|
|
29
|
+
getArguments().find(
|
|
30
|
+
(arg: ComponentArgument<DashboardNetworkMapComponent>) => {
|
|
31
|
+
return arg.id === id;
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (!found) {
|
|
36
|
+
throw new Error(`No Network Map widget argument declared with id "${id}"`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return found;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getDropdownValues(id: ArgumentIds): Array<string> {
|
|
43
|
+
return (getArgumentById(id).dropdownOptions || []).map(
|
|
44
|
+
(option: DropdownOption): string => {
|
|
45
|
+
return String(option.value);
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
describe("DashboardNetworkMapComponentUtil", () => {
|
|
51
|
+
describe("getDefaultComponent", () => {
|
|
52
|
+
it("declares its componentType as NetworkMap so the renderer dispatch matches", () => {
|
|
53
|
+
expect(
|
|
54
|
+
DashboardNetworkMapComponentUtil.getDefaultComponent().componentType,
|
|
55
|
+
).toBe(DashboardComponentType.NetworkMap);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("marks itself as a dashboard component so it survives config serialization", () => {
|
|
59
|
+
expect(DashboardNetworkMapComponentUtil.getDefaultComponent()._type).toBe(
|
|
60
|
+
ObjectType.DashboardComponent,
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("places a 6x5 tile at the canvas origin", () => {
|
|
65
|
+
const component: DashboardNetworkMapComponent =
|
|
66
|
+
DashboardNetworkMapComponentUtil.getDefaultComponent();
|
|
67
|
+
|
|
68
|
+
expect(component.widthInDashboardUnits).toBe(6);
|
|
69
|
+
expect(component.heightInDashboardUnits).toBe(5);
|
|
70
|
+
expect(component.topInDashboardUnits).toBe(0);
|
|
71
|
+
expect(component.leftInDashboardUnits).toBe(0);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* The world is roughly 2:1, so a tile that is allowed to be short and
|
|
76
|
+
* wide letterboxes the map into an unreadable strip. The minimum has to
|
|
77
|
+
* bound BOTH axes, and the default has to sit at or above it — a widget
|
|
78
|
+
* that spawns below its own minimum is one the resize handles then
|
|
79
|
+
* refuse to shrink.
|
|
80
|
+
*/
|
|
81
|
+
it("cannot be resized below a square-ish 4x4, and spawns at or above that", () => {
|
|
82
|
+
const component: DashboardNetworkMapComponent =
|
|
83
|
+
DashboardNetworkMapComponentUtil.getDefaultComponent();
|
|
84
|
+
|
|
85
|
+
expect(component.minWidthInDashboardUnits).toBe(4);
|
|
86
|
+
expect(component.minHeightInDashboardUnits).toBe(4);
|
|
87
|
+
expect(component.widthInDashboardUnits).toBeGreaterThanOrEqual(
|
|
88
|
+
component.minWidthInDashboardUnits,
|
|
89
|
+
);
|
|
90
|
+
expect(component.heightInDashboardUnits).toBeGreaterThanOrEqual(
|
|
91
|
+
component.minHeightInDashboardUnits,
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("fits inside the 12-unit dashboard grid", () => {
|
|
96
|
+
const component: DashboardNetworkMapComponent =
|
|
97
|
+
DashboardNetworkMapComponentUtil.getDefaultComponent();
|
|
98
|
+
|
|
99
|
+
expect(
|
|
100
|
+
component.leftInDashboardUnits + component.widthInDashboardUnits,
|
|
101
|
+
).toBeLessThanOrEqual(12);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("opens on the map rather than the list, with names on and the row cap seeded", () => {
|
|
105
|
+
const component: DashboardNetworkMapComponent =
|
|
106
|
+
DashboardNetworkMapComponentUtil.getDefaultComponent();
|
|
107
|
+
|
|
108
|
+
expect(component.arguments.viewMode).toBe("map");
|
|
109
|
+
expect(component.arguments.showLabels).toBe(true);
|
|
110
|
+
expect(component.arguments.maxSites).toBe(DEFAULT_MAX_SITES);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("seeds no filters, so a freshly added widget shows the whole estate", () => {
|
|
114
|
+
const component: DashboardNetworkMapComponent =
|
|
115
|
+
DashboardNetworkMapComponentUtil.getDefaultComponent();
|
|
116
|
+
|
|
117
|
+
expect(component.arguments.statusFilter).toBeUndefined();
|
|
118
|
+
expect(component.arguments.networkSiteTypeIds).toBeUndefined();
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
/*
|
|
122
|
+
* Two widgets dropped on the same dashboard must not share an id — the
|
|
123
|
+
* canvas keys, selects and persists components by it.
|
|
124
|
+
*/
|
|
125
|
+
it("generates a fresh component id on every call", () => {
|
|
126
|
+
const first: DashboardNetworkMapComponent =
|
|
127
|
+
DashboardNetworkMapComponentUtil.getDefaultComponent();
|
|
128
|
+
const second: DashboardNetworkMapComponent =
|
|
129
|
+
DashboardNetworkMapComponentUtil.getDefaultComponent();
|
|
130
|
+
|
|
131
|
+
expect(first.componentId.toString()).not.toBe(
|
|
132
|
+
second.componentId.toString(),
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("caps the fetch at a bounded number of sites", () => {
|
|
137
|
+
expect(DEFAULT_MAX_SITES).toBeGreaterThan(0);
|
|
138
|
+
expect(Number.isInteger(DEFAULT_MAX_SITES)).toBe(true);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe("getComponentConfigArguments", () => {
|
|
143
|
+
it("declares exactly the arguments the widget reads", () => {
|
|
144
|
+
const ids: Array<unknown> = getArguments().map(
|
|
145
|
+
(arg: ComponentArgument<DashboardNetworkMapComponent>) => {
|
|
146
|
+
return arg.id;
|
|
147
|
+
},
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
expect(ids).toEqual([
|
|
151
|
+
"title",
|
|
152
|
+
"viewMode",
|
|
153
|
+
"maxSites",
|
|
154
|
+
"showLabels",
|
|
155
|
+
"networkSiteTypeIds",
|
|
156
|
+
"statusFilter",
|
|
157
|
+
]);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("declares no duplicate argument ids", () => {
|
|
161
|
+
const ids: Array<unknown> = getArguments().map(
|
|
162
|
+
(arg: ComponentArgument<DashboardNetworkMapComponent>) => {
|
|
163
|
+
return arg.id;
|
|
164
|
+
},
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
expect(new Set(ids).size).toBe(ids.length);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it("gives every argument a name, a description and no required flag", () => {
|
|
171
|
+
for (const arg of getArguments()) {
|
|
172
|
+
expect(arg.name.trim().length).toBeGreaterThan(0);
|
|
173
|
+
expect(arg.description.trim().length).toBeGreaterThan(0);
|
|
174
|
+
/*
|
|
175
|
+
* Every argument has a working default, so none of them may be
|
|
176
|
+
* required — a required field with a default is a form the user
|
|
177
|
+
* cannot submit without re-entering what is already true.
|
|
178
|
+
*/
|
|
179
|
+
expect(arg.required).toBe(false);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("types each argument as the input the settings form should render", () => {
|
|
184
|
+
expect(getArgumentById("title").type).toBe(ComponentInputType.Text);
|
|
185
|
+
expect(getArgumentById("viewMode").type).toBe(
|
|
186
|
+
ComponentInputType.Dropdown,
|
|
187
|
+
);
|
|
188
|
+
expect(getArgumentById("maxSites").type).toBe(ComponentInputType.Number);
|
|
189
|
+
expect(getArgumentById("showLabels").type).toBe(
|
|
190
|
+
ComponentInputType.Boolean,
|
|
191
|
+
);
|
|
192
|
+
expect(getArgumentById("networkSiteTypeIds").type).toBe(
|
|
193
|
+
ComponentInputType.EntityMultiSelectDropdown,
|
|
194
|
+
);
|
|
195
|
+
expect(getArgumentById("statusFilter").type).toBe(
|
|
196
|
+
ComponentInputType.Dropdown,
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
/*
|
|
201
|
+
* The site-type picker has to name a model the EntityFilterDropdown
|
|
202
|
+
* switch knows about, or it throws when the settings modal opens.
|
|
203
|
+
*/
|
|
204
|
+
it("binds the site-type picker to the NetworkSiteType lookup table", () => {
|
|
205
|
+
expect(getArgumentById("networkSiteTypeIds").entityFilterModelType).toBe(
|
|
206
|
+
EntityFilterModelType.NetworkSiteType,
|
|
207
|
+
);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("gives only the entity picker an entityFilterModelType", () => {
|
|
211
|
+
for (const arg of getArguments()) {
|
|
212
|
+
if (arg.id === "networkSiteTypeIds") {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
expect(arg.entityFilterModelType).toBeUndefined();
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it("offers exactly the two view modes the renderer implements", () => {
|
|
220
|
+
expect(getDropdownValues("viewMode")).toEqual(["map", "list"]);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
/*
|
|
224
|
+
* The empty option is what lets somebody UNDO a status filter. Without
|
|
225
|
+
* it the only way back to "all sites" is to delete the widget.
|
|
226
|
+
*/
|
|
227
|
+
it("offers an empty status option so the filter can be cleared", () => {
|
|
228
|
+
expect(getDropdownValues("statusFilter")).toEqual([
|
|
229
|
+
"",
|
|
230
|
+
"down",
|
|
231
|
+
"operational",
|
|
232
|
+
]);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it("gives every dropdown option a non-empty label", () => {
|
|
236
|
+
for (const arg of getArguments()) {
|
|
237
|
+
for (const option of arg.dropdownOptions || []) {
|
|
238
|
+
expect(String(option.label).trim().length).toBeGreaterThan(0);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it("splits the arguments into a Display section and a collapsed Filters section", () => {
|
|
244
|
+
const sectionOf: (
|
|
245
|
+
id: ArgumentIds,
|
|
246
|
+
) => ComponentArgumentSection | undefined = (
|
|
247
|
+
id: ArgumentIds,
|
|
248
|
+
): ComponentArgumentSection | undefined => {
|
|
249
|
+
return getArgumentById(id).section;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
for (const id of [
|
|
253
|
+
"title",
|
|
254
|
+
"viewMode",
|
|
255
|
+
"maxSites",
|
|
256
|
+
"showLabels",
|
|
257
|
+
] as Array<ArgumentIds>) {
|
|
258
|
+
expect(sectionOf(id)?.name).toBe("Display Options");
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
for (const id of [
|
|
262
|
+
"networkSiteTypeIds",
|
|
263
|
+
"statusFilter",
|
|
264
|
+
] as Array<ArgumentIds>) {
|
|
265
|
+
expect(sectionOf(id)?.name).toBe("Filters");
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
expect(sectionOf("title")?.order).toBeLessThan(
|
|
269
|
+
sectionOf("statusFilter")?.order as number,
|
|
270
|
+
);
|
|
271
|
+
expect(sectionOf("statusFilter")?.defaultCollapsed).toBe(true);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it("returns a fresh array each call so a caller cannot mutate the declaration", () => {
|
|
275
|
+
const first: Array<ComponentArgument<DashboardNetworkMapComponent>> =
|
|
276
|
+
getArguments();
|
|
277
|
+
first.pop();
|
|
278
|
+
|
|
279
|
+
expect(getArguments()).toHaveLength(6);
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
/*
|
|
284
|
+
* These go through the registry's public lookup rather than the util
|
|
285
|
+
* directly, so forgetting to wire DashboardComponentType.NetworkMap into
|
|
286
|
+
* Common/Utils/Dashboard/Components/Index.ts fails the suite. Nothing else
|
|
287
|
+
* in the codebase asserts that registry is exhaustive.
|
|
288
|
+
*/
|
|
289
|
+
describe("registration in DashboardComponentsUtil", () => {
|
|
290
|
+
it("resolves DashboardComponentType.NetworkMap instead of throwing", () => {
|
|
291
|
+
expect(() => {
|
|
292
|
+
return DashboardComponentsUtil.getComponentSettingsArguments(
|
|
293
|
+
DashboardComponentType.NetworkMap,
|
|
294
|
+
);
|
|
295
|
+
}).not.toThrow();
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it("returns the Network Map widget's own arguments for that type", () => {
|
|
299
|
+
const fromRegistry: Array<ComponentArgument<DashboardBaseComponent>> =
|
|
300
|
+
DashboardComponentsUtil.getComponentSettingsArguments(
|
|
301
|
+
DashboardComponentType.NetworkMap,
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
expect(
|
|
305
|
+
fromRegistry.map(
|
|
306
|
+
(arg: ComponentArgument<DashboardBaseComponent>): unknown => {
|
|
307
|
+
return arg.id;
|
|
308
|
+
},
|
|
309
|
+
),
|
|
310
|
+
).toEqual(
|
|
311
|
+
getArguments().map(
|
|
312
|
+
(arg: ComponentArgument<DashboardNetworkMapComponent>): unknown => {
|
|
313
|
+
return arg.id;
|
|
314
|
+
},
|
|
315
|
+
),
|
|
316
|
+
);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
it("still throws for a component type that is not registered", () => {
|
|
320
|
+
expect(() => {
|
|
321
|
+
return DashboardComponentsUtil.getComponentSettingsArguments(
|
|
322
|
+
"NotARealWidget" as DashboardComponentType,
|
|
323
|
+
);
|
|
324
|
+
}).toThrow();
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
});
|