From 8ccbbc864741928951988bc943169ddedb105229 Mon Sep 17 00:00:00 2001 From: "pakintada@gmail.com" Date: Wed, 4 Oct 2023 16:19:59 +0700 Subject: [PATCH] add merge log modal --- .../changelog/changelog.component.html | 72 +++++++++++-------- .../features/changelog/changelog.component.ts | 2 +- .../app/shared/services/fetch-log.service.ts | 33 +++++++-- client/src/index.html | 27 +++++++ 4 files changed, 99 insertions(+), 35 deletions(-) diff --git a/client/src/app/features/changelog/changelog.component.html b/client/src/app/features/changelog/changelog.component.html index be64813..112f547 100644 --- a/client/src/app/features/changelog/changelog.component.html +++ b/client/src/app/features/changelog/changelog.component.html @@ -2,6 +2,27 @@
+ +
+ + + +
+ +
@@ -32,14 +53,29 @@
-
+
+ + +
+

How to use

+

Click on "Load", if the file does not have any error, the "View" button will appear and you can view the log file.

+
+ +
+

Generated log files

+
+
+
+ +
+

{{logfile}}

+
+ +
+
+ +
-

Log files

-
-
-
-

{{logfile}}

-
@@ -48,28 +84,6 @@
-
-

Merged files

-
-
- - -
-

{{logfile}}

- -
- -
-
- - -
- - -
diff --git a/client/src/app/features/changelog/changelog.component.ts b/client/src/app/features/changelog/changelog.component.ts index 7858850..2e12cc4 100644 --- a/client/src/app/features/changelog/changelog.component.ts +++ b/client/src/app/features/changelog/changelog.component.ts @@ -96,7 +96,7 @@ export class ChangelogComponent { viewLog(name: string) { let cli = new FetchLogService(this.httpClient); - this.showLogModal = !this.showLogModal; + // this.showLogModal = !this.showLogModal; cli.fetchLogsToDisplay('changelog', true, false, name); cli.fetchLogsToDisplay('changelog', false, false, name); } diff --git a/client/src/app/shared/services/fetch-log.service.ts b/client/src/app/shared/services/fetch-log.service.ts index 6edfa07..8c13a24 100644 --- a/client/src/app/shared/services/fetch-log.service.ts +++ b/client/src/app/shared/services/fetch-log.service.ts @@ -58,15 +58,38 @@ export class FetchLogService { a.innerText = "Download "+filename+".log"; if(isDisplayOnly){ this.showModal = !this.showModal; - blob.text().then(v => document.getElementById("log-disp-texts")!.innerHTML = v); + blob.text().then(v => { + let disp_log = document.getElementById("log-disp-texts-"+filename)!; + disp_log.innerHTML = v; + let target = disp_log.getElementsByTagName('input'); + target[0].remove(); + }); + // create label modall + let l_t = document.getElementById("log_modal_label-"+filename); + console.log(l_t); + if(l_t !== null){ + l_t!.remove(); + } + const l = document.createElement('label'); + l.htmlFor = "log_modal-"+filename; + l.className = "btn flex-1"; + l.innerText = "View"; + l.id = "log_modal_label-"+filename; + document.getElementById("load_log_action-"+filename)!.appendChild(l); + + // change text to loaded after download html + let load_log_btn = document.getElementById("load_log_btn-"+filename)!; + load_log_btn.innerText = "Loaded"; + + } else { - while(document.getElementById("log-dl")?.firstChild){ - document.getElementById("log-dl")?.removeChild(document.getElementById("log-dl")!.firstChild!); + while(document.getElementById("log-dl-"+filename)?.firstChild){ + document.getElementById("log-dl-"+filename)?.removeChild(document.getElementById("log-dl-"+filename)!.firstChild!); } - document.getElementById("log-dl")?.appendChild(a); - document.getElementById("log-dl")!.className = "bg-yellow-500 rounded p-2 sticky top-0"; + document.getElementById("log-dl-"+filename)?.appendChild(a); + document.getElementById("log-dl-"+filename)!.className = "btn"; } }, error: (err: any) => { diff --git a/client/src/index.html b/client/src/index.html index 4bd6dc0..33689a5 100644 --- a/client/src/index.html +++ b/client/src/index.html @@ -13,6 +13,33 @@ /> --> +