Skip to content

Commit

Permalink
show original text in script match options
Browse files Browse the repository at this point in the history
  • Loading branch information
mathewthe2 committed May 19, 2021
1 parent 6b02bf8 commit c302f50
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions web/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ function formatMatchScriptMenu(logId, matchScriptContent) {
const log = getLogById(logId);
matchScriptContent.innerHTML = `<div class="matchingScriptMenuCard mdl-card mdl-shadow--2dp">
<ul class="mdl-list">
${(log.matches && log.originalText && log.originalText.trim() !== log.matches[0][0].trim()) ?
`<li class="mdl-list__item" log_id="${logId}" onclick="replaceLogText(this.getAttribute('log_id'), this.innerText)">
<span class="mdl-list__item-primary-content">${log.originalText}</span>
</li>` : ''}
${log.matches.map(match=>{
return (
`<li class="mdl-list__item" log_id="${logId}" onclick="replaceLogText(this.getAttribute('log_id'), this.innerText)">
Expand Down Expand Up @@ -406,7 +410,10 @@ function isLogDataUpdated(logId) {
}

function replaceLogText(logId, newText) {
const log = getLogById(logId);
const originalText = log.originalText ? log.originalText : log.text;
updateLogDataById(logId, {
originalText: originalText,
text: newText,
isMatched: true,
autoMatch: false
Expand Down Expand Up @@ -463,6 +470,7 @@ function logToHtml(log) {
firstMatch = log.matches[0];
firstMatchConfidence = firstMatch[1];
if (firstMatchConfidence > confidenceThreshold) {
log.originalText = log.originalText ? log.originalText : log.text;
log.text = firstMatch[0];
log.isMatched = true;
}
Expand Down

0 comments on commit c302f50

Please sign in to comment.