@perses-dev/logs-table-plugin 0.3.0 → 0.4.0-beta.1

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.
Files changed (202) hide show
  1. package/__mf/js/{LogsTable.f8cdc769.js → LogsTable.5f90fc7a.js} +3 -3
  2. package/__mf/js/async/10.bcca0993.js +1 -0
  3. package/__mf/js/async/121.0b393209.js +2 -0
  4. package/__mf/js/async/141.32e969e2.js +1 -0
  5. package/__mf/js/async/192.fc13839d.js +1 -0
  6. package/__mf/js/async/2.9fe1a207.js +1 -0
  7. package/__mf/js/async/205.68d26c79.js +1 -0
  8. package/__mf/js/async/235.b7fd9fbd.js +1 -0
  9. package/__mf/js/async/274.2b0ee3e5.js +2 -0
  10. package/__mf/js/async/356.2f0b1efb.js +1 -0
  11. package/__mf/js/async/358.d7e737b5.js +111 -0
  12. package/__mf/js/async/392.ed78da9c.js +2 -0
  13. package/__mf/js/async/413.22923ee3.js +1 -0
  14. package/__mf/js/async/432.481e486b.js +1 -0
  15. package/__mf/js/async/458.84b877ba.js +1 -0
  16. package/__mf/js/async/470.3af71569.js +2 -0
  17. package/__mf/js/async/522.0ab2b630.js +1 -0
  18. package/__mf/js/async/587.7956e241.js +1 -0
  19. package/__mf/js/async/597.a6830f1c.js +2 -0
  20. package/__mf/js/async/608.79199272.js +1 -0
  21. package/__mf/js/async/612.265f875c.js +3 -0
  22. package/__mf/js/async/616.04a2fde6.js +1 -0
  23. package/__mf/js/async/634.f0773d52.js +2 -0
  24. package/__mf/js/async/663.0b1c854a.js +1 -0
  25. package/__mf/js/async/705.d5f9313a.js +22 -0
  26. package/__mf/js/async/72.be3fbcf8.js +7 -0
  27. package/__mf/js/async/72.be3fbcf8.js.LICENSE.txt +102 -0
  28. package/__mf/js/async/77.8b8e4afd.js +1 -0
  29. package/__mf/js/async/802.f980a2b2.js +1 -0
  30. package/__mf/js/async/923.60207cc2.js +1 -0
  31. package/__mf/js/async/941.1064117a.js +2 -0
  32. package/__mf/js/async/968.21668c0c.js +1 -0
  33. package/__mf/js/async/985.5af87994.js +37 -0
  34. package/__mf/js/async/__federation_expose_LogsTable.c8f94043.js +1 -0
  35. package/__mf/js/async/lib-router.edb1af73.js +2 -0
  36. package/__mf/js/{main.4253925a.js → main.e5de84d3.js} +3 -3
  37. package/lib/LogsTable.d.ts +2 -2
  38. package/lib/LogsTable.d.ts.map +1 -1
  39. package/lib/LogsTable.js +5 -5
  40. package/lib/LogsTable.js.map +1 -1
  41. package/lib/LogsTableComponent.d.ts +2 -2
  42. package/lib/LogsTableComponent.d.ts.map +1 -1
  43. package/lib/LogsTableComponent.js +4 -4
  44. package/lib/LogsTableComponent.js.map +1 -1
  45. package/lib/LogsTableCsvExportAction.d.ts +2 -2
  46. package/lib/LogsTableCsvExportAction.d.ts.map +1 -1
  47. package/lib/LogsTableCsvExportAction.js +7 -7
  48. package/lib/LogsTableCsvExportAction.js.map +1 -1
  49. package/lib/LogsTableExportAction.d.ts +1 -1
  50. package/lib/LogsTableExportAction.d.ts.map +1 -1
  51. package/lib/LogsTableExportAction.js +5 -5
  52. package/lib/LogsTableExportAction.js.map +1 -1
  53. package/lib/LogsTableItemSelectionActionsEditor.d.ts +2 -2
  54. package/lib/LogsTableItemSelectionActionsEditor.d.ts.map +1 -1
  55. package/lib/LogsTableItemSelectionActionsEditor.js +2 -2
  56. package/lib/LogsTableItemSelectionActionsEditor.js.map +1 -1
  57. package/lib/LogsTablePanel.d.ts +2 -2
  58. package/lib/LogsTablePanel.d.ts.map +1 -1
  59. package/lib/LogsTablePanel.js +3 -3
  60. package/lib/LogsTablePanel.js.map +1 -1
  61. package/lib/LogsTableSettingsEditor.d.ts +3 -3
  62. package/lib/LogsTableSettingsEditor.d.ts.map +1 -1
  63. package/lib/LogsTableSettingsEditor.js +3 -3
  64. package/lib/LogsTableSettingsEditor.js.map +1 -1
  65. package/lib/bootstrap.js +2 -2
  66. package/lib/components/EmptyLogsState.d.ts.map +1 -1
  67. package/lib/components/EmptyLogsState.js +2 -2
  68. package/lib/components/EmptyLogsState.js.map +1 -1
  69. package/lib/components/LogRow/LogDetailsTable.d.ts +2 -2
  70. package/lib/components/LogRow/LogDetailsTable.d.ts.map +1 -1
  71. package/lib/components/LogRow/LogDetailsTable.js +4 -4
  72. package/lib/components/LogRow/LogDetailsTable.js.map +1 -1
  73. package/lib/components/LogRow/LogRow.d.ts +3 -2
  74. package/lib/components/LogRow/LogRow.d.ts.map +1 -1
  75. package/lib/components/LogRow/LogRow.js +15 -15
  76. package/lib/components/LogRow/LogRow.js.map +1 -1
  77. package/lib/components/LogRow/LogTimestamp.js +1 -1
  78. package/lib/components/LogRow/LogsStyles.d.ts.map +1 -1
  79. package/lib/components/LogRow/LogsStyles.js +2 -2
  80. package/lib/components/LogRow/LogsStyles.js.map +1 -1
  81. package/lib/components/LogRow/index.js +2 -2
  82. package/lib/components/LogRow/index.js.map +1 -1
  83. package/lib/components/LogsList.d.ts +2 -2
  84. package/lib/components/LogsList.d.ts.map +1 -1
  85. package/lib/components/LogsList.js +5 -5
  86. package/lib/components/LogsList.js.map +1 -1
  87. package/lib/components/VirtualizedLogsList.d.ts +2 -2
  88. package/lib/components/VirtualizedLogsList.d.ts.map +1 -1
  89. package/lib/components/VirtualizedLogsList.js +18 -13
  90. package/lib/components/VirtualizedLogsList.js.map +1 -1
  91. package/lib/components/hooks/useExpandedRows.js +1 -1
  92. package/lib/components/hooks/useSeverity.d.ts +1 -1
  93. package/lib/components/hooks/useSeverity.d.ts.map +1 -1
  94. package/lib/components/hooks/useSeverity.js +2 -2
  95. package/lib/components/hooks/useSeverity.js.map +1 -1
  96. package/lib/components/utils.d.ts +1 -1
  97. package/lib/components/utils.d.ts.map +1 -1
  98. package/lib/components/utils.js.map +1 -1
  99. package/lib/getPluginModule.d.ts +1 -1
  100. package/lib/getPluginModule.d.ts.map +1 -1
  101. package/lib/getPluginModule.js +3 -1
  102. package/lib/getPluginModule.js.map +1 -1
  103. package/lib/index-federation.js +1 -1
  104. package/lib/index.js +3 -3
  105. package/lib/index.js.map +1 -1
  106. package/lib/model.d.ts +3 -3
  107. package/lib/model.d.ts.map +1 -1
  108. package/lib/model.js.map +1 -1
  109. package/lib/setup-tests.d.ts +1 -1
  110. package/lib/setup-tests.d.ts.map +1 -1
  111. package/lib/setup-tests.js +2 -2
  112. package/lib/setup-tests.js.map +1 -1
  113. package/lib/test/mock-query-results.d.ts +1 -1
  114. package/lib/test/mock-query-results.d.ts.map +1 -1
  115. package/lib/test/mock-query-results.js.map +1 -1
  116. package/lib/utils/ansi.js +2 -2
  117. package/lib/utils/copyHelpers.d.ts +1 -1
  118. package/lib/utils/copyHelpers.d.ts.map +1 -1
  119. package/lib/utils/copyHelpers.js +1 -1
  120. package/lib/utils/copyHelpers.js.map +1 -1
  121. package/mf-manifest.json +43 -86
  122. package/mf-stats.json +43 -94
  123. package/package.json +11 -11
  124. package/__mf/js/async/1603.89bfb1ad.js +0 -2
  125. package/__mf/js/async/1616.c3be409a.js +0 -1
  126. package/__mf/js/async/2043.dba84aa4.js +0 -2
  127. package/__mf/js/async/2043.dba84aa4.js.LICENSE.txt +0 -24
  128. package/__mf/js/async/2546.6b3aab40.js +0 -3
  129. package/__mf/js/async/2842.610cb74b.js +0 -1
  130. package/__mf/js/async/304.21c30c64.js +0 -37
  131. package/__mf/js/async/3332.ab0338e8.js +0 -7
  132. package/__mf/js/async/3332.ab0338e8.js.LICENSE.txt +0 -39
  133. package/__mf/js/async/392.5cb44640.js +0 -2
  134. package/__mf/js/async/4077.32e3919d.js +0 -1
  135. package/__mf/js/async/4121.d4c9b3e3.js +0 -2
  136. package/__mf/js/async/4869.80345aa7.js +0 -1
  137. package/__mf/js/async/5002.1d6e3559.js +0 -1
  138. package/__mf/js/async/5071.be3352f1.js +0 -1
  139. package/__mf/js/async/5587.9e49a823.js +0 -1
  140. package/__mf/js/async/6274.fe68ed99.js +0 -2
  141. package/__mf/js/async/6458.de33906b.js +0 -1
  142. package/__mf/js/async/7177.8dd90707.js +0 -1
  143. package/__mf/js/async/7192.017cbe40.js +0 -1
  144. package/__mf/js/async/7250.05494519.js +0 -1
  145. package/__mf/js/async/7413.c2661694.js +0 -1
  146. package/__mf/js/async/7445.009cf084.js +0 -110
  147. package/__mf/js/async/7968.ec249f6f.js +0 -1
  148. package/__mf/js/async/7978.026a8b19.js +0 -1
  149. package/__mf/js/async/8356.f736e620.js +0 -1
  150. package/__mf/js/async/8470.f0bbed7d.js +0 -2
  151. package/__mf/js/async/8542.aa0c5fe3.js +0 -1
  152. package/__mf/js/async/8608.618e49dc.js +0 -1
  153. package/__mf/js/async/8634.231e1601.js +0 -2
  154. package/__mf/js/async/873.4fd8a061.js +0 -1
  155. package/__mf/js/async/8964.3e308de6.js +0 -2
  156. package/__mf/js/async/8964.3e308de6.js.LICENSE.txt +0 -37
  157. package/__mf/js/async/9126.a313fc37.js +0 -22
  158. package/__mf/js/async/9235.b68f4586.js +0 -1
  159. package/__mf/js/async/9293.ee3265d4.js +0 -2
  160. package/__mf/js/async/941.ad1062bb.js +0 -2
  161. package/__mf/js/async/9588.b214b983.js +0 -1
  162. package/__mf/js/async/__federation_expose_LogsTable.e6a243de.js +0 -1
  163. package/__mf/js/async/lib-router.c5e3aef3.js +0 -2
  164. package/lib/cjs/LogsTable.js +0 -58
  165. package/lib/cjs/LogsTableComponent.js +0 -47
  166. package/lib/cjs/LogsTableCsvExportAction.js +0 -124
  167. package/lib/cjs/LogsTableExportAction.js +0 -80
  168. package/lib/cjs/LogsTableItemSelectionActionsEditor.js +0 -44
  169. package/lib/cjs/LogsTablePanel.js +0 -42
  170. package/lib/cjs/LogsTableSettingsEditor.js +0 -57
  171. package/lib/cjs/bootstrap.js +0 -26
  172. package/lib/cjs/components/EmptyLogsState.js +0 -49
  173. package/lib/cjs/components/LogRow/LogDetailsTable.js +0 -126
  174. package/lib/cjs/components/LogRow/LogRow.js +0 -421
  175. package/lib/cjs/components/LogRow/LogTimestamp.js +0 -44
  176. package/lib/cjs/components/LogRow/LogsStyles.js +0 -87
  177. package/lib/cjs/components/LogRow/index.js +0 -37
  178. package/lib/cjs/components/LogsList.js +0 -44
  179. package/lib/cjs/components/VirtualizedLogsList.js +0 -547
  180. package/lib/cjs/components/hooks/useExpandedRows.js +0 -45
  181. package/lib/cjs/components/hooks/useSeverity.js +0 -47
  182. package/lib/cjs/components/utils.js +0 -78
  183. package/lib/cjs/env.d.js +0 -14
  184. package/lib/cjs/getPluginModule.js +0 -39
  185. package/lib/cjs/index-federation.js +0 -55
  186. package/lib/cjs/index.js +0 -38
  187. package/lib/cjs/model.js +0 -16
  188. package/lib/cjs/setup-tests.js +0 -19
  189. package/lib/cjs/test/mock-query-results.js +0 -133
  190. package/lib/cjs/utils/ansi.js +0 -60
  191. package/lib/cjs/utils/copyHelpers.js +0 -72
  192. /package/__mf/css/async/{3332.85c2cbf6.css → 72.85c2cbf6.css} +0 -0
  193. /package/__mf/js/async/{4121.d4c9b3e3.js.LICENSE.txt → 121.0b393209.js.LICENSE.txt} +0 -0
  194. /package/__mf/js/async/{6274.fe68ed99.js.LICENSE.txt → 274.2b0ee3e5.js.LICENSE.txt} +0 -0
  195. /package/__mf/js/async/{7445.009cf084.js.LICENSE.txt → 358.d7e737b5.js.LICENSE.txt} +0 -0
  196. /package/__mf/js/async/{392.5cb44640.js.LICENSE.txt → 392.ed78da9c.js.LICENSE.txt} +0 -0
  197. /package/__mf/js/async/{8470.f0bbed7d.js.LICENSE.txt → 470.3af71569.js.LICENSE.txt} +0 -0
  198. /package/__mf/js/async/{1603.89bfb1ad.js.LICENSE.txt → 597.a6830f1c.js.LICENSE.txt} +0 -0
  199. /package/__mf/js/async/{8634.231e1601.js.LICENSE.txt → 634.f0773d52.js.LICENSE.txt} +0 -0
  200. /package/__mf/js/async/{9126.a313fc37.js.LICENSE.txt → 705.d5f9313a.js.LICENSE.txt} +0 -0
  201. /package/__mf/js/async/{941.ad1062bb.js.LICENSE.txt → 941.1064117a.js.LICENSE.txt} +0 -0
  202. /package/__mf/js/async/{lib-router.c5e3aef3.js.LICENSE.txt → lib-router.edb1af73.js.LICENSE.txt} +0 -0
@@ -1,547 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "VirtualizedLogsList", {
18
- enumerable: true,
19
- get: function() {
20
- return VirtualizedLogsList;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
25
- const _material = require("@mui/material");
26
- const _Close = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Close"));
27
- const _reactvirtuoso = require("react-virtuoso");
28
- const _components = require("@perses-dev/components");
29
- const _dashboards = require("@perses-dev/dashboards");
30
- const _pluginsystem = require("@perses-dev/plugin-system");
31
- const _copyHelpers = require("../utils/copyHelpers");
32
- const _LogRow = require("./LogRow");
33
- function _interop_require_default(obj) {
34
- return obj && obj.__esModule ? obj : {
35
- default: obj
36
- };
37
- }
38
- function _getRequireWildcardCache(nodeInterop) {
39
- if (typeof WeakMap !== "function") return null;
40
- var cacheBabelInterop = new WeakMap();
41
- var cacheNodeInterop = new WeakMap();
42
- return (_getRequireWildcardCache = function(nodeInterop) {
43
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
44
- })(nodeInterop);
45
- }
46
- function _interop_require_wildcard(obj, nodeInterop) {
47
- if (!nodeInterop && obj && obj.__esModule) {
48
- return obj;
49
- }
50
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
51
- return {
52
- default: obj
53
- };
54
- }
55
- var cache = _getRequireWildcardCache(nodeInterop);
56
- if (cache && cache.has(obj)) {
57
- return cache.get(obj);
58
- }
59
- var newObj = {
60
- __proto__: null
61
- };
62
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
63
- for(var key in obj){
64
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
65
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
66
- if (desc && (desc.get || desc.set)) {
67
- Object.defineProperty(newObj, key, desc);
68
- } else {
69
- newObj[key] = obj[key];
70
- }
71
- }
72
- }
73
- newObj.default = obj;
74
- if (cache) {
75
- cache.set(obj, newObj);
76
- }
77
- return newObj;
78
- }
79
- const PERSES_LOGSTABLE_HINTS_DISMISSED = 'PERSES_LOGSTABLE_HINTS_DISMISSED';
80
- const COPY_TOAST_DURATION_MS = 5000;
81
- // Platform-aware modifier key display using TanStack's formatForDisplay
82
- const modKeyDisplay = (0, _dashboards.formatForDisplay)('Mod');
83
- const VirtualizedLogsList = ({ logs, spec, expandedRows, onToggleExpand })=>{
84
- const theme = (0, _material.useTheme)();
85
- const [selectedRows, setSelectedRows] = (0, _react.useState)(new Set());
86
- const [lastSelectedIndex, setLastSelectedIndex] = (0, _react.useState)(null);
87
- const selectedRowsRef = (0, _react.useRef)(selectedRows);
88
- const [copyPopoverAnchor, setCopyPopoverAnchor] = (0, _react.useState)(null);
89
- const [lastCopiedFormat, setLastCopiedFormat] = (0, _react.useState)('full');
90
- const [lastCopiedCount, setLastCopiedCount] = (0, _react.useState)(0);
91
- const copyPopoverTimerRef = (0, _react.useRef)(null);
92
- const [isHintsDismissed, setIsHintsDismissed] = (0, _react.useState)(()=>{
93
- try {
94
- return localStorage.getItem(PERSES_LOGSTABLE_HINTS_DISMISSED) === 'true';
95
- } catch {
96
- return false;
97
- }
98
- });
99
- const selectionEnabled = spec.selection?.enabled ?? false;
100
- const { setSelection, clearSelection } = (0, _components.useSelection)();
101
- const allVariables = (0, _pluginsystem.useAllVariableValues)();
102
- const itemActionsConfig = spec.actions ? spec.actions : undefined;
103
- const itemActionsListConfig = itemActionsConfig?.enabled && itemActionsConfig.displayWithItem ? itemActionsConfig.actionsList : [];
104
- const { getItemActionButtons, confirmDialog } = (0, _dashboards.useSelectionItemActions)({
105
- actions: itemActionsListConfig,
106
- variableState: allVariables
107
- });
108
- (0, _react.useEffect)(()=>{
109
- selectedRowsRef.current = selectedRows;
110
- }, [
111
- selectedRows
112
- ]);
113
- // Sync local selection state with context when selection is enabled
114
- (0, _react.useEffect)(()=>{
115
- if (!selectionEnabled) return;
116
- if (selectedRows.size === 0) {
117
- clearSelection();
118
- } else {
119
- const selectionItems = Array.from(selectedRows).map((index)=>{
120
- const log = logs[index];
121
- return log ? {
122
- id: index,
123
- item: log
124
- } : null;
125
- }).filter((entry)=>entry !== null);
126
- setSelection(selectionItems);
127
- }
128
- }, [
129
- selectedRows,
130
- logs,
131
- selectionEnabled,
132
- setSelection,
133
- clearSelection
134
- ]);
135
- const handleDismissHints = (0, _react.useCallback)(()=>{
136
- setIsHintsDismissed(true);
137
- try {
138
- localStorage.setItem(PERSES_LOGSTABLE_HINTS_DISMISSED, 'true');
139
- } catch {
140
- // Ignore localStorage errors
141
- }
142
- }, []);
143
- const showCopyPopover = (0, _react.useCallback)((format = 'full', count)=>{
144
- // Show toast at bottom-right corner
145
- const x = window.innerWidth - 32;
146
- const y = window.innerHeight - 32;
147
- setCopyPopoverAnchor({
148
- x,
149
- y
150
- });
151
- setLastCopiedFormat(format);
152
- setLastCopiedCount(count);
153
- // Clear existing timer
154
- if (copyPopoverTimerRef.current) {
155
- window.clearTimeout(copyPopoverTimerRef.current);
156
- }
157
- // Auto-dismiss after configured duration
158
- copyPopoverTimerRef.current = window.setTimeout(()=>{
159
- setCopyPopoverAnchor(null);
160
- }, COPY_TOAST_DURATION_MS);
161
- }, []);
162
- const handleCloseCopyPopover = (0, _react.useCallback)(()=>{
163
- if (copyPopoverTimerRef.current) {
164
- window.clearTimeout(copyPopoverTimerRef.current);
165
- }
166
- setCopyPopoverAnchor(null);
167
- }, []);
168
- const handleCopyInFormat = (0, _react.useCallback)(async (format)=>{
169
- const selectedLogs = Array.from(selectedRowsRef.current).sort((a, b)=>a - b).map((index)=>logs[index]).filter((log)=>log !== undefined);
170
- let text;
171
- if (format === 'message') {
172
- text = selectedLogs.map(_copyHelpers.formatLogMessage).join('\n');
173
- } else if (format === 'json') {
174
- text = JSON.stringify(selectedLogs, null, 2);
175
- } else {
176
- text = (0, _copyHelpers.formatLogEntries)(selectedLogs);
177
- }
178
- await navigator.clipboard.writeText(text);
179
- showCopyPopover(format, selectedLogs.length);
180
- }, [
181
- logs,
182
- showCopyPopover
183
- ]);
184
- const handleRowSelect = (0, _react.useCallback)((index, event)=>{
185
- if (event.shiftKey) {
186
- // Prevent text selection during shift-click
187
- event.preventDefault();
188
- window.getSelection()?.removeAllRanges();
189
- if (lastSelectedIndex !== null) {
190
- // Range selection: select all rows between anchor and current
191
- const start = Math.min(lastSelectedIndex, index);
192
- const end = Math.max(lastSelectedIndex, index);
193
- const newSelection = new Set();
194
- for(let i = start; i <= end; i++){
195
- newSelection.add(i);
196
- }
197
- setSelectedRows(newSelection);
198
- } else {
199
- // No anchor set: just select this row and set as anchor
200
- const newSelection = new Set([
201
- index
202
- ]);
203
- setSelectedRows(newSelection);
204
- setLastSelectedIndex(index);
205
- }
206
- } else if (event.ctrlKey || event.metaKey) {
207
- // Prevent text selection during cmd/ctrl-click
208
- event.preventDefault();
209
- window.getSelection()?.removeAllRanges();
210
- // Toggle individual row (additive selection)
211
- const newSelection = new Set(selectedRows);
212
- if (newSelection.has(index)) {
213
- newSelection.delete(index);
214
- } else {
215
- newSelection.add(index);
216
- }
217
- setSelectedRows(newSelection);
218
- setLastSelectedIndex(index);
219
- } else {
220
- // Plain click: set as anchor for future shift-clicks
221
- // Don't prevent default to allow text selection
222
- setLastSelectedIndex(index);
223
- }
224
- }, [
225
- selectedRows,
226
- lastSelectedIndex
227
- ]);
228
- const renderLogRow = (index)=>{
229
- const log = logs[index];
230
- if (!log) return null;
231
- const itemActionButtons = itemActionsListConfig?.length ? getItemActionButtons({
232
- id: index,
233
- data: log
234
- }) : [];
235
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_LogRow.LogRow, {
236
- isExpandable: spec.enableDetails,
237
- log: log,
238
- index: index,
239
- isExpanded: expandedRows.has(index),
240
- onToggle: onToggleExpand,
241
- allowWrap: spec.allowWrap,
242
- showTime: spec.showTime,
243
- isSelected: selectedRows.has(index),
244
- onSelect: handleRowSelect,
245
- itemActionButtons: itemActionButtons
246
- });
247
- };
248
- const handleCopy = (e)=>{
249
- const selection = window.getSelection();
250
- const hasTextSelection = selection && selection.rangeCount > 0 && selection.toString().length > 0;
251
- // If user has text selected, let browser handle it normally
252
- if (hasTextSelection) {
253
- return;
254
- }
255
- // If rows are selected, copy those
256
- const currentSelectedRows = selectedRowsRef.current;
257
- if (currentSelectedRows.size > 0) {
258
- e.preventDefault();
259
- const selectedLogs = Array.from(currentSelectedRows).sort((a, b)=>a - b).map((index)=>logs[index]).filter((log)=>log !== undefined);
260
- const formattedText = (0, _copyHelpers.formatLogEntries)(selectedLogs);
261
- e.clipboardData.setData('text/plain', formattedText);
262
- }
263
- };
264
- // Keyboard shortcuts for selection
265
- (0, _react.useEffect)(()=>{
266
- const handleKeyDown = async (e)=>{
267
- // Cmd/Ctrl+A: Select all logs
268
- if ((e.metaKey || e.ctrlKey) && e.key === 'a') {
269
- e.preventDefault();
270
- const allIndices = new Set(logs.map((_, index)=>index));
271
- setSelectedRows(allIndices);
272
- if (logs.length > 0) {
273
- setLastSelectedIndex(logs.length - 1);
274
- }
275
- }
276
- // Cmd/Ctrl+C: Copy selected rows
277
- if ((e.metaKey || e.ctrlKey) && e.key === 'c') {
278
- const selection = window.getSelection();
279
- const hasTextSelection = selection && selection.rangeCount > 0 && selection.toString().length > 0;
280
- // Only handle if we have selected rows and no text selection
281
- if (selectedRowsRef.current.size > 0 && !hasTextSelection) {
282
- e.preventDefault();
283
- const selectedLogs = Array.from(selectedRowsRef.current).sort((a, b)=>a - b).map((index)=>logs[index]).filter((log)=>log !== undefined);
284
- const formattedText = (0, _copyHelpers.formatLogEntries)(selectedLogs);
285
- await navigator.clipboard.writeText(formattedText);
286
- showCopyPopover('full', selectedLogs.length);
287
- }
288
- }
289
- // Escape: Clear selection
290
- if (e.key === 'Escape' && selectedRows.size > 0) {
291
- setSelectedRows(new Set());
292
- setLastSelectedIndex(null);
293
- }
294
- };
295
- window.addEventListener('keydown', handleKeyDown);
296
- return ()=>{
297
- window.removeEventListener('keydown', handleKeyDown);
298
- };
299
- }, [
300
- logs,
301
- selectedRows,
302
- showCopyPopover
303
- ]);
304
- // Cleanup timer on unmount
305
- (0, _react.useEffect)(()=>{
306
- return ()=>{
307
- if (copyPopoverTimerRef.current) {
308
- window.clearTimeout(copyPopoverTimerRef.current);
309
- }
310
- };
311
- }, []);
312
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
313
- children: [
314
- confirmDialog,
315
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
316
- sx: {
317
- height: '100%',
318
- backgroundColor: theme.palette.background.default,
319
- overflow: 'hidden',
320
- boxShadow: theme.shadows[1],
321
- display: 'flex',
322
- flexDirection: 'column'
323
- },
324
- onCopy: handleCopy,
325
- children: [
326
- !isHintsDismissed && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
327
- sx: {
328
- px: 2,
329
- py: 0.75,
330
- fontSize: '12px',
331
- color: theme.palette.text.secondary,
332
- backgroundColor: theme.palette.background.paper,
333
- borderBottom: `1px solid ${theme.palette.divider}`,
334
- display: 'flex',
335
- alignItems: 'center',
336
- gap: 2,
337
- flexShrink: 0
338
- },
339
- children: [
340
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
341
- sx: {
342
- display: 'flex',
343
- alignItems: 'center',
344
- gap: 2,
345
- flex: 1
346
- },
347
- children: [
348
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
349
- component: "span",
350
- sx: {
351
- opacity: 0.8
352
- },
353
- children: [
354
- modKeyDisplay,
355
- "+Click to select"
356
- ]
357
- }),
358
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
359
- component: "span",
360
- sx: {
361
- opacity: 0.6
362
- },
363
- children: "•"
364
- }),
365
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
366
- component: "span",
367
- sx: {
368
- opacity: 0.8
369
- },
370
- children: "Shift+Click for range"
371
- }),
372
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
373
- component: "span",
374
- sx: {
375
- opacity: 0.6
376
- },
377
- children: "•"
378
- }),
379
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
380
- component: "span",
381
- sx: {
382
- opacity: 0.8
383
- },
384
- children: [
385
- modKeyDisplay,
386
- "+C to copy"
387
- ]
388
- }),
389
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
390
- component: "span",
391
- sx: {
392
- opacity: 0.6
393
- },
394
- children: "•"
395
- }),
396
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
397
- component: "span",
398
- sx: {
399
- opacity: 0.8
400
- },
401
- children: "Esc to clear"
402
- })
403
- ]
404
- }),
405
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
406
- size: "small",
407
- onClick: handleDismissHints,
408
- sx: {
409
- opacity: 0.6,
410
- '&:hover': {
411
- opacity: 1
412
- },
413
- padding: 0.5
414
- },
415
- "aria-label": "Dismiss hints",
416
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Close.default, {
417
- sx: {
418
- fontSize: '16px'
419
- }
420
- })
421
- })
422
- ]
423
- }),
424
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactvirtuoso.Virtuoso, {
425
- style: {
426
- height: '100%',
427
- flexGrow: 1
428
- },
429
- initialItemCount: spec.showAll ? logs.length : undefined,
430
- totalCount: logs.length,
431
- itemContent: renderLogRow
432
- }),
433
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Popover, {
434
- open: Boolean(copyPopoverAnchor),
435
- anchorReference: "anchorPosition",
436
- anchorPosition: copyPopoverAnchor ? {
437
- top: copyPopoverAnchor.y,
438
- left: copyPopoverAnchor.x
439
- } : undefined,
440
- onClose: handleCloseCopyPopover,
441
- disableScrollLock: true,
442
- disableAutoFocus: true,
443
- disableRestoreFocus: true,
444
- disableEnforceFocus: true,
445
- anchorOrigin: {
446
- vertical: 'bottom',
447
- horizontal: 'right'
448
- },
449
- transformOrigin: {
450
- vertical: 'bottom',
451
- horizontal: 'right'
452
- },
453
- slotProps: {
454
- paper: {
455
- sx: {
456
- px: 2,
457
- py: 1.5,
458
- boxShadow: theme.shadows[8],
459
- borderRadius: 2,
460
- pointerEvents: 'auto'
461
- }
462
- }
463
- },
464
- sx: {
465
- pointerEvents: 'none'
466
- },
467
- children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
468
- sx: {
469
- display: 'flex',
470
- alignItems: 'center',
471
- gap: 2
472
- },
473
- children: [
474
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
475
- sx: {
476
- fontSize: '14px',
477
- color: theme.palette.text.primary,
478
- fontWeight: 500,
479
- display: 'flex',
480
- alignItems: 'center',
481
- gap: 0.5
482
- },
483
- children: [
484
- "✓ Copied ",
485
- lastCopiedCount,
486
- " ",
487
- lastCopiedCount === 1 ? 'log' : 'logs',
488
- " as",
489
- ' ',
490
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
491
- component: "span",
492
- sx: {
493
- color: theme.palette.primary.main,
494
- minWidth: '60px',
495
- display: 'inline-block'
496
- },
497
- children: lastCopiedFormat === 'full' ? 'Full' : lastCopiedFormat === 'message' ? 'Message' : 'JSON'
498
- })
499
- ]
500
- }),
501
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.ButtonGroup, {
502
- size: "small",
503
- variant: "outlined",
504
- children: [
505
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
506
- onClick: ()=>handleCopyInFormat('full'),
507
- sx: {
508
- fontSize: '12px',
509
- textTransform: 'none',
510
- minWidth: '52px',
511
- fontWeight: lastCopiedFormat === 'full' ? 600 : 400,
512
- bgcolor: lastCopiedFormat === 'full' ? theme.palette.action.selected : 'transparent'
513
- },
514
- children: "Full"
515
- }),
516
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
517
- onClick: ()=>handleCopyInFormat('message'),
518
- sx: {
519
- fontSize: '12px',
520
- textTransform: 'none',
521
- minWidth: '74px',
522
- fontWeight: lastCopiedFormat === 'message' ? 600 : 400,
523
- bgcolor: lastCopiedFormat === 'message' ? theme.palette.action.selected : 'transparent'
524
- },
525
- children: "Message"
526
- }),
527
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
528
- onClick: ()=>handleCopyInFormat('json'),
529
- sx: {
530
- fontSize: '12px',
531
- textTransform: 'none',
532
- minWidth: '52px',
533
- fontWeight: lastCopiedFormat === 'json' ? 600 : 400,
534
- bgcolor: lastCopiedFormat === 'json' ? theme.palette.action.selected : 'transparent'
535
- },
536
- children: "JSON"
537
- })
538
- ]
539
- })
540
- ]
541
- })
542
- })
543
- ]
544
- })
545
- ]
546
- });
547
- };
@@ -1,45 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "useExpandedRows", {
18
- enumerable: true,
19
- get: function() {
20
- return useExpandedRows;
21
- }
22
- });
23
- const _react = require("react");
24
- const useExpandedRows = ()=>{
25
- const [expandedRows, setExpandedRows] = (0, _react.useState)(new Set());
26
- const toggleExpand = (0, _react.useCallback)((index)=>{
27
- setExpandedRows((prev)=>{
28
- const newSet = new Set(prev);
29
- if (newSet.has(index)) {
30
- newSet.delete(index);
31
- } else {
32
- newSet.add(index);
33
- }
34
- return newSet;
35
- });
36
- }, []);
37
- const clearExpanded = (0, _react.useCallback)(()=>{
38
- setExpandedRows(new Set());
39
- }, []);
40
- return {
41
- expandedRows,
42
- toggleExpand,
43
- clearExpanded
44
- };
45
- };
@@ -1,47 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "useSeverityColor", {
18
- enumerable: true,
19
- get: function() {
20
- return useSeverityColor;
21
- }
22
- });
23
- const _material = require("@mui/material");
24
- const _utils = require("../utils");
25
- const useSeverityColor = (log)=>{
26
- const theme = (0, _material.useTheme)();
27
- if (!log) {
28
- return theme.palette.text.secondary;
29
- }
30
- const severity = (0, _utils.getSeverity)(log);
31
- switch(severity){
32
- case 'critical':
33
- return theme.palette.error.dark;
34
- case 'error':
35
- return theme.palette.error.main;
36
- case 'warning':
37
- return theme.palette.warning.main;
38
- case 'info':
39
- return theme.palette.info.main;
40
- case 'debug':
41
- return theme.palette.primary.main;
42
- case 'trace':
43
- return theme.palette.grey[500];
44
- default:
45
- return theme.palette.text.secondary;
46
- }
47
- };