add requester to api

This commit is contained in:
pakintada@gmail.com 2023-09-21 13:52:00 +07:00
parent 3301098aa1
commit da4110a47b
4 changed files with 41 additions and 19 deletions

View file

@ -36,13 +36,13 @@
<!-- Output path -->
<div class="flex">
<label class="flex-1 bg-yellow-100 font-bold rounded text-center" for="output_path">Output Path</label>
<label class="flex-1 bg-yellow-100 font-bold rounded text-center" for="output_path">Output Path (.json)</label>
<input class="flex-1 mx-1 bg-slate-300 hover:bg-blue-400 text-center border border-collapse rounded-md" id="output_path" formControlName="output_path" type="text" required>
</div>
<!-- Changelog path -->
<div class="flex">
<label class="flex-1 bg-yellow-100 font-bold rounded text-center" for="changelog_path">Changelog Path</label>
<label class="flex-1 bg-yellow-100 font-bold rounded text-center" for="changelog_path">Changelog Path (.json)</label>
<input class="flex-1 mx-1 bg-slate-300 hover:bg-blue-400 text-center border border-collapse rounded-md" id="changelog_path" formControlName="changelog_path" type="text" required>
</div>

View file

@ -25,12 +25,22 @@ export class MergeComponent<T> {
changelog_path: ""
});
mergeLogs: Map<string, string> | void | undefined
constructor(
private targets: MergeServiceService,
private formBuilder: FormBuilder,
private httpClient: HttpClient,
){}
){
// Default fetching logs
// fetch html
// this.fetchLogsToDisplay("", true, false);
// // fetch log file
// this.fetchLogsToDisplay("", false, false);
// // fetch json
// this.mergeLogs = this.fetchLogsToDisplay("", false, true);
}
private isException(value: any){
return this.exceptionValues.includes(value)
@ -46,7 +56,6 @@ export class MergeComponent<T> {
this.targets.changelog_path = this.mergeForm.value.changelog_path!;
// TODO: Fetch merge. Modify this to websocket
let mergeLogs;
this.httpClient.post<T>(environment.api+"/merge", {
master: this.targets.master_version,
dev: this.targets.dev_version,
@ -64,14 +73,14 @@ export class MergeComponent<T> {
// fetch log file
this.fetchLogsToDisplay("", false, false);
// fetch json
mergeLogs = this.fetchLogsToDisplay("", false, true);
this.mergeLogs = this.fetchLogsToDisplay("", false, true);
}
}
},
})
}
fetchLogsToDisplay(query: string, isDisplayOnly: boolean, requestJson: boolean){
fetchLogsToDisplay(query: string, isDisplayOnly: boolean, requestJson: boolean) : Map<string, string> | void{
let additionalParams:string = "?query=";
if(query != ""){
additionalParams += query