fix static bug and load main page
All checks were successful
Build Process Supervisor / build (amd64, .exe, windows) (push) Successful in 2m32s
Build Process Supervisor / build (amd64, , linux) (push) Successful in 2m41s
Build Process Supervisor / build (arm, 6, , linux) (push) Successful in 2m35s
Build Process Supervisor / build (arm64, , linux) (push) Successful in 2m31s
All checks were successful
Build Process Supervisor / build (amd64, .exe, windows) (push) Successful in 2m32s
Build Process Supervisor / build (amd64, , linux) (push) Successful in 2m41s
Build Process Supervisor / build (arm, 6, , linux) (push) Successful in 2m35s
Build Process Supervisor / build (arm64, , linux) (push) Successful in 2m31s
This commit is contained in:
@@ -34,18 +34,18 @@ func NewMainPage(templates *embed.FS) (*MainPage, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *MainPage) UpdateMainPage(w http.ResponseWriter, r *http.Request) {
|
func (m *MainPage) UpdateMainPage(w http.ResponseWriter, r *http.Request) {
|
||||||
// tmpl := template.Must(
|
|
||||||
// template.New("index.html").ParseFS(
|
|
||||||
// m.templates,
|
|
||||||
// "templates/index.html",
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
|
|
||||||
tmpl := template.Must(
|
tmpl := template.Must(
|
||||||
template.New("index.html").ParseFiles(
|
template.New("index.html").ParseFS(
|
||||||
|
m.templates,
|
||||||
"templates/index.html",
|
"templates/index.html",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// tmpl := template.Must(
|
||||||
|
// template.New("index.html").ParseFiles(
|
||||||
|
// "templates/index.html",
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
tmpl.Execute(w, m)
|
tmpl.Execute(w, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
main.go
8
main.go
@@ -4,6 +4,7 @@ import (
|
|||||||
"embed"
|
"embed"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"processSupervisor/handlers"
|
"processSupervisor/handlers"
|
||||||
@@ -28,7 +29,12 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(staticFS))))
|
staticSub, err := fs.Sub(staticFS, "static")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(staticSub))))
|
||||||
|
|
||||||
http.HandleFunc("/taskmanager/htop", htop.UpdateHTop)
|
http.HandleFunc("/taskmanager/htop", htop.UpdateHTop)
|
||||||
http.HandleFunc("/", mainPage.UpdateMainPage)
|
http.HandleFunc("/", mainPage.UpdateMainPage)
|
||||||
|
@@ -8,6 +8,9 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Placeholder List for Future Processes -->
|
||||||
|
<ul id="process-list">
|
||||||
<div class="top-link-container">
|
<div class="top-link-container">
|
||||||
<a href="/taskmanager/htop" class="top-link" target="_blank" rel="noopener noreferrer">
|
<a href="/taskmanager/htop" class="top-link" target="_blank" rel="noopener noreferrer">
|
||||||
📈 Task Manager
|
📈 Task Manager
|
||||||
@@ -16,8 +19,6 @@
|
|||||||
|
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<h2>Processes</h2>
|
<h2>Processes</h2>
|
||||||
<!-- Placeholder List for Future Processes -->
|
|
||||||
<ul id="process-list">
|
|
||||||
{{ range .Supervisor.GetProcesses }}
|
{{ range .Supervisor.GetProcesses }}
|
||||||
<li>
|
<li>
|
||||||
<span class="process-name">📦
|
<span class="process-name">📦
|
||||||
|
Reference in New Issue
Block a user