add fetch all merge logs
This commit is contained in:
parent
baa66609ee
commit
325020fd37
6 changed files with 205 additions and 70 deletions
|
|
@ -1,16 +1,72 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { MergeComponent } from '../merge/merge.component';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment.development';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FetchLogService } from 'src/app/shared/services/fetch-log.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-changelog',
|
||||
standalone: true,
|
||||
templateUrl: './changelog.component.html',
|
||||
styleUrls: ['./changelog.component.css'],
|
||||
imports: [MergeComponent]
|
||||
imports: [CommonModule,MergeComponent]
|
||||
})
|
||||
export class ChangelogComponent {
|
||||
fetchLog(){
|
||||
|
||||
public displayableLogs: string[] = [];
|
||||
|
||||
constructor(
|
||||
private httpClient: HttpClient,
|
||||
){
|
||||
this.fetchLoglist();
|
||||
this.translateLogDirToString();
|
||||
}
|
||||
|
||||
public fetchLoglist(): string[]{
|
||||
// TODO: Fetch changelog.html
|
||||
fetch("/changelog")
|
||||
// fetch("/changelog")
|
||||
let dirlist: any[] = []
|
||||
this.httpClient.get(environment.api+"/mergelogList", {
|
||||
withCredentials: true
|
||||
}).subscribe({
|
||||
next: (value) => {
|
||||
console.log(value)
|
||||
if(typeof value === "object" && value !== null){
|
||||
if("dirs" in value){
|
||||
console.log("dirs", value)
|
||||
// dirlist.push(...(value as {dirs: unknown[]})["dirs"]);
|
||||
this.displayableLogs = value.dirs as any[];
|
||||
}
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('Error fetch json: ',err);
|
||||
}
|
||||
})
|
||||
console.log(dirlist);
|
||||
return dirlist;
|
||||
}
|
||||
|
||||
|
||||
public translateLogDirToString(){
|
||||
console.log("LogDirList: ", this.displayableLogs)
|
||||
let dirSelector = document.getElementById("log-dir-list")
|
||||
// for(let dir of this.displayableLogs){
|
||||
// console.log(dir)
|
||||
// const p = document.createElement('p');
|
||||
// p.innerText = dir;
|
||||
// dirSelector!.appendChild(p);
|
||||
// dirSelector?.replaceChild(p, dirSelector.children[])
|
||||
// }
|
||||
}
|
||||
|
||||
refreshLogList(){
|
||||
this.fetchLoglist();
|
||||
this.translateLogDirToString();
|
||||
}
|
||||
|
||||
viewLog(name:string){
|
||||
new FetchLogService(this.httpClient).fetchLogsToDisplay("", true, false, name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue