settings.createWindow(async () => { const View = new ViewWindow({ title: ` Paramètres`, width: "500px", height: "620px" }) View.setContent(`

Options d'alimentation

Configuration des Tokens

Jenkins

Omega

Accès aux logs

`) const allLogs = document.getElementById("all-logs") const readLogs = document.getElementById("read-logs") get("SERVER_GET_LOGS").then((logs) => { logs.reverse() allLogs.innerHTML = logs.map((log) => { return `` }).join("") }) readLogs.addEventListener("click", () => { const log = allLogs.value post("SERVER_READ_LOG", log).then((logContent) => { const logView = new ViewWindow({ title: ` ${log}`, width: "1000px", height: "520px" }) logContent = logContent.replaceAll("[INFO]", "[INFO]") logContent = logContent.replaceAll("[WARN]", "[WARN]") logContent = logContent.replaceAll("[ERROR]", "[ERROR]") logContent = logContent.replaceAll("[STEP]", "[STEP]") logContent = logContent.replaceAll("[Users]", "[Users]") logContent = logContent.replaceAll("[Web]", "[Web]") logContent = logContent.replaceAll("[Serveur]", "[Serveur]") logContent = logContent.replaceAll("[Authentification]", "[Authentification]") // Get every line of logs and add a set the style in blue when it's the date in [] const logLines = logContent.split("\n") const newLogLines = new Array() logLines.forEach((line) => { if(line.startsWith("[") && line.includes("]")) { const date = line.split("]")[0] + "]" const content = line.replace(date, "") newLogLines.push(`${date}${content}\n`) } else { newLogLines.push(`${line}\n`) } }) logView.setContent(`
${newLogLines.join("")}
`) }) }) const restartButton = document.getElementById("st-restart") const stopButton = document.getElementById("st-stop") const saveButton = document.getElementById("st-save") const jenkinsToken = document.getElementById("jenkins_token") const omegaToken = document.getElementById("omega_token") get("SETTINGS_GET").then((settings) => { jenkinsToken.value = settings.jenkins_token omegaToken.value = settings.omega_token }) restartButton.addEventListener("click", () => { post("SERVER_RESTART") }) stopButton.addEventListener("click", () => { post("SERVER_STOP") }) saveButton.addEventListener("click", () => { post("SETTINGS_SAVE", { jenkins_token: jenkinsToken.value, omega_token: omegaToken.value }) get("SETTINGS_GET").then((settings) => { jenkinsToken.value = settings.jenkins_token omegaToken.value = settings.omega_token }) }) })