@oneuptime/common 12.0.8 → 12.0.9
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/AnalyticsModels/MetricItemAggMV1mByK8sCluster.ts +1 -1
- package/Models/AnalyticsModels/MetricItemAggMV1mByService.ts +1 -1
- package/Models/DatabaseModels/AIConversation.ts +32 -0
- package/Models/DatabaseModels/AIConversationMessage.ts +41 -0
- package/Models/DatabaseModels/AlertEpisodeMember.ts +27 -0
- package/Models/DatabaseModels/IncidentEpisodeMember.ts +28 -0
- package/Models/DatabaseModels/Index.ts +12 -4
- package/Models/DatabaseModels/{TelemetryEntity.ts → InventoryItem.ts} +139 -9
- package/Models/DatabaseModels/InventoryItemCustomField.ts +434 -0
- package/Models/DatabaseModels/{TelemetryEntityRelationship.ts → InventoryItemRelationship.ts} +8 -8
- package/Models/DatabaseModels/NetworkDevice.ts +141 -0
- package/Models/DatabaseModels/NetworkDeviceLink.ts +699 -0
- package/Models/DatabaseModels/NetworkDeviceLinkRule.ts +467 -0
- package/Models/DatabaseModels/NetworkTopologySuppression.ts +429 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.ts +9 -0
- package/Models/DatabaseModels/Project.ts +78 -0
- package/Models/DatabaseModels/UserCall.ts +42 -0
- package/Models/DatabaseModels/UserEmail.ts +44 -0
- package/Models/DatabaseModels/UserNotificationRule.ts +425 -55
- package/Models/DatabaseModels/UserOnCallLogTimeline.ts +24 -2
- package/Models/DatabaseModels/UserPush.ts +49 -0
- package/Models/DatabaseModels/UserSMS.ts +43 -0
- package/Models/DatabaseModels/UserTelegram.ts +59 -0
- package/Models/DatabaseModels/UserWebhook.ts +52 -0
- package/Models/DatabaseModels/UserWhatsApp.ts +41 -0
- package/Models/DatabaseModels/WorkflowVariable.ts +12 -0
- package/Server/API/AIChatAPI.ts +315 -1
- package/Server/API/DashboardAPI.ts +217 -1
- package/Server/API/OnCallReadinessAPI.ts +841 -0
- package/Server/API/TeamComplianceAPI.ts +69 -17
- package/Server/API/TelemetryAPI.ts +220 -12
- package/Server/EnvironmentConfig.ts +52 -0
- package/Server/Infrastructure/Postgres/DataSourceOptions.ts +22 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786100000000-RestoreServiceLowerNameIndex.ts +4 -4
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786200000000-RestoreDroppedUniqueIndexes.ts +5 -5
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786625176831-AddMonitoringMethodToNetworkDevice.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786634985763-AddNetworkDeviceLink.ts +82 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786639512056-AddNetworkDeviceLinkRule.ts +91 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786639972982-AddNetworkTopologySuppression.ts +47 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786800000000-RenameTelemetryEntityToInventoryItem.ts +255 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786900000000-AddInventoryItemArchiveAndCustomFields.ts +107 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1787000000000-AddOnCallNotificationFallbackColumns.ts +90 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1787100000000-AddAIConversationPageContext.ts +39 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1787200000000-AddAIChatMessageFeedback.ts +33 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1787300000000-AddEpisodeMemberNotifyIndexes.ts +59 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +20 -0
- package/Server/Infrastructure/Queue.ts +78 -13
- package/Server/Middleware/PublicDashboardRateLimit.ts +593 -0
- package/Server/Services/AIService.ts +7 -0
- package/Server/Services/AlertEpisodeStateTimelineService.ts +29 -0
- package/Server/Services/AlertSeverityService.ts +63 -0
- package/Server/Services/DashboardService.ts +9 -10
- package/Server/Services/DatabaseService.ts +32 -2
- package/Server/Services/IncidentEpisodeStateTimelineService.ts +29 -0
- package/Server/Services/IncidentSeverityService.ts +76 -0
- package/Server/Services/Index.ts +12 -4
- package/Server/Services/InventoryItemCustomFieldService.ts +9 -0
- package/Server/Services/{TelemetryEntityRelationshipService.ts → InventoryItemRelationshipService.ts} +4 -4
- package/Server/Services/{TelemetryEntityService.ts → InventoryItemService.ts} +89 -20
- package/Server/Services/LogAggregationService.ts +45 -8
- package/Server/Services/MetricAggregationService.ts +121 -0
- package/Server/Services/MetricService.ts +7 -7
- package/Server/Services/NetworkDeviceLinkRuleService.ts +10 -0
- package/Server/Services/NetworkDeviceLinkService.ts +84 -0
- package/Server/Services/NetworkDeviceService.ts +140 -0
- package/Server/Services/NetworkSiteService.ts +77 -25
- package/Server/Services/NetworkTopologySuppressionService.ts +84 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +41 -29
- package/Server/Services/OnCallDutyPolicyExecutionLogService.ts +8 -0
- package/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.ts +62 -13
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +61 -1
- package/Server/Services/OnCallNotificationAlertingService.ts +742 -0
- package/Server/Services/OnCallReadinessService.ts +2803 -0
- package/Server/Services/OnCallSetupReminderService.ts +955 -0
- package/Server/Services/ProfileAggregationService.ts +123 -0
- package/Server/Services/StatusPageService.ts +9 -10
- package/Server/Services/TeamComplianceService.ts +429 -252
- package/Server/Services/UserCallService.ts +26 -1
- package/Server/Services/UserEmailService.ts +26 -1
- package/Server/Services/UserNotificationRuleAdminService.ts +1183 -0
- package/Server/Services/UserNotificationRuleService.ts +3812 -333
- package/Server/Services/UserOnCallLogService.ts +561 -48
- package/Server/Services/UserPushService.ts +29 -0
- package/Server/Services/UserService.ts +11 -0
- package/Server/Services/UserSmsService.ts +26 -1
- package/Server/Services/UserTelegramService.ts +24 -1
- package/Server/Services/UserWebhookService.ts +28 -1
- package/Server/Services/UserWhatsAppService.ts +24 -1
- package/Server/Types/Database/Permissions/BasePermission.ts +19 -0
- package/Server/Types/Database/Permissions/CreatePermission.ts +164 -0
- package/Server/Types/Database/Permissions/OwnerOnlyColumnPermission.ts +340 -0
- package/Server/Types/Database/Permissions/QueryPermission.ts +48 -0
- package/Server/Types/Database/Permissions/TenantPermission.ts +8 -1
- package/Server/Types/Workflow/Components/API/Delete.ts +1 -1
- package/Server/Types/Workflow/Components/API/Get.ts +1 -1
- package/Server/Types/Workflow/Components/API/Patch.ts +1 -1
- package/Server/Types/Workflow/Components/API/Post.ts +1 -1
- package/Server/Types/Workflow/Components/API/Put.ts +1 -1
- package/Server/Types/Workflow/Components/BaseModel/CreateManyBaseModel.ts +29 -5
- package/Server/Types/Workflow/Components/BaseModel/CreateOneBaseModel.ts +18 -10
- package/Server/Types/Workflow/Components/BaseModel/ModelArguments.ts +55 -0
- package/Server/Types/Workflow/Components/Conditions/IfElse.ts +3 -17
- package/Server/Types/Workflow/Components/Email.ts +25 -7
- package/Server/Types/Workflow/Components/JavaScript.ts +10 -3
- package/Server/Types/Workflow/Components/MicrosoftTeams/SendMessageToChannel.ts +1 -1
- package/Server/Utils/AI/Chat/ChatAgentRunner.ts +643 -48
- package/Server/Utils/AI/Chat/ObservabilityAssistant.ts +32 -3
- package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +20 -6
- package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +7 -0
- package/Server/Utils/AI/Toolbox/AIActionTools.ts +2 -2
- package/Server/Utils/AI/Toolbox/AIMetaTools.ts +863 -0
- package/Server/Utils/AI/Toolbox/AlertTools.ts +177 -15
- package/Server/Utils/AI/Toolbox/IncidentTools.ts +191 -10
- package/Server/Utils/AI/Toolbox/Index.ts +48 -0
- package/Server/Utils/AI/Toolbox/MonitorTools.ts +298 -11
- package/Server/Utils/AI/Toolbox/NoteWriteTools.ts +295 -0
- package/Server/Utils/AI/Toolbox/OnCallTools.ts +1246 -0
- package/Server/Utils/AI/Toolbox/RunbookTools.ts +424 -0
- package/Server/Utils/AI/Toolbox/SloTools.ts +456 -0
- package/Server/Utils/AI/Toolbox/StatusPageTools.ts +559 -0
- package/Server/Utils/AI/Toolbox/TeamTools.ts +327 -0
- package/Server/Utils/AI/Toolbox/TimelineTools.ts +615 -0
- package/Server/Utils/AI/Toolbox/WorkflowProbeTools.ts +664 -0
- package/Server/Utils/ClientIp.ts +221 -0
- package/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.ts +47 -0
- package/Server/Utils/Dashboard/PublicDashboardSloHistoryPolicy.ts +163 -0
- package/Server/Utils/Dashboard/PublicDashboardSloWidget.ts +147 -0
- package/Server/Utils/Express.ts +12 -17
- package/Server/Utils/LLM/LLMService.ts +85 -8
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +204 -10
- package/Server/Utils/SSRFProtection.ts +98 -23
- package/Server/Utils/StartServer.ts +12 -3
- package/Server/Utils/Telemetry/EntityRegistry.ts +205 -18
- package/Server/Utils/Telemetry/InventoryEntityRegistry.ts +25 -25
- package/Server/Utils/Telemetry/TelemetryEntity.ts +160 -52
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +7 -3
- package/Tests/App/Dashboard/AdminNotificationRulesPage.test.tsx +2146 -0
- package/Tests/App/Dashboard/CreateWorkflowModal.test.tsx +561 -0
- package/Tests/App/Dashboard/EscalationRuleReadiness.test.tsx +2470 -0
- package/Tests/App/Dashboard/OnCallPreventionGuards.test.tsx +1897 -0
- package/Tests/App/Dashboard/OnCallReadinessSurfaces.test.tsx +3606 -0
- package/Tests/App/Dashboard/OnCallRulesDeleteGuard.test.tsx +784 -0
- package/Tests/App/Dashboard/OnCallRulesTable.test.tsx +1119 -0
- package/Tests/App/Dashboard/SloWidgetFetching.test.tsx +531 -0
- package/Tests/App/Dashboard/UserSettingsSetupChecklistModel.test.ts +1312 -0
- package/Tests/App/Dashboard/UserSettingsSetupChecklistPage.test.tsx +1390 -0
- package/Tests/Models/InventoryItemModel.test.ts +174 -0
- package/Tests/Models/InventoryItemNaming.test.ts +302 -0
- package/Tests/Server/API/AIChatCancelAndFeedback.test.ts +437 -0
- package/Tests/Server/API/DashboardPublicRateLimit.test.ts +659 -0
- package/Tests/Server/API/DashboardPublicResourceListAPI.test.ts +18 -0
- package/Tests/Server/API/DashboardPublicSloAPI.test.ts +880 -0
- package/Tests/Server/API/Helpers.ts +24 -15
- package/Tests/Server/API/OnCallReadinessAPI.test.ts +2680 -0
- package/Tests/Server/API/OnCallSetupReminderAPI.test.ts +915 -0
- package/Tests/Server/Infrastructure/Postgres/EpisodeMemberNotifyIndexesMigration.test.ts +533 -0
- package/Tests/Server/Infrastructure/Postgres/InventoryItemArchiveMigration.test.ts +213 -0
- package/Tests/Server/Infrastructure/Postgres/RenameInventoryItemMigration.test.ts +432 -0
- package/Tests/Server/Infrastructure/Queue.test.ts +293 -0
- package/Tests/Server/Middleware/PublicDashboardRateLimit.test.ts +1645 -0
- package/Tests/Server/Services/AdminRuleEditGuards.test.ts +2848 -0
- package/Tests/Server/Services/DeliverNotificationForRuleExtraction.test.ts +1393 -0
- package/Tests/Server/Services/EpisodeRuleSeverityRepair.test.ts +1802 -0
- package/Tests/Server/Services/EpisodeStateTimelineNote.test.ts +304 -0
- package/Tests/Server/Services/InventoryItemDisplayName.test.ts +339 -0
- package/Tests/Server/Services/{TelemetryEntityManualCreate.test.ts → InventoryItemManualCreate.test.ts} +27 -27
- package/Tests/Server/Services/IpAllowlistSpoofing.test.ts +450 -0
- package/Tests/Server/Services/LogAggregationService.test.ts +235 -1
- package/Tests/Server/Services/MetricAggregationService.test.ts +231 -0
- package/Tests/Server/Services/MetricEntityMVKeyParity.test.ts +80 -29
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +30 -30
- package/Tests/Server/Services/NetworkSiteService.test.ts +18 -3
- package/Tests/Server/Services/NotificationChannelEventCoverage.test.ts +1728 -0
- package/Tests/Server/Services/NotificationDeletionImpact.test.ts +2402 -0
- package/Tests/Server/Services/OnCallDutyPolicyExecutionLogTimelineGapFeed.test.ts +394 -0
- package/Tests/Server/Services/OnCallNotificationFallback.test.ts +1744 -0
- package/Tests/Server/Services/OnCallReadinessService.test.ts +4295 -0
- package/Tests/Server/Services/OnCallSetupReminder.test.ts +1272 -0
- package/Tests/Server/Services/OnCallWeeklyReadinessDigest.test.ts +1021 -0
- package/Tests/Server/Services/ProfileAggregationService.test.ts +296 -0
- package/Tests/Server/Services/SeverityCreationRuleBackfill.test.ts +1536 -0
- package/Tests/Server/Services/SeverityRuleBackfill.test.ts +1818 -0
- package/Tests/Server/Services/TeamComplianceServiceBehaviour.test.ts +1845 -0
- package/Tests/Server/Services/UserNotificationRuleAdminGuards.test.ts +1394 -0
- package/Tests/Server/Services/UserNotificationRuleDefaultCreation.test.ts +1166 -0
- package/Tests/Server/Services/UserNotificationRuleExecuteItem.test.ts +1468 -0
- package/Tests/Server/Services/UserOnCallLogNoNotificationRules.test.ts +1457 -0
- package/Tests/Server/Types/Database/Permissions/AdminNotificationRuleAccess.test.ts +1546 -0
- package/Tests/Server/Types/Database/Permissions/CreateOwnershipScoping.test.ts +529 -0
- package/Tests/Server/Types/Database/Permissions/OwnerOnlyColumns.test.ts +1219 -0
- package/Tests/Server/Types/Database/Permissions/UserNotificationRuleScoping.test.ts +1089 -0
- package/Tests/Server/Types/Workflow/Components/ApiComponentErrorPort.test.ts +2 -1
- package/Tests/Server/Types/Workflow/Components/BaseModelDatabaseComponents.test.ts +190 -0
- package/Tests/Server/Types/Workflow/Components/ChatWebhookComponents.test.ts +44 -14
- package/Tests/Server/Types/Workflow/Components/Email.test.ts +151 -0
- package/Tests/Server/Types/Workflow/Components/IfElse.test.ts +98 -0
- package/Tests/Server/Types/Workflow/Components/JavaScript.test.ts +51 -0
- package/Tests/Server/Utils/AI/AIMetaTools.test.ts +586 -0
- package/Tests/Server/Utils/AI/AlertMonitorFilters.test.ts +582 -0
- package/Tests/Server/Utils/AI/ChatAgentRunner.test.ts +726 -0
- package/Tests/Server/Utils/AI/IncidentToolsFilters.test.ts +315 -0
- package/Tests/Server/Utils/AI/LLMServiceStopReason.test.ts +314 -0
- package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +26 -3
- package/Tests/Server/Utils/AI/NoteWriteTools.test.ts +268 -0
- package/Tests/Server/Utils/AI/ObservabilityChatPrompt.test.ts +169 -0
- package/Tests/Server/Utils/AI/OnCallTools.test.ts +664 -0
- package/Tests/Server/Utils/AI/RunbookTools.test.ts +325 -0
- package/Tests/Server/Utils/AI/SloTools.test.ts +306 -0
- package/Tests/Server/Utils/AI/StatusPageTools.test.ts +391 -0
- package/Tests/Server/Utils/AI/TeamTools.test.ts +257 -0
- package/Tests/Server/Utils/AI/TimelineTools.test.ts +472 -0
- package/Tests/Server/Utils/AI/WorkflowProbeTools.test.ts +428 -0
- package/Tests/Server/Utils/ClientIp.test.ts +438 -0
- package/Tests/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.test.ts +171 -0
- package/Tests/Server/Utils/Dashboard/PublicDashboardSloHistoryPolicy.test.ts +383 -0
- package/Tests/Server/Utils/EntityRegistryRowFence.test.ts +23 -25
- package/Tests/Server/Utils/MicrosoftTeamsWebhookUrlValidation.test.ts +6 -0
- package/Tests/Server/Utils/Monitor/Criteria/DnssecMonitorCriteria.test.ts +307 -0
- package/Tests/Server/Utils/Monitor/Criteria/SSLMonitorCriteria.test.ts +468 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorTelemetryDeepLinks.test.ts +460 -0
- package/Tests/Server/Utils/ResponseRateLimitStatusCodes.test.ts +137 -0
- package/Tests/Server/Utils/SSRFProtectionBypasses.test.ts +40 -8
- package/Tests/Server/Utils/SSRFProtectionUserInfo.test.ts +351 -0
- package/Tests/Server/Utils/Telemetry/EntityRegistryRetirement.test.ts +531 -0
- package/Tests/Server/Utils/Telemetry/InventoryEntityRegistry.test.ts +15 -15
- package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +356 -39
- package/Tests/Types/IP/IP.test.ts +263 -0
- package/Tests/Types/IP/IPWhitelist.test.ts +197 -0
- package/Tests/Types/IP/IPv6.test.ts +12 -1
- package/Tests/Types/Monitor/SnmpOid.test.ts +64 -0
- package/Tests/Types/NetworkDevice/NetworkDeviceMonitoringMethod.test.ts +110 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMergeAudit.test.ts +106 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMergeDifferential.test.ts +511 -0
- package/Tests/Types/OnCallDutyPolicy/ScheduleCoverageEndToEnd.test.ts +489 -0
- package/Tests/Types/OnCallDutyPolicy/ScheduleCoverageGapTolerance.test.ts +479 -0
- package/Tests/Types/OnCallDutyPolicy/ScheduleCoverageState.test.ts +822 -0
- package/Tests/Types/Telemetry/EntityTypeGroups.test.ts +6 -6
- package/Tests/Types/Workflow/BaseModelComponents.test.ts +429 -0
- package/Tests/Types/Workflow/Components/BaseModel.test.ts +225 -0
- package/Tests/Types/Workflow/IntegrationCredentialMetadata.test.ts +100 -0
- package/Tests/Types/Workflow/TemplateSyntax.test.ts +112 -0
- package/Tests/Types/Workflow/Templates.test.ts +916 -101
- package/Tests/UI/Components/ActiveFilterChipsOpenRoute.test.tsx +82 -0
- package/Tests/UI/Components/ComponentsModal.test.tsx +564 -7
- package/Tests/UI/Components/KeyboardShortcut.test.tsx +95 -0
- package/Tests/UI/Components/LogDetailsPanelCrossSignal.test.tsx +448 -0
- package/Tests/UI/Components/LogsTableCrossLinks.test.tsx +263 -0
- package/Tests/UI/Components/PendingProjectInvitations.test.tsx +913 -0
- package/Tests/UI/Components/SimpleLogViewer.test.tsx +228 -0
- package/Tests/UI/Components/TableRowSelectability.test.tsx +312 -0
- package/Tests/UI/Components/Workflow/GraphLint.test.ts +72 -0
- package/Tests/UI/Components/Workflow/GraphLintSummary.test.ts +755 -0
- package/Tests/UI/Components/Workflow/ModelColumnEditor.test.ts +242 -7
- package/Tests/UI/Components/Workflow/ModelColumnEditorServerContract.test.ts +15 -7
- package/Tests/UI/Components/Workflow/ModelSchema.test.ts +242 -28
- package/Tests/UI/Components/Workflow/RunStatusWatcher.test.ts +59 -1
- package/Tests/UI/Components/Workflow/StepTraceViewer.test.tsx +256 -0
- package/Tests/UI/Components/Workflow/UseRunWatch.test.tsx +665 -0
- package/Tests/UI/Components/Workflow/WorkflowIssuesModal.test.tsx +485 -0
- package/Tests/UI/Components/Workflow/WorkflowLogModal.test.tsx +478 -0
- package/Tests/UI/Components/Workflow/WorkflowStatusBar.test.tsx +379 -0
- package/Tests/UI/EsbuildConfig.test.ts +607 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +5 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +11 -4
- package/Tests/UI/Utils/ModelAPICreateMiscData.test.ts +94 -0
- package/Tests/UI/Utils/Platform.test.ts +147 -0
- package/Tests/UI/Utils/ProjectInvitationDisplay.test.ts +357 -0
- package/Tests/Utils/Monitor/NetworkDeviceLinkRuleUtil.test.ts +198 -0
- package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +487 -0
- package/Tests/Utils/Telemetry/CrossSignalScope.test.ts +698 -0
- package/Tests/__mocks__/bullmq.js +55 -0
- package/Types/AI/AIChatMessageStatus.ts +8 -1
- package/Types/AI/AIChatTypes.ts +12 -0
- package/Types/Database/AccessControl/OwnerOnlyColumn.ts +88 -0
- package/Types/Exception/ExceptionCode.ts +2 -0
- package/Types/Exception/ServiceUnavailableException.ts +8 -0
- package/Types/Exception/TooManyRequestsException.ts +8 -0
- package/Types/IP/IP.ts +93 -47
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +49 -3
- package/Types/NetworkDevice/NetworkDeviceMonitoringMethod.ts +55 -0
- package/Types/OnCallDutyPolicy/Layer.ts +203 -149
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyStatus.ts +13 -0
- package/Types/OnCallDutyPolicy/ScheduleShiftUtil.ts +155 -10
- package/Types/Permission.ts +193 -0
- package/Types/Telemetry/EntityRelationshipType.ts +1 -1
- package/Types/Telemetry/EntitySource.ts +1 -1
- package/Types/Telemetry/EntityType.ts +1 -1
- package/Types/Telemetry/EntityTypeGroups.ts +1 -1
- package/Types/Workflow/Components/BaseModel.ts +75 -29
- package/Types/Workflow/Components/Discord.ts +1 -0
- package/Types/Workflow/Components/Email.ts +12 -3
- package/Types/Workflow/Components/JavaScript.ts +7 -0
- package/Types/Workflow/Components/MicrosoftTeams.ts +3 -2
- package/Types/Workflow/Components/Slack.ts +1 -0
- package/Types/Workflow/Components/Telegram.ts +1 -0
- package/Types/Workflow/TemplateSyntax.ts +44 -0
- package/Types/Workflow/Templates.ts +2097 -45
- package/UI/Components/Calendar/Calendar.css +43 -0
- package/UI/Components/Calendar/Calendar.tsx +8 -0
- package/UI/Components/Card/Card.tsx +2 -2
- package/UI/Components/Checkbox/Checkbox.tsx +16 -0
- package/UI/Components/Dictionary/Dictionary.tsx +48 -9
- package/UI/Components/FormModal/BasicFormModal.tsx +2 -1
- package/UI/Components/Header/HeaderIconDropdownButton.tsx +53 -3
- package/UI/Components/Input/Input.tsx +1 -0
- package/UI/Components/KeyboardShortcut/KeyboardKey.ts +185 -0
- package/UI/Components/KeyboardShortcut/KeyboardShortcut.tsx +87 -0
- package/UI/Components/LogsViewer/LogsViewer.tsx +28 -0
- package/UI/Components/LogsViewer/components/ActiveFilterChips.tsx +31 -0
- package/UI/Components/LogsViewer/components/KeyboardShortcutsHelp.tsx +18 -18
- package/UI/Components/LogsViewer/components/LogDetailsPanel.tsx +363 -14
- package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +11 -0
- package/UI/Components/LogsViewer/components/LogsTable.tsx +155 -12
- package/UI/Components/LogsViewer/components/LogsViewerToolbar.tsx +29 -0
- package/UI/Components/LogsViewer/types.ts +23 -0
- package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +9 -2
- package/UI/Components/Navbar/NavBarMenuModal.tsx +15 -30
- package/UI/Components/ProjectInvitations/PendingProjectInvitations.tsx +442 -0
- package/UI/Components/SimpleLogViewer/SimpleLogViewer.tsx +23 -1
- package/UI/Components/Table/Table.tsx +49 -16
- package/UI/Components/Table/TableBody.tsx +53 -28
- package/UI/Components/Table/TableHeader.tsx +13 -0
- package/UI/Components/Table/TableRow.tsx +58 -26
- package/UI/Components/Workflow/ArgumentsForm.tsx +155 -9
- package/UI/Components/Workflow/ComponentReturnValueViewer.tsx +26 -0
- package/UI/Components/Workflow/ComponentSettingsModal.tsx +10 -1
- package/UI/Components/Workflow/ComponentValuePickerModal.tsx +135 -7
- package/UI/Components/Workflow/ComponentsModal.tsx +116 -22
- package/UI/Components/Workflow/DocumentationViewer.tsx +59 -9
- package/UI/Components/Workflow/GraphLint.ts +42 -5
- package/UI/Components/Workflow/GraphLintSummary.ts +390 -0
- package/UI/Components/Workflow/ModelColumnEditor.tsx +154 -22
- package/UI/Components/Workflow/ModelSchema.ts +115 -33
- package/UI/Components/Workflow/RunStatusWatcher.ts +1 -1
- package/UI/Components/Workflow/StepTraceViewer.tsx +1 -1
- package/UI/Components/Workflow/UseRunWatch.ts +212 -0
- package/UI/Components/Workflow/VariableModal.tsx +6 -2
- package/UI/Components/Workflow/Workflow.tsx +49 -3
- package/UI/Components/Workflow/WorkflowIssuesModal.tsx +255 -0
- package/UI/Components/Workflow/WorkflowLogModal.tsx +128 -0
- package/UI/Components/Workflow/WorkflowStatusBar.tsx +224 -0
- package/UI/Utils/AIChatExport/ConversationMarkdown.ts +10 -0
- package/UI/Utils/ModelAPI/ModelAPI.ts +7 -1
- package/UI/Utils/Platform.ts +149 -0
- package/UI/Utils/ProjectInvitationDisplay.ts +118 -0
- package/UI/esbuild-config.js +22 -1
- package/Utils/Monitor/NetworkDeviceLinkRuleUtil.ts +187 -0
- package/Utils/Monitor/NetworkTopologyUtil.ts +888 -164
- package/Utils/Telemetry/CrossSignalScope.ts +502 -0
- package/Utils/Telemetry/EntityKey.ts +5 -5
- package/Utils/Telemetry/EntityRelationship.ts +1 -1
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.js +1 -1
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByService.js +1 -1
- package/build/dist/Models/DatabaseModels/AIConversation.js +32 -0
- package/build/dist/Models/DatabaseModels/AIConversation.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AIConversationMessage.js +42 -0
- package/build/dist/Models/DatabaseModels/AIConversationMessage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertEpisodeMember.js +28 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeMember.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js +29 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +12 -4
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/{TelemetryEntity.js → InventoryItem.js} +167 -31
- package/build/dist/Models/DatabaseModels/InventoryItem.js.map +1 -0
- package/build/dist/Models/DatabaseModels/InventoryItemCustomField.js +454 -0
- package/build/dist/Models/DatabaseModels/InventoryItemCustomField.js.map +1 -0
- package/build/dist/Models/DatabaseModels/{TelemetryEntityRelationship.js → InventoryItemRelationship.js} +27 -27
- package/build/dist/Models/DatabaseModels/InventoryItemRelationship.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +141 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js +719 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLinkRule.js +475 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLinkRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkTopologySuppression.js +446 -0
- package/build/dist/Models/DatabaseModels/NetworkTopologySuppression.js.map +1 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyFeed.js +9 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +80 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserCall.js +46 -2
- package/build/dist/Models/DatabaseModels/UserCall.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserEmail.js +48 -2
- package/build/dist/Models/DatabaseModels/UserEmail.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserNotificationRule.js +424 -55
- package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +24 -2
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserPush.js +51 -1
- package/build/dist/Models/DatabaseModels/UserPush.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserSMS.js +47 -2
- package/build/dist/Models/DatabaseModels/UserSMS.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserTelegram.js +65 -3
- package/build/dist/Models/DatabaseModels/UserTelegram.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserWebhook.js +56 -2
- package/build/dist/Models/DatabaseModels/UserWebhook.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserWhatsApp.js +45 -2
- package/build/dist/Models/DatabaseModels/UserWhatsApp.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkflowVariable.js +12 -0
- package/build/dist/Models/DatabaseModels/WorkflowVariable.js.map +1 -1
- package/build/dist/Server/API/AIChatAPI.js +237 -1
- package/build/dist/Server/API/AIChatAPI.js.map +1 -1
- package/build/dist/Server/API/DashboardAPI.js +165 -13
- package/build/dist/Server/API/DashboardAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallReadinessAPI.js +599 -0
- package/build/dist/Server/API/OnCallReadinessAPI.js.map +1 -0
- package/build/dist/Server/API/TeamComplianceAPI.js +68 -9
- package/build/dist/Server/API/TeamComplianceAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js +129 -18
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +45 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/DataSourceOptions.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/DataSourceOptions.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786100000000-RestoreServiceLowerNameIndex.js +4 -4
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786625176831-AddMonitoringMethodToNetworkDevice.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786625176831-AddMonitoringMethodToNetworkDevice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786634985763-AddNetworkDeviceLink.js +39 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786634985763-AddNetworkDeviceLink.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786639512056-AddNetworkDeviceLinkRule.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786639512056-AddNetworkDeviceLinkRule.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786639972982-AddNetworkTopologySuppression.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786639972982-AddNetworkTopologySuppression.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786800000000-RenameTelemetryEntityToInventoryItem.js +150 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786800000000-RenameTelemetryEntityToInventoryItem.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786900000000-AddInventoryItemArchiveAndCustomFields.js +57 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786900000000-AddInventoryItemArchiveAndCustomFields.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787000000000-AddOnCallNotificationFallbackColumns.js +69 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787000000000-AddOnCallNotificationFallbackColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787100000000-AddAIConversationPageContext.js +32 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787100000000-AddAIConversationPageContext.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787200000000-AddAIChatMessageFeedback.js +26 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787200000000-AddAIChatMessageFeedback.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787300000000-AddEpisodeMemberNotifyIndexes.js +48 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787300000000-AddEpisodeMemberNotifyIndexes.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Queue.js +72 -13
- package/build/dist/Server/Infrastructure/Queue.js.map +1 -1
- package/build/dist/Server/Middleware/PublicDashboardRateLimit.js +399 -0
- package/build/dist/Server/Middleware/PublicDashboardRateLimit.js.map +1 -0
- package/build/dist/Server/Services/AIService.js +1 -0
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js +24 -3
- package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/AlertSeverityService.js +54 -0
- package/build/dist/Server/Services/AlertSeverityService.js.map +1 -1
- package/build/dist/Server/Services/DashboardService.js +10 -9
- package/build/dist/Server/Services/DashboardService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +24 -2
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js +24 -3
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/IncidentSeverityService.js +67 -0
- package/build/dist/Server/Services/IncidentSeverityService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +12 -4
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/InventoryItemCustomFieldService.js +9 -0
- package/build/dist/Server/Services/InventoryItemCustomFieldService.js.map +1 -0
- package/build/dist/Server/Services/{TelemetryEntityRelationshipService.js → InventoryItemRelationshipService.js} +6 -6
- package/build/dist/Server/Services/InventoryItemRelationshipService.js.map +1 -0
- package/build/dist/Server/Services/{TelemetryEntityService.js → InventoryItemService.js} +68 -23
- package/build/dist/Server/Services/InventoryItemService.js.map +1 -0
- package/build/dist/Server/Services/LogAggregationService.js +27 -8
- package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
- package/build/dist/Server/Services/MetricAggregationService.js +80 -0
- package/build/dist/Server/Services/MetricAggregationService.js.map +1 -1
- package/build/dist/Server/Services/MetricService.js +6 -6
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceLinkRuleService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceLinkRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceLinkService.js +71 -0
- package/build/dist/Server/Services/NetworkDeviceLinkService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceService.js +113 -0
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
- package/build/dist/Server/Services/NetworkSiteService.js +53 -13
- package/build/dist/Server/Services/NetworkSiteService.js.map +1 -1
- package/build/dist/Server/Services/NetworkTopologySuppressionService.js +85 -0
- package/build/dist/Server/Services/NetworkTopologySuppressionService.js.map +1 -0
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +48 -32
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js +8 -0
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js +51 -12
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +57 -13
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallNotificationAlertingService.js +548 -0
- package/build/dist/Server/Services/OnCallNotificationAlertingService.js.map +1 -0
- package/build/dist/Server/Services/OnCallReadinessService.js +1961 -0
- package/build/dist/Server/Services/OnCallReadinessService.js.map +1 -0
- package/build/dist/Server/Services/OnCallSetupReminderService.js +738 -0
- package/build/dist/Server/Services/OnCallSetupReminderService.js.map +1 -0
- package/build/dist/Server/Services/ProfileAggregationService.js +68 -4
- package/build/dist/Server/Services/ProfileAggregationService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +11 -10
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/TeamComplianceService.js +312 -160
- package/build/dist/Server/Services/TeamComplianceService.js.map +1 -1
- package/build/dist/Server/Services/UserCallService.js +24 -1
- package/build/dist/Server/Services/UserCallService.js.map +1 -1
- package/build/dist/Server/Services/UserEmailService.js +24 -1
- package/build/dist/Server/Services/UserEmailService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleAdminService.js +858 -0
- package/build/dist/Server/Services/UserNotificationRuleAdminService.js.map +1 -0
- package/build/dist/Server/Services/UserNotificationRuleService.js +2830 -175
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallLogService.js +488 -43
- package/build/dist/Server/Services/UserOnCallLogService.js.map +1 -1
- package/build/dist/Server/Services/UserPushService.js +26 -0
- package/build/dist/Server/Services/UserPushService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +10 -0
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/UserSmsService.js +24 -1
- package/build/dist/Server/Services/UserSmsService.js.map +1 -1
- package/build/dist/Server/Services/UserTelegramService.js +22 -1
- package/build/dist/Server/Services/UserTelegramService.js.map +1 -1
- package/build/dist/Server/Services/UserWebhookService.js +25 -1
- package/build/dist/Server/Services/UserWebhookService.js.map +1 -1
- package/build/dist/Server/Services/UserWhatsAppService.js +22 -1
- package/build/dist/Server/Services/UserWhatsAppService.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/BasePermission.js +12 -1
- package/build/dist/Server/Types/Database/Permissions/BasePermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/CreatePermission.js +126 -0
- package/build/dist/Server/Types/Database/Permissions/CreatePermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/OwnerOnlyColumnPermission.js +254 -0
- package/build/dist/Server/Types/Database/Permissions/OwnerOnlyColumnPermission.js.map +1 -0
- package/build/dist/Server/Types/Database/Permissions/QueryPermission.js +47 -2
- package/build/dist/Server/Types/Database/Permissions/QueryPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/TenantPermission.js +7 -0
- package/build/dist/Server/Types/Database/Permissions/TenantPermission.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Delete.js +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Delete.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Get.js +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Get.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Patch.js +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Patch.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Post.js +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Post.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Put.js +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Put.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/BaseModel/CreateManyBaseModel.js +21 -5
- package/build/dist/Server/Types/Workflow/Components/BaseModel/CreateManyBaseModel.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/BaseModel/CreateOneBaseModel.js +14 -10
- package/build/dist/Server/Types/Workflow/Components/BaseModel/CreateOneBaseModel.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/BaseModel/ModelArguments.js +31 -0
- package/build/dist/Server/Types/Workflow/Components/BaseModel/ModelArguments.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js +3 -9
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/Email.js +15 -4
- package/build/dist/Server/Types/Workflow/Components/Email.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/JavaScript.js +7 -2
- package/build/dist/Server/Types/Workflow/Components/JavaScript.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/MicrosoftTeams/SendMessageToChannel.js +1 -1
- package/build/dist/Server/Types/Workflow/Components/MicrosoftTeams/SendMessageToChannel.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +514 -56
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js +20 -3
- package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +19 -6
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +7 -0
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/AIActionTools.js +2 -2
- package/build/dist/Server/Utils/AI/Toolbox/AIActionTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/AIMetaTools.js +692 -0
- package/build/dist/Server/Utils/AI/Toolbox/AIMetaTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/AlertTools.js +148 -12
- package/build/dist/Server/Utils/AI/Toolbox/AlertTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js +157 -10
- package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +37 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/MonitorTools.js +259 -14
- package/build/dist/Server/Utils/AI/Toolbox/MonitorTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/NoteWriteTools.js +235 -0
- package/build/dist/Server/Utils/AI/Toolbox/NoteWriteTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/OnCallTools.js +1000 -0
- package/build/dist/Server/Utils/AI/Toolbox/OnCallTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/RunbookTools.js +356 -0
- package/build/dist/Server/Utils/AI/Toolbox/RunbookTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/SloTools.js +394 -0
- package/build/dist/Server/Utils/AI/Toolbox/SloTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/StatusPageTools.js +465 -0
- package/build/dist/Server/Utils/AI/Toolbox/StatusPageTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/TeamTools.js +280 -0
- package/build/dist/Server/Utils/AI/Toolbox/TeamTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/TimelineTools.js +527 -0
- package/build/dist/Server/Utils/AI/Toolbox/TimelineTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/WorkflowProbeTools.js +548 -0
- package/build/dist/Server/Utils/AI/Toolbox/WorkflowProbeTools.js.map +1 -0
- package/build/dist/Server/Utils/ClientIp.js +137 -0
- package/build/dist/Server/Utils/ClientIp.js.map +1 -0
- package/build/dist/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.js +38 -0
- package/build/dist/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.js.map +1 -1
- package/build/dist/Server/Utils/Dashboard/PublicDashboardSloHistoryPolicy.js +89 -0
- package/build/dist/Server/Utils/Dashboard/PublicDashboardSloHistoryPolicy.js.map +1 -0
- package/build/dist/Server/Utils/Dashboard/PublicDashboardSloWidget.js +77 -0
- package/build/dist/Server/Utils/Dashboard/PublicDashboardSloWidget.js.map +1 -0
- package/build/dist/Server/Utils/Express.js +12 -12
- package/build/dist/Server/Utils/Express.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +70 -7
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +121 -11
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/SSRFProtection.js +82 -21
- package/build/dist/Server/Utils/SSRFProtection.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +12 -4
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +165 -18
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js +11 -11
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +122 -47
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +7 -3
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Types/AI/AIChatMessageStatus.js +8 -1
- package/build/dist/Types/AI/AIChatMessageStatus.js.map +1 -1
- package/build/dist/Types/AI/AIChatTypes.js +12 -0
- package/build/dist/Types/AI/AIChatTypes.js.map +1 -1
- package/build/dist/Types/Database/AccessControl/OwnerOnlyColumn.js +60 -0
- package/build/dist/Types/Database/AccessControl/OwnerOnlyColumn.js.map +1 -0
- package/build/dist/Types/Exception/ExceptionCode.js +2 -0
- package/build/dist/Types/Exception/ExceptionCode.js.map +1 -1
- package/build/dist/Types/Exception/ServiceUnavailableException.js +8 -0
- package/build/dist/Types/Exception/ServiceUnavailableException.js.map +1 -0
- package/build/dist/Types/Exception/TooManyRequestsException.js +8 -0
- package/build/dist/Types/Exception/TooManyRequestsException.js.map +1 -0
- package/build/dist/Types/IP/IP.js +87 -43
- package/build/dist/Types/IP/IP.js.map +1 -1
- package/build/dist/Types/NetworkDevice/NetworkDeviceMonitoringMethod.js +50 -0
- package/build/dist/Types/NetworkDevice/NetworkDeviceMonitoringMethod.js.map +1 -0
- package/build/dist/Types/OnCallDutyPolicy/Layer.js +186 -123
- package/build/dist/Types/OnCallDutyPolicy/Layer.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/OnCallDutyPolicyStatus.js +13 -0
- package/build/dist/Types/OnCallDutyPolicy/OnCallDutyPolicyStatus.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/ScheduleShiftUtil.js +105 -11
- package/build/dist/Types/OnCallDutyPolicy/ScheduleShiftUtil.js.map +1 -1
- package/build/dist/Types/Permission.js +174 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Telemetry/EntityRelationshipType.js +1 -1
- package/build/dist/Types/Telemetry/EntitySource.js +1 -1
- package/build/dist/Types/Telemetry/EntityType.js +1 -1
- package/build/dist/Types/Telemetry/EntityTypeGroups.js +1 -1
- package/build/dist/Types/Telemetry/EntityTypeGroups.js.map +1 -1
- package/build/dist/Types/Workflow/Components/BaseModel.js +66 -28
- package/build/dist/Types/Workflow/Components/BaseModel.js.map +1 -1
- package/build/dist/Types/Workflow/Components/Discord.js +1 -0
- package/build/dist/Types/Workflow/Components/Discord.js.map +1 -1
- package/build/dist/Types/Workflow/Components/Email.js +12 -3
- package/build/dist/Types/Workflow/Components/Email.js.map +1 -1
- package/build/dist/Types/Workflow/Components/JavaScript.js +7 -0
- package/build/dist/Types/Workflow/Components/JavaScript.js.map +1 -1
- package/build/dist/Types/Workflow/Components/MicrosoftTeams.js +3 -2
- package/build/dist/Types/Workflow/Components/MicrosoftTeams.js.map +1 -1
- package/build/dist/Types/Workflow/Components/Slack.js +1 -0
- package/build/dist/Types/Workflow/Components/Slack.js.map +1 -1
- package/build/dist/Types/Workflow/Components/Telegram.js +1 -0
- package/build/dist/Types/Workflow/Components/Telegram.js.map +1 -1
- package/build/dist/Types/Workflow/TemplateSyntax.js +12 -0
- package/build/dist/Types/Workflow/TemplateSyntax.js.map +1 -1
- package/build/dist/Types/Workflow/Templates.js +1931 -38
- package/build/dist/Types/Workflow/Templates.js.map +1 -1
- package/build/dist/UI/Components/Calendar/Calendar.js +1 -1
- package/build/dist/UI/Components/Calendar/Calendar.js.map +1 -1
- package/build/dist/UI/Components/Checkbox/Checkbox.js +1 -1
- package/build/dist/UI/Components/Checkbox/Checkbox.js.map +1 -1
- package/build/dist/UI/Components/Dictionary/Dictionary.js +25 -11
- package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
- package/build/dist/UI/Components/FormModal/BasicFormModal.js.map +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +27 -4
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
- package/build/dist/UI/Components/Input/Input.js +1 -0
- package/build/dist/UI/Components/Input/Input.js.map +1 -1
- package/build/dist/UI/Components/KeyboardShortcut/KeyboardKey.js +163 -0
- package/build/dist/UI/Components/KeyboardShortcut/KeyboardKey.js.map +1 -0
- package/build/dist/UI/Components/KeyboardShortcut/KeyboardShortcut.js +47 -0
- package/build/dist/UI/Components/KeyboardShortcut/KeyboardShortcut.js.map +1 -0
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +4 -4
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/ActiveFilterChips.js +11 -1
- package/build/dist/UI/Components/LogsViewer/components/ActiveFilterChips.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/KeyboardShortcutsHelp.js +10 -8
- package/build/dist/UI/Components/LogsViewer/components/KeyboardShortcutsHelp.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js +227 -14
- package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +5 -0
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsTable.js +69 -5
- package/build/dist/UI/Components/LogsViewer/components/LogsTable.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js +8 -0
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/types.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +9 -2
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js +8 -21
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js.map +1 -1
- package/build/dist/UI/Components/ProjectInvitations/PendingProjectInvitations.js +251 -0
- package/build/dist/UI/Components/ProjectInvitations/PendingProjectInvitations.js.map +1 -0
- package/build/dist/UI/Components/SimpleLogViewer/SimpleLogViewer.js +9 -2
- package/build/dist/UI/Components/SimpleLogViewer/SimpleLogViewer.js.map +1 -1
- package/build/dist/UI/Components/Table/Table.js +27 -15
- package/build/dist/UI/Components/Table/Table.js.map +1 -1
- package/build/dist/UI/Components/Table/TableBody.js +24 -18
- package/build/dist/UI/Components/Table/TableBody.js.map +1 -1
- package/build/dist/UI/Components/Table/TableHeader.js +9 -1
- package/build/dist/UI/Components/Table/TableHeader.js.map +1 -1
- package/build/dist/UI/Components/Table/TableRow.js +29 -21
- package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ArgumentsForm.js +130 -12
- package/build/dist/UI/Components/Workflow/ArgumentsForm.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js +10 -1
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js +4 -4
- package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentValuePickerModal.js +57 -7
- package/build/dist/UI/Components/Workflow/ComponentValuePickerModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentsModal.js +53 -18
- package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/DocumentationViewer.js +19 -6
- package/build/dist/UI/Components/Workflow/DocumentationViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/GraphLint.js +33 -4
- package/build/dist/UI/Components/Workflow/GraphLint.js.map +1 -1
- package/build/dist/UI/Components/Workflow/GraphLintSummary.js +231 -0
- package/build/dist/UI/Components/Workflow/GraphLintSummary.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ModelColumnEditor.js +116 -21
- package/build/dist/UI/Components/Workflow/ModelColumnEditor.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ModelSchema.js +72 -34
- package/build/dist/UI/Components/Workflow/ModelSchema.js.map +1 -1
- package/build/dist/UI/Components/Workflow/RunStatusWatcher.js +1 -1
- package/build/dist/UI/Components/Workflow/RunStatusWatcher.js.map +1 -1
- package/build/dist/UI/Components/Workflow/StepTraceViewer.js +1 -1
- package/build/dist/UI/Components/Workflow/StepTraceViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/UseRunWatch.js +123 -0
- package/build/dist/UI/Components/Workflow/UseRunWatch.js.map +1 -0
- package/build/dist/UI/Components/Workflow/VariableModal.js +3 -2
- package/build/dist/UI/Components/Workflow/VariableModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Workflow.js +41 -1
- package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
- package/build/dist/UI/Components/Workflow/WorkflowIssuesModal.js +99 -0
- package/build/dist/UI/Components/Workflow/WorkflowIssuesModal.js.map +1 -0
- package/build/dist/UI/Components/Workflow/WorkflowLogModal.js +56 -0
- package/build/dist/UI/Components/Workflow/WorkflowLogModal.js.map +1 -0
- package/build/dist/UI/Components/Workflow/WorkflowStatusBar.js +92 -0
- package/build/dist/UI/Components/Workflow/WorkflowStatusBar.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/ConversationMarkdown.js +9 -0
- package/build/dist/UI/Utils/AIChatExport/ConversationMarkdown.js.map +1 -1
- package/build/dist/UI/Utils/ModelAPI/ModelAPI.js +1 -1
- package/build/dist/UI/Utils/ModelAPI/ModelAPI.js.map +1 -1
- package/build/dist/UI/Utils/Platform.js +118 -0
- package/build/dist/UI/Utils/Platform.js.map +1 -0
- package/build/dist/UI/Utils/ProjectInvitationDisplay.js +106 -0
- package/build/dist/UI/Utils/ProjectInvitationDisplay.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkDeviceLinkRuleUtil.js +108 -0
- package/build/dist/Utils/Monitor/NetworkDeviceLinkRuleUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +642 -136
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/Telemetry/CrossSignalScope.js +328 -0
- package/build/dist/Utils/Telemetry/CrossSignalScope.js.map +1 -0
- package/build/dist/Utils/Telemetry/EntityKey.js +5 -5
- package/build/dist/Utils/Telemetry/EntityRelationship.js +1 -1
- package/jest.config.json +1 -0
- package/package.json +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryEntity.js.map +0 -1
- package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js.map +0 -1
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js.map +0 -1
- package/build/dist/Server/Services/TelemetryEntityService.js.map +0 -1
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import API from "../../Utils/API/API";
|
|
2
|
+
import ModelAPI, { ListResult } from "../../Utils/ModelAPI/ModelAPI";
|
|
3
|
+
import ProjectInvitationDisplay from "../../Utils/ProjectInvitationDisplay";
|
|
4
|
+
import User from "../../Utils/User";
|
|
5
|
+
import Button, { ButtonSize, ButtonStyleType } from "../Button/Button";
|
|
6
|
+
import ErrorMessage from "../ErrorMessage/ErrorMessage";
|
|
7
|
+
import Icon, { SizeProp } from "../Icon/Icon";
|
|
8
|
+
import ConfirmModal from "../Modal/ConfirmModal";
|
|
9
|
+
import TeamMember from "../../../Models/DatabaseModels/TeamMember";
|
|
10
|
+
import TeamMembersByProject, {
|
|
11
|
+
UserProjectMembership,
|
|
12
|
+
} from "../../../Utils/TeamMembersByProject";
|
|
13
|
+
import SortOrder from "../../../Types/BaseDatabase/SortOrder";
|
|
14
|
+
import { LIMIT_PER_PROJECT } from "../../../Types/Database/LimitMax";
|
|
15
|
+
import OneUptimeDate from "../../../Types/Date";
|
|
16
|
+
import { PromiseVoidFunction } from "../../../Types/FunctionTypes";
|
|
17
|
+
import IconProp from "../../../Types/Icon/IconProp";
|
|
18
|
+
import ObjectID from "../../../Types/ObjectID";
|
|
19
|
+
import React, { FunctionComponent, ReactElement, useState } from "react";
|
|
20
|
+
import useAsyncEffect from "use-async-effect";
|
|
21
|
+
|
|
22
|
+
export interface ComponentProps {
|
|
23
|
+
/**
|
|
24
|
+
* Called after every membership of the accepted project has been accepted,
|
|
25
|
+
* with the project the user has just joined. The caller decides what happens
|
|
26
|
+
* next - the dashboard reloads into that project - because navigating from in
|
|
27
|
+
* here would make this component unusable anywhere but the welcome page.
|
|
28
|
+
*/
|
|
29
|
+
onInvitationAccepted?: ((projectId: ObjectID) => void) | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* How many invitations are pending, reported after every load - including the
|
|
32
|
+
* first one, including zero, and including a load that failed (as zero).
|
|
33
|
+
*
|
|
34
|
+
* This is the only signal a caller gets that the fetch has finished, and the
|
|
35
|
+
* welcome page needs it: until it knows, it cannot tell whether to offer
|
|
36
|
+
* "create your first project" or to step out of the way of an invitation.
|
|
37
|
+
* That is also why a failed load reports zero rather than staying silent - a
|
|
38
|
+
* user whose invitations cannot be read must still be offered the way
|
|
39
|
+
* forward that does not depend on them.
|
|
40
|
+
*/
|
|
41
|
+
onInvitationsLoaded?: ((invitationCount: number) => void) | undefined;
|
|
42
|
+
className?: string | undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* Every project the signed-in user has been invited to and has not accepted
|
|
47
|
+
* yet, offered for acceptance in place.
|
|
48
|
+
*
|
|
49
|
+
* The list is memberships grouped into projects, not memberships: a person
|
|
50
|
+
* invited to three teams of one project is invited to ONE project, and asking
|
|
51
|
+
* them to press Accept three times to get in reads as three separate invites
|
|
52
|
+
* from the same company. Accepting a card therefore accepts every membership
|
|
53
|
+
* behind it, and declining deletes every one of them.
|
|
54
|
+
*
|
|
55
|
+
* Nothing is rendered until the first load finishes (and nothing at all when
|
|
56
|
+
* there is nothing pending), so a page can mount this unconditionally without
|
|
57
|
+
* a loader flashing at the majority of users, who have no invitations.
|
|
58
|
+
*/
|
|
59
|
+
const PendingProjectInvitations: FunctionComponent<ComponentProps> = (
|
|
60
|
+
props: ComponentProps,
|
|
61
|
+
): ReactElement => {
|
|
62
|
+
const [invitations, setInvitations] = useState<Array<UserProjectMembership>>(
|
|
63
|
+
[],
|
|
64
|
+
);
|
|
65
|
+
const [isLoading, setIsLoading] = useState<boolean>(true);
|
|
66
|
+
const [loadError, setLoadError] = useState<string>("");
|
|
67
|
+
const [refreshToggle, setRefreshToggle] = useState<boolean>(false);
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
* The row key of the card currently mid-request, so only that card's buttons
|
|
71
|
+
* go busy. A single boolean would disable every Accept on the page while one
|
|
72
|
+
* of them is in flight.
|
|
73
|
+
*/
|
|
74
|
+
const [busyRowKey, setBusyRowKey] = useState<string>("");
|
|
75
|
+
const [actionError, setActionError] = useState<string>("");
|
|
76
|
+
const [invitationToDecline, setInvitationToDecline] =
|
|
77
|
+
useState<UserProjectMembership | null>(null);
|
|
78
|
+
|
|
79
|
+
const fetchInvitations: PromiseVoidFunction = async (): Promise<void> => {
|
|
80
|
+
setIsLoading(true);
|
|
81
|
+
setLoadError("");
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
const listResult: ListResult<TeamMember> =
|
|
85
|
+
await ModelAPI.getList<TeamMember>({
|
|
86
|
+
modelType: TeamMember,
|
|
87
|
+
query: {
|
|
88
|
+
userId: User.getUserId(),
|
|
89
|
+
hasAcceptedInvitation: false,
|
|
90
|
+
},
|
|
91
|
+
select: {
|
|
92
|
+
_id: true,
|
|
93
|
+
createdAt: true,
|
|
94
|
+
projectId: true,
|
|
95
|
+
project: {
|
|
96
|
+
_id: true,
|
|
97
|
+
name: true,
|
|
98
|
+
},
|
|
99
|
+
teamId: true,
|
|
100
|
+
team: {
|
|
101
|
+
_id: true,
|
|
102
|
+
name: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
sort: {
|
|
106
|
+
createdAt: SortOrder.Ascending,
|
|
107
|
+
},
|
|
108
|
+
limit: LIMIT_PER_PROJECT,
|
|
109
|
+
skip: 0,
|
|
110
|
+
/*
|
|
111
|
+
* A pending invitation is the one thing a user reads about a project
|
|
112
|
+
* they are not yet a member of, so it cannot be scoped to the project
|
|
113
|
+
* currently selected in the dashboard - on the welcome page there is
|
|
114
|
+
* no selected project at all.
|
|
115
|
+
*/
|
|
116
|
+
requestOptions: {
|
|
117
|
+
isMultiTenantRequest: true,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const rows: Array<UserProjectMembership> =
|
|
122
|
+
TeamMembersByProject.sortByProjectName(
|
|
123
|
+
TeamMembersByProject.groupByProject(listResult.data),
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
setInvitations(rows);
|
|
127
|
+
setIsLoading(false);
|
|
128
|
+
|
|
129
|
+
if (props.onInvitationsLoaded) {
|
|
130
|
+
props.onInvitationsLoaded(rows.length);
|
|
131
|
+
}
|
|
132
|
+
} catch (err) {
|
|
133
|
+
setInvitations([]);
|
|
134
|
+
setLoadError(API.getFriendlyMessage(err));
|
|
135
|
+
setIsLoading(false);
|
|
136
|
+
|
|
137
|
+
if (props.onInvitationsLoaded) {
|
|
138
|
+
props.onInvitationsLoaded(0);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
useAsyncEffect(async () => {
|
|
144
|
+
await fetchInvitations();
|
|
145
|
+
}, [refreshToggle]);
|
|
146
|
+
|
|
147
|
+
type InvitationActionFunction = (
|
|
148
|
+
invitation: UserProjectMembership,
|
|
149
|
+
) => Promise<void>;
|
|
150
|
+
|
|
151
|
+
const acceptInvitation: InvitationActionFunction = async (
|
|
152
|
+
invitation: UserProjectMembership,
|
|
153
|
+
): Promise<void> => {
|
|
154
|
+
setBusyRowKey(ProjectInvitationDisplay.getRowKey(invitation));
|
|
155
|
+
setActionError("");
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
/*
|
|
159
|
+
* One request per membership, in sequence. There is no bulk accept, and
|
|
160
|
+
* a card stands for at most a handful of teams; running them in sequence
|
|
161
|
+
* keeps a failure attributable to the membership that caused it.
|
|
162
|
+
*
|
|
163
|
+
* A failure part-way through leaves the user accepted into the teams
|
|
164
|
+
* already updated - which does put them in the project - so the list is
|
|
165
|
+
* reloaded below rather than left as it was, and what is still pending
|
|
166
|
+
* comes back as a smaller invitation they can accept again.
|
|
167
|
+
*/
|
|
168
|
+
for (const teamMemberId of invitation.teamMemberIds) {
|
|
169
|
+
await ModelAPI.updateById({
|
|
170
|
+
modelType: TeamMember,
|
|
171
|
+
id: new ObjectID(teamMemberId),
|
|
172
|
+
data: {
|
|
173
|
+
hasAcceptedInvitation: true,
|
|
174
|
+
invitationAcceptedAt: OneUptimeDate.getCurrentDate(),
|
|
175
|
+
},
|
|
176
|
+
requestOptions: {
|
|
177
|
+
isMultiTenantRequest: true,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (props.onInvitationAccepted && invitation.projectId) {
|
|
183
|
+
props.onInvitationAccepted(invitation.projectId);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/*
|
|
187
|
+
* The caller normally reloads the dashboard into the project it was just
|
|
188
|
+
* handed, and this never runs. It is here for the case where it does not
|
|
189
|
+
* - an invitation with no project id to hand over, or a caller that only
|
|
190
|
+
* wants to be told - so the accepted card leaves the list either way.
|
|
191
|
+
*/
|
|
192
|
+
setBusyRowKey("");
|
|
193
|
+
setRefreshToggle((toggle: boolean) => {
|
|
194
|
+
return !toggle;
|
|
195
|
+
});
|
|
196
|
+
} catch (err) {
|
|
197
|
+
setActionError(API.getFriendlyMessage(err));
|
|
198
|
+
setBusyRowKey("");
|
|
199
|
+
setRefreshToggle((toggle: boolean) => {
|
|
200
|
+
return !toggle;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const declineInvitation: InvitationActionFunction = async (
|
|
206
|
+
invitation: UserProjectMembership,
|
|
207
|
+
): Promise<void> => {
|
|
208
|
+
setBusyRowKey(ProjectInvitationDisplay.getRowKey(invitation));
|
|
209
|
+
setActionError("");
|
|
210
|
+
setInvitationToDecline(null);
|
|
211
|
+
|
|
212
|
+
try {
|
|
213
|
+
for (const teamMemberId of invitation.teamMemberIds) {
|
|
214
|
+
await ModelAPI.deleteItem({
|
|
215
|
+
modelType: TeamMember,
|
|
216
|
+
id: new ObjectID(teamMemberId),
|
|
217
|
+
requestOptions: {
|
|
218
|
+
isMultiTenantRequest: true,
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
} catch (err) {
|
|
223
|
+
setActionError(API.getFriendlyMessage(err));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
setBusyRowKey("");
|
|
227
|
+
setRefreshToggle((toggle: boolean) => {
|
|
228
|
+
return !toggle;
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
type RenderInvitationFunction = (
|
|
233
|
+
invitation: UserProjectMembership,
|
|
234
|
+
) => ReactElement;
|
|
235
|
+
|
|
236
|
+
const renderInvitation: RenderInvitationFunction = (
|
|
237
|
+
invitation: UserProjectMembership,
|
|
238
|
+
): ReactElement => {
|
|
239
|
+
const rowKey: string = ProjectInvitationDisplay.getRowKey(invitation);
|
|
240
|
+
const projectName: string =
|
|
241
|
+
ProjectInvitationDisplay.getProjectName(invitation);
|
|
242
|
+
const teamNames: Array<string> =
|
|
243
|
+
ProjectInvitationDisplay.getTeamNames(invitation);
|
|
244
|
+
const isBusy: boolean = Boolean(rowKey) && busyRowKey === rowKey;
|
|
245
|
+
|
|
246
|
+
return (
|
|
247
|
+
<li
|
|
248
|
+
key={rowKey}
|
|
249
|
+
data-testid="project-invitation"
|
|
250
|
+
className="px-5 py-4 transition-colors duration-200 hover:bg-gray-50 md:px-6"
|
|
251
|
+
>
|
|
252
|
+
<div className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
|
|
253
|
+
<div className="flex min-w-0 items-center gap-4">
|
|
254
|
+
{/* Decorative: the project name sits right next to it. */}
|
|
255
|
+
<div
|
|
256
|
+
aria-hidden="true"
|
|
257
|
+
className="flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-xl bg-indigo-600 text-sm font-semibold tracking-wide text-white shadow-sm"
|
|
258
|
+
>
|
|
259
|
+
{ProjectInvitationDisplay.getInitials(projectName)}
|
|
260
|
+
</div>
|
|
261
|
+
<div className="min-w-0">
|
|
262
|
+
<p className="truncate text-sm font-semibold text-gray-900">
|
|
263
|
+
{projectName}
|
|
264
|
+
</p>
|
|
265
|
+
{teamNames.length > 0 ? (
|
|
266
|
+
<div className="mt-1.5 flex flex-wrap items-center gap-1.5">
|
|
267
|
+
{teamNames.map((teamName: string) => {
|
|
268
|
+
return (
|
|
269
|
+
<span
|
|
270
|
+
key={teamName}
|
|
271
|
+
className="inline-flex items-center rounded-md bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-600 ring-1 ring-inset ring-gray-200"
|
|
272
|
+
>
|
|
273
|
+
{teamName}
|
|
274
|
+
</span>
|
|
275
|
+
);
|
|
276
|
+
})}
|
|
277
|
+
</div>
|
|
278
|
+
) : (
|
|
279
|
+
<p className="mt-1 text-xs text-gray-500">
|
|
280
|
+
{`You have been invited to ${ProjectInvitationDisplay.getTeamCountLabel(
|
|
281
|
+
invitation,
|
|
282
|
+
)} in this project.`}
|
|
283
|
+
</p>
|
|
284
|
+
)}
|
|
285
|
+
{invitation.joinedAt ? (
|
|
286
|
+
<p className="mt-1.5 text-xs text-gray-400">
|
|
287
|
+
{`Invited ${OneUptimeDate.fromNow(invitation.joinedAt)}`}
|
|
288
|
+
</p>
|
|
289
|
+
) : (
|
|
290
|
+
<></>
|
|
291
|
+
)}
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
<div className="flex flex-shrink-0 items-center gap-2 md:justify-end">
|
|
295
|
+
{/*
|
|
296
|
+
* NORMAL, not OUTLINE: the OUTLINE style is carried by a
|
|
297
|
+
* `btn-outline-secondary` class no stylesheet in this repo
|
|
298
|
+
* defines, so it renders as bare text - and "Decline" reading as
|
|
299
|
+
* a caption rather than a control is how somebody presses it by
|
|
300
|
+
* accident.
|
|
301
|
+
*/}
|
|
302
|
+
<Button
|
|
303
|
+
title="Decline"
|
|
304
|
+
buttonStyle={ButtonStyleType.NORMAL}
|
|
305
|
+
buttonSize={ButtonSize.Small}
|
|
306
|
+
/*
|
|
307
|
+
* Both buttons carry `w-full` below the md breakpoint, so on a
|
|
308
|
+
* phone they share the row and "Accept & Join" breaks across two
|
|
309
|
+
* lines inside its own box. They fit side by side unwrapped at
|
|
310
|
+
* 375px; this is what stops them being wrapped anyway.
|
|
311
|
+
*/
|
|
312
|
+
className="whitespace-nowrap"
|
|
313
|
+
disabled={isBusy}
|
|
314
|
+
dataTestId="decline-invitation-button"
|
|
315
|
+
ariaLabel={`Decline invitation to ${projectName}`}
|
|
316
|
+
onClick={() => {
|
|
317
|
+
setInvitationToDecline(invitation);
|
|
318
|
+
}}
|
|
319
|
+
/>
|
|
320
|
+
<Button
|
|
321
|
+
title="Accept & Join"
|
|
322
|
+
icon={IconProp.Check}
|
|
323
|
+
buttonStyle={ButtonStyleType.PRIMARY}
|
|
324
|
+
buttonSize={ButtonSize.Small}
|
|
325
|
+
className="whitespace-nowrap"
|
|
326
|
+
isLoading={isBusy}
|
|
327
|
+
disabled={isBusy}
|
|
328
|
+
dataTestId="accept-invitation-button"
|
|
329
|
+
ariaLabel={`Accept invitation to ${projectName}`}
|
|
330
|
+
onClick={() => {
|
|
331
|
+
acceptInvitation(invitation).catch(() => {
|
|
332
|
+
/*
|
|
333
|
+
* acceptInvitation reports its own failures into the card;
|
|
334
|
+
* this only stops an unhandled rejection reaching the console.
|
|
335
|
+
*/
|
|
336
|
+
});
|
|
337
|
+
}}
|
|
338
|
+
/>
|
|
339
|
+
</div>
|
|
340
|
+
</div>
|
|
341
|
+
</li>
|
|
342
|
+
);
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
/*
|
|
346
|
+
* Nothing at all until the first load lands. Most people who reach the
|
|
347
|
+
* welcome page have no invitation waiting, and a loader that resolves to an
|
|
348
|
+
* empty region is a flash of furniture they never needed.
|
|
349
|
+
*/
|
|
350
|
+
if (isLoading) {
|
|
351
|
+
return <></>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (loadError) {
|
|
355
|
+
return (
|
|
356
|
+
<div className={props.className || ""} data-testid="invitations-error">
|
|
357
|
+
<ErrorMessage
|
|
358
|
+
message={loadError}
|
|
359
|
+
onRefreshClick={() => {
|
|
360
|
+
setRefreshToggle((toggle: boolean) => {
|
|
361
|
+
return !toggle;
|
|
362
|
+
});
|
|
363
|
+
}}
|
|
364
|
+
/>
|
|
365
|
+
</div>
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (invitations.length === 0) {
|
|
370
|
+
return <></>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return (
|
|
374
|
+
<div className={props.className || ""} data-testid="pending-invitations">
|
|
375
|
+
<div className="overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm">
|
|
376
|
+
<div className="flex items-start gap-4 border-b border-gray-200 bg-gradient-to-r from-indigo-50 to-white px-5 py-5 md:px-6">
|
|
377
|
+
<div className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-indigo-600 shadow-sm">
|
|
378
|
+
<Icon
|
|
379
|
+
icon={IconProp.Email}
|
|
380
|
+
size={SizeProp.Five}
|
|
381
|
+
className="h-5 w-5 text-white"
|
|
382
|
+
/>
|
|
383
|
+
</div>
|
|
384
|
+
<div className="min-w-0">
|
|
385
|
+
<h2 className="text-lg font-semibold leading-6 text-gray-900">
|
|
386
|
+
{invitations.length === 1
|
|
387
|
+
? "You have been invited to a project"
|
|
388
|
+
: `You have been invited to ${invitations.length} projects`}
|
|
389
|
+
</h2>
|
|
390
|
+
<p className="mt-1 text-sm leading-relaxed text-gray-500">
|
|
391
|
+
Accept an invitation to join right away. There is nothing to set
|
|
392
|
+
up.
|
|
393
|
+
</p>
|
|
394
|
+
</div>
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
{actionError ? (
|
|
398
|
+
<div
|
|
399
|
+
data-testid="invitation-action-error"
|
|
400
|
+
role="alert"
|
|
401
|
+
className="border-b border-red-200 bg-red-50 px-5 py-3 text-sm text-red-700 md:px-6"
|
|
402
|
+
>
|
|
403
|
+
{actionError}
|
|
404
|
+
</div>
|
|
405
|
+
) : (
|
|
406
|
+
<></>
|
|
407
|
+
)}
|
|
408
|
+
|
|
409
|
+
<ul role="list" className="divide-y divide-gray-200">
|
|
410
|
+
{invitations.map(renderInvitation)}
|
|
411
|
+
</ul>
|
|
412
|
+
</div>
|
|
413
|
+
|
|
414
|
+
{invitationToDecline ? (
|
|
415
|
+
<ConfirmModal
|
|
416
|
+
title={`Decline invitation`}
|
|
417
|
+
description={`Are you sure you want to decline the invitation to ${ProjectInvitationDisplay.getProjectName(
|
|
418
|
+
invitationToDecline,
|
|
419
|
+
)}? You will lose access to ${ProjectInvitationDisplay.getTeamCountLabel(
|
|
420
|
+
invitationToDecline,
|
|
421
|
+
)} in this project, and will need a new invitation to join.`}
|
|
422
|
+
submitButtonText={`Decline`}
|
|
423
|
+
submitButtonType={ButtonStyleType.DANGER}
|
|
424
|
+
onSubmit={() => {
|
|
425
|
+
const invitation: UserProjectMembership = invitationToDecline;
|
|
426
|
+
|
|
427
|
+
declineInvitation(invitation).catch(() => {
|
|
428
|
+
// declineInvitation reports its own failures into the card.
|
|
429
|
+
});
|
|
430
|
+
}}
|
|
431
|
+
onClose={() => {
|
|
432
|
+
setInvitationToDecline(null);
|
|
433
|
+
}}
|
|
434
|
+
/>
|
|
435
|
+
) : (
|
|
436
|
+
<></>
|
|
437
|
+
)}
|
|
438
|
+
</div>
|
|
439
|
+
);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
export default PendingProjectInvitations;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
FunctionComponent,
|
|
3
|
+
ReactElement,
|
|
4
|
+
useEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
} from "react";
|
|
2
7
|
|
|
3
8
|
export interface ComponentProps {
|
|
4
9
|
children: ReactElement | string | Array<ReactElement>;
|
|
5
10
|
showLineNumbers?: boolean | undefined;
|
|
6
11
|
height?: string | undefined;
|
|
7
12
|
title?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Keep the newest lines in view as they arrive. For a log that is still
|
|
15
|
+
* being written — the tail is the part worth reading.
|
|
16
|
+
*/
|
|
17
|
+
autoScrollToBottom?: boolean | undefined;
|
|
8
18
|
}
|
|
9
19
|
|
|
10
20
|
const SimpleLogViewer: FunctionComponent<ComponentProps> = (
|
|
@@ -73,6 +83,17 @@ const SimpleLogViewer: FunctionComponent<ComponentProps> = (
|
|
|
73
83
|
);
|
|
74
84
|
};
|
|
75
85
|
|
|
86
|
+
const contentRef: React.RefObject<HTMLDivElement> =
|
|
87
|
+
useRef<HTMLDivElement>(null);
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!props.autoScrollToBottom || !contentRef.current) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
contentRef.current.scrollTop = contentRef.current.scrollHeight;
|
|
95
|
+
}, [props.autoScrollToBottom, props.children]);
|
|
96
|
+
|
|
76
97
|
const scrollbarStyles: React.CSSProperties = {
|
|
77
98
|
maxHeight: height,
|
|
78
99
|
scrollbarWidth: "thin",
|
|
@@ -89,6 +110,7 @@ const SimpleLogViewer: FunctionComponent<ComponentProps> = (
|
|
|
89
110
|
)}
|
|
90
111
|
{/* Log Content */}
|
|
91
112
|
<div
|
|
113
|
+
ref={contentRef}
|
|
92
114
|
className="overflow-auto font-mono text-sm leading-6 p-4 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-slate-800 [&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:hover:bg-slate-500"
|
|
93
115
|
style={scrollbarStyles}
|
|
94
116
|
>
|
|
@@ -92,6 +92,18 @@ export interface ComponentProps<T extends GenericObject> {
|
|
|
92
92
|
isBulkSelectionTruncated?: boolean | undefined;
|
|
93
93
|
bulkSelectionTotalCount?: number | undefined;
|
|
94
94
|
matchBulkSelectedItemByField?: keyof T | undefined; // which field to use to match selected items. For exmaple this could be '_id'
|
|
95
|
+
/*
|
|
96
|
+
* Which rows may be ticked. Absent means all of them, so every existing table
|
|
97
|
+
* is unaffected.
|
|
98
|
+
*
|
|
99
|
+
* Supplying it locks the rest of the selection machinery to the same rule -
|
|
100
|
+
* the header's select-all covers only the selectable rows, and "all selected"
|
|
101
|
+
* is judged against those - because a header box that can never fill, or one
|
|
102
|
+
* that fills while leaving rows unticked, is worse than no header box at all.
|
|
103
|
+
*/
|
|
104
|
+
isItemSelectable?: ((item: T) => boolean) | undefined;
|
|
105
|
+
/** Hover text for a locked row's checkbox. Says why, in the caller's words. */
|
|
106
|
+
itemNotSelectableReason?: ((item: T) => string) | undefined;
|
|
95
107
|
onBulkActionEnd?: (() => void) | undefined;
|
|
96
108
|
onBulkActionStart?: (() => void) | undefined;
|
|
97
109
|
bulkItemToString?: ((item: T) => string) | undefined;
|
|
@@ -292,29 +304,49 @@ const Table: TableFunction = <T extends GenericObject>(
|
|
|
292
304
|
}}
|
|
293
305
|
selectedItems={bulkSelectedItems}
|
|
294
306
|
matchBulkSelectedItemByField={props.matchBulkSelectedItemByField}
|
|
307
|
+
isItemSelectable={props.isItemSelectable}
|
|
308
|
+
itemNotSelectableReason={props.itemNotSelectableReason}
|
|
309
|
+
bulkItemToString={props.bulkItemToString}
|
|
295
310
|
isMobile={isMobile}
|
|
296
311
|
/>
|
|
297
312
|
);
|
|
298
313
|
};
|
|
299
314
|
|
|
300
|
-
|
|
301
|
-
|
|
315
|
+
/*
|
|
316
|
+
* The rows on this page the header checkbox is actually talking about. With no
|
|
317
|
+
* isItemSelectable this is every row, which is what it has always been.
|
|
318
|
+
*/
|
|
319
|
+
const selectableRowsOnThePage: Array<T> = props.isItemSelectable
|
|
320
|
+
? props.data.filter(props.isItemSelectable)
|
|
321
|
+
: props.data;
|
|
302
322
|
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
if (props.matchBulkSelectedItemByField === undefined) {
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
return (
|
|
309
|
-
x[props.matchBulkSelectedItemByField]?.toString() ===
|
|
310
|
-
item[props.matchBulkSelectedItemByField]?.toString()
|
|
311
|
-
);
|
|
312
|
-
});
|
|
323
|
+
const isRowSelected: (item: T) => boolean = (item: T): boolean => {
|
|
324
|
+
const matchBy: keyof T | undefined = props.matchBulkSelectedItemByField;
|
|
313
325
|
|
|
314
|
-
if (
|
|
315
|
-
|
|
326
|
+
if (matchBy === undefined) {
|
|
327
|
+
return false;
|
|
316
328
|
}
|
|
317
|
-
|
|
329
|
+
|
|
330
|
+
return bulkSelectedItems.some((selected: T) => {
|
|
331
|
+
return selected[matchBy]?.toString() === item[matchBy]?.toString();
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const selectedRowsOnThePageCount: number =
|
|
336
|
+
selectableRowsOnThePage.filter(isRowSelected).length;
|
|
337
|
+
|
|
338
|
+
/*
|
|
339
|
+
* "All selected" means all of the SELECTABLE rows, and a page with none of
|
|
340
|
+
* those does not count as fully selected - otherwise a page of entirely locked
|
|
341
|
+
* rows would render a ticked header box above nothing that is ticked.
|
|
342
|
+
*/
|
|
343
|
+
const isAllItemsOnThePageSelected: boolean =
|
|
344
|
+
selectableRowsOnThePage.length > 0 &&
|
|
345
|
+
selectedRowsOnThePageCount === selectableRowsOnThePage.length;
|
|
346
|
+
|
|
347
|
+
const isSomeItemsOnThePageSelected: boolean =
|
|
348
|
+
selectedRowsOnThePageCount > 0 &&
|
|
349
|
+
selectedRowsOnThePageCount < selectableRowsOnThePage.length;
|
|
318
350
|
|
|
319
351
|
return (
|
|
320
352
|
<div className={props.className}>
|
|
@@ -412,7 +444,8 @@ const Table: TableFunction = <T extends GenericObject>(
|
|
|
412
444
|
}
|
|
413
445
|
}}
|
|
414
446
|
isAllItemsOnThePageSelected={isAllItemsOnThePageSelected}
|
|
415
|
-
|
|
447
|
+
isSomeItemsOnThePageSelected={isSomeItemsOnThePageSelected}
|
|
448
|
+
hasTableItems={selectableRowsOnThePage.length > 0}
|
|
416
449
|
/>
|
|
417
450
|
{getTablebody()}
|
|
418
451
|
</table>
|
|
@@ -21,6 +21,15 @@ export interface ComponentProps<T extends GenericObject> {
|
|
|
21
21
|
onItemDeselected?: undefined | ((item: T) => void);
|
|
22
22
|
selectedItems: Array<T>;
|
|
23
23
|
matchBulkSelectedItemByField: keyof T | undefined; // which field to use to match selected items. For exmaple this could be '_id'
|
|
24
|
+
/*
|
|
25
|
+
* Which rows may be ticked at all. Absent means every row, so a table that
|
|
26
|
+
* does not care is unaffected. See TableRow.isItemSelectable.
|
|
27
|
+
*/
|
|
28
|
+
isItemSelectable?: ((item: T) => boolean) | undefined;
|
|
29
|
+
/** The accessible name for a row's checkbox: "Select {this}". */
|
|
30
|
+
bulkItemToString?: ((item: T) => string) | undefined;
|
|
31
|
+
/** Why a locked row is locked, in the caller's own words. */
|
|
32
|
+
itemNotSelectableReason?: ((item: T) => string) | undefined;
|
|
24
33
|
|
|
25
34
|
// responsive
|
|
26
35
|
isMobile?: boolean;
|
|
@@ -35,6 +44,48 @@ const TableBody: TableBodyFunction = <T extends GenericObject>(
|
|
|
35
44
|
): ReactElement => {
|
|
36
45
|
type GetBodyFunction = (provided?: DroppableProvided) => ReactElement;
|
|
37
46
|
|
|
47
|
+
/*
|
|
48
|
+
* Everything about ONE row's checkbox, computed once and spread into both the
|
|
49
|
+
* desktop and the mobile TableRow. The selected-ness test used to be written
|
|
50
|
+
* out twice, identically, a hundred lines apart; adding three more selection
|
|
51
|
+
* props to both copies is how that kind of duplication turns into a row that
|
|
52
|
+
* is locked at one breakpoint and not the other.
|
|
53
|
+
*/
|
|
54
|
+
type SelectionPropsFunction = (item: T) => {
|
|
55
|
+
isItemSelected: boolean;
|
|
56
|
+
isItemSelectable: boolean;
|
|
57
|
+
itemSelectLabel: string | undefined;
|
|
58
|
+
itemNotSelectableReason: string | undefined;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const getSelectionProps: SelectionPropsFunction = (item: T) => {
|
|
62
|
+
const matchBy: keyof T | undefined = props.matchBulkSelectedItemByField;
|
|
63
|
+
|
|
64
|
+
const isItemSelected: boolean = Boolean(
|
|
65
|
+
matchBy !== undefined &&
|
|
66
|
+
props.selectedItems?.some((selectedItem: T) => {
|
|
67
|
+
return (
|
|
68
|
+
selectedItem[matchBy]?.toString() === item[matchBy]?.toString()
|
|
69
|
+
);
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const label: string | undefined = props.bulkItemToString
|
|
74
|
+
? `Select ${props.bulkItemToString(item)}`
|
|
75
|
+
: undefined;
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
isItemSelected: isItemSelected,
|
|
79
|
+
isItemSelectable: props.isItemSelectable
|
|
80
|
+
? props.isItemSelectable(item)
|
|
81
|
+
: true,
|
|
82
|
+
itemSelectLabel: label,
|
|
83
|
+
itemNotSelectableReason: props.itemNotSelectableReason
|
|
84
|
+
? props.itemNotSelectableReason(item)
|
|
85
|
+
: undefined,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
38
89
|
const getBody: GetBodyFunction = (
|
|
39
90
|
provided?: DroppableProvided,
|
|
40
91
|
): ReactElement => {
|
|
@@ -54,20 +105,7 @@ const TableBody: TableBodyFunction = <T extends GenericObject>(
|
|
|
54
105
|
isBulkActionsEnabled={props.isBulkActionsEnabled}
|
|
55
106
|
onItemSelected={props.onItemSelected}
|
|
56
107
|
onItemDeselected={props.onItemDeselected}
|
|
57
|
-
|
|
58
|
-
props.selectedItems?.filter((selectedItem: T) => {
|
|
59
|
-
if (props.matchBulkSelectedItemByField === undefined) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
selectedItem[
|
|
65
|
-
props.matchBulkSelectedItemByField
|
|
66
|
-
]?.toString() ===
|
|
67
|
-
item[props.matchBulkSelectedItemByField]?.toString()
|
|
68
|
-
);
|
|
69
|
-
}).length > 0 || false
|
|
70
|
-
}
|
|
108
|
+
{...getSelectionProps(item)}
|
|
71
109
|
dragAndDropScope={props.dragAndDropScope}
|
|
72
110
|
enableDragAndDrop={props.enableDragAndDrop}
|
|
73
111
|
key={i}
|
|
@@ -100,20 +138,7 @@ const TableBody: TableBodyFunction = <T extends GenericObject>(
|
|
|
100
138
|
isBulkActionsEnabled={props.isBulkActionsEnabled}
|
|
101
139
|
onItemSelected={props.onItemSelected}
|
|
102
140
|
onItemDeselected={props.onItemDeselected}
|
|
103
|
-
|
|
104
|
-
props.selectedItems?.filter((selectedItem: T) => {
|
|
105
|
-
if (props.matchBulkSelectedItemByField === undefined) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
selectedItem[
|
|
111
|
-
props.matchBulkSelectedItemByField
|
|
112
|
-
]?.toString() ===
|
|
113
|
-
item[props.matchBulkSelectedItemByField]?.toString()
|
|
114
|
-
);
|
|
115
|
-
}).length > 0 || false
|
|
116
|
-
}
|
|
141
|
+
{...getSelectionProps(item)}
|
|
117
142
|
dragAndDropScope={props.dragAndDropScope}
|
|
118
143
|
enableDragAndDrop={props.enableDragAndDrop}
|
|
119
144
|
key={i}
|