@perses-dev/logs-table-plugin 0.2.0 → 0.3.0-beta.0
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/__mf/css/async/5369.85c2cbf6.css +1 -0
- package/__mf/css/async/__federation_expose_LogsTable.eedb54d8.css +1 -0
- package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
- package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
- package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
- package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
- package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
- package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
- package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
- package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
- package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
- package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
- package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
- package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
- package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
- package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
- package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
- package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
- package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
- package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
- package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
- package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
- package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
- package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
- package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
- package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
- package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
- package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
- package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
- package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
- package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
- package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
- package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
- package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
- package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
- package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
- package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
- package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
- package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
- package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
- package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
- package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
- package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
- package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
- package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
- package/__mf/js/LogsTable.471dc288.js +7 -0
- package/__mf/js/async/1159.9276d668.js +22 -0
- package/__mf/js/async/1519.40e06bfc.js +1 -0
- package/__mf/js/async/1616.1b9a06fe.js +1 -0
- package/__mf/js/async/1805.ab82c1ef.js +1 -0
- package/__mf/js/async/20.b04ebcaa.js +3 -0
- package/__mf/js/async/2043.956cdbbb.js +2 -0
- package/__mf/js/async/256.20a94089.js +1 -0
- package/__mf/js/async/2842.4aad5bc1.js +1 -0
- package/__mf/js/async/304.8985bacb.js +37 -0
- package/__mf/js/async/392.f9cb0cfc.js +2 -0
- package/__mf/js/async/4077.e9103d7c.js +1 -0
- package/__mf/js/async/4121.c9ef0518.js +2 -0
- package/__mf/js/async/4869.940da5d7.js +1 -0
- package/__mf/js/async/5002.1fe02654.js +1 -0
- package/__mf/js/async/5071.87183f5a.js +1 -0
- package/__mf/js/async/5369.0aa8782c.js +7 -0
- package/__mf/js/async/{1129.e0f0503a.js.LICENSE.txt → 5369.0aa8782c.js.LICENSE.txt} +19 -1
- package/__mf/js/async/540.d4d0de7f.js +2 -0
- package/__mf/js/async/540.d4d0de7f.js.LICENSE.txt +1 -0
- package/__mf/js/async/5587.c7e5a39c.js +1 -0
- package/__mf/js/async/5652.e6029fc8.js +2 -0
- package/__mf/js/async/{1117.0a72bc85.js.LICENSE.txt → 5652.e6029fc8.js.LICENSE.txt} +1 -1
- package/__mf/js/async/6274.940dee19.js +2 -0
- package/__mf/js/async/6458.b2359789.js +1 -0
- package/__mf/js/async/7177.44516b97.js +1 -0
- package/__mf/js/async/7192.84e9432b.js +1 -0
- package/__mf/js/async/7250.78e3cd06.js +1 -0
- package/__mf/js/async/7413.581476fb.js +1 -0
- package/__mf/js/async/7445.73c38e72.js +110 -0
- package/__mf/js/async/{7445.28262ec0.js.LICENSE.txt → 7445.73c38e72.js.LICENSE.txt} +1 -1
- package/__mf/js/async/7452.7c6fe277.js +2 -0
- package/__mf/js/async/7968.aaf8a8bc.js +1 -0
- package/__mf/js/async/7978.35e0aa88.js +1 -0
- package/__mf/js/async/8356.355b4afe.js +1 -0
- package/__mf/js/async/8470.878f89da.js +2 -0
- package/__mf/js/async/8542.e30a008f.js +1 -0
- package/__mf/js/async/8608.072381d3.js +1 -0
- package/__mf/js/async/873.a4b44e41.js +1 -0
- package/__mf/js/async/9235.33a97899.js +1 -0
- package/__mf/js/async/9293.77eed9f0.js +2 -0
- package/__mf/js/async/941.c74117a1.js +2 -0
- package/__mf/js/async/9588.4e751733.js +1 -0
- package/__mf/js/async/__federation_expose_LogsTable.b2bc5b29.js +1 -0
- package/__mf/js/async/lib-router.47d4d226.js +2 -0
- package/__mf/js/main.04ea2a20.js +7 -0
- package/lib/LogsTable.d.ts.map +1 -1
- package/lib/LogsTable.js +8 -1
- package/lib/LogsTable.js.map +1 -1
- package/lib/LogsTableExportAction.d.ts +3 -0
- package/lib/LogsTableExportAction.d.ts.map +1 -0
- package/lib/LogsTableExportAction.js +67 -0
- package/lib/LogsTableExportAction.js.map +1 -0
- package/lib/cjs/LogsTable.js +8 -1
- package/lib/cjs/LogsTableExportAction.js +80 -0
- package/lib/cjs/components/LogRow/LogDetailsTable.js +60 -5
- package/lib/cjs/components/LogRow/LogRow.js +18 -7
- package/lib/cjs/components/VirtualizedLogsList.js +4 -4
- package/lib/cjs/utils/ansi.js +60 -0
- package/lib/cjs/utils/copyHelpers.js +4 -2
- package/lib/components/LogRow/LogDetailsTable.d.ts +2 -1
- package/lib/components/LogRow/LogDetailsTable.d.ts.map +1 -1
- package/lib/components/LogRow/LogDetailsTable.js +22 -3
- package/lib/components/LogRow/LogDetailsTable.js.map +1 -1
- package/lib/components/LogRow/LogRow.d.ts +2 -1
- package/lib/components/LogRow/LogRow.d.ts.map +1 -1
- package/lib/components/LogRow/LogRow.js +20 -9
- package/lib/components/LogRow/LogRow.js.map +1 -1
- package/lib/components/LogsList.d.ts +1 -1
- package/lib/components/LogsList.js.map +1 -1
- package/lib/components/VirtualizedLogsList.d.ts +1 -1
- package/lib/components/VirtualizedLogsList.d.ts.map +1 -1
- package/lib/components/VirtualizedLogsList.js +5 -5
- package/lib/components/VirtualizedLogsList.js.map +1 -1
- package/lib/components/hooks/useExpandedRows.d.ts +3 -2
- package/lib/components/hooks/useExpandedRows.d.ts.map +1 -1
- package/lib/components/hooks/useExpandedRows.js.map +1 -1
- package/lib/components/hooks/useSeverity.d.ts +1 -1
- package/lib/components/hooks/useSeverity.d.ts.map +1 -1
- package/lib/components/hooks/useSeverity.js.map +1 -1
- package/lib/components/utils.d.ts +1 -1
- package/lib/components/utils.js.map +1 -1
- package/lib/model.d.ts +2 -1
- package/lib/model.d.ts.map +1 -1
- package/lib/model.js.map +1 -1
- package/lib/utils/ansi.d.ts +3 -0
- package/lib/utils/ansi.d.ts.map +1 -0
- package/lib/utils/ansi.js +39 -0
- package/lib/utils/ansi.js.map +1 -0
- package/lib/utils/copyHelpers.d.ts +1 -1
- package/lib/utils/copyHelpers.d.ts.map +1 -1
- package/lib/utils/copyHelpers.js +4 -2
- package/lib/utils/copyHelpers.js.map +1 -1
- package/mf-manifest.json +93 -72
- package/mf-stats.json +109 -74
- package/package.json +9 -5
- package/__mf/css/async/3061.d3010b86.css +0 -1
- package/__mf/css/async/5442.d3010b86.css +0 -1
- package/__mf/css/async/7823.d3010b86.css +0 -1
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/LogsTable.2781dfd7.js +0 -6
- package/__mf/js/async/1117.0a72bc85.js +0 -2
- package/__mf/js/async/1129.e0f0503a.js +0 -7
- package/__mf/js/async/1240.1a0b69fc.js +0 -1
- package/__mf/js/async/1616.832c6e3d.js +0 -1
- package/__mf/js/async/2043.3343388c.js +0 -2
- package/__mf/js/async/304.d0edd380.js +0 -37
- package/__mf/js/async/392.2e457deb.js +0 -2
- package/__mf/js/async/3982.ab5d25af.js +0 -1
- package/__mf/js/async/4077.4c4e9533.js +0 -1
- package/__mf/js/async/4121.6fa52018.js +0 -2
- package/__mf/js/async/5002.c1c54a52.js +0 -1
- package/__mf/js/async/5019.84406c37.js +0 -1
- package/__mf/js/async/5071.a0b2c6c3.js +0 -1
- package/__mf/js/async/5587.180213b1.js +0 -1
- package/__mf/js/async/6034.130a9e6d.js +0 -22
- package/__mf/js/async/6274.145959f1.js +0 -2
- package/__mf/js/async/6458.4d73f1df.js +0 -1
- package/__mf/js/async/648.0ddef36d.js +0 -1
- package/__mf/js/async/7177.848ebbb2.js +0 -1
- package/__mf/js/async/7192.269aa1db.js +0 -1
- package/__mf/js/async/7445.28262ec0.js +0 -110
- package/__mf/js/async/7452.60dd8e7a.js +0 -2
- package/__mf/js/async/7968.2c2a16b3.js +0 -1
- package/__mf/js/async/7978.8fed4f5a.js +0 -1
- package/__mf/js/async/8356.9ea56838.js +0 -1
- package/__mf/js/async/8470.6f543f7d.js +0 -2
- package/__mf/js/async/8542.1802a06b.js +0 -1
- package/__mf/js/async/8608.4e8b55b4.js +0 -1
- package/__mf/js/async/873.6dbef0bc.js +0 -1
- package/__mf/js/async/8859.f8f648fc.js +0 -1
- package/__mf/js/async/9235.3d5006e1.js +0 -1
- package/__mf/js/async/9293.7e278959.js +0 -2
- package/__mf/js/async/941.66a54646.js +0 -2
- package/__mf/js/async/9588.1ab96620.js +0 -1
- package/__mf/js/async/__federation_expose_LogsTable.f2d6f7ad.js +0 -1
- package/__mf/js/async/lib-router.04411383.js +0 -2
- package/__mf/js/main.76fc2531.js +0 -6
- /package/__mf/js/async/{6034.130a9e6d.js.LICENSE.txt → 1159.9276d668.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2043.3343388c.js.LICENSE.txt → 2043.956cdbbb.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.2e457deb.js.LICENSE.txt → 392.f9cb0cfc.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4121.6fa52018.js.LICENSE.txt → 4121.c9ef0518.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6274.145959f1.js.LICENSE.txt → 6274.940dee19.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{7452.60dd8e7a.js.LICENSE.txt → 7452.7c6fe277.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8470.6f543f7d.js.LICENSE.txt → 8470.878f89da.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.66a54646.js.LICENSE.txt → 941.c74117a1.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.04411383.js.LICENSE.txt → lib-router.47d4d226.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/VirtualizedLogsList.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { useCallback, useState, useEffect, useRef, ReactNode } from 'react';\nimport { Box, useTheme, Popover, Button, ButtonGroup, IconButton } from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { Virtuoso } from 'react-virtuoso';\nimport { LogEntry } from '@perses-dev/core';\nimport { useSelection } from '@perses-dev/components';\nimport { useSelectionItemActions } from '@perses-dev/dashboards';\nimport { ActionOptions, useAllVariableValues } from '@perses-dev/plugin-system';\nimport { formatLogEntries, formatLogMessage } from '../utils/copyHelpers';\nimport { LogsTableOptions } from '../model';\nimport { LogRow } from './LogRow';\n\nconst PERSES_LOGSTABLE_HINTS_DISMISSED = 'PERSES_LOGSTABLE_HINTS_DISMISSED';\nconst COPY_TOAST_DURATION_MS = 5000;\n\n// Detect Mac for keyboard shortcuts display\nconst isMac = /(Mac|iPhone|iPod|iPad)/i.test(navigator.userAgent);\n\ninterface VirtualizedLogsListProps {\n logs: LogEntry[];\n spec: LogsTableOptions;\n expandedRows: Set<number>;\n onToggleExpand: (index: number) => void;\n}\n\nexport const VirtualizedLogsList: React.FC<VirtualizedLogsListProps> = ({\n logs,\n spec,\n expandedRows,\n onToggleExpand,\n}) => {\n const theme = useTheme();\n const [selectedRows, setSelectedRows] = useState<Set<number>>(new Set());\n const [lastSelectedIndex, setLastSelectedIndex] = useState<number | null>(null);\n const selectedRowsRef = useRef<Set<number>>(selectedRows);\n const [copyPopoverAnchor, setCopyPopoverAnchor] = useState<{ x: number; y: number } | null>(null);\n const [lastCopiedFormat, setLastCopiedFormat] = useState<'full' | 'message' | 'json'>('full');\n const [lastCopiedCount, setLastCopiedCount] = useState(0);\n const copyPopoverTimerRef = useRef<number | null>(null);\n const [isHintsDismissed, setIsHintsDismissed] = useState(() => {\n try {\n return localStorage.getItem(PERSES_LOGSTABLE_HINTS_DISMISSED) === 'true';\n } catch {\n return false;\n }\n });\n\n const selectionEnabled = spec.selection?.enabled ?? false;\n const { setSelection, clearSelection } = useSelection<LogEntry, number>();\n\n const allVariables = useAllVariableValues();\n const itemActionsConfig = spec.actions ? (spec.actions as ActionOptions) : undefined;\n const itemActionsListConfig =\n itemActionsConfig?.enabled && itemActionsConfig.displayWithItem ? itemActionsConfig.actionsList : [];\n\n const { getItemActionButtons, confirmDialog } = useSelectionItemActions<number>({\n actions: itemActionsListConfig,\n variableState: allVariables,\n });\n\n useEffect(() => {\n selectedRowsRef.current = selectedRows;\n }, [selectedRows]);\n\n // Sync local selection state with context when selection is enabled\n useEffect(() => {\n if (!selectionEnabled) return;\n\n if (selectedRows.size === 0) {\n clearSelection();\n } else {\n const selectionItems = Array.from(selectedRows)\n .map((index) => {\n const log = logs[index];\n return log ? { id: index, item: log } : null;\n })\n .filter((entry): entry is { id: number; item: LogEntry } => entry !== null);\n setSelection(selectionItems);\n }\n }, [selectedRows, logs, selectionEnabled, setSelection, clearSelection]);\n\n const handleDismissHints = useCallback(() => {\n setIsHintsDismissed(true);\n try {\n localStorage.setItem(PERSES_LOGSTABLE_HINTS_DISMISSED, 'true');\n } catch {\n // Ignore localStorage errors\n }\n }, []);\n\n const showCopyPopover = useCallback((format: 'full' | 'message' | 'json' = 'full', count: number) => {\n // Show toast at bottom-right corner\n const x = window.innerWidth - 32;\n const y = window.innerHeight - 32;\n setCopyPopoverAnchor({ x, y });\n setLastCopiedFormat(format);\n setLastCopiedCount(count);\n\n // Clear existing timer\n if (copyPopoverTimerRef.current) {\n window.clearTimeout(copyPopoverTimerRef.current);\n }\n\n // Auto-dismiss after configured duration\n copyPopoverTimerRef.current = window.setTimeout(() => {\n setCopyPopoverAnchor(null);\n }, COPY_TOAST_DURATION_MS);\n }, []);\n\n const handleCloseCopyPopover = useCallback(() => {\n if (copyPopoverTimerRef.current) {\n window.clearTimeout(copyPopoverTimerRef.current);\n }\n setCopyPopoverAnchor(null);\n }, []);\n\n const handleCopyInFormat = useCallback(\n async (format: 'full' | 'message' | 'json') => {\n const selectedLogs = Array.from(selectedRowsRef.current)\n .sort((a, b) => a - b)\n .map((index) => logs[index])\n .filter((log) => log !== undefined);\n\n let text: string;\n if (format === 'message') {\n text = selectedLogs.map(formatLogMessage).join('\\n');\n } else if (format === 'json') {\n text = JSON.stringify(selectedLogs, null, 2);\n } else {\n text = formatLogEntries(selectedLogs);\n }\n\n await navigator.clipboard.writeText(text);\n showCopyPopover(format, selectedLogs.length);\n },\n [logs, showCopyPopover]\n );\n\n const handleRowSelect = useCallback(\n (index: number, event: React.MouseEvent) => {\n if (event.shiftKey) {\n // Prevent text selection during shift-click\n event.preventDefault();\n window.getSelection()?.removeAllRanges();\n\n if (lastSelectedIndex !== null) {\n // Range selection: select all rows between anchor and current\n const start = Math.min(lastSelectedIndex, index);\n const end = Math.max(lastSelectedIndex, index);\n const newSelection = new Set<number>();\n for (let i = start; i <= end; i++) {\n newSelection.add(i);\n }\n setSelectedRows(newSelection);\n } else {\n // No anchor set: just select this row and set as anchor\n const newSelection = new Set([index]);\n setSelectedRows(newSelection);\n setLastSelectedIndex(index);\n }\n } else if (event.ctrlKey || event.metaKey) {\n // Prevent text selection during cmd/ctrl-click\n event.preventDefault();\n window.getSelection()?.removeAllRanges();\n\n // Toggle individual row (additive selection)\n const newSelection = new Set(selectedRows);\n if (newSelection.has(index)) {\n newSelection.delete(index);\n } else {\n newSelection.add(index);\n }\n setSelectedRows(newSelection);\n setLastSelectedIndex(index);\n } else {\n // Plain click: set as anchor for future shift-clicks\n // Don't prevent default to allow text selection\n setLastSelectedIndex(index);\n }\n },\n [selectedRows, lastSelectedIndex]\n );\n\n const renderLogRow = (index: number) => {\n const log = logs[index];\n if (!log) return null;\n\n const itemActionButtons: ReactNode[] = itemActionsListConfig?.length\n ? getItemActionButtons({ id: index, data: log as unknown as Record<string, unknown> })\n : [];\n\n return (\n <LogRow\n isExpandable={spec.enableDetails}\n log={log}\n index={index}\n isExpanded={expandedRows.has(index)}\n onToggle={onToggleExpand}\n allowWrap={spec.allowWrap}\n showTime={spec.showTime}\n isSelected={selectedRows.has(index)}\n onSelect={handleRowSelect}\n itemActionButtons={itemActionButtons}\n />\n );\n };\n\n const handleCopy = (e: React.ClipboardEvent<HTMLDivElement>) => {\n const selection = window.getSelection();\n const hasTextSelection = selection && selection.rangeCount > 0 && selection.toString().length > 0;\n\n // If user has text selected, let browser handle it normally\n if (hasTextSelection) {\n return;\n }\n\n // If rows are selected, copy those\n const currentSelectedRows = selectedRowsRef.current;\n if (currentSelectedRows.size > 0) {\n e.preventDefault();\n const selectedLogs = Array.from(currentSelectedRows)\n .sort((a, b) => a - b)\n .map((index) => logs[index])\n .filter((log) => log !== undefined);\n const formattedText = formatLogEntries(selectedLogs);\n e.clipboardData.setData('text/plain', formattedText);\n }\n };\n\n // Keyboard shortcuts for selection\n useEffect(() => {\n const handleKeyDown = async (e: KeyboardEvent) => {\n // Cmd/Ctrl+A: Select all logs\n if ((e.metaKey || e.ctrlKey) && e.key === 'a') {\n e.preventDefault();\n const allIndices = new Set(logs.map((_, index) => index));\n setSelectedRows(allIndices);\n if (logs.length > 0) {\n setLastSelectedIndex(logs.length - 1);\n }\n }\n\n // Cmd/Ctrl+C: Copy selected rows\n if ((e.metaKey || e.ctrlKey) && e.key === 'c') {\n const selection = window.getSelection();\n const hasTextSelection = selection && selection.rangeCount > 0 && selection.toString().length > 0;\n\n // Only handle if we have selected rows and no text selection\n if (selectedRowsRef.current.size > 0 && !hasTextSelection) {\n e.preventDefault();\n const selectedLogs = Array.from(selectedRowsRef.current)\n .sort((a, b) => a - b)\n .map((index) => logs[index])\n .filter((log) => log !== undefined);\n const formattedText = formatLogEntries(selectedLogs);\n await navigator.clipboard.writeText(formattedText);\n showCopyPopover('full', selectedLogs.length);\n }\n }\n\n // Escape: Clear selection\n if (e.key === 'Escape' && selectedRows.size > 0) {\n setSelectedRows(new Set());\n setLastSelectedIndex(null);\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => {\n window.removeEventListener('keydown', handleKeyDown);\n };\n }, [logs, selectedRows, showCopyPopover]);\n\n // Cleanup timer on unmount\n useEffect(() => {\n return () => {\n if (copyPopoverTimerRef.current) {\n window.clearTimeout(copyPopoverTimerRef.current);\n }\n };\n }, []);\n\n return (\n <>\n {confirmDialog}\n <Box\n sx={{\n height: '100%',\n backgroundColor: theme.palette.background.default,\n overflow: 'hidden',\n boxShadow: theme.shadows[1],\n display: 'flex',\n flexDirection: 'column',\n }}\n onCopy={handleCopy}\n >\n {!isHintsDismissed && (\n <Box\n sx={{\n px: 2,\n py: 0.75,\n fontSize: '12px',\n color: theme.palette.text.secondary,\n backgroundColor: theme.palette.background.paper,\n borderBottom: `1px solid ${theme.palette.divider}`,\n display: 'flex',\n alignItems: 'center',\n gap: 2,\n flexShrink: 0,\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 2, flex: 1 }}>\n <Box component=\"span\" sx={{ opacity: 0.8 }}>\n {isMac ? '⌘' : 'Ctrl'}+Click to select\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.6 }}>\n •\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.8 }}>\n Shift+Click for range\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.6 }}>\n •\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.8 }}>\n {isMac ? '⌘' : 'Ctrl'}+C to copy\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.6 }}>\n •\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.8 }}>\n Esc to clear\n </Box>\n </Box>\n <IconButton\n size=\"small\"\n onClick={handleDismissHints}\n sx={{\n opacity: 0.6,\n '&:hover': { opacity: 1 },\n padding: 0.5,\n }}\n aria-label=\"Dismiss hints\"\n >\n <CloseIcon sx={{ fontSize: '16px' }} />\n </IconButton>\n </Box>\n )}\n <Virtuoso\n style={{ height: '100%', flexGrow: 1 }}\n initialItemCount={spec.showAll ? logs.length : undefined}\n totalCount={logs.length}\n itemContent={renderLogRow}\n />\n <Popover\n open={Boolean(copyPopoverAnchor)}\n anchorReference=\"anchorPosition\"\n anchorPosition={copyPopoverAnchor ? { top: copyPopoverAnchor.y, left: copyPopoverAnchor.x } : undefined}\n onClose={handleCloseCopyPopover}\n disableScrollLock\n disableAutoFocus\n disableRestoreFocus\n disableEnforceFocus\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n slotProps={{\n paper: {\n sx: {\n px: 2,\n py: 1.5,\n boxShadow: theme.shadows[8],\n borderRadius: 2,\n pointerEvents: 'auto',\n },\n },\n }}\n sx={{\n pointerEvents: 'none',\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>\n <Box\n sx={{\n fontSize: '14px',\n color: theme.palette.text.primary,\n fontWeight: 500,\n display: 'flex',\n alignItems: 'center',\n gap: 0.5,\n }}\n >\n ✓ Copied {lastCopiedCount} {lastCopiedCount === 1 ? 'log' : 'logs'} as{' '}\n <Box\n component=\"span\"\n sx={{ color: theme.palette.primary.main, minWidth: '60px', display: 'inline-block' }}\n >\n {lastCopiedFormat === 'full' ? 'Full' : lastCopiedFormat === 'message' ? 'Message' : 'JSON'}\n </Box>\n </Box>\n <ButtonGroup size=\"small\" variant=\"outlined\">\n <Button\n onClick={() => handleCopyInFormat('full')}\n sx={{\n fontSize: '12px',\n textTransform: 'none',\n minWidth: '52px',\n fontWeight: lastCopiedFormat === 'full' ? 600 : 400,\n bgcolor: lastCopiedFormat === 'full' ? theme.palette.action.selected : 'transparent',\n }}\n >\n Full\n </Button>\n <Button\n onClick={() => handleCopyInFormat('message')}\n sx={{\n fontSize: '12px',\n textTransform: 'none',\n minWidth: '74px',\n fontWeight: lastCopiedFormat === 'message' ? 600 : 400,\n bgcolor: lastCopiedFormat === 'message' ? theme.palette.action.selected : 'transparent',\n }}\n >\n Message\n </Button>\n <Button\n onClick={() => handleCopyInFormat('json')}\n sx={{\n fontSize: '12px',\n textTransform: 'none',\n minWidth: '52px',\n fontWeight: lastCopiedFormat === 'json' ? 600 : 400,\n bgcolor: lastCopiedFormat === 'json' ? theme.palette.action.selected : 'transparent',\n }}\n >\n JSON\n </Button>\n </ButtonGroup>\n </Box>\n </Popover>\n </Box>\n </>\n );\n};\n"],"names":["React","useCallback","useState","useEffect","useRef","Box","useTheme","Popover","Button","ButtonGroup","IconButton","CloseIcon","Virtuoso","useSelection","useSelectionItemActions","useAllVariableValues","formatLogEntries","formatLogMessage","LogRow","PERSES_LOGSTABLE_HINTS_DISMISSED","COPY_TOAST_DURATION_MS","isMac","test","navigator","userAgent","VirtualizedLogsList","logs","spec","expandedRows","onToggleExpand","theme","selectedRows","setSelectedRows","Set","lastSelectedIndex","setLastSelectedIndex","selectedRowsRef","copyPopoverAnchor","setCopyPopoverAnchor","lastCopiedFormat","setLastCopiedFormat","lastCopiedCount","setLastCopiedCount","copyPopoverTimerRef","isHintsDismissed","setIsHintsDismissed","localStorage","getItem","selectionEnabled","selection","enabled","setSelection","clearSelection","allVariables","itemActionsConfig","actions","undefined","itemActionsListConfig","displayWithItem","actionsList","getItemActionButtons","confirmDialog","variableState","current","size","selectionItems","Array","from","map","index","log","id","item","filter","entry","handleDismissHints","setItem","showCopyPopover","format","count","x","window","innerWidth","y","innerHeight","clearTimeout","setTimeout","handleCloseCopyPopover","handleCopyInFormat","selectedLogs","sort","a","b","text","join","JSON","stringify","clipboard","writeText","length","handleRowSelect","event","shiftKey","preventDefault","getSelection","removeAllRanges","start","Math","min","end","max","newSelection","i","add","ctrlKey","metaKey","has","delete","renderLogRow","itemActionButtons","data","isExpandable","enableDetails","isExpanded","onToggle","allowWrap","showTime","isSelected","onSelect","handleCopy","e","hasTextSelection","rangeCount","toString","currentSelectedRows","formattedText","clipboardData","setData","handleKeyDown","key","allIndices","_","addEventListener","removeEventListener","sx","height","backgroundColor","palette","background","default","overflow","boxShadow","shadows","display","flexDirection","onCopy","px","py","fontSize","color","secondary","paper","borderBottom","divider","alignItems","gap","flexShrink","flex","component","opacity","onClick","padding","aria-label","style","flexGrow","initialItemCount","showAll","totalCount","itemContent","open","Boolean","anchorReference","anchorPosition","top","left","onClose","disableScrollLock","disableAutoFocus","disableRestoreFocus","disableEnforceFocus","anchorOrigin","vertical","horizontal","transformOrigin","slotProps","borderRadius","pointerEvents","primary","fontWeight","main","minWidth","variant","textTransform","bgcolor","action","selected"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,SAASC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAmB,QAAQ;AACnF,SAASC,GAAG,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,EAAEC,WAAW,EAAEC,UAAU,QAAQ,gBAAgB;AACxF,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAAwBC,oBAAoB,QAAQ,4BAA4B;AAChF,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,uBAAuB;AAE1E,SAASC,MAAM,QAAQ,WAAW;AAElC,MAAMC,mCAAmC;AACzC,MAAMC,yBAAyB;AAE/B,4CAA4C;AAC5C,MAAMC,QAAQ,0BAA0BC,IAAI,CAACC,UAAUC,SAAS;AAShE,OAAO,MAAMC,sBAA0D,CAAC,EACtEC,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E;sDACD;;;;;;;;;;;AASf,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/VirtualizedLogsList.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { useCallback, useState, useEffect, useRef, ReactNode } from 'react';\nimport { Box, useTheme, Popover, Button, ButtonGroup, IconButton } from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { Virtuoso } from 'react-virtuoso';\nimport { useSelection } from '@perses-dev/components';\nimport { formatForDisplay, useSelectionItemActions } from '@perses-dev/dashboards';\nimport { ActionOptions, useAllVariableValues } from '@perses-dev/plugin-system';\nimport { LogEntry } from '@perses-dev/spec';\nimport { formatLogEntries, formatLogMessage } from '../utils/copyHelpers';\nimport { LogsTableOptions } from '../model';\nimport { LogRow } from './LogRow';\n\nconst PERSES_LOGSTABLE_HINTS_DISMISSED = 'PERSES_LOGSTABLE_HINTS_DISMISSED';\nconst COPY_TOAST_DURATION_MS = 5000;\n\n// Platform-aware modifier key display using TanStack's formatForDisplay\nconst modKeyDisplay = formatForDisplay('Mod');\n\ninterface VirtualizedLogsListProps {\n logs: LogEntry[];\n spec: LogsTableOptions;\n expandedRows: Set<number>;\n onToggleExpand: (index: number) => void;\n}\n\nexport const VirtualizedLogsList: React.FC<VirtualizedLogsListProps> = ({\n logs,\n spec,\n expandedRows,\n onToggleExpand,\n}) => {\n const theme = useTheme();\n const [selectedRows, setSelectedRows] = useState<Set<number>>(new Set());\n const [lastSelectedIndex, setLastSelectedIndex] = useState<number | null>(null);\n const selectedRowsRef = useRef<Set<number>>(selectedRows);\n const [copyPopoverAnchor, setCopyPopoverAnchor] = useState<{ x: number; y: number } | null>(null);\n const [lastCopiedFormat, setLastCopiedFormat] = useState<'full' | 'message' | 'json'>('full');\n const [lastCopiedCount, setLastCopiedCount] = useState(0);\n const copyPopoverTimerRef = useRef<number | null>(null);\n const [isHintsDismissed, setIsHintsDismissed] = useState(() => {\n try {\n return localStorage.getItem(PERSES_LOGSTABLE_HINTS_DISMISSED) === 'true';\n } catch {\n return false;\n }\n });\n\n const selectionEnabled = spec.selection?.enabled ?? false;\n const { setSelection, clearSelection } = useSelection<LogEntry, number>();\n\n const allVariables = useAllVariableValues();\n const itemActionsConfig = spec.actions ? (spec.actions as ActionOptions) : undefined;\n const itemActionsListConfig =\n itemActionsConfig?.enabled && itemActionsConfig.displayWithItem ? itemActionsConfig.actionsList : [];\n\n const { getItemActionButtons, confirmDialog } = useSelectionItemActions<number>({\n actions: itemActionsListConfig,\n variableState: allVariables,\n });\n\n useEffect(() => {\n selectedRowsRef.current = selectedRows;\n }, [selectedRows]);\n\n // Sync local selection state with context when selection is enabled\n useEffect(() => {\n if (!selectionEnabled) return;\n\n if (selectedRows.size === 0) {\n clearSelection();\n } else {\n const selectionItems = Array.from(selectedRows)\n .map((index) => {\n const log = logs[index];\n return log ? { id: index, item: log } : null;\n })\n .filter((entry): entry is { id: number; item: LogEntry } => entry !== null);\n setSelection(selectionItems);\n }\n }, [selectedRows, logs, selectionEnabled, setSelection, clearSelection]);\n\n const handleDismissHints = useCallback(() => {\n setIsHintsDismissed(true);\n try {\n localStorage.setItem(PERSES_LOGSTABLE_HINTS_DISMISSED, 'true');\n } catch {\n // Ignore localStorage errors\n }\n }, []);\n\n const showCopyPopover = useCallback((format: 'full' | 'message' | 'json' = 'full', count: number) => {\n // Show toast at bottom-right corner\n const x = window.innerWidth - 32;\n const y = window.innerHeight - 32;\n setCopyPopoverAnchor({ x, y });\n setLastCopiedFormat(format);\n setLastCopiedCount(count);\n\n // Clear existing timer\n if (copyPopoverTimerRef.current) {\n window.clearTimeout(copyPopoverTimerRef.current);\n }\n\n // Auto-dismiss after configured duration\n copyPopoverTimerRef.current = window.setTimeout(() => {\n setCopyPopoverAnchor(null);\n }, COPY_TOAST_DURATION_MS);\n }, []);\n\n const handleCloseCopyPopover = useCallback(() => {\n if (copyPopoverTimerRef.current) {\n window.clearTimeout(copyPopoverTimerRef.current);\n }\n setCopyPopoverAnchor(null);\n }, []);\n\n const handleCopyInFormat = useCallback(\n async (format: 'full' | 'message' | 'json') => {\n const selectedLogs = Array.from(selectedRowsRef.current)\n .sort((a, b) => a - b)\n .map((index) => logs[index])\n .filter((log) => log !== undefined);\n\n let text: string;\n if (format === 'message') {\n text = selectedLogs.map(formatLogMessage).join('\\n');\n } else if (format === 'json') {\n text = JSON.stringify(selectedLogs, null, 2);\n } else {\n text = formatLogEntries(selectedLogs);\n }\n\n await navigator.clipboard.writeText(text);\n showCopyPopover(format, selectedLogs.length);\n },\n [logs, showCopyPopover]\n );\n\n const handleRowSelect = useCallback(\n (index: number, event: React.MouseEvent) => {\n if (event.shiftKey) {\n // Prevent text selection during shift-click\n event.preventDefault();\n window.getSelection()?.removeAllRanges();\n\n if (lastSelectedIndex !== null) {\n // Range selection: select all rows between anchor and current\n const start = Math.min(lastSelectedIndex, index);\n const end = Math.max(lastSelectedIndex, index);\n const newSelection = new Set<number>();\n for (let i = start; i <= end; i++) {\n newSelection.add(i);\n }\n setSelectedRows(newSelection);\n } else {\n // No anchor set: just select this row and set as anchor\n const newSelection = new Set([index]);\n setSelectedRows(newSelection);\n setLastSelectedIndex(index);\n }\n } else if (event.ctrlKey || event.metaKey) {\n // Prevent text selection during cmd/ctrl-click\n event.preventDefault();\n window.getSelection()?.removeAllRanges();\n\n // Toggle individual row (additive selection)\n const newSelection = new Set(selectedRows);\n if (newSelection.has(index)) {\n newSelection.delete(index);\n } else {\n newSelection.add(index);\n }\n setSelectedRows(newSelection);\n setLastSelectedIndex(index);\n } else {\n // Plain click: set as anchor for future shift-clicks\n // Don't prevent default to allow text selection\n setLastSelectedIndex(index);\n }\n },\n [selectedRows, lastSelectedIndex]\n );\n\n const renderLogRow = (index: number): ReactNode | null => {\n const log = logs[index];\n if (!log) return null;\n\n const itemActionButtons: ReactNode[] = itemActionsListConfig?.length\n ? getItemActionButtons({ id: index, data: log as unknown as Record<string, unknown> })\n : [];\n\n return (\n <LogRow\n isExpandable={spec.enableDetails}\n log={log}\n index={index}\n isExpanded={expandedRows.has(index)}\n onToggle={onToggleExpand}\n allowWrap={spec.allowWrap}\n showTime={spec.showTime}\n isSelected={selectedRows.has(index)}\n onSelect={handleRowSelect}\n itemActionButtons={itemActionButtons}\n />\n );\n };\n\n const handleCopy = (e: React.ClipboardEvent<HTMLDivElement>): void => {\n const selection = window.getSelection();\n const hasTextSelection = selection && selection.rangeCount > 0 && selection.toString().length > 0;\n\n // If user has text selected, let browser handle it normally\n if (hasTextSelection) {\n return;\n }\n\n // If rows are selected, copy those\n const currentSelectedRows = selectedRowsRef.current;\n if (currentSelectedRows.size > 0) {\n e.preventDefault();\n const selectedLogs = Array.from(currentSelectedRows)\n .sort((a, b) => a - b)\n .map((index) => logs[index])\n .filter((log) => log !== undefined);\n const formattedText = formatLogEntries(selectedLogs);\n e.clipboardData.setData('text/plain', formattedText);\n }\n };\n\n // Keyboard shortcuts for selection\n useEffect(() => {\n const handleKeyDown = async (e: KeyboardEvent): Promise<void> => {\n // Cmd/Ctrl+A: Select all logs\n if ((e.metaKey || e.ctrlKey) && e.key === 'a') {\n e.preventDefault();\n const allIndices = new Set(logs.map((_, index) => index));\n setSelectedRows(allIndices);\n if (logs.length > 0) {\n setLastSelectedIndex(logs.length - 1);\n }\n }\n\n // Cmd/Ctrl+C: Copy selected rows\n if ((e.metaKey || e.ctrlKey) && e.key === 'c') {\n const selection = window.getSelection();\n const hasTextSelection = selection && selection.rangeCount > 0 && selection.toString().length > 0;\n\n // Only handle if we have selected rows and no text selection\n if (selectedRowsRef.current.size > 0 && !hasTextSelection) {\n e.preventDefault();\n const selectedLogs = Array.from(selectedRowsRef.current)\n .sort((a, b) => a - b)\n .map((index) => logs[index])\n .filter((log) => log !== undefined);\n const formattedText = formatLogEntries(selectedLogs);\n await navigator.clipboard.writeText(formattedText);\n showCopyPopover('full', selectedLogs.length);\n }\n }\n\n // Escape: Clear selection\n if (e.key === 'Escape' && selectedRows.size > 0) {\n setSelectedRows(new Set());\n setLastSelectedIndex(null);\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return (): void => {\n window.removeEventListener('keydown', handleKeyDown);\n };\n }, [logs, selectedRows, showCopyPopover]);\n\n // Cleanup timer on unmount\n useEffect(() => {\n return (): void => {\n if (copyPopoverTimerRef.current) {\n window.clearTimeout(copyPopoverTimerRef.current);\n }\n };\n }, []);\n\n return (\n <>\n {confirmDialog}\n <Box\n sx={{\n height: '100%',\n backgroundColor: theme.palette.background.default,\n overflow: 'hidden',\n boxShadow: theme.shadows[1],\n display: 'flex',\n flexDirection: 'column',\n }}\n onCopy={handleCopy}\n >\n {!isHintsDismissed && (\n <Box\n sx={{\n px: 2,\n py: 0.75,\n fontSize: '12px',\n color: theme.palette.text.secondary,\n backgroundColor: theme.palette.background.paper,\n borderBottom: `1px solid ${theme.palette.divider}`,\n display: 'flex',\n alignItems: 'center',\n gap: 2,\n flexShrink: 0,\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 2, flex: 1 }}>\n <Box component=\"span\" sx={{ opacity: 0.8 }}>\n {modKeyDisplay}+Click to select\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.6 }}>\n •\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.8 }}>\n Shift+Click for range\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.6 }}>\n •\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.8 }}>\n {modKeyDisplay}+C to copy\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.6 }}>\n •\n </Box>\n <Box component=\"span\" sx={{ opacity: 0.8 }}>\n Esc to clear\n </Box>\n </Box>\n <IconButton\n size=\"small\"\n onClick={handleDismissHints}\n sx={{\n opacity: 0.6,\n '&:hover': { opacity: 1 },\n padding: 0.5,\n }}\n aria-label=\"Dismiss hints\"\n >\n <CloseIcon sx={{ fontSize: '16px' }} />\n </IconButton>\n </Box>\n )}\n <Virtuoso\n style={{ height: '100%', flexGrow: 1 }}\n initialItemCount={spec.showAll ? logs.length : undefined}\n totalCount={logs.length}\n itemContent={renderLogRow}\n />\n <Popover\n open={Boolean(copyPopoverAnchor)}\n anchorReference=\"anchorPosition\"\n anchorPosition={copyPopoverAnchor ? { top: copyPopoverAnchor.y, left: copyPopoverAnchor.x } : undefined}\n onClose={handleCloseCopyPopover}\n disableScrollLock\n disableAutoFocus\n disableRestoreFocus\n disableEnforceFocus\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n slotProps={{\n paper: {\n sx: {\n px: 2,\n py: 1.5,\n boxShadow: theme.shadows[8],\n borderRadius: 2,\n pointerEvents: 'auto',\n },\n },\n }}\n sx={{\n pointerEvents: 'none',\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>\n <Box\n sx={{\n fontSize: '14px',\n color: theme.palette.text.primary,\n fontWeight: 500,\n display: 'flex',\n alignItems: 'center',\n gap: 0.5,\n }}\n >\n ✓ Copied {lastCopiedCount} {lastCopiedCount === 1 ? 'log' : 'logs'} as{' '}\n <Box\n component=\"span\"\n sx={{ color: theme.palette.primary.main, minWidth: '60px', display: 'inline-block' }}\n >\n {lastCopiedFormat === 'full' ? 'Full' : lastCopiedFormat === 'message' ? 'Message' : 'JSON'}\n </Box>\n </Box>\n <ButtonGroup size=\"small\" variant=\"outlined\">\n <Button\n onClick={() => handleCopyInFormat('full')}\n sx={{\n fontSize: '12px',\n textTransform: 'none',\n minWidth: '52px',\n fontWeight: lastCopiedFormat === 'full' ? 600 : 400,\n bgcolor: lastCopiedFormat === 'full' ? theme.palette.action.selected : 'transparent',\n }}\n >\n Full\n </Button>\n <Button\n onClick={() => handleCopyInFormat('message')}\n sx={{\n fontSize: '12px',\n textTransform: 'none',\n minWidth: '74px',\n fontWeight: lastCopiedFormat === 'message' ? 600 : 400,\n bgcolor: lastCopiedFormat === 'message' ? theme.palette.action.selected : 'transparent',\n }}\n >\n Message\n </Button>\n <Button\n onClick={() => handleCopyInFormat('json')}\n sx={{\n fontSize: '12px',\n textTransform: 'none',\n minWidth: '52px',\n fontWeight: lastCopiedFormat === 'json' ? 600 : 400,\n bgcolor: lastCopiedFormat === 'json' ? theme.palette.action.selected : 'transparent',\n }}\n >\n JSON\n </Button>\n </ButtonGroup>\n </Box>\n </Popover>\n </Box>\n </>\n );\n};\n"],"names":["React","useCallback","useState","useEffect","useRef","Box","useTheme","Popover","Button","ButtonGroup","IconButton","CloseIcon","Virtuoso","useSelection","formatForDisplay","useSelectionItemActions","useAllVariableValues","formatLogEntries","formatLogMessage","LogRow","PERSES_LOGSTABLE_HINTS_DISMISSED","COPY_TOAST_DURATION_MS","modKeyDisplay","VirtualizedLogsList","logs","spec","expandedRows","onToggleExpand","theme","selectedRows","setSelectedRows","Set","lastSelectedIndex","setLastSelectedIndex","selectedRowsRef","copyPopoverAnchor","setCopyPopoverAnchor","lastCopiedFormat","setLastCopiedFormat","lastCopiedCount","setLastCopiedCount","copyPopoverTimerRef","isHintsDismissed","setIsHintsDismissed","localStorage","getItem","selectionEnabled","selection","enabled","setSelection","clearSelection","allVariables","itemActionsConfig","actions","undefined","itemActionsListConfig","displayWithItem","actionsList","getItemActionButtons","confirmDialog","variableState","current","size","selectionItems","Array","from","map","index","log","id","item","filter","entry","handleDismissHints","setItem","showCopyPopover","format","count","x","window","innerWidth","y","innerHeight","clearTimeout","setTimeout","handleCloseCopyPopover","handleCopyInFormat","selectedLogs","sort","a","b","text","join","JSON","stringify","navigator","clipboard","writeText","length","handleRowSelect","event","shiftKey","preventDefault","getSelection","removeAllRanges","start","Math","min","end","max","newSelection","i","add","ctrlKey","metaKey","has","delete","renderLogRow","itemActionButtons","data","isExpandable","enableDetails","isExpanded","onToggle","allowWrap","showTime","isSelected","onSelect","handleCopy","e","hasTextSelection","rangeCount","toString","currentSelectedRows","formattedText","clipboardData","setData","handleKeyDown","key","allIndices","_","addEventListener","removeEventListener","sx","height","backgroundColor","palette","background","default","overflow","boxShadow","shadows","display","flexDirection","onCopy","px","py","fontSize","color","secondary","paper","borderBottom","divider","alignItems","gap","flexShrink","flex","component","opacity","onClick","padding","aria-label","style","flexGrow","initialItemCount","showAll","totalCount","itemContent","open","Boolean","anchorReference","anchorPosition","top","left","onClose","disableScrollLock","disableAutoFocus","disableRestoreFocus","disableEnforceFocus","anchorOrigin","vertical","horizontal","transformOrigin","slotProps","borderRadius","pointerEvents","primary","fontWeight","main","minWidth","variant","textTransform","bgcolor","action","selected"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,SAASC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAmB,QAAQ;AACnF,SAASC,GAAG,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,EAAEC,WAAW,EAAEC,UAAU,QAAQ,gBAAgB;AACxF,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,gBAAgB,EAAEC,uBAAuB,QAAQ,yBAAyB;AACnF,SAAwBC,oBAAoB,QAAQ,4BAA4B;AAEhF,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,uBAAuB;AAE1E,SAASC,MAAM,QAAQ,WAAW;AAElC,MAAMC,mCAAmC;AACzC,MAAMC,yBAAyB;AAE/B,wEAAwE;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sH,OAAO,CAACyD,MAAM,CAACC,QAAQ,GAAG;4CACzE;sDACD;;;;;;;;;;;AASf,EAAE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface UseExpandedRowsReturn {
|
|
2
2
|
expandedRows: Set<number>;
|
|
3
3
|
toggleExpand: (index: number) => void;
|
|
4
4
|
clearExpanded: () => void;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
|
+
export declare const useExpandedRows: () => UseExpandedRowsReturn;
|
|
6
7
|
//# sourceMappingURL=useExpandedRows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExpandedRows.d.ts","sourceRoot":"","sources":["../../../../src/components/hooks/useExpandedRows.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"useExpandedRows.d.ts","sourceRoot":"","sources":["../../../../src/components/hooks/useExpandedRows.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,QAAO,qBAwBlC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/hooks/useExpandedRows.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useState, useCallback } from 'react';\n\nexport const useExpandedRows = () => {\n const [expandedRows, setExpandedRows] = useState<Set<number>>(new Set());\n\n const toggleExpand = useCallback((index: number) => {\n setExpandedRows((prev) => {\n const newSet = new Set(prev);\n if (newSet.has(index)) {\n newSet.delete(index);\n } else {\n newSet.add(index);\n }\n return newSet;\n });\n }, []);\n\n const clearExpanded = useCallback(() => {\n setExpandedRows(new Set());\n }, []);\n\n return {\n expandedRows,\n toggleExpand,\n clearExpanded,\n };\n};\n"],"names":["useState","useCallback","useExpandedRows","expandedRows","setExpandedRows","Set","toggleExpand","index","prev","newSet","has","delete","add","clearExpanded"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,EAAEC,WAAW,QAAQ,QAAQ;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/hooks/useExpandedRows.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useState, useCallback } from 'react';\n\nexport interface UseExpandedRowsReturn {\n expandedRows: Set<number>;\n toggleExpand: (index: number) => void;\n clearExpanded: () => void;\n}\n\nexport const useExpandedRows = (): UseExpandedRowsReturn => {\n const [expandedRows, setExpandedRows] = useState<Set<number>>(new Set());\n\n const toggleExpand = useCallback((index: number) => {\n setExpandedRows((prev) => {\n const newSet = new Set(prev);\n if (newSet.has(index)) {\n newSet.delete(index);\n } else {\n newSet.add(index);\n }\n return newSet;\n });\n }, []);\n\n const clearExpanded = useCallback(() => {\n setExpandedRows(new Set());\n }, []);\n\n return {\n expandedRows,\n toggleExpand,\n clearExpanded,\n };\n};\n"],"names":["useState","useCallback","useExpandedRows","expandedRows","setExpandedRows","Set","toggleExpand","index","prev","newSet","has","delete","add","clearExpanded"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,EAAEC,WAAW,QAAQ,QAAQ;AAQ9C,OAAO,MAAMC,kBAAkB;IAC7B,MAAM,CAACC,cAAcC,gBAAgB,GAAGJ,SAAsB,IAAIK;IAElE,MAAMC,eAAeL,YAAY,CAACM;QAChCH,gBAAgB,CAACI;YACf,MAAMC,SAAS,IAAIJ,IAAIG;YACvB,IAAIC,OAAOC,GAAG,CAACH,QAAQ;gBACrBE,OAAOE,MAAM,CAACJ;YAChB,OAAO;gBACLE,OAAOG,GAAG,CAACL;YACb;YACA,OAAOE;QACT;IACF,GAAG,EAAE;IAEL,MAAMI,gBAAgBZ,YAAY;QAChCG,gBAAgB,IAAIC;IACtB,GAAG,EAAE;IAEL,OAAO;QACLF;QACAG;QACAO;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSeverity.d.ts","sourceRoot":"","sources":["../../../../src/components/hooks/useSeverity.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,eAAO,MAAM,gBAAgB,GAAI,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"useSeverity.d.ts","sourceRoot":"","sources":["../../../../src/components/hooks/useSeverity.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,eAAO,MAAM,gBAAgB,GAAI,MAAM,QAAQ,KAAG,MAuBjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/hooks/useSeverity.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useTheme } from '@mui/material';\nimport { LogEntry } from '@perses-dev/
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/hooks/useSeverity.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useTheme } from '@mui/material';\nimport { LogEntry } from '@perses-dev/spec';\nimport { getSeverity } from '../utils';\n\nexport const useSeverityColor = (log?: LogEntry): string => {\n const theme = useTheme();\n if (!log) {\n return theme.palette.text.secondary;\n }\n const severity = getSeverity(log);\n\n switch (severity) {\n case 'critical':\n return theme.palette.error.dark;\n case 'error':\n return theme.palette.error.main;\n case 'warning':\n return theme.palette.warning.main;\n case 'info':\n return theme.palette.info.main;\n case 'debug':\n return theme.palette.primary.main;\n case 'trace':\n return theme.palette.grey[500];\n default:\n return theme.palette.text.secondary;\n }\n};\n"],"names":["useTheme","getSeverity","useSeverityColor","log","theme","palette","text","secondary","severity","error","dark","main","warning","info","primary","grey"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,QAAQ,gBAAgB;AAEzC,SAASC,WAAW,QAAQ,WAAW;AAEvC,OAAO,MAAMC,mBAAmB,CAACC;IAC/B,MAAMC,QAAQJ;IACd,IAAI,CAACG,KAAK;QACR,OAAOC,MAAMC,OAAO,CAACC,IAAI,CAACC,SAAS;IACrC;IACA,MAAMC,WAAWP,YAAYE;IAE7B,OAAQK;QACN,KAAK;YACH,OAAOJ,MAAMC,OAAO,CAACI,KAAK,CAACC,IAAI;QACjC,KAAK;YACH,OAAON,MAAMC,OAAO,CAACI,KAAK,CAACE,IAAI;QACjC,KAAK;YACH,OAAOP,MAAMC,OAAO,CAACO,OAAO,CAACD,IAAI;QACnC,KAAK;YACH,OAAOP,MAAMC,OAAO,CAACQ,IAAI,CAACF,IAAI;QAChC,KAAK;YACH,OAAOP,MAAMC,OAAO,CAACS,OAAO,CAACH,IAAI;QACnC,KAAK;YACH,OAAOP,MAAMC,OAAO,CAACU,IAAI,CAAC,IAAI;QAChC;YACE,OAAOX,MAAMC,OAAO,CAACC,IAAI,CAACC,SAAS;IACvC;AACF,EAAE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogEntry } from '@perses-dev/
|
|
1
|
+
import { LogEntry } from '@perses-dev/spec';
|
|
2
2
|
export type Severity = 'critical' | 'error' | 'warning' | 'info' | 'debug' | 'trace' | 'unknown' | 'other';
|
|
3
3
|
export declare const severityAbbreviations: Record<Severity, string[]>;
|
|
4
4
|
export declare const getSeverity: (log: LogEntry) => Severity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LogEntry } from '@perses-dev/
|
|
1
|
+
{"version":3,"sources":["../../../src/components/utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LogEntry } from '@perses-dev/spec';\n\nexport type Severity = 'critical' | 'error' | 'warning' | 'info' | 'debug' | 'trace' | 'unknown' | 'other';\n\nexport const severityAbbreviations: Record<Severity, string[]> = {\n critical: ['critical', 'emerg', 'fatal', 'alert', 'crit'],\n error: ['error', 'err', 'eror'],\n debug: ['debug', 'dbug'],\n info: ['info', 'inf', 'information', 'notice'],\n trace: ['trace'],\n warning: ['warn', 'warning'],\n unknown: ['unknown'],\n other: [''],\n};\n\nexport const getSeverity = (log: LogEntry): Severity => {\n const level = log.labels?.level?.toLowerCase();\n\n if (level) {\n for (const [severity, abbreviations] of Object.entries(severityAbbreviations)) {\n if (abbreviations.some((abbr) => abbr && level.includes(abbr))) {\n return severity as Severity;\n }\n }\n }\n\n return 'unknown';\n};\n"],"names":["severityAbbreviations","critical","error","debug","info","trace","warning","unknown","other","getSeverity","log","level","labels","toLowerCase","severity","abbreviations","Object","entries","some","abbr","includes"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC,OAAO,MAAMA,wBAAoD;IAC/DC,UAAU;QAAC;QAAY;QAAS;QAAS;QAAS;KAAO;IACzDC,OAAO;QAAC;QAAS;QAAO;KAAO;IAC/BC,OAAO;QAAC;QAAS;KAAO;IACxBC,MAAM;QAAC;QAAQ;QAAO;QAAe;KAAS;IAC9CC,OAAO;QAAC;KAAQ;IAChBC,SAAS;QAAC;QAAQ;KAAU;IAC5BC,SAAS;QAAC;KAAU;IACpBC,OAAO;QAAC;KAAG;AACb,EAAE;AAEF,OAAO,MAAMC,cAAc,CAACC;IAC1B,MAAMC,QAAQD,IAAIE,MAAM,EAAED,OAAOE;IAEjC,IAAIF,OAAO;QACT,KAAK,MAAM,CAACG,UAAUC,cAAc,IAAIC,OAAOC,OAAO,CAACjB,uBAAwB;YAC7E,IAAIe,cAAcG,IAAI,CAAC,CAACC,OAASA,QAAQR,MAAMS,QAAQ,CAACD,QAAQ;gBAC9D,OAAOL;YACT;QACF;IACF;IAEA,OAAO;AACT,EAAE"}
|
package/lib/model.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThresholdOptions } from '@perses-dev/components';
|
|
2
2
|
import { PanelProps, LegendSpecOptions, SelectionOptions, OptionsEditorProps, ActionOptions } from '@perses-dev/plugin-system';
|
|
3
|
+
import { LogData } from '@perses-dev/spec';
|
|
3
4
|
export type LogsTableProps = PanelProps<LogsTableOptions, LogsQueryData>;
|
|
4
5
|
export interface LogsQueryData {
|
|
5
6
|
logs?: LogData;
|
package/lib/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,MAAM,4BAA4B,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC"}
|
package/lib/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/model.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ThresholdOptions } from '@perses-dev/components';\nimport {\n PanelProps,\n LegendSpecOptions,\n SelectionOptions,\n OptionsEditorProps,\n ActionOptions,\n} from '@perses-dev/plugin-system';\nimport { LogData } from '@perses-dev/spec';\n\nexport type LogsTableProps = PanelProps<LogsTableOptions, LogsQueryData>;\n\nexport interface LogsQueryData {\n logs?: LogData;\n}\n\nexport interface LogsTableOptions {\n legend?: LegendSpecOptions;\n thresholds?: ThresholdOptions;\n allowWrap?: boolean;\n enableDetails?: boolean;\n showTime?: boolean;\n showAll?: boolean;\n selection?: SelectionOptions;\n actions?: ActionOptions;\n}\n\nexport type LogsTableSettingsEditorProps = OptionsEditorProps<LogsTableOptions>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA6BjC,WAAgF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../../../src/utils/ansi.ts"],"names":[],"mappings":"AAsBA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS/D;AAID,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { AnsiUp } from 'ansi_up';
|
|
14
|
+
import DOMPurify from 'dompurify';
|
|
15
|
+
const ansiUp = new AnsiUp();
|
|
16
|
+
ansiUp.use_classes = true;
|
|
17
|
+
const ESC = String.fromCharCode(27);
|
|
18
|
+
const ANSI_REGEX = new RegExp(ESC + '\\[[0-9;]*m');
|
|
19
|
+
export function ansiToSanitizedHtml(text) {
|
|
20
|
+
if (!ANSI_REGEX.test(text)) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const html = ansiUp.ansi_to_html(text);
|
|
24
|
+
return DOMPurify.sanitize(html, {
|
|
25
|
+
ALLOWED_TAGS: [
|
|
26
|
+
'span'
|
|
27
|
+
],
|
|
28
|
+
ALLOWED_ATTR: [
|
|
29
|
+
'class',
|
|
30
|
+
'style'
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const ANSI_STRIP_REGEX = new RegExp(ESC + '\\[[0-9;]*m', 'g');
|
|
35
|
+
export function stripAnsi(text) {
|
|
36
|
+
return text.replace(ANSI_STRIP_REGEX, '');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=ansi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/ansi.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { AnsiUp } from 'ansi_up';\nimport DOMPurify from 'dompurify';\n\nconst ansiUp = new AnsiUp();\nansiUp.use_classes = true;\n\nconst ESC = String.fromCharCode(27);\nconst ANSI_REGEX = new RegExp(ESC + '\\\\[[0-9;]*m');\n\nexport function ansiToSanitizedHtml(text: string): string | null {\n if (!ANSI_REGEX.test(text)) {\n return null;\n }\n const html = ansiUp.ansi_to_html(text);\n return DOMPurify.sanitize(html, {\n ALLOWED_TAGS: ['span'],\n ALLOWED_ATTR: ['class', 'style'],\n });\n}\n\nconst ANSI_STRIP_REGEX = new RegExp(ESC + '\\\\[[0-9;]*m', 'g');\n\nexport function stripAnsi(text: string): string {\n return text.replace(ANSI_STRIP_REGEX, '');\n}\n"],"names":["AnsiUp","DOMPurify","ansiUp","use_classes","ESC","String","fromCharCode","ANSI_REGEX","RegExp","ansiToSanitizedHtml","text","test","html","ansi_to_html","sanitize","ALLOWED_TAGS","ALLOWED_ATTR","ANSI_STRIP_REGEX","stripAnsi","replace"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAQ,UAAU;AACjC,OAAOC,eAAe,YAAY;AAElC,MAAMC,SAAS,IAAIF;AACnBE,OAAOC,WAAW,GAAG;AAErB,MAAMC,MAAMC,OAAOC,YAAY,CAAC;AAChC,MAAMC,aAAa,IAAIC,OAAOJ,MAAM;AAEpC,OAAO,SAASK,oBAAoBC,IAAY;IAC9C,IAAI,CAACH,WAAWI,IAAI,CAACD,OAAO;QAC1B,OAAO;IACT;IACA,MAAME,OAAOV,OAAOW,YAAY,CAACH;IACjC,OAAOT,UAAUa,QAAQ,CAACF,MAAM;QAC9BG,cAAc;YAAC;SAAO;QACtBC,cAAc;YAAC;YAAS;SAAQ;IAClC;AACF;AAEA,MAAMC,mBAAmB,IAAIT,OAAOJ,MAAM,eAAe;AAEzD,OAAO,SAASc,UAAUR,IAAY;IACpC,OAAOA,KAAKS,OAAO,CAACF,kBAAkB;AACxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyHelpers.d.ts","sourceRoot":"","sources":["../../../src/utils/copyHelpers.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"copyHelpers.d.ts","sourceRoot":"","sources":["../../../src/utils/copyHelpers.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAGlE;AASD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAInE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAKpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAEtD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,CAEzD"}
|
package/lib/utils/copyHelpers.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
import { stripAnsi } from './ansi';
|
|
13
14
|
/**
|
|
14
15
|
* Formats a timestamp for display in copied text
|
|
15
16
|
*/ export function formatTimestamp(timestamp) {
|
|
@@ -34,12 +35,13 @@
|
|
|
34
35
|
*/ export function formatLogEntry(log) {
|
|
35
36
|
const timestamp = formatTimestamp(log.timestamp);
|
|
36
37
|
const labels = formatLabels(log.labels || {});
|
|
37
|
-
|
|
38
|
+
const cleanLine = stripAnsi(log.line);
|
|
39
|
+
return labels ? `${timestamp} ${labels} ${cleanLine}` : `${timestamp} ${cleanLine}`;
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* Formats just the log message text (no timestamp or labels)
|
|
41
43
|
*/ export function formatLogMessage(log) {
|
|
42
|
-
return log.line;
|
|
44
|
+
return stripAnsi(log.line);
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
47
|
* Formats a log entry as JSON
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/copyHelpers.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LogEntry } from '@perses-dev/
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/copyHelpers.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LogEntry } from '@perses-dev/spec';\nimport { stripAnsi } from './ansi';\n\n/**\n * Formats a timestamp for display in copied text\n */\nexport function formatTimestamp(timestamp: number | string): string {\n const date = typeof timestamp === 'number' ? new Date(timestamp * 1000) : parseTimestamp(timestamp);\n return date.toISOString();\n}\n\n/**\n * Parses a timestamp string to a Date object\n */\nfunction parseTimestamp(timestamp: string): Date {\n return /^\\d+$/.test(timestamp) ? new Date(parseInt(timestamp) * 1000) : new Date(Date.parse(timestamp));\n}\n\n/**\n * Formats labels as key=value pairs\n */\nexport function formatLabels(labels: Record<string, string>): string {\n const entries = Object.entries(labels);\n if (entries.length === 0) return '';\n return entries.map(([key, value]) => `${key}=\"${value}\"`).join(' ');\n}\n\n/**\n * Formats a single log entry as plain text for copying\n * Format: {timestamp} {labels} {message}\n */\nexport function formatLogEntry(log: LogEntry): string {\n const timestamp = formatTimestamp(log.timestamp);\n const labels = formatLabels(log.labels || {});\n const cleanLine = stripAnsi(log.line);\n return labels ? `${timestamp} ${labels} ${cleanLine}` : `${timestamp} ${cleanLine}`;\n}\n\n/**\n * Formats just the log message text (no timestamp or labels)\n */\nexport function formatLogMessage(log: LogEntry): string {\n return stripAnsi(log.line);\n}\n\n/**\n * Formats a log entry as JSON\n */\nexport function formatLogAsJson(log: LogEntry): string {\n return JSON.stringify(log, null, 2);\n}\n\n/**\n * Formats multiple log entries as plain text for copying\n * Each log entry is on its own line\n */\nexport function formatLogEntries(logs: LogEntry[]): string {\n return logs.map(formatLogEntry).join('\\n');\n}\n"],"names":["stripAnsi","formatTimestamp","timestamp","date","Date","parseTimestamp","toISOString","test","parseInt","parse","formatLabels","labels","entries","Object","length","map","key","value","join","formatLogEntry","log","cleanLine","line","formatLogMessage","formatLogAsJson","JSON","stringify","formatLogEntries","logs"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE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