submodule+revert /fetchlog back to REST

This commit is contained in:
pakintada@gmail.com 2023-10-04 11:47:49 +07:00
parent f54eed47e9
commit 22eea482b9
5 changed files with 133 additions and 128 deletions

View file

@ -19,7 +19,7 @@ export class ChangelogComponent {
showLogModal: boolean = false;
showMergeModal: boolean = false;
constructor(private httpClient: HttpClient, private wss: WebsocketService) {
constructor(private httpClient: HttpClient) {
this.fetchLoglist();
// this.translateLogDirToString();
}
@ -29,50 +29,50 @@ export class ChangelogComponent {
// fetch("/changelog")
let dirlist: any[] = [];
this.wss.connect(environment.wsapi + '/listFileInDir');
this.wss.send({
topic: 'changelog',
});
// this.wss.connect(environment.wsapi + '/listFileInDir');
// this.wss.send({
// topic: 'changelog',
// });
let response = this.wss.data;
console.log(response);
// let response = this.wss.data;
// console.log(response);
// this.httpClient.get(environment.api+"/listFileInDir/changelog", {
// 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);
this.httpClient.get(environment.api+"/listFileInDir/changelog", {
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);
// 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);
// }
// })
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;
}

View file

@ -38,9 +38,9 @@ export class WebsocketService {
// }
public data = this.subject.pipe(
share()
);
// public data = this.subject.pipe(
// share()
// );
public send(url: any){
this.subject.next(url);