add search bar to change log
This commit is contained in:
parent
498bcf1c24
commit
db2031a14c
3 changed files with 38 additions and 31 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
<div class="modal-box max-w-5xl">
|
<div class="modal-box max-w-5xl">
|
||||||
<div class="modal-top">
|
<div class="modal-top">
|
||||||
<!-- Searchbar -->
|
<!-- Searchbar -->
|
||||||
|
<input type="text" name="search-{{logfile}}" placeholder="Search" id="searchInput-{{logfile}}" (keyup)="searchLog(logfile)" class="input input-bordered input-ghost w-full">
|
||||||
<!-- Download log -->
|
<!-- Download log -->
|
||||||
<div id="log-dl-{{logfile}}"></div>
|
<div id="log-dl-{{logfile}}"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -92,8 +93,5 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Temporary remove merge tool -->
|
<!-- Temporary remove merge tool -->
|
||||||
|
|
||||||
<div class="mockup-code">
|
|
||||||
<pre><code>press this -> <button class="btn">Press</button></code></pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { HttpClient } from '@angular/common/http';
|
||||||
import { environment } from 'src/environments/environment.development';
|
import { environment } from 'src/environments/environment.development';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FetchLogService } from 'src/app/shared/services/fetch-log.service';
|
import { FetchLogService } from 'src/app/shared/services/fetch-log.service';
|
||||||
import { WebsocketService } from 'src/app/shared/services/websocket.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-changelog',
|
selector: 'app-changelog',
|
||||||
|
|
@ -115,4 +114,41 @@ export class ChangelogComponent {
|
||||||
this.showLogModal = !this.showLogModal;
|
this.showLogModal = !this.showLogModal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Context from Function d:/CodeProjects/recipe_manager/taobin_recipe_manager/server/python_api/merge_recipe.py:searchFnForHtml
|
||||||
|
searchLog(id: string){
|
||||||
|
var input, filter, logBody, logRow, logP, logContent;
|
||||||
|
console.log("searchLog", id);
|
||||||
|
// log-disp-texts-changelog_580
|
||||||
|
|
||||||
|
let log_disp = document.getElementById("log-disp-texts-"+id);
|
||||||
|
logBody = log_disp!.getElementsByTagName("div")
|
||||||
|
|
||||||
|
input = document.getElementById("searchInput-"+id) as HTMLInputElement;
|
||||||
|
filter = input!.value;
|
||||||
|
// logBody = document.getElementById("logBody");
|
||||||
|
for (let index = 0; index < logBody.length; index++) {
|
||||||
|
const element = logBody[index];
|
||||||
|
// console.log(element)
|
||||||
|
logRow = element.getElementsByTagName("div");
|
||||||
|
for(let i = 0; i < logRow.length; i++){
|
||||||
|
let p = logRow[i].getElementsByTagName("p");
|
||||||
|
// console.log("Total P = ", logRow[i].getElementsByTagName("p").length);
|
||||||
|
|
||||||
|
for(let p_i = 0; p_i < p.length; p_i++){
|
||||||
|
let pcontent = p[p_i].textContent || p[p_i].innerText;
|
||||||
|
|
||||||
|
if(pcontent.includes(filter)){
|
||||||
|
logRow[i].style.display = "";
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
logRow[i].style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,33 +13,6 @@
|
||||||
/> -->
|
/> -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script>
|
|
||||||
// Context from Function d:/CodeProjects/recipe_manager/taobin_recipe_manager/server/python_api/merge_recipe.py:searchFnForHtml
|
|
||||||
function searchLog(){
|
|
||||||
var input, filter, logBody, logRow, logP, logContent;
|
|
||||||
input = document.getElementById("searchInput");
|
|
||||||
filter = input.value;
|
|
||||||
logBody = document.getElementById("logBody");
|
|
||||||
logRow = logBody.getElementsByTagName("div");
|
|
||||||
|
|
||||||
|
|
||||||
for(let i = 0; i < logRow.length; i++){
|
|
||||||
p = logRow[i].getElementsByTagName("p");
|
|
||||||
console.log("Total P = ", logRow[i].getElementsByTagName("p").length);
|
|
||||||
|
|
||||||
for(let p_i = 0; p_i < p.length; p_i++){
|
|
||||||
pcontent = p[p_i].textContent || p[p_i].innerText;
|
|
||||||
|
|
||||||
if(pcontent.includes(filter)){
|
|
||||||
logRow[i].style.display = "";
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
logRow[i].style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<app-root></app-root>
|
<app-root></app-root>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue