@perses-dev/logs-table-plugin 0.2.0-beta.0 → 0.2.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/js/{LogsTable.6980b2d9.js → LogsTable.2781dfd7.js} +3 -3
- package/__mf/js/async/1117.0a72bc85.js +2 -0
- package/__mf/js/async/1129.e0f0503a.js +7 -0
- package/__mf/js/async/1240.1a0b69fc.js +1 -0
- package/__mf/js/async/304.d0edd380.js +37 -0
- package/__mf/js/async/392.2e457deb.js +2 -0
- package/__mf/js/async/3982.ab5d25af.js +1 -0
- package/__mf/js/async/6034.130a9e6d.js +22 -0
- package/__mf/js/async/648.0ddef36d.js +1 -0
- package/__mf/js/async/7445.28262ec0.js +110 -0
- package/__mf/js/async/8542.1802a06b.js +1 -0
- package/__mf/js/async/8608.4e8b55b4.js +1 -0
- package/__mf/js/async/8859.f8f648fc.js +1 -0
- package/__mf/js/async/9293.7e278959.js +2 -0
- package/__mf/js/async/__federation_expose_LogsTable.f2d6f7ad.js +1 -0
- package/__mf/js/async/lib-router.04411383.js +2 -0
- package/__mf/js/async/{lib-router.318cb64e.js.LICENSE.txt → lib-router.04411383.js.LICENSE.txt} +3 -3
- package/__mf/js/{main.029df708.js → main.76fc2531.js} +3 -3
- package/lib/LogsTable.d.ts.map +1 -1
- package/lib/LogsTable.js +6 -1
- package/lib/LogsTable.js.map +1 -1
- package/lib/LogsTableComponent.d.ts.map +1 -1
- package/lib/LogsTableComponent.js +13 -9
- package/lib/LogsTableComponent.js.map +1 -1
- package/lib/LogsTableItemSelectionActionsEditor.d.ts +4 -0
- package/lib/LogsTableItemSelectionActionsEditor.d.ts.map +1 -0
- package/lib/LogsTableItemSelectionActionsEditor.js +36 -0
- package/lib/LogsTableItemSelectionActionsEditor.js.map +1 -0
- package/lib/LogsTablePanel.js +1 -1
- package/lib/LogsTablePanel.js.map +1 -1
- package/lib/LogsTableSettingsEditor.js +2 -2
- package/lib/LogsTableSettingsEditor.js.map +1 -1
- package/lib/bootstrap.js +1 -1
- package/lib/bootstrap.js.map +1 -1
- package/lib/cjs/LogsTable.js +6 -1
- package/lib/cjs/LogsTableComponent.js +12 -8
- package/lib/cjs/LogsTableItemSelectionActionsEditor.js +44 -0
- package/lib/cjs/LogsTablePanel.js +1 -1
- package/lib/cjs/LogsTableSettingsEditor.js +1 -1
- package/lib/cjs/bootstrap.js +1 -1
- package/lib/cjs/components/EmptyLogsState.js +1 -1
- package/lib/cjs/components/LogRow/LogDetailsTable.js +1 -1
- package/lib/cjs/components/LogRow/LogRow.js +260 -13
- package/lib/cjs/components/LogRow/LogTimestamp.js +1 -1
- package/lib/cjs/components/LogRow/LogsStyles.js +9 -7
- package/lib/cjs/components/LogRow/index.js +1 -1
- package/lib/cjs/components/LogsList.js +1 -1
- package/lib/cjs/components/VirtualizedLogsList.js +502 -19
- package/lib/cjs/components/hooks/useExpandedRows.js +1 -1
- package/lib/cjs/components/hooks/useSeverity.js +47 -0
- package/lib/cjs/components/utils.js +78 -0
- package/lib/cjs/env.d.js +1 -1
- package/lib/cjs/getPluginModule.js +12 -0
- package/lib/cjs/index-federation.js +1 -1
- package/lib/cjs/index.js +12 -0
- package/lib/cjs/model.js +1 -1
- package/lib/cjs/setup-tests.js +1 -1
- package/lib/cjs/test/mock-query-results.js +60 -3
- package/lib/cjs/utils/copyHelpers.js +70 -0
- package/lib/components/EmptyLogsState.js +1 -1
- package/lib/components/EmptyLogsState.js.map +1 -1
- package/lib/components/LogRow/LogDetailsTable.js +1 -1
- package/lib/components/LogRow/LogDetailsTable.js.map +1 -1
- package/lib/components/LogRow/LogRow.d.ts +4 -1
- package/lib/components/LogRow/LogRow.d.ts.map +1 -1
- package/lib/components/LogRow/LogRow.js +262 -15
- package/lib/components/LogRow/LogRow.js.map +1 -1
- package/lib/components/LogRow/LogTimestamp.js +1 -1
- package/lib/components/LogRow/LogTimestamp.js.map +1 -1
- package/lib/components/LogRow/LogsStyles.d.ts +3 -0
- package/lib/components/LogRow/LogsStyles.d.ts.map +1 -1
- package/lib/components/LogRow/LogsStyles.js +9 -7
- package/lib/components/LogRow/LogsStyles.js.map +1 -1
- package/lib/components/LogRow/index.js +1 -1
- package/lib/components/LogRow/index.js.map +1 -1
- package/lib/components/LogsList.js +1 -1
- package/lib/components/LogsList.js.map +1 -1
- package/lib/components/VirtualizedLogsList.d.ts.map +1 -1
- package/lib/components/VirtualizedLogsList.js +463 -21
- package/lib/components/VirtualizedLogsList.js.map +1 -1
- package/lib/components/hooks/useExpandedRows.js +1 -1
- package/lib/components/hooks/useExpandedRows.js.map +1 -1
- package/lib/components/hooks/useSeverity.d.ts +3 -0
- package/lib/components/hooks/useSeverity.d.ts.map +1 -0
- package/lib/components/hooks/useSeverity.js +39 -0
- package/lib/components/hooks/useSeverity.js.map +1 -0
- package/lib/components/utils.d.ts +5 -0
- package/lib/components/utils.d.ts.map +1 -0
- package/lib/components/utils.js +62 -0
- package/lib/components/utils.js.map +1 -0
- package/lib/env.d.js +1 -1
- package/lib/env.d.js.map +1 -1
- package/lib/getPluginModule.d.ts.map +1 -1
- package/lib/getPluginModule.js +12 -0
- package/lib/getPluginModule.js.map +1 -1
- package/lib/index-federation.js +1 -1
- package/lib/index-federation.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -1
- package/lib/model.d.ts +4 -1
- package/lib/model.d.ts.map +1 -1
- package/lib/model.js +1 -1
- package/lib/model.js.map +1 -1
- package/lib/setup-tests.js +1 -1
- package/lib/setup-tests.js.map +1 -1
- package/lib/test/mock-query-results.d.ts +1 -0
- package/lib/test/mock-query-results.d.ts.map +1 -1
- package/lib/test/mock-query-results.js +57 -3
- package/lib/test/mock-query-results.js.map +1 -1
- package/lib/utils/copyHelpers.d.ts +28 -0
- package/lib/utils/copyHelpers.d.ts.map +1 -0
- package/lib/utils/copyHelpers.js +56 -0
- package/lib/utils/copyHelpers.js.map +1 -0
- package/mf-manifest.json +30 -30
- package/mf-stats.json +35 -32
- package/package.json +5 -5
- package/__mf/js/async/1117.921746cb.js +0 -2
- package/__mf/js/async/1939.46722505.js +0 -1
- package/__mf/js/async/392.ffb0729b.js +0 -2
- package/__mf/js/async/580.9e16464c.js +0 -110
- package/__mf/js/async/5997.f6b3408c.js +0 -2
- package/__mf/js/async/6600.884fc0ad.js +0 -22
- package/__mf/js/async/6916.3d24109f.js +0 -7
- package/__mf/js/async/7417.39d13c6a.js +0 -1
- package/__mf/js/async/8252.88cd9656.js +0 -1
- package/__mf/js/async/8294.dac3426d.js +0 -37
- package/__mf/js/async/8535.20f8a453.js +0 -1
- package/__mf/js/async/9558.692edca6.js +0 -1
- package/__mf/js/async/9890.b97f395d.js +0 -1
- package/__mf/js/async/__federation_expose_LogsTable.6f8b33f4.js +0 -1
- package/__mf/js/async/lib-router.318cb64e.js +0 -2
- /package/__mf/js/async/{1117.921746cb.js.LICENSE.txt → 1117.0a72bc85.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6916.3d24109f.js.LICENSE.txt → 1129.e0f0503a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.ffb0729b.js.LICENSE.txt → 392.2e457deb.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6600.884fc0ad.js.LICENSE.txt → 6034.130a9e6d.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{580.9e16464c.js.LICENSE.txt → 7445.28262ec0.js.LICENSE.txt} +0 -0
|
@@ -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 { useTheme } from '@mui/material';
|
|
14
|
+
import { getSeverity } from '../utils';
|
|
15
|
+
export const useSeverityColor = (log)=>{
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
if (!log) {
|
|
18
|
+
return theme.palette.text.secondary;
|
|
19
|
+
}
|
|
20
|
+
const severity = getSeverity(log);
|
|
21
|
+
switch(severity){
|
|
22
|
+
case 'critical':
|
|
23
|
+
return theme.palette.error.dark;
|
|
24
|
+
case 'error':
|
|
25
|
+
return theme.palette.error.main;
|
|
26
|
+
case 'warning':
|
|
27
|
+
return theme.palette.warning.main;
|
|
28
|
+
case 'info':
|
|
29
|
+
return theme.palette.info.main;
|
|
30
|
+
case 'debug':
|
|
31
|
+
return theme.palette.primary.main;
|
|
32
|
+
case 'trace':
|
|
33
|
+
return theme.palette.grey[500];
|
|
34
|
+
default:
|
|
35
|
+
return theme.palette.text.secondary;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=useSeverity.js.map
|
|
@@ -0,0 +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/core';\nimport { getSeverity } from '../utils';\n\nexport const useSeverityColor = (log?: LogEntry) => {\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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LogEntry } from '@perses-dev/core';
|
|
2
|
+
export type Severity = 'critical' | 'error' | 'warning' | 'info' | 'debug' | 'trace' | 'unknown' | 'other';
|
|
3
|
+
export declare const severityAbbreviations: Record<Severity, string[]>;
|
|
4
|
+
export declare const getSeverity: (log: LogEntry) => Severity;
|
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3G,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,CAS5D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,KAAK,QAAQ,KAAG,QAY3C,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
export const severityAbbreviations = {
|
|
14
|
+
critical: [
|
|
15
|
+
'critical',
|
|
16
|
+
'emerg',
|
|
17
|
+
'fatal',
|
|
18
|
+
'alert',
|
|
19
|
+
'crit'
|
|
20
|
+
],
|
|
21
|
+
error: [
|
|
22
|
+
'error',
|
|
23
|
+
'err',
|
|
24
|
+
'eror'
|
|
25
|
+
],
|
|
26
|
+
debug: [
|
|
27
|
+
'debug',
|
|
28
|
+
'dbug'
|
|
29
|
+
],
|
|
30
|
+
info: [
|
|
31
|
+
'info',
|
|
32
|
+
'inf',
|
|
33
|
+
'information',
|
|
34
|
+
'notice'
|
|
35
|
+
],
|
|
36
|
+
trace: [
|
|
37
|
+
'trace'
|
|
38
|
+
],
|
|
39
|
+
warning: [
|
|
40
|
+
'warn',
|
|
41
|
+
'warning'
|
|
42
|
+
],
|
|
43
|
+
unknown: [
|
|
44
|
+
'unknown'
|
|
45
|
+
],
|
|
46
|
+
other: [
|
|
47
|
+
''
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
export const getSeverity = (log)=>{
|
|
51
|
+
const level = log.labels?.level?.toLowerCase();
|
|
52
|
+
if (level) {
|
|
53
|
+
for (const [severity, abbreviations] of Object.entries(severityAbbreviations)){
|
|
54
|
+
if (abbreviations.some((abbr)=>abbr && level.includes(abbr))) {
|
|
55
|
+
return severity;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return 'unknown';
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +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/core';\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/env.d.js
CHANGED
package/lib/env.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/env.d.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/env.d.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\n/// <reference types=\"@rsbuild/core/types\" />\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;AAEjC,6CAA6C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAGnF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
|
package/lib/getPluginModule.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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.
|
|
1
13
|
import packageJson from '../package.json';
|
|
2
14
|
/**
|
|
3
15
|
* Returns the plugin module information from package.json
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getPluginModule.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/getPluginModule.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 { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\nimport packageJson from '../package.json';\n\n/**\n * Returns the plugin module information from package.json\n */\nexport function getPluginModule(): PluginModuleResource {\n const { name, version, perses } = packageJson;\n return {\n kind: 'PluginModule',\n metadata: {\n name,\n version,\n },\n spec: perses as PluginModuleSpec,\n };\n}\n"],"names":["packageJson","getPluginModule","name","version","perses","kind","metadata","spec"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,OAAOA,iBAAiB,kBAAkB;AAE1C;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAClC,OAAO;QACLK,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
|
package/lib/index-federation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index-federation.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/index-federation.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('./bootstrap');\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;AAEjC,MAAM,CAAC"}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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.
|
|
1
13
|
export { getPluginModule } from './getPluginModule';
|
|
2
14
|
export * from './model';
|
|
3
15
|
export * from './LogsTable';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/index.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\nexport { getPluginModule } from './getPluginModule';\nexport * from './model';\nexport * from './LogsTable';\n"],"names":["getPluginModule"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,QAAQ,oBAAoB;AACpD,cAAc,UAAU;AACxB,cAAc,cAAc"}
|
package/lib/model.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogData, ThresholdOptions } from '@perses-dev/core';
|
|
2
|
-
import { PanelProps, LegendSpecOptions } from '@perses-dev/plugin-system';
|
|
2
|
+
import { PanelProps, LegendSpecOptions, SelectionOptions, OptionsEditorProps, ActionOptions } from '@perses-dev/plugin-system';
|
|
3
3
|
export type LogsTableProps = PanelProps<LogsTableOptions, LogsQueryData>;
|
|
4
4
|
export interface LogsQueryData {
|
|
5
5
|
logs?: LogData;
|
|
@@ -11,5 +11,8 @@ export interface LogsTableOptions {
|
|
|
11
11
|
enableDetails?: boolean;
|
|
12
12
|
showTime?: boolean;
|
|
13
13
|
showAll?: boolean;
|
|
14
|
+
selection?: SelectionOptions;
|
|
15
|
+
actions?: ActionOptions;
|
|
14
16
|
}
|
|
17
|
+
export type LogsTableSettingsEditorProps = OptionsEditorProps<LogsTableOptions>;
|
|
15
18
|
//# sourceMappingURL=model.d.ts.map
|
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,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACd,MAAM,2BAA2B,CAAC;AAEnC,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
CHANGED
package/lib/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model.ts"],"sourcesContent":["// Copyright
|
|
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 { LogData, ThresholdOptions } from '@perses-dev/core';\nimport {\n PanelProps,\n LegendSpecOptions,\n SelectionOptions,\n OptionsEditorProps,\n ActionOptions,\n} from '@perses-dev/plugin-system';\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;AA4BjC,WAAgF"}
|
package/lib/setup-tests.js
CHANGED
package/lib/setup-tests.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/setup-tests.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 '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"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,OAAO,4BAA4B;AAEnC,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-query-results.d.ts","sourceRoot":"","sources":["../../../src/test/mock-query-results.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,sBAAsB,EAAE,aAkCpC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;CAUtC,CAAC"}
|
|
1
|
+
{"version":3,"file":"mock-query-results.d.ts","sourceRoot":"","sources":["../../../src/test/mock-query-results.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,sBAAsB,EAAE,aAkCpC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAAa,EAqDlD,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;CAUtC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -19,7 +19,7 @@ export const MOCK_LOGS_QUERY_RESULT = {
|
|
|
19
19
|
},
|
|
20
20
|
entries: [
|
|
21
21
|
{
|
|
22
|
-
timestamp:
|
|
22
|
+
timestamp: 1666625491,
|
|
23
23
|
line: 'foo',
|
|
24
24
|
labels: {
|
|
25
25
|
device: '/dev/vda1',
|
|
@@ -31,7 +31,7 @@ export const MOCK_LOGS_QUERY_RESULT = {
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
timestamp:
|
|
34
|
+
timestamp: 1666625490,
|
|
35
35
|
line: 'bar',
|
|
36
36
|
labels: {
|
|
37
37
|
device: '/dev/vda15',
|
|
@@ -45,6 +45,60 @@ export const MOCK_LOGS_QUERY_RESULT = {
|
|
|
45
45
|
]
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
export const MOCK_LOGS_QUERY_RESULTS = [
|
|
49
|
+
{
|
|
50
|
+
logs: {
|
|
51
|
+
entries: [
|
|
52
|
+
{
|
|
53
|
+
timestamp: 1769009811.4465687,
|
|
54
|
+
line: '{"host":"120.180.160.121", "user-identifier":"-", "datetime":"21/Jan/2026:15:32:31 +0000", "method": "DELETE", "request": "/killer/pixy", "protocol":"HTTP/2.0", "status":200, "bytes":9821, "referer": "http://www.internationalend-to-end.com/e-business/web services"}',
|
|
55
|
+
labels: {
|
|
56
|
+
app: 'log-generator',
|
|
57
|
+
bytes: '9821',
|
|
58
|
+
datetime: '21/Jan/2026:15:32:31 +0000',
|
|
59
|
+
detected_level: 'unknown',
|
|
60
|
+
filename: '/var/log/fake/fake.log',
|
|
61
|
+
host: '120.180.160.121',
|
|
62
|
+
method: 'DELETE',
|
|
63
|
+
protocol: 'HTTP/2.0',
|
|
64
|
+
referer: 'http://www.internationalend-to-end.com/e-business/web services',
|
|
65
|
+
request: '/killer/pixy',
|
|
66
|
+
service_name: 'log-generator',
|
|
67
|
+
status: '200',
|
|
68
|
+
user_identifier: '-'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
totalCount: 1
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
logs: {
|
|
77
|
+
entries: [
|
|
78
|
+
{
|
|
79
|
+
timestamp: 1769009890.5294495,
|
|
80
|
+
line: '{"host":"18.178.231.77", "user-identifier":"cormier2584", "datetime":"21/Jan/2026:15:33:49 +0000", "method": "POST", "request": "/facilitate/mesh/methodologies/deploy", "protocol":"HTTP/1.1", "status":503, "bytes":9892, "referer": "http://www.direct.com/holistic"}',
|
|
81
|
+
labels: {
|
|
82
|
+
app: 'log-generator',
|
|
83
|
+
bytes: '9892',
|
|
84
|
+
datetime: '21/Jan/2026:15:33:49 +0000',
|
|
85
|
+
detected_level: 'unknown',
|
|
86
|
+
filename: '/var/log/fake/fake.log',
|
|
87
|
+
host: '18.178.231.77',
|
|
88
|
+
method: 'POST',
|
|
89
|
+
protocol: 'HTTP/1.1',
|
|
90
|
+
referer: 'http://www.direct.com/holistic',
|
|
91
|
+
request: '/facilitate/mesh/methodologies/deploy',
|
|
92
|
+
service_name: 'log-generator',
|
|
93
|
+
status: '503',
|
|
94
|
+
user_identifier: 'cormier2584'
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
totalCount: 1
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
];
|
|
48
102
|
export const MOCK_LOGS_QUERY_DEFINITION = {
|
|
49
103
|
kind: 'LogsQuery',
|
|
50
104
|
spec: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/mock-query-results.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/test/mock-query-results.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 { LogsQueryData } from '../model';\n\nexport const MOCK_LOGS_QUERY_RESULT: LogsQueryData = {\n logs: {\n hasMore: false,\n timeRange: {\n start: new Date(1666625490),\n end: new Date(1666625535),\n },\n entries: [\n {\n timestamp: 1666625491,\n line: 'foo',\n labels: {\n device: '/dev/vda1',\n env: 'demo',\n fstype: 'ext4',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/',\n },\n },\n {\n timestamp: 1666625490,\n line: 'bar',\n labels: {\n device: '/dev/vda15',\n env: 'demo',\n fstype: 'vfat',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/boot/efi',\n },\n },\n ],\n },\n};\n\nexport const MOCK_LOGS_QUERY_RESULTS: LogsQueryData[] = [\n {\n logs: {\n entries: [\n {\n timestamp: 1769009811.4465687,\n line: '{\"host\":\"120.180.160.121\", \"user-identifier\":\"-\", \"datetime\":\"21/Jan/2026:15:32:31 +0000\", \"method\": \"DELETE\", \"request\": \"/killer/pixy\", \"protocol\":\"HTTP/2.0\", \"status\":200, \"bytes\":9821, \"referer\": \"http://www.internationalend-to-end.com/e-business/web services\"}',\n labels: {\n app: 'log-generator',\n bytes: '9821',\n datetime: '21/Jan/2026:15:32:31 +0000',\n detected_level: 'unknown',\n filename: '/var/log/fake/fake.log',\n host: '120.180.160.121',\n method: 'DELETE',\n protocol: 'HTTP/2.0',\n referer: 'http://www.internationalend-to-end.com/e-business/web services',\n request: '/killer/pixy',\n service_name: 'log-generator',\n status: '200',\n user_identifier: '-',\n },\n },\n ],\n totalCount: 1,\n },\n },\n {\n logs: {\n entries: [\n {\n timestamp: 1769009890.5294495,\n line: '{\"host\":\"18.178.231.77\", \"user-identifier\":\"cormier2584\", \"datetime\":\"21/Jan/2026:15:33:49 +0000\", \"method\": \"POST\", \"request\": \"/facilitate/mesh/methodologies/deploy\", \"protocol\":\"HTTP/1.1\", \"status\":503, \"bytes\":9892, \"referer\": \"http://www.direct.com/holistic\"}',\n labels: {\n app: 'log-generator',\n bytes: '9892',\n datetime: '21/Jan/2026:15:33:49 +0000',\n detected_level: 'unknown',\n filename: '/var/log/fake/fake.log',\n host: '18.178.231.77',\n method: 'POST',\n protocol: 'HTTP/1.1',\n referer: 'http://www.direct.com/holistic',\n request: '/facilitate/mesh/methodologies/deploy',\n service_name: 'log-generator',\n status: '503',\n user_identifier: 'cormier2584',\n },\n },\n ],\n totalCount: 1,\n },\n },\n];\n\nexport const MOCK_LOGS_QUERY_DEFINITION = {\n kind: 'LogsQuery',\n spec: {\n plugin: {\n kind: 'LokiLogsQuery',\n spec: {\n query: '',\n },\n },\n },\n};\n"],"names":["MOCK_LOGS_QUERY_RESULT","logs","hasMore","timeRange","start","Date","end","entries","timestamp","line","labels","device","env","fstype","instance","job","mountpoint","MOCK_LOGS_QUERY_RESULTS","app","bytes","datetime","detected_level","filename","host","method","protocol","referer","request","service_name","status","user_identifier","totalCount","MOCK_LOGS_QUERY_DEFINITION","kind","spec","plugin","query"],"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;AAIjC,OAAO,MAAMA,yBAAwC;IACnDC,MAAM;QACJC,SAAS;QACTC,WAAW;YACTC,OAAO,IAAIC,KAAK;YAChBC,KAAK,IAAID,KAAK;QAChB;QACAE,SAAS;YACP;gBACEC,WAAW;gBACXC,MAAM;gBACNC,QAAQ;oBACNC,QAAQ;oBACRC,KAAK;oBACLC,QAAQ;oBACRC,UAAU;oBACVC,KAAK;oBACLC,YAAY;gBACd;YACF;YACA;gBACER,WAAW;gBACXC,MAAM;gBACNC,QAAQ;oBACNC,QAAQ;oBACRC,KAAK;oBACLC,QAAQ;oBACRC,UAAU;oBACVC,KAAK;oBACLC,YAAY;gBACd;YACF;SACD;IACH;AACF,EAAE;AAEF,OAAO,MAAMC,0BAA2C;IACtD;QACEhB,MAAM;YACJM,SAAS;gBACP;oBACEC,WAAW;oBACXC,MAAM;oBACNC,QAAQ;wBACNQ,KAAK;wBACLC,OAAO;wBACPC,UAAU;wBACVC,gBAAgB;wBAChBC,UAAU;wBACVC,MAAM;wBACNC,QAAQ;wBACRC,UAAU;wBACVC,SAAS;wBACTC,SAAS;wBACTC,cAAc;wBACdC,QAAQ;wBACRC,iBAAiB;oBACnB;gBACF;aACD;YACDC,YAAY;QACd;IACF;IACA;QACE9B,MAAM;YACJM,SAAS;gBACP;oBACEC,WAAW;oBACXC,MAAM;oBACNC,QAAQ;wBACNQ,KAAK;wBACLC,OAAO;wBACPC,UAAU;wBACVC,gBAAgB;wBAChBC,UAAU;wBACVC,MAAM;wBACNC,QAAQ;wBACRC,UAAU;wBACVC,SAAS;wBACTC,SAAS;wBACTC,cAAc;wBACdC,QAAQ;wBACRC,iBAAiB;oBACnB;gBACF;aACD;YACDC,YAAY;QACd;IACF;CACD,CAAC;AAEF,OAAO,MAAMC,6BAA6B;IACxCC,MAAM;IACNC,MAAM;QACJC,QAAQ;YACNF,MAAM;YACNC,MAAM;gBACJE,OAAO;YACT;QACF;IACF;AACF,EAAE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LogEntry } from '@perses-dev/core';
|
|
2
|
+
/**
|
|
3
|
+
* Formats a timestamp for display in copied text
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatTimestamp(timestamp: number | string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Formats labels as key=value pairs
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatLabels(labels: Record<string, string>): string;
|
|
10
|
+
/**
|
|
11
|
+
* Formats a single log entry as plain text for copying
|
|
12
|
+
* Format: {timestamp} {labels} {message}
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatLogEntry(log: LogEntry): string;
|
|
15
|
+
/**
|
|
16
|
+
* Formats just the log message text (no timestamp or labels)
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatLogMessage(log: LogEntry): string;
|
|
19
|
+
/**
|
|
20
|
+
* Formats a log entry as JSON
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatLogAsJson(log: LogEntry): string;
|
|
23
|
+
/**
|
|
24
|
+
* Formats multiple log entries as plain text for copying
|
|
25
|
+
* Each log entry is on its own line
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatLogEntries(logs: LogEntry[]): string;
|
|
28
|
+
//# sourceMappingURL=copyHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyHelpers.d.ts","sourceRoot":"","sources":["../../../src/utils/copyHelpers.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;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,CAIpD;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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* Formats a timestamp for display in copied text
|
|
15
|
+
*/ export function formatTimestamp(timestamp) {
|
|
16
|
+
const date = typeof timestamp === 'number' ? new Date(timestamp * 1000) : parseTimestamp(timestamp);
|
|
17
|
+
return date.toISOString();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parses a timestamp string to a Date object
|
|
21
|
+
*/ function parseTimestamp(timestamp) {
|
|
22
|
+
return /^\d+$/.test(timestamp) ? new Date(parseInt(timestamp) * 1000) : new Date(Date.parse(timestamp));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Formats labels as key=value pairs
|
|
26
|
+
*/ export function formatLabels(labels) {
|
|
27
|
+
const entries = Object.entries(labels);
|
|
28
|
+
if (entries.length === 0) return '';
|
|
29
|
+
return entries.map(([key, value])=>`${key}="${value}"`).join(' ');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Formats a single log entry as plain text for copying
|
|
33
|
+
* Format: {timestamp} {labels} {message}
|
|
34
|
+
*/ export function formatLogEntry(log) {
|
|
35
|
+
const timestamp = formatTimestamp(log.timestamp);
|
|
36
|
+
const labels = formatLabels(log.labels || {});
|
|
37
|
+
return labels ? `${timestamp} ${labels} ${log.line}` : `${timestamp} ${log.line}`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Formats just the log message text (no timestamp or labels)
|
|
41
|
+
*/ export function formatLogMessage(log) {
|
|
42
|
+
return log.line;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Formats a log entry as JSON
|
|
46
|
+
*/ export function formatLogAsJson(log) {
|
|
47
|
+
return JSON.stringify(log, null, 2);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Formats multiple log entries as plain text for copying
|
|
51
|
+
* Each log entry is on its own line
|
|
52
|
+
*/ export function formatLogEntries(logs) {
|
|
53
|
+
return logs.map(formatLogEntry).join('\n');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=copyHelpers.js.map
|
|
@@ -0,0 +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/core';\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 return labels ? `${timestamp} ${labels} ${log.line}` : `${timestamp} ${log.line}`;\n}\n\n/**\n * Formats just the log message text (no timestamp or labels)\n */\nexport function formatLogMessage(log: LogEntry): string {\n return 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":["formatTimestamp","timestamp","date","Date","parseTimestamp","toISOString","test","parseInt","parse","formatLabels","labels","entries","Object","length","map","key","value","join","formatLogEntry","log","line","formatLogMessage","formatLogAsJson","JSON","stringify","formatLogEntries","logs"],"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;AAIjC;;CAEC,GACD,OAAO,SAASA,gBAAgBC,SAA0B;IACxD,MAAMC,OAAO,OAAOD,cAAc,WAAW,IAAIE,KAAKF,YAAY,QAAQG,eAAeH;IACzF,OAAOC,KAAKG,WAAW;AACzB;AAEA;;CAEC,GACD,SAASD,eAAeH,SAAiB;IACvC,OAAO,QAAQK,IAAI,CAACL,aAAa,IAAIE,KAAKI,SAASN,aAAa,QAAQ,IAAIE,KAAKA,KAAKK,KAAK,CAACP;AAC9F;AAEA;;CAEC,GACD,OAAO,SAASQ,aAAaC,MAA8B;IACzD,MAAMC,UAAUC,OAAOD,OAAO,CAACD;IAC/B,IAAIC,QAAQE,MAAM,KAAK,GAAG,OAAO;IACjC,OAAOF,QAAQG,GAAG,CAAC,CAAC,CAACC,KAAKC,MAAM,GAAK,GAAGD,IAAI,EAAE,EAAEC,MAAM,CAAC,CAAC,EAAEC,IAAI,CAAC;AACjE;AAEA;;;CAGC,GACD,OAAO,SAASC,eAAeC,GAAa;IAC1C,MAAMlB,YAAYD,gBAAgBmB,IAAIlB,SAAS;IAC/C,MAAMS,SAASD,aAAaU,IAAIT,MAAM,IAAI,CAAC;IAC3C,OAAOA,SAAS,GAAGT,UAAU,CAAC,EAAES,OAAO,CAAC,EAAES,IAAIC,IAAI,EAAE,GAAG,GAAGnB,UAAU,CAAC,EAAEkB,IAAIC,IAAI,EAAE;AACnF;AAEA;;CAEC,GACD,OAAO,SAASC,iBAAiBF,GAAa;IAC5C,OAAOA,IAAIC,IAAI;AACjB;AAEA;;CAEC,GACD,OAAO,SAASE,gBAAgBH,GAAa;IAC3C,OAAOI,KAAKC,SAAS,CAACL,KAAK,MAAM;AACnC;AAEA;;;CAGC,GACD,OAAO,SAASM,iBAAiBC,IAAgB;IAC/C,OAAOA,KAAKZ,GAAG,CAACI,gBAAgBD,IAAI,CAAC;AACvC"}
|