add display merged files. WIP json display

This commit is contained in:
pakintada@gmail.com 2023-09-22 16:54:52 +07:00
parent a5f4d48aad
commit e7bb2639cd
7 changed files with 250 additions and 44 deletions

View file

@ -15,7 +15,9 @@ import { FetchLogService } from 'src/app/shared/services/fetch-log.service';
export class ChangelogComponent {
public displayableLogs: string[] = [];
public displayableMergeJson: string[] = [];
showLogModal:boolean = false;
showMergeModal:boolean = false;
constructor(
private httpClient: HttpClient,
@ -28,7 +30,7 @@ export class ChangelogComponent {
// TODO: Fetch changelog.html
// fetch("/changelog")
let dirlist: any[] = []
this.httpClient.get(environment.api+"/mergelogList", {
this.httpClient.get(environment.api+"/listFileInDir/changelog", {
withCredentials: true
}).subscribe({
next: (value) => {
@ -45,7 +47,26 @@ export class ChangelogComponent {
console.error('Error fetch json: ',err);
}
})
console.log(dirlist);
// console.log(dirlist);
this.httpClient.get(environment.api+"/listFileInDir/merge", {
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.displayableMergeJson = value.dirs as any[];
}
}
},
error: (err) => {
console.error('Error fetch json: ',err);
}
})
return dirlist;
}
@ -70,11 +91,22 @@ export class ChangelogComponent {
viewLog(name:string){
let cli = new FetchLogService(this.httpClient);
this.showLogModal = !this.showLogModal;
cli.fetchLogsToDisplay("", true, false, name);
cli.fetchLogsToDisplay("", false, false, name);
cli.fetchLogsToDisplay("changelog", true, false, name);
cli.fetchLogsToDisplay("changelog", false, false, name);
}
toggleLogModal(){
this.showLogModal = !this.showLogModal;
viewJson(name:string){
let cli = new FetchLogService(this.httpClient);
this.showMergeModal = !this.showMergeModal;
cli.fetchLogsToDisplay("merge", false, true, name);
// cli.fetchLogsToDisplay("", false, false, name);
}
toggleLogModal(target:string){
if(target == "merge"){
this.showMergeModal = !this.showMergeModal;
} else {
this.showLogModal = !this.showLogModal;
}
}
}