neutral/public/javascripts/pipeline.js

66 lines
2.1 KiB
JavaScript
Raw Normal View History

2023-12-06 21:56:58 +00:00
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>
2023-12-06 21:56:58 +00:00
${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()
})