Browse Source

En cours de développement

master
mls-361 9 months ago
parent
commit
d383710154
  1. 16
      internal/gui/gui.go
  2. 40
      internal/gui/jobs.go
  3. 6
      internal/gui/layout.go
  4. 16
      internal/gui/static/css/jobs.css
  5. 16
      internal/gui/static/css/workflows.css
  6. 36
      internal/gui/static/js/dashboard.js
  7. 9
      internal/gui/static/js/jobs.js
  8. 9
      internal/gui/static/js/workflows.js
  9. 40
      internal/gui/workflows.go

16
internal/gui/gui.go

@ -28,18 +28,30 @@ func Build(ccs *components.Components) error {
Render(w)
}))
router.Get("/dashboard", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
router.Get("/gui/dashboard", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
_ = newDashboard(ccs).
build().
Render(w)
}))
router.Get("/dashboard/update", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
router.Get("/gui/dashboard/update", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
_ = newDashboard(ccs).
update().
Render(w)
}))
router.Get("/gui/job/list", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_ = newJobList(ccs).
build().
Render(w)
}))
router.Get("/gui/workflow/list", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_ = newWorkflowList(ccs).
build().
Render(w)
}))
return nil
}

40
internal/gui/jobs.go

@ -0,0 +1,40 @@
/*
------------------------------------------------------------------------------------------------------------------------
####### gui ####### Copyright (c) 2021 mls-361 ##################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package gui
import (
g "github.com/maragudk/gomponents"
. "github.com/maragudk/gomponents/html"
"forge.chapril.org/armen/armen/internal/components"
)
type jobList struct {
app components.Application
storage components.Storage
}
func newJobList(ccs *components.Components) *jobList {
return &jobList{
app: ccs.Application,
storage: ccs.Storage,
}
}
func (jl *jobList) content() g.Node {
return Div(
Class("jobs"),
)
}
func (jl *jobList) build() g.Node {
return buildPage(jl.app, "jobs", jl.content())
}
/*
######################################################################################################## @(°_°)@ #######
*/

6
internal/gui/layout.go

@ -58,9 +58,9 @@ func buildPage(app components.Application, name string, content g.Node) g.Node {
Div(
Class("navbar"),
navbarLink(app.Name(), "/", "home", name),
navbarLink("dashboard", "/dashboard", "number of jobs and workflows per status", name),
navbarLink("jobs", "/search/jobs", "search for jobs", name),
navbarLink("workflows", "/search/workflows", "search for workflows", name),
navbarLink("dashboard", "/gui/dashboard", "number of jobs and workflows per status", name),
navbarLink("jobs", "/gui/search/jobs", "search for jobs", name),
navbarLink("workflows", "/gui/search/workflows", "search for workflows", name),
),
),
),

16
internal/gui/static/css/jobs.css

@ -0,0 +1,16 @@
/*
------------------------------------------------------------------------------------------------------------------------
####### jobs ####### Copyright (c) 2021 mls-361 #################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
@charset "utf-8";
@import url("normalize.css");
@import url("colors.css");
@import url("common.css");
/*
######################################################################################################## @(°_°)@ #######
*/

16
internal/gui/static/css/workflows.css

@ -0,0 +1,16 @@
/*
------------------------------------------------------------------------------------------------------------------------
####### workflows ####### Copyright (c) 2021 mls-361 ############################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
@charset "utf-8";
@import url("normalize.css");
@import url("colors.css");
@import url("common.css");
/*
######################################################################################################## @(°_°)@ #######
*/

36
internal/gui/static/js/dashboard.js

@ -7,25 +7,31 @@
(function() {
const dashboard = document.getElementById("dashboard");
window.addEventListener("load", function(event) {
window.setInterval(
var interval;
window.onload = function(event) {
interval = window.setInterval(
function() {
fetch("/dashboard/update").then(function(response) {
if (response.ok) {
response.text().then(function(html) {
dashboard.innerHTML = html;
});
} else {
$.showError("Fetch error: invalid network response"); //////////////////////////////////////////
}
})
.catch(function(error) {
$.showError("Fetch error: " + error.message); //////////////////////////////////////////////////////
});
if (window.closed) {
window.clearInterval(interval);
} else {
fetch("/gui/dashboard/update").then(function(response) {
if (response.ok) {
response.text().then(function(html) {
dashboard.innerHTML = html;
});
} else {
$.showError("Fetch error: invalid network response"); //////////////////////////////////////
}
})
.catch(function(error) {
$.showError("Fetch error: " + error.message); //////////////////////////////////////////////////
});
}
},
3000
);
});
};
})();
/*

9
internal/gui/static/js/jobs.js

@ -0,0 +1,9 @@
/*
------------------------------------------------------------------------------------------------------------------------
####### jobs ####### Copyright (c) 2021 mls-361 #################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
/*
######################################################################################################## @(°_°)@ #######
*/

9
internal/gui/static/js/workflows.js

@ -0,0 +1,9 @@
/*
------------------------------------------------------------------------------------------------------------------------
####### workflows ####### Copyright (c) 2021 mls-361 ############################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
/*
######################################################################################################## @(°_°)@ #######
*/

40
internal/gui/workflows.go

@ -0,0 +1,40 @@
/*
------------------------------------------------------------------------------------------------------------------------
####### gui ####### Copyright (c) 2021 mls-361 ##################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package gui
import (
g "github.com/maragudk/gomponents"
. "github.com/maragudk/gomponents/html"
"forge.chapril.org/armen/armen/internal/components"
)
type workflowList struct {
app components.Application
storage components.Storage
}
func newWorkflowList(ccs *components.Components) *workflowList {
return &workflowList{
app: ccs.Application,
storage: ccs.Storage,
}
}
func (wl *workflowList) content() g.Node {
return Div(
Class("jobs"),
)
}
func (wl *workflowList) build() g.Node {
return buildPage(wl.app, "workflows", wl.content())
}
/*
######################################################################################################## @(°_°)@ #######
*/
Loading…
Cancel
Save