@oneuptime/common 12.0.9 → 12.0.11
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/NetworkDevice.ts +44 -0
- package/Models/DatabaseModels/NetworkDeviceLink.ts +116 -0
- package/Models/DatabaseModels/RunnerJob.ts +17 -2
- package/Server/API/LlmProviderAPI.ts +8 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.ts +52 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +240 -0
- package/Server/Services/NetworkDeviceLinkService.ts +338 -2
- package/Server/Services/NetworkDeviceService.ts +265 -12
- package/Server/Services/RunnerJobService.ts +24 -1
- package/Server/Types/Billing/MeteredPlan/AllMeteredPlans.ts +19 -5
- package/Server/Types/Database/JSONColumnQuery.ts +42 -4
- package/Server/Utils/LLM/LLMService.ts +108 -19
- package/Server/Utils/Monitor/MonitorAlert.ts +22 -115
- package/Server/Utils/Monitor/MonitorIncident.ts +7 -337
- package/Server/Utils/Monitor/MonitorMaintenanceSuppression.ts +27 -2
- package/Server/Utils/Monitor/SeriesResourceLabels.ts +32 -0
- package/Server/Utils/Monitor/SeriesResourceLinker.ts +469 -0
- package/Server/Utils/SSRFProtection.ts +5 -4
- package/Server/Utils/Telemetry/InventoryEntityRegistry.ts +186 -38
- package/Tests/App/AdminDashboard/AdminUsersBulkAddToProject.test.tsx +955 -0
- package/Tests/App/AdminDashboard/BulkAddUsersToProject.test.ts +778 -0
- package/Tests/App/AdminDashboard/BulkAddUsersToProjectModal.test.tsx +1051 -0
- package/Tests/App/Dashboard/AdminNotificationRulesPage.test.tsx +420 -112
- package/Tests/App/Dashboard/OnCallReadinessSurfaces.test.tsx +81 -6
- package/Tests/App/Dashboard/PayAsYouGoConsentGate.test.tsx +543 -0
- package/Tests/App/Dashboard/PayAsYouGoFreePlan.test.ts +125 -0
- package/Tests/App/Dashboard/PayAsYouGoNotices.test.tsx +612 -0
- package/Tests/App/Dashboard/SloWidgetChartRendering.test.tsx +536 -0
- package/Tests/App/Dashboard/UserElementEmail.test.tsx +447 -0
- package/Tests/App/Dashboard/UserEmailCallSites.test.tsx +284 -0
- package/Tests/Models/AnalyticsModels/CommonModel.test.ts +312 -0
- package/Tests/Server/Infrastructure/Postgres/DeviceRoleAndDeclaredLinkParentMigration.test.ts +250 -0
- package/Tests/Server/Infrastructure/Postgres/EpisodeMemberNotifyIndexesMigration.test.ts +46 -18
- package/Tests/Server/Services/NetworkDeviceLabelRuleRun.test.ts +618 -0
- package/Tests/Server/Services/NetworkDeviceLinkParentValidation.test.ts +1043 -0
- package/Tests/Server/Services/NetworkSiteAssignmentRuleRun.test.ts +706 -0
- package/Tests/Server/Services/RunnerJobEnqueue.test.ts +412 -0
- package/Tests/Server/Types/Billing/PayAsYouGoMeteredPricing.test.ts +125 -0
- package/Tests/Server/Types/Database/JSONColumnQuery.test.ts +508 -0
- package/Tests/Server/Utils/AI/LLMServiceRequestPolicy.test.ts +2 -2
- package/Tests/Server/Utils/AI/LLMServiceRetryPolicy.test.ts +450 -0
- package/Tests/Server/Utils/Monitor/MonitorAlertResourceLinking.test.ts +556 -0
- package/Tests/Server/Utils/Monitor/MonitorIncidentResourceLinking.test.ts +547 -0
- package/Tests/Server/Utils/Monitor/MonitorMaintenanceSuppression.test.ts +30 -0
- package/Tests/Server/Utils/Monitor/SeriesResourceLinker.test.ts +699 -0
- package/Tests/Server/Utils/SeriesResourceLabels.test.ts +55 -0
- package/Tests/Server/Utils/Telemetry/InventoryEntityRegistry.test.ts +668 -0
- package/Tests/Types/API/URLMalformedTolerance.test.ts +301 -0
- package/Tests/Types/API/URLTelScheme.test.ts +261 -0
- package/Tests/Types/API/URLUnsupportedScheme.test.ts +148 -0
- package/Tests/Types/Billing/PayAsYouGoPricing.test.ts +64 -0
- package/Tests/Types/CustomField/CustomFieldTypeCorrespondence.test.ts +107 -0
- package/Tests/Types/Monitor/MonitorType.test.ts +62 -0
- package/Tests/Types/NetworkAutomation/RuleRunResult.test.ts +184 -0
- package/Tests/Types/Runbook/RunbookStepType.test.ts +124 -0
- package/Tests/Types/Workflow/BaseModelComponents.test.ts +17 -0
- package/Tests/UI/Components/Button.test.tsx +279 -0
- package/Tests/UI/Components/Charts/ChartXAxisDataKey.test.tsx +256 -0
- package/Tests/UI/Components/Charts/DataPointUtil.test.ts +323 -0
- package/Tests/UI/Components/DictionaryValuePlaceholderAndSuggestions.test.tsx +595 -0
- package/Tests/UI/Components/Icon.test.tsx +57 -0
- package/Tests/UI/Components/List.test.tsx +20 -3
- package/Tests/UI/Components/LogsSavedViewsDropdown.test.tsx +304 -0
- package/Tests/UI/Components/LogsViewerClearSavedView.test.tsx +179 -0
- package/Tests/UI/Components/ModelTable/CustomFieldColumns.test.tsx +349 -1
- package/Tests/UI/Components/Pagination.test.tsx +721 -146
- package/Tests/UI/Components/PaginationIntegration.test.tsx +386 -0
- package/Tests/UI/Components/PaginationUtil.test.ts +417 -0
- package/Tests/UI/Components/TelemetrySavedViewsDropdown.test.tsx +343 -0
- package/Tests/UI/Components/Workflow/ColumnEditor/ColumnControl.test.ts +289 -0
- package/Tests/UI/Components/Workflow/ColumnEditor/ColumnOperators.test.ts +271 -0
- package/Tests/UI/Components/Workflow/ColumnEditor/ColumnRow.test.ts +119 -0
- package/Tests/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.test.ts +968 -0
- package/Tests/UI/Components/Workflow/ModelColumnEditor.render.test.tsx +766 -0
- package/Tests/UI/Utils/RunNetworkRule.test.ts +320 -0
- package/Tests/Utils/APIRetryPolicy.test.ts +823 -0
- package/Tests/Utils/Monitor/NetworkDeviceRoleUtil.test.ts +502 -0
- package/Tests/Utils/Monitor/NetworkTopologyDeclaredHierarchy.test.ts +759 -0
- package/Tests/Utils/NetworkAutomation/RuleRunSummary.test.ts +286 -0
- package/Tests/Utils/Schema/BaseSchema.test.ts +651 -0
- package/Types/API/Protocol.ts +9 -0
- package/Types/API/URL.ts +286 -20
- package/Types/Billing/PayAsYouGoPricing.ts +47 -0
- package/Types/CustomField/CustomFieldType.ts +28 -0
- package/Types/Monitor/MonitorType.ts +11 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +13 -0
- package/Types/NetworkAutomation/RuleRunResult.ts +121 -0
- package/Types/Runbook/RunbookStepType.ts +23 -0
- package/UI/Components/AutocompleteTextInput/AutocompleteTextInput.tsx +7 -0
- package/UI/Components/Button/Button.tsx +14 -22
- package/UI/Components/Charts/Area/AreaChart.tsx +4 -2
- package/UI/Components/Charts/Bar/BarChart.tsx +4 -2
- package/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.ts +13 -0
- package/UI/Components/Charts/Line/LineChart.tsx +4 -2
- package/UI/Components/Charts/Types/XAxis/XAxis.ts +6 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +15 -12
- package/UI/Components/Dictionary/Dictionary.tsx +4 -39
- package/UI/Components/Icon/Icon.tsx +1 -1
- package/UI/Components/LogsViewer/LogsViewer.tsx +5 -1
- package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +8 -0
- package/UI/Components/LogsViewer/components/LogsPagination.tsx +29 -91
- package/UI/Components/LogsViewer/components/LogsViewerToolbar.tsx +2 -0
- package/UI/Components/LogsViewer/components/SavedViewsDropdown.tsx +66 -1
- package/UI/Components/ModelTable/CustomFieldColumns.tsx +55 -0
- package/UI/Components/Pagination/Pagination.tsx +373 -328
- package/UI/Components/Pagination/PaginationUtil.ts +263 -0
- package/UI/Components/Pagination/Screenshots/README.md +15 -0
- package/UI/Components/Pagination/Screenshots/pagination-before-after.png +0 -0
- package/UI/Components/Pagination/Screenshots/pagination-go-to-page-modal.png +0 -0
- package/UI/Components/Pagination/Screenshots/pagination-long-list.png +0 -0
- package/UI/Components/Pagination/Screenshots/pagination-mobile.png +0 -0
- package/UI/Components/Pagination/Screenshots/pagination-telemetry.png +0 -0
- package/UI/Components/TelemetryViewer/components/SavedViewsDropdown.tsx +66 -1
- package/UI/Components/TelemetryViewer/components/TelemetryPagination.tsx +38 -92
- package/UI/Components/TextArea/TextArea.tsx +3 -0
- package/UI/Components/Workflow/ArgumentsForm.tsx +18 -1
- package/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.tsx +177 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.tsx +243 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnControl.ts +255 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.tsx +178 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnOperators.ts +206 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnRow.ts +157 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.ts +517 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnValueInput.tsx +482 -0
- package/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.tsx +131 -0
- package/UI/Components/Workflow/ColumnEditor/ModelRecordForm.tsx +163 -0
- package/UI/Components/Workflow/ModelColumnEditor.tsx +284 -100
- package/UI/Utils/NetworkAutomation/RunNetworkRule.ts +122 -0
- package/Utils/API.ts +243 -36
- package/Utils/Monitor/NetworkDeviceRoleUtil.ts +45 -0
- package/Utils/Monitor/NetworkTopologyUtil.ts +42 -2
- package/Utils/NetworkAutomation/RuleRunSummary.ts +147 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +45 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js +115 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RunnerJob.js +17 -2
- package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
- package/build/dist/Server/API/LlmProviderAPI.js +9 -1
- package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.js +33 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +202 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceLinkService.js +253 -1
- package/build/dist/Server/Services/NetworkDeviceLinkService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceService.js +223 -12
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
- package/build/dist/Server/Services/RunnerJobService.js +20 -2
- package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
- package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js +12 -5
- package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js.map +1 -1
- package/build/dist/Server/Types/Database/JSONColumnQuery.js +40 -4
- package/build/dist/Server/Types/Database/JSONColumnQuery.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +78 -22
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +22 -98
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +7 -254
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js +14 -2
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +27 -0
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js +285 -0
- package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js.map +1 -0
- package/build/dist/Server/Utils/SSRFProtection.js +5 -4
- package/build/dist/Server/Utils/SSRFProtection.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js +128 -35
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js.map +1 -1
- package/build/dist/Types/API/Protocol.js +9 -0
- package/build/dist/Types/API/Protocol.js.map +1 -1
- package/build/dist/Types/API/URL.js +241 -18
- package/build/dist/Types/API/URL.js.map +1 -1
- package/build/dist/Types/Billing/PayAsYouGoPricing.js +41 -0
- package/build/dist/Types/Billing/PayAsYouGoPricing.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldType.js +26 -0
- package/build/dist/Types/CustomField/CustomFieldType.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +10 -0
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js +39 -0
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js.map +1 -0
- package/build/dist/Types/Runbook/RunbookStepType.js +21 -0
- package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
- package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js +1 -1
- package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js.map +1 -1
- package/build/dist/UI/Components/Button/Button.js +10 -16
- package/build/dist/UI/Components/Button/Button.js.map +1 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +2 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +2 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js +12 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js +2 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +17 -10
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
- package/build/dist/UI/Components/Dictionary/Dictionary.js +4 -18
- package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +1 -1
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +3 -3
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +5 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsPagination.js +14 -44
- package/build/dist/UI/Components/LogsViewer/components/LogsPagination.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js +20 -2
- package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js +42 -0
- package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js.map +1 -1
- package/build/dist/UI/Components/Pagination/Pagination.js +174 -199
- package/build/dist/UI/Components/Pagination/Pagination.js.map +1 -1
- package/build/dist/UI/Components/Pagination/PaginationUtil.js +160 -0
- package/build/dist/UI/Components/Pagination/PaginationUtil.js.map +1 -0
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js +20 -2
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryPagination.js +23 -47
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryPagination.js.map +1 -1
- package/build/dist/UI/Components/TextArea/TextArea.js +1 -1
- package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ArgumentsForm.js +14 -2
- package/build/dist/UI/Components/Workflow/ArgumentsForm.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.js +86 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.js +119 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnControl.js +206 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnControl.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.js +57 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnOperators.js +150 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnOperators.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRow.js +67 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRow.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.js +309 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnValueInput.js +204 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnValueInput.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js +66 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelRecordForm.js +83 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelRecordForm.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ModelColumnEditor.js +187 -68
- package/build/dist/UI/Components/Workflow/ModelColumnEditor.js.map +1 -1
- package/build/dist/UI/Utils/NetworkAutomation/RunNetworkRule.js +75 -0
- package/build/dist/UI/Utils/NetworkAutomation/RunNetworkRule.js.map +1 -0
- package/build/dist/Utils/API.js +175 -34
- package/build/dist/Utils/API.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js +37 -0
- package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +25 -3
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/NetworkAutomation/RuleRunSummary.js +78 -0
- package/build/dist/Utils/NetworkAutomation/RuleRunSummary.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogsViewerToolbar.js","sourceRoot":"","sources":["../../../../../../UI/Components/LogsViewer/components/LogsViewerToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAC/D,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAS5C,OAAO,wBAAwB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"LogsViewerToolbar.js","sourceRoot":"","sources":["../../../../../../UI/Components/LogsViewer/components/LogsViewerToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAC/D,OAAO,cAAc,MAAM,kBAAkB,CAAC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EACrB,cAAc,EAAC,OAAO,EACtB,CAAC,EAAC,4BAA4B,GAC9B,CACE,CACC;gBACR,YAAY,IAAI,CACf,6BAAK,SAAS,EAAC,2FAA2F;oBACvG,KAAK,CAAC,WAAW,IAAI,CACpB,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,6FAA6F,EACvG,OAAO,EAAE,GAAG,EAAE;4BACZ,eAAe,CAAC,KAAK,CAAC,CAAC;4BACvB,KAAK,CAAC,WAAY,EAAE,CAAC;wBACvB,CAAC,oBAGM,CACV;oBACA,KAAK,CAAC,YAAY,IAAI,CACrB,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,6FAA6F,EACvG,OAAO,EAAE,GAAG,EAAE;4BACZ,eAAe,CAAC,KAAK,CAAC,CAAC;4BACvB,KAAK,CAAC,YAAa,EAAE,CAAC;wBACxB,CAAC,qBAGM,CACV,CACG,CACP,CACG,CACP;YAEA,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAC7C,oBAAC,kBAAkB,IACjB,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,QAAQ,EAAE,KAAK,CAAC,iBAAiB,GACjC,CACH;YAEA,KAAK,CAAC,WAAW,IAAI,oBAAC,cAAc,oBAAK,KAAK,CAAC,WAAW,EAAI,CAC3D,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -6,6 +6,16 @@ const SavedViewsDropdown = (props) => {
|
|
|
6
6
|
const selectedView = props.savedViews.find((view) => {
|
|
7
7
|
return view.id === props.selectedSavedViewId;
|
|
8
8
|
});
|
|
9
|
+
/*
|
|
10
|
+
* Clearing is only offered once a view is actually applied — an inert
|
|
11
|
+
* "Clear view" row sitting above an unfiltered explorer says nothing.
|
|
12
|
+
*/
|
|
13
|
+
const canClear = Boolean(props.onClear && selectedView);
|
|
14
|
+
const clearSelection = () => {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = props.onClear) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
17
|
+
setIsComponentVisible(false);
|
|
18
|
+
};
|
|
9
19
|
return (React.createElement("div", { className: "relative", ref: ref },
|
|
10
20
|
React.createElement("button", { type: "button", className: triggerButtonClassName, onClick: () => {
|
|
11
21
|
setIsComponentVisible(!isComponentVisible);
|
|
@@ -13,16 +23,24 @@ const SavedViewsDropdown = (props) => {
|
|
|
13
23
|
React.createElement("span", { className: "max-w-40 truncate" }, (selectedView === null || selectedView === void 0 ? void 0 : selectedView.name) || "Saved Views"),
|
|
14
24
|
React.createElement("span", { className: "text-xs text-gray-400" }, props.savedViews.length.toLocaleString())),
|
|
15
25
|
isComponentVisible && (React.createElement("div", { className: "absolute left-0 z-20 mt-2 w-72 rounded-lg border border-gray-200 bg-white shadow-xl" },
|
|
26
|
+
canClear && (React.createElement("div", { className: "border-b border-gray-100 py-1" },
|
|
27
|
+
React.createElement("button", { type: "button", className: "flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-gray-50", onClick: clearSelection },
|
|
28
|
+
React.createElement("span", { className: "w-4 shrink-0 text-center text-xs text-gray-400", "aria-hidden": "true" }, "\u2715"),
|
|
29
|
+
React.createElement("span", { className: "truncate text-sm text-gray-600" }, "Clear view")))),
|
|
16
30
|
React.createElement("div", { className: "max-h-72 overflow-y-auto py-1" },
|
|
17
31
|
props.savedViews.length === 0 && (React.createElement("div", { className: "px-3 py-6 text-center text-xs text-gray-400" }, "No saved views yet.")),
|
|
18
32
|
props.savedViews.map((view) => {
|
|
19
33
|
const isSelected = view.id === props.selectedSavedViewId;
|
|
20
34
|
return (React.createElement("div", { key: view.id, className: `group flex items-center justify-between gap-2 px-3 py-1.5 ${isSelected ? "bg-indigo-50" : "hover:bg-gray-50"}` },
|
|
21
|
-
React.createElement("button", { type: "button", className: "flex min-w-0 flex-1 items-center gap-2 text-left", onClick: () => {
|
|
35
|
+
React.createElement("button", { type: "button", className: "flex min-w-0 flex-1 items-center gap-2 text-left", "aria-label": view.isDefault ? `${view.name} (default)` : view.name, "aria-pressed": isSelected, onClick: () => {
|
|
36
|
+
if (isSelected && props.onClear) {
|
|
37
|
+
clearSelection();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
22
40
|
props.onSelect(view.id);
|
|
23
41
|
setIsComponentVisible(false);
|
|
24
42
|
} },
|
|
25
|
-
React.createElement("span", { className: "w-4 shrink-0 text-center text-xs" }, isSelected ? (React.createElement("span", { className: "text-indigo-600" }, "\u2713")) : ("")),
|
|
43
|
+
React.createElement("span", { className: "w-4 shrink-0 text-center text-xs", "aria-hidden": "true" }, isSelected ? (React.createElement("span", { className: "text-indigo-600" }, "\u2713")) : ("")),
|
|
26
44
|
React.createElement("span", { className: `truncate text-sm ${isSelected
|
|
27
45
|
? "font-medium text-indigo-700"
|
|
28
46
|
: "text-gray-700"}` }, view.name),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SavedViewsDropdown.js","sourceRoot":"","sources":["../../../../../../UI/Components/LogsViewer/components/SavedViewsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAE/D,OAAO,wBAAwB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"SavedViewsDropdown.js","sourceRoot":"","sources":["../../../../../../UI/Components/LogsViewer/components/SavedViewsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAE/D,OAAO,wBAAwB,MAAM,yCAAyC,CAAC;AAmB/E,MAAM,sBAAsB,GAC1B,gMAAgM,CAAC;AAEnM,MAAM,kBAAkB,GAA+C,CACrE,KAA8B,EAChB,EAAE;IAChB,MAAM,EAAE,GAAG,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,GACtD,wBAAwB,CAAC,KAAK,CAAC,CAAC;IAElC,MAAM,YAAY,GAAoC,KAAK,CAAC,UAAU,CAAC,IAAI,CACzE,CAAC,IAAyB,EAAE,EAAE;QAC5B,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ropdown/DropdownValueBadge";
|
|
3
3
|
import CustomFieldType from "../../../Types/CustomField/CustomFieldType";
|
|
4
|
+
import OneUptimeDate from "../../../Types/Date";
|
|
4
5
|
import { parseCustomFieldDropdownOptions, } from "../../../Types/CustomField/CustomFieldDropdownOption";
|
|
5
6
|
import React from "react";
|
|
6
7
|
export const CustomFieldsColumnKey = "customFields";
|
|
@@ -78,6 +79,47 @@ export const renderCustomFieldValue = (data) => {
|
|
|
78
79
|
? "inline-flex items-center px-2 py-1 rounded-md bg-green-50 text-green-700 text-xs font-medium ring-1 ring-inset ring-green-600/20"
|
|
79
80
|
: "inline-flex items-center px-2 py-1 rounded-md bg-gray-50 text-gray-600 text-xs font-medium ring-1 ring-inset ring-gray-500/10" }, isTrue ? "Yes" : "No"));
|
|
80
81
|
}
|
|
82
|
+
if (definition.customFieldType === CustomFieldType.Date ||
|
|
83
|
+
definition.customFieldType === CustomFieldType.DateTime) {
|
|
84
|
+
/*
|
|
85
|
+
* Stored as ISO-8601 (the shared date Input normalises every entry through
|
|
86
|
+
* OneUptimeDate.toString()), which is unreadable in a cell, so it is shown
|
|
87
|
+
* in the viewer's own timezone — the same rendering Detail gives a date
|
|
88
|
+
* field, so the list and the item page agree.
|
|
89
|
+
*/
|
|
90
|
+
const isDateOnly = definition.customFieldType === CustomFieldType.Date;
|
|
91
|
+
const raw = String(value);
|
|
92
|
+
/*
|
|
93
|
+
* Validity is decided here rather than by inspecting what the formatter
|
|
94
|
+
* returned, because the formatter never reports failure: OneUptimeDate
|
|
95
|
+
* .fromString swallows moment's parse error and falls back to `new
|
|
96
|
+
* Date(str)`, so junk becomes an Invalid Date and moment renders it as the
|
|
97
|
+
* literal, truthy string "Invalid date" (and "Invalid date UTC" for the
|
|
98
|
+
* DateTime variant). A `formatted || raw` fallback therefore never fires.
|
|
99
|
+
*
|
|
100
|
+
* Showing the raw text instead matters because the value is not
|
|
101
|
+
* necessarily one this UI wrote — a project can PUT anything into the
|
|
102
|
+
* `customFields` bag over the API, and may well have been storing dates as
|
|
103
|
+
* free text before this field became a date. "Invalid date" hides which
|
|
104
|
+
* value is wrong; the value itself is the thing that lets someone fix it.
|
|
105
|
+
*/
|
|
106
|
+
let parsed = null;
|
|
107
|
+
try {
|
|
108
|
+
parsed = OneUptimeDate.fromString(raw);
|
|
109
|
+
}
|
|
110
|
+
catch (_b) {
|
|
111
|
+
parsed = null;
|
|
112
|
+
}
|
|
113
|
+
if (!parsed || isNaN(parsed.getTime())) {
|
|
114
|
+
return React.createElement("span", null, raw);
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
return (React.createElement("span", null, OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(parsed, isDateOnly)));
|
|
118
|
+
}
|
|
119
|
+
catch (_c) {
|
|
120
|
+
return React.createElement("span", null, raw);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
81
123
|
if (definition.customFieldType === CustomFieldType.MultiSelectDropdown) {
|
|
82
124
|
/*
|
|
83
125
|
* Tolerant on the way out: an older single-select value that was later
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomFieldColumns.js","sourceRoot":"","sources":["../../../../../UI/Components/ModelTable/CustomFieldColumns.tsx"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,kBAAkB,MAAM,gCAAgC,CAAC;AAGhE,OAAO,eAAe,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomFieldColumns.js","sourceRoot":"","sources":["../../../../../UI/Components/ModelTable/CustomFieldColumns.tsx"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,kBAAkB,MAAM,gCAAgC,CAAC;AAGhE,OAAO,eAAe,MAAM,4CAA4C,CAAC;AACzE,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAEL,+BAA+B,GAChC,MAAM,sDAAsD,CAAC;AAE9D,OAAO,KAAuB,MAAM,OAAO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E,QAAQ;YAC3B,cAAc,EAAE,CAAC,IAAgB,EAAU,EAAE;gBAC3C,MAAM,KAAK,GAAY,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;gBAElE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBAC1C,OAAO,EAAE,CAAC;gBACZ,CAAC;gBAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC1B,CAAC;gBAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;oBAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBAC/B,CAAC;gBAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;YACD,UAAU,EAAE,CAAC,IAAgB,EAAgB,EAAE;gBAC7C,OAAO,sBAAsB,CAAC;oBAC5B,KAAK,EAAE,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC;oBACjD,UAAU,EAAE,UAAU;iBACvB,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,216 +1,191 @@
|
|
|
1
|
-
import
|
|
2
|
-
import BasicFormModal from "../FormModal/BasicFormModal";
|
|
3
|
-
import FormFieldSchemaType from "../Forms/Types/FormFieldSchemaType";
|
|
1
|
+
import Icon from "../Icon/Icon";
|
|
4
2
|
import IconProp from "../../../Types/Icon/IconProp";
|
|
5
|
-
import
|
|
3
|
+
import Modal from "../Modal/Modal";
|
|
4
|
+
import PaginationUtil, { DefaultItemsOnPageOptions, } from "./PaginationUtil";
|
|
5
|
+
import React, { useEffect, useId, useState, } from "react";
|
|
6
6
|
const Pagination = (props) => {
|
|
7
|
+
/*
|
|
8
|
+
* Has-more mode: the count is a lower bound, so there is no last page to
|
|
9
|
+
* link to and no "of N" to print. Prev/next and the page size are all the
|
|
10
|
+
* control can honestly offer.
|
|
11
|
+
*/
|
|
7
12
|
const isHasMoreMode = props.hasMore !== undefined;
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const uniqueId = useId();
|
|
14
|
+
const itemsOnPageSelectId = `pagination-items-on-page-${uniqueId}`;
|
|
15
|
+
const goToPageInputId = `pagination-go-to-page-${uniqueId}`;
|
|
16
|
+
const totalPageCount = PaginationUtil.getTotalPageCount(props.totalItemsCount, props.itemsOnPage);
|
|
17
|
+
const currentPageNumber = Math.max(Math.floor(props.currentPageNumber) || 1, 1);
|
|
18
|
+
const isDisabled = props.isLoading || props.isError || Boolean(props.isDisabled);
|
|
19
|
+
const isPreviousDisabled = currentPageNumber <= 1 || isDisabled;
|
|
20
|
+
/*
|
|
21
|
+
* An empty list is one page long, so the last-page check already covers
|
|
22
|
+
* it - there is nowhere forward to go from page 1 of 1.
|
|
23
|
+
*/
|
|
24
|
+
const isNextDisabled = isHasMoreMode
|
|
25
|
+
? !props.hasMore || isDisabled
|
|
26
|
+
: currentPageNumber >= totalPageCount || isDisabled;
|
|
27
|
+
const pageWindow = isHasMoreMode
|
|
28
|
+
? []
|
|
29
|
+
: PaginationUtil.getPageWindow(currentPageNumber, totalPageCount);
|
|
30
|
+
/*
|
|
31
|
+
* The collapsed gaps are the jump affordance: a gap is drawn exactly where
|
|
32
|
+
* pages the reader might want are not on the bar, so that is where asking
|
|
33
|
+
* for one belongs. Nothing is spent on the toolbar until they ask.
|
|
34
|
+
*/
|
|
35
|
+
const [isGoToPageModalVisible, setIsGoToPageModalVisible] = useState(false);
|
|
36
|
+
const [goToPageValue, setGoToPageValue] = useState("");
|
|
37
|
+
// A page change from anywhere (prev/next, a number, the URL) closes the box.
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
setIsGoToPageModalVisible(false);
|
|
40
|
+
setGoToPageValue("");
|
|
41
|
+
}, [currentPageNumber]);
|
|
42
|
+
const itemRange = PaginationUtil.getItemRange({
|
|
43
|
+
currentPageNumber: currentPageNumber,
|
|
44
|
+
itemsOnPage: props.itemsOnPage,
|
|
45
|
+
totalItemsCount: props.totalItemsCount,
|
|
46
|
+
itemsOnCurrentPage: props.itemsOnCurrentPage,
|
|
47
|
+
});
|
|
48
|
+
const itemsOnPageOptions = PaginationUtil.getItemsOnPageOptions(props.itemsOnPage, props.itemsOnPageOptions || DefaultItemsOnPageOptions);
|
|
49
|
+
const textSizeClassName = props.isCompact ? "text-xs" : "text-sm";
|
|
50
|
+
const navigateToPage = (pageNumber) => {
|
|
51
|
+
if (isDisabled) {
|
|
52
|
+
return;
|
|
17
53
|
}
|
|
18
|
-
|
|
54
|
+
props.onNavigateToPage(pageNumber, props.itemsOnPage);
|
|
55
|
+
};
|
|
56
|
+
const submitGoToPage = () => {
|
|
57
|
+
const requestedPageNumber = Number(goToPageValue);
|
|
58
|
+
if (!requestedPageNumber) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setIsGoToPageModalVisible(false);
|
|
62
|
+
navigateToPage(PaginationUtil.clampPageNumber(requestedPageNumber, totalPageCount));
|
|
63
|
+
};
|
|
64
|
+
const getSummary = () => {
|
|
65
|
+
const pluralLabel = props.pluralLabel.toLowerCase();
|
|
66
|
+
const singularLabel = props.singularLabel.toLowerCase();
|
|
67
|
+
if (itemRange.isEmpty) {
|
|
68
|
+
return `No ${pluralLabel}`;
|
|
69
|
+
}
|
|
70
|
+
const rangeText = itemRange.firstItemNumber === itemRange.lastItemNumber
|
|
71
|
+
? itemRange.firstItemNumber.toLocaleString()
|
|
72
|
+
: `${itemRange.firstItemNumber.toLocaleString()}-${itemRange.lastItemNumber.toLocaleString()}`;
|
|
73
|
+
if (isHasMoreMode) {
|
|
74
|
+
/*
|
|
75
|
+
* The count cannot be printed here — it is a lower bound that also
|
|
76
|
+
* includes the probe row the payload dropped. The trailing "+" is all
|
|
77
|
+
* that can be said about what comes after this page.
|
|
78
|
+
*/
|
|
79
|
+
return `Showing ${rangeText}${props.hasMore ? "+" : ""} ${pluralLabel}`;
|
|
80
|
+
}
|
|
81
|
+
return `Showing ${rangeText} of ${props.totalItemsCount.toLocaleString()} ${props.totalItemsCount === 1 ? singularLabel : pluralLabel}`;
|
|
19
82
|
};
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
setMinAndMaxPageNumber();
|
|
22
|
-
}, []);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
setMinAndMaxPageNumber();
|
|
25
|
-
}, [props.totalItemsCount, props.itemsOnPage]);
|
|
26
|
-
const isPreviousDisabled = props.currentPageNumber === 1 || props.isLoading || props.isError;
|
|
27
|
-
const isNextDisabled = isHasMoreMode
|
|
28
|
-
? !props.hasMore || props.isLoading || props.isError
|
|
29
|
-
: props.currentPageNumber * props.itemsOnPage >= props.totalItemsCount ||
|
|
30
|
-
props.isLoading ||
|
|
31
|
-
props.isError;
|
|
32
|
-
const isCurrentPageButtonDisabled = isHasMoreMode
|
|
33
|
-
? props.isLoading || props.isError
|
|
34
|
-
: props.totalItemsCount === 0 || props.isLoading || props.isError;
|
|
35
|
-
const [showPaginationModel, setShowPaginationModel] = useState(false);
|
|
36
83
|
/*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
84
|
+
* A minimum width rather than padding alone, so a row of single-digit
|
|
85
|
+
* pages does not read as a row of narrower buttons than the two- and
|
|
86
|
+
* three-digit ones beside it.
|
|
39
87
|
*/
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
?
|
|
46
|
-
:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
React.createElement("button", { type: "button", disabled: isCurrentPageButtonDisabled, "aria-current": "page", "aria-label": `Page ${props.currentPageNumber}, current page. Select to jump to another page.`, "data-testid": "current-page-link", className: ` z-10 inline-flex items-center border border-x-0 border-gray-300 hover:bg-gray-50 px-4 py-2 text-sm font-medium text-text-600 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-500 ${isCurrentPageButtonDisabled ? "bg-gray-100" : ""}`, onClick: () => {
|
|
83
|
-
if (!isHasMoreMode) {
|
|
84
|
-
setShowPaginationModel(true);
|
|
85
|
-
}
|
|
86
|
-
} },
|
|
87
|
-
React.createElement("span", null, props.currentPageNumber))),
|
|
88
|
-
React.createElement("li", { className: "flex" },
|
|
89
|
-
React.createElement("button", { type: "button", disabled: isNextDisabled, "aria-label": "Go to next page", onClick: () => {
|
|
90
|
-
let currentPageNumber = props.currentPageNumber;
|
|
91
|
-
if (typeof currentPageNumber === "string") {
|
|
92
|
-
currentPageNumber = parseInt(currentPageNumber);
|
|
93
|
-
}
|
|
94
|
-
if (props.onNavigateToPage && !isNextDisabled) {
|
|
95
|
-
props.onNavigateToPage(currentPageNumber + 1, props.itemsOnPage);
|
|
96
|
-
}
|
|
97
|
-
}, className: ` inline-flex items-center rounded-r-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-500 ${isNextDisabled
|
|
98
|
-
? "bg-gray-100 cursor-not-allowed"
|
|
99
|
-
: " hover:bg-gray-50 cursor-pointer"}` },
|
|
100
|
-
React.createElement("span", null, "Next")))))),
|
|
101
|
-
React.createElement("div", { className: "md:hidden my-2" },
|
|
102
|
-
React.createElement(Button, { dataTestId: "show-pagination-modal-button-mobile", className: "my-2", buttonSize: ButtonSize.ExtraSmall, icon: IconProp.AdjustmentHorizontal, buttonStyle: ButtonStyleType.ICON_LIGHT, ariaLabel: "Open pagination settings", onClick: () => {
|
|
103
|
-
setShowPaginationModel(true);
|
|
104
|
-
} })),
|
|
105
|
-
React.createElement("div", { className: "md:hidden" },
|
|
106
|
-
React.createElement("div", { className: "inline-flex -space-x-px rounded-md shadow-sm" },
|
|
107
|
-
React.createElement("ul", { className: "flex", role: "list" },
|
|
108
|
-
React.createElement("li", { className: "flex" },
|
|
109
|
-
React.createElement("button", { type: "button", disabled: isPreviousDisabled, "aria-label": "Go to previous page", onClick: () => {
|
|
110
|
-
let currentPageNumber = props.currentPageNumber;
|
|
111
|
-
if (typeof currentPageNumber === "string") {
|
|
112
|
-
currentPageNumber = parseInt(currentPageNumber);
|
|
113
|
-
}
|
|
114
|
-
if (props.onNavigateToPage && !isPreviousDisabled) {
|
|
115
|
-
props.onNavigateToPage(currentPageNumber - 1, props.itemsOnPage);
|
|
88
|
+
const pageButtonBaseClassName = `relative inline-flex items-center justify-center border border-gray-300 font-medium transition-colors focus:z-20 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-500 ${props.isCompact
|
|
89
|
+
? "min-w-8 px-2 py-1.5 text-xs"
|
|
90
|
+
: "min-w-9 px-2 py-2 text-sm"}`;
|
|
91
|
+
const getArrowButtonClassName = (isButtonDisabled) => {
|
|
92
|
+
return `${pageButtonBaseClassName} ${isButtonDisabled
|
|
93
|
+
? "cursor-not-allowed bg-gray-50 text-gray-300"
|
|
94
|
+
: "cursor-pointer bg-white text-gray-500 hover:bg-gray-50 hover:text-gray-700"}`;
|
|
95
|
+
};
|
|
96
|
+
const getPageNumberButton = (pageNumber) => {
|
|
97
|
+
const isCurrentPage = pageNumber === currentPageNumber;
|
|
98
|
+
return (React.createElement("li", { className: "hidden sm:flex", key: `page-${pageNumber}` },
|
|
99
|
+
React.createElement("button", { type: "button", "data-testid": `pagination-page-${pageNumber}`, "aria-label": isCurrentPage ? `Page ${pageNumber}` : `Go to page ${pageNumber}`, "aria-current": isCurrentPage ? "page" : undefined, disabled: isDisabled, onClick: () => {
|
|
100
|
+
if (!isCurrentPage) {
|
|
101
|
+
navigateToPage(pageNumber);
|
|
102
|
+
}
|
|
103
|
+
}, className: `${pageButtonBaseClassName} ${isCurrentPage
|
|
104
|
+
? "z-10 border-indigo-500 bg-indigo-50 text-indigo-600"
|
|
105
|
+
: "bg-white text-gray-600 hover:bg-gray-50"} ${isDisabled && !isCurrentPage
|
|
106
|
+
? "cursor-not-allowed text-gray-300"
|
|
107
|
+
: "cursor-pointer"}` }, pageNumber.toLocaleString())));
|
|
108
|
+
};
|
|
109
|
+
const getEllipsis = (key) => {
|
|
110
|
+
return (React.createElement("li", { className: "hidden sm:flex", key: key },
|
|
111
|
+
React.createElement("button", { type: "button", "data-testid": `pagination-${key}`, "aria-label": "Go to a page in between", title: "Go to page", disabled: isDisabled, onClick: () => {
|
|
112
|
+
if (!isDisabled) {
|
|
113
|
+
setIsGoToPageModalVisible(true);
|
|
114
|
+
}
|
|
115
|
+
}, className: `${pageButtonBaseClassName} bg-white text-gray-400 ${isDisabled
|
|
116
|
+
? "cursor-not-allowed"
|
|
117
|
+
: "cursor-pointer hover:bg-gray-50 hover:text-gray-600"}` }, "\u2026")));
|
|
118
|
+
};
|
|
119
|
+
return (React.createElement(React.Fragment, null,
|
|
120
|
+
React.createElement("nav", { className: `flex flex-col gap-3 border-t border-gray-200 bg-white px-4 py-3 text-left sm:flex-row sm:items-center sm:justify-between ${props.className || ""}`, "data-testid": props.dataTestId, "aria-label": `Pagination for ${props.pluralLabel}` },
|
|
121
|
+
React.createElement("p", { className: `${textSizeClassName} shrink-0 whitespace-nowrap text-gray-500`, "data-testid": "pagination-summary", "aria-live": "polite" }, props.isLoading ? "Loading…" : getSummary()),
|
|
122
|
+
React.createElement("div", { className: "flex flex-wrap items-center justify-start gap-x-3 gap-y-3 sm:justify-end" },
|
|
123
|
+
React.createElement("div", { className: "flex items-center gap-2" },
|
|
124
|
+
React.createElement("label", { htmlFor: itemsOnPageSelectId, className: `${textSizeClassName} whitespace-nowrap text-gray-500` }, "Rows per page"),
|
|
125
|
+
React.createElement("div", { className: "relative" },
|
|
126
|
+
React.createElement("select", { id: itemsOnPageSelectId, "data-testid": "pagination-items-on-page-select", value: props.itemsOnPage, disabled: isDisabled, onChange: (event) => {
|
|
127
|
+
const newItemsOnPage = Number(event.target.value);
|
|
128
|
+
if (!newItemsOnPage || newItemsOnPage === props.itemsOnPage) {
|
|
129
|
+
return;
|
|
116
130
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
131
|
+
/*
|
|
132
|
+
* Row 400 of the old page size is not row 400 of the new one,
|
|
133
|
+
* so resizing the page returns to the top of the list rather
|
|
134
|
+
* than to an offset that may no longer exist.
|
|
135
|
+
*/
|
|
136
|
+
props.onNavigateToPage(1, newItemsOnPage);
|
|
137
|
+
}, className: `cursor-pointer appearance-none rounded-md border border-gray-300 bg-white py-1.5 pl-2.5 pr-8 font-medium text-gray-700 shadow-sm transition-colors hover:bg-gray-50 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-400 ${textSizeClassName}` }, itemsOnPageOptions.map((option) => {
|
|
138
|
+
return (React.createElement("option", { key: option, value: option }, option));
|
|
139
|
+
})),
|
|
140
|
+
React.createElement("span", { className: "pointer-events-none absolute inset-y-0 right-2 flex items-center" },
|
|
141
|
+
React.createElement(Icon, { icon: IconProp.ChevronDown, className: "h-4 w-4 text-gray-400" })))),
|
|
142
|
+
React.createElement("ul", { className: "isolate inline-flex -space-x-px rounded-md shadow-sm", role: "list" },
|
|
121
143
|
React.createElement("li", { className: "flex" },
|
|
122
|
-
React.createElement("button", { type: "button",
|
|
123
|
-
if (!
|
|
124
|
-
|
|
144
|
+
React.createElement("button", { type: "button", "data-testid": "pagination-previous-button", disabled: isPreviousDisabled, "aria-label": "Go to previous page", onClick: () => {
|
|
145
|
+
if (!isPreviousDisabled) {
|
|
146
|
+
navigateToPage(currentPageNumber - 1);
|
|
125
147
|
}
|
|
126
|
-
} },
|
|
127
|
-
React.createElement(
|
|
148
|
+
}, className: `${getArrowButtonClassName(isPreviousDisabled)} rounded-l-md` },
|
|
149
|
+
React.createElement(Icon, { icon: IconProp.ChevronLeft, className: "h-4 w-4" }))),
|
|
150
|
+
React.createElement("li", { className: "flex sm:hidden" },
|
|
151
|
+
React.createElement("span", { "data-testid": "pagination-current-page-indicator", className: `${pageButtonBaseClassName} bg-white text-gray-600` }, isHasMoreMode
|
|
152
|
+
? `Page ${currentPageNumber.toLocaleString()}`
|
|
153
|
+
: `Page ${currentPageNumber.toLocaleString()} of ${totalPageCount.toLocaleString()}`)),
|
|
154
|
+
isHasMoreMode && (React.createElement("li", { className: "hidden sm:flex" },
|
|
155
|
+
React.createElement("span", { "data-testid": "pagination-current-page-indicator-desktop", "aria-current": "page", className: `${pageButtonBaseClassName} z-10 border-indigo-500 bg-indigo-50 text-indigo-600` }, `Page ${currentPageNumber.toLocaleString()}`))),
|
|
156
|
+
pageWindow.map((item) => {
|
|
157
|
+
if (typeof item === "number") {
|
|
158
|
+
return getPageNumberButton(item);
|
|
159
|
+
}
|
|
160
|
+
return getEllipsis(item);
|
|
161
|
+
}),
|
|
128
162
|
React.createElement("li", { className: "flex" },
|
|
129
|
-
React.createElement("button", { type: "button", disabled: isNextDisabled, "aria-label": "Go to next page", onClick: () => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
currentPageNumber = parseInt(currentPageNumber);
|
|
133
|
-
}
|
|
134
|
-
if (props.onNavigateToPage && !isNextDisabled) {
|
|
135
|
-
props.onNavigateToPage(currentPageNumber + 1, props.itemsOnPage);
|
|
163
|
+
React.createElement("button", { type: "button", "data-testid": "pagination-next-button", disabled: isNextDisabled, "aria-label": "Go to next page", onClick: () => {
|
|
164
|
+
if (!isNextDisabled) {
|
|
165
|
+
navigateToPage(currentPageNumber + 1);
|
|
136
166
|
}
|
|
137
|
-
}, className:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
167
|
+
}, className: `${getArrowButtonClassName(isNextDisabled)} rounded-r-md` },
|
|
168
|
+
React.createElement(Icon, { icon: IconProp.ChevronRight, className: "h-4 w-4" })))))),
|
|
169
|
+
isGoToPageModalVisible && (React.createElement(Modal, { title: "Go to page", description: `This list has ${totalPageCount.toLocaleString()} pages. Enter the one you want to see.`, submitButtonText: "Go", closeButtonText: "Cancel", disableSubmitButton: goToPageValue === "", onSubmit: submitGoToPage, onClose: () => {
|
|
170
|
+
setIsGoToPageModalVisible(false);
|
|
171
|
+
setGoToPageValue("");
|
|
172
|
+
} },
|
|
173
|
+
React.createElement("div", null,
|
|
174
|
+
React.createElement("label", { htmlFor: goToPageInputId, className: "block text-sm font-medium text-gray-700" }, "Page number"),
|
|
175
|
+
React.createElement("input", { id: goToPageInputId, "data-testid": "pagination-go-to-page-input", type: "number", inputMode: "numeric", autoFocus: true, min: 1, max: totalPageCount, value: goToPageValue, placeholder: `1-${totalPageCount}`, onChange: (event) => {
|
|
176
|
+
setGoToPageValue(event.target.value);
|
|
177
|
+
},
|
|
145
178
|
/*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* size.
|
|
179
|
+
* The modal's footer button is not a form submit, so Enter is
|
|
180
|
+
* wired up by hand - typing a number and pressing Enter is how
|
|
181
|
+
* anyone who reached for this box expects it to end.
|
|
150
182
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}, formProps: {
|
|
158
|
-
initialValues: {
|
|
159
|
-
pageNumber: props.currentPageNumber,
|
|
160
|
-
itemsOnPage: props.itemsOnPage,
|
|
161
|
-
},
|
|
162
|
-
fields: [
|
|
163
|
-
...(isHasMoreMode
|
|
164
|
-
? []
|
|
165
|
-
: [
|
|
166
|
-
{
|
|
167
|
-
title: "Page Number",
|
|
168
|
-
description: `You can enter page numbers from ${minPageNumber !== maxPageNumber
|
|
169
|
-
? minPageNumber + " to " + maxPageNumber
|
|
170
|
-
: minPageNumber}. Please enter it here:`,
|
|
171
|
-
field: {
|
|
172
|
-
pageNumber: true,
|
|
173
|
-
},
|
|
174
|
-
disabled: minPageNumber === maxPageNumber,
|
|
175
|
-
placeholder: "1",
|
|
176
|
-
required: true,
|
|
177
|
-
validation: {
|
|
178
|
-
minValue: minPageNumber,
|
|
179
|
-
maxValue: maxPageNumber,
|
|
180
|
-
},
|
|
181
|
-
fieldType: FormFieldSchemaType.PositiveNumber,
|
|
182
|
-
},
|
|
183
|
-
]),
|
|
184
|
-
{
|
|
185
|
-
title: `${props.pluralLabel} on Page `,
|
|
186
|
-
description: `Enter the number of ${props.pluralLabel.toLowerCase()} you would like to see on the page:`,
|
|
187
|
-
field: {
|
|
188
|
-
itemsOnPage: true,
|
|
189
|
-
},
|
|
190
|
-
placeholder: "10",
|
|
191
|
-
required: true,
|
|
192
|
-
fieldType: FormFieldSchemaType.Dropdown,
|
|
193
|
-
dropdownOptions: [
|
|
194
|
-
{
|
|
195
|
-
value: 10,
|
|
196
|
-
label: "10",
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
value: 20,
|
|
200
|
-
label: "20",
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
value: 25,
|
|
204
|
-
label: "25",
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
value: 50,
|
|
208
|
-
label: "50",
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
},
|
|
212
|
-
],
|
|
213
|
-
} }))));
|
|
183
|
+
onKeyDown: (event) => {
|
|
184
|
+
if (event.key === "Enter") {
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
submitGoToPage();
|
|
187
|
+
}
|
|
188
|
+
}, className: "mt-2 block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500" }))))));
|
|
214
189
|
};
|
|
215
190
|
export default Pagination;
|
|
216
191
|
//# sourceMappingURL=Pagination.js.map
|