neutral/public/javascripts/pipeline.js
Raphix 3484ff9ff7
All checks were successful
Neutral/pipeline/head This commit looks good
Version 1.0.0 - Ajout de WebMetrics et de l'édit utilisateur
2024-01-13 18:44:27 +01:00

66 lines
2.1 KiB
JavaScript

pipelines.createWindow(() => {
const View = new ViewWindow({
title: `<i class="fa fa-code-merge"></i> Gestion des pipelines`,
width: "900px",
height: "600px"
})
const pipelinesList = new Array()
View.setContent(`<div style='font-size: 24px; margin-top: 225px;' class='t-center'>
<p><i class="fa-solid fa-rotate fa-spin"></i> Chargement en cours ...</p>
</div>`)
var AllPipelines = new Array()
function getPipelines() {
const pipes = get("PL_GET_ALL")
pipes.then((ANS_pipes) => {
AllPipelines.length = 0
pipelinesList.length = 0
if(ANS_pipes != "UNAVAILABLE") {
ANS_pipes.jobs.forEach((pipe) => {
console.log(pipe)
const pipeline = new Pipeline({
pipeline: pipe,
View: View
})
pipelinesList.push(pipeline.generateHTML())
AllPipelines.push(pipeline)
})
View.setContent(`
<div class="pipelines">
<button id='reload_Btn_pipeline' class='btn blue'><span><i class='fa fa-rotate-left'></i> Recharger les pipelines</span></button>
${pipelinesList.join("")}
</div>`)
for(const pipeline of AllPipelines) {
pipeline.loadScript()
}
getID("reload_Btn_pipeline").addEventListener("click", () => {
View.setContent(`<div style='font-size: 24px; margin-top: 225px;' class='t-center'>
<p><i class="fa-solid fa-rotate fa-spin"></i> Chargement en cours ...</p>
</div>`)
getPipelines()
})
} else {
View.setContent(`<div style='font-size: 24px; margin-top: 225px;' class='t-center lightred'>
<p><i class="fa-solid fa-warning"></i> Une erreur est survenue lors du chargement des pipelines</p>
</div>`)
}
})
}
getPipelines()
})