console: switch to Vue.JS + Tailwind CSS + Headless UI for the frontend

This commit is contained in:
Vincent Bernat
2022-04-03 22:49:24 +02:00
parent cb541fd6e9
commit ce7fce32ba
42 changed files with 1502 additions and 489 deletions

View File

@@ -5,20 +5,28 @@ import (
netHTTP "net/http"
"testing"
"akvorado/common/daemon"
"akvorado/common/http"
"akvorado/common/reporter"
)
func TestServeAssets(t *testing.T) {
for _, live := range []bool{false, true} {
for _, f := range []string{"images/akvorado.svg", "javascript/bootstrap.bundle.min.js"} {
cases := []struct {
Path string
Code int
}{
{"", 200},
{"something", 200},
{"assets/akvorado.399701ee.svg", 200},
{"assets/somethingelse.svg", 404},
}
for _, tc := range cases {
var name string
switch live {
case true:
name = fmt.Sprintf("livefs-%s", f)
name = fmt.Sprintf("livefs-%s", tc.Path)
case false:
name = fmt.Sprintf("embeddedfs-%s", f)
name = fmt.Sprintf("embeddedfs-%s", tc.Path)
}
t.Run(name, func(t *testing.T) {
r := reporter.NewMock(t)
@@ -26,20 +34,19 @@ func TestServeAssets(t *testing.T) {
_, err := New(r, Configuration{
ServeLiveFS: live,
}, Dependencies{
HTTP: h,
Daemon: daemon.NewMock(t),
HTTP: h,
})
if err != nil {
t.Fatalf("New() error:\n%+v", err)
}
resp, err := netHTTP.Get(fmt.Sprintf("http://%s/assets/%s", h.Address, f))
resp, err := netHTTP.Get(fmt.Sprintf("http://%s/%s", h.Address, tc.Path))
if err != nil {
t.Fatalf("GET /assets/%s:\n%+v", f, err)
t.Fatalf("GET /%s:\n%+v", tc.Path, err)
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
t.Errorf("GET /assets/%s: got status code %d, not 200", f, resp.StatusCode)
if resp.StatusCode != tc.Code {
t.Errorf("GET /%s: got status code %d, not %d", tc.Path, resp.StatusCode, tc.Code)
}
})
}