mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-01 07:42:52 +00:00
fix: highlight keywords in logs (#405)
This commit is contained in:
parent
8f179f00a2
commit
4e00073ec2
@ -53,9 +53,6 @@ export const logStore = defineStore({
|
|||||||
setLogCondition(data: Recordable) {
|
setLogCondition(data: Recordable) {
|
||||||
this.conditions = { ...this.conditions, ...data };
|
this.conditions = { ...this.conditions, ...data };
|
||||||
},
|
},
|
||||||
getLogKeywords() {
|
|
||||||
return this.conditions.keywordsOfContent;
|
|
||||||
},
|
|
||||||
resetState() {
|
resetState() {
|
||||||
this.logs = [];
|
this.logs = [];
|
||||||
this.conditions = {
|
this.conditions = {
|
||||||
|
@ -61,7 +61,7 @@ limitations under the License. -->
|
|||||||
return (props.data.tags.find((d: { key: string; value: string }) => d.key === "level") || {}).value || "";
|
return (props.data.tags.find((d: { key: string; value: string }) => d.key === "level") || {}).value || "";
|
||||||
});
|
});
|
||||||
const highlightKeywords = (data: string) => {
|
const highlightKeywords = (data: string) => {
|
||||||
const keywords = Object.values(logStore.getLogKeywords());
|
const keywords = Object.values(logStore.conditions.keywordsOfContent || {});
|
||||||
const regex = new RegExp(keywords.join("|"), "gi");
|
const regex = new RegExp(keywords.join("|"), "gi");
|
||||||
return data.replace(regex, (match) => `<span style="color: red">${match}</span>`);
|
return data.replace(regex, (match) => `<span style="color: red">${match}</span>`);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user