frontend: Rework asset generation

This commit reworks frontend asset generation to not need manually
written html files, but instead generate them automatically.
This commit is contained in:
Tom Wiesing 2022-10-15 14:10:32 +02:00
parent ebdbe9fabd
commit ccab2883a6
No known key found for this signature in database
42 changed files with 408 additions and 177 deletions

View file

@ -18,4 +18,4 @@
.wisski.stopped {
background-color: #ff7a7a;
}
}

View file

@ -1,5 +1,2 @@
import "~/src/base/index"
import "./index.css"
import "~/src/lib/remote"
import "~/src/lib/highlight"

View file

@ -0,0 +1 @@
@import url("../ControlIndex/index.css")

View file

@ -0,0 +1 @@
import "../ControlIndex/index"

View file

@ -1 +0,0 @@
<script type="module" src="./index.ts"></script>

View file

@ -1 +0,0 @@
<script type="module" src="./index.ts"></script>

View file

@ -1 +0,0 @@
<script type="module" src="./index.ts"></script>

View file

@ -1 +0,0 @@
import "~/src/base/index"

View file

@ -49,6 +49,7 @@ function makeTextBuffer(target: HTMLElement, scrollContainer: HTMLElement, size:
const elements = document.getElementsByClassName('remote-action')
Array.from(elements).forEach((element) => {
const action = element.getAttribute('data-action') as string;
const reload = element.hasAttribute('data-force-reload');
const param = element.getAttribute('data-param') as string | undefined;
const bufferSize = (function () {
const number = parseInt(element.getAttribute('data-buffer') ?? "", 10) ?? 0;
@ -72,9 +73,17 @@ Array.from(elements).forEach((element) => {
// create a button to eventually close everything
const button = document.createElement("button")
button.className = "pure-button pure-button-success"
button.append("Close")
button.append(reload ? "Close & Reload" : "Close")
button.addEventListener('click', function (event) {
event.preventDefault();
if (reload) {
button.setAttribute('disabled', 'disabled');
target.innerHTML = 'Reloading page ...'
location.reload()
return;
}
modal.parentNode?.removeChild(modal);
})