Add support for changelog.json
This commit is contained in:
parent
1b439edb77
commit
8221183630
2 changed files with 124 additions and 30 deletions
|
|
@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
|
|||
|
||||
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MergeServiceService } from './merge-service.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment.development';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
|
|
@ -59,23 +59,27 @@ export class MergeComponent<T> {
|
|||
console.log(value)
|
||||
if(typeof value === "object" && value !== null){
|
||||
if("message" in value){
|
||||
console.log(value.message)
|
||||
// alert(value.message + " \n Fetching logs ...")
|
||||
this.downloadLogs("");
|
||||
// fetch html
|
||||
this.fetchLogsToDisplay("", true);
|
||||
// fetch log file
|
||||
this.fetchLogsToDisplay("", false);
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
downloadLogs(query: string){
|
||||
fetchLogsToDisplay(query: string, isDisplayOnly: boolean){
|
||||
let additionalParams:string = "?query=";
|
||||
if(query != ""){
|
||||
additionalParams += query
|
||||
} else {
|
||||
additionalParams = ""
|
||||
}
|
||||
this.httpClient.get(environment.api+"/dllog"+additionalParams, {
|
||||
|
||||
this.httpClient.post(environment.api+"/dllog"+additionalParams, {
|
||||
htmlfile: isDisplayOnly,
|
||||
},{
|
||||
responseType: 'blob',
|
||||
withCredentials: true,
|
||||
}).subscribe(
|
||||
|
|
@ -86,15 +90,13 @@ export class MergeComponent<T> {
|
|||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = 'logfile.log';
|
||||
a.innerText = "download log";
|
||||
console.log("Blob: ",blob.text())
|
||||
// document.body.appendChild(a);
|
||||
document.getElementById("log-dl")?.appendChild(a);
|
||||
document.getElementById("log-dl")!.className = "bg-yellow-500 rounded p-2";
|
||||
blob.text().then(v => document.getElementById("log-disp-texts")!.innerHTML = v);
|
||||
// a.click();
|
||||
|
||||
// window.URL.revokeObjectURL(url);
|
||||
a.innerText = "Click here to download as `.log` file";
|
||||
if(isDisplayOnly){
|
||||
blob.text().then(v => document.getElementById("log-disp-texts")!.innerHTML = v);
|
||||
} else {
|
||||
document.getElementById("log-dl")?.appendChild(a);
|
||||
document.getElementById("log-dl")!.className = "bg-yellow-500 rounded p-2 sticky top-0";
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('Error downloading log file: ',err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue