diff --git a/wasm/app-worker.js b/wasm/app-worker.js index 2598271..bec7a7a 100644 --- a/wasm/app-worker.js +++ b/wasm/app-worker.js @@ -1,8 +1,8 @@ -const cacheName = "app-" + "4b705cbe38f400c5db0320ed10fc29357d6d1889"; +const cacheName = "app-" + "e31aa1c4d4bf560a2b0d649865fab57a2bf48d9c"; const resourcesToCache = ["/","/app.css","/app.js","/manifest.webmanifest","/wasm_exec.js","/web/app.wasm","/web/css/alert.css","/web/img/logo.png","https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js","https://cdn.jsdelivr.net/npm/halfmoon@2.0.1/css/halfmoon.min.css","https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css","https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js","https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/yaml.min.js","https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css"]; self.addEventListener("install", (event) => { - console.log("installing app worker 4b705cbe38f400c5db0320ed10fc29357d6d1889"); + console.log("installing app worker e31aa1c4d4bf560a2b0d649865fab57a2bf48d9c"); event.waitUntil( caches @@ -28,7 +28,7 @@ self.addEventListener("activate", (event) => { ); }) ); - console.log("app worker 4b705cbe38f400c5db0320ed10fc29357d6d1889 is activated"); + console.log("app worker e31aa1c4d4bf560a2b0d649865fab57a2bf48d9c is activated"); }); self.addEventListener("fetch", (event) => { diff --git a/wasm/app.go b/wasm/app.go index 2ff8775..ef8a7c5 100644 --- a/wasm/app.go +++ b/wasm/app.go @@ -161,30 +161,43 @@ func render(d app.UI, p []*Property, accordionID string, depth int) app.UI { headerElements = append(headerElements, app.Div().Class("col").Class("fst-italic").Text(prop.Patterns)) } - header := app.H2().Class("accordion-header").Class(borderOpacity).Body( - app.Button().ID("accordion-button-id-"+prop.Name+accordionID).Class("accordion-button").Type("button").DataSets( - map[string]any{ - "bs-toggle": "collapse", - "bs-target": "#accordion-collapse-for-" + prop.Name + accordionID}). - Aria("expanded", "false"). - Aria("controls", "accordion-collapse-for-"+prop.Name+accordionID). - Body( - app.Div().Class("container").Body( - // Both row's are important here to produce the desired outcome. - app.Div().Class("row").Body( - app.P().Class("fw-bold").Class("row").Body( - headerElements..., - ), - app.Div().Class("row").Class("text-break").Body(app.Text(prop.Description)), - ), - ), - )) + headerContainer := app.Div().Class("container").Body( + // Both rows are important here to produce the desired outcome. + app.Div().Class("row").Body( + app.P().Class("fw-bold").Class("row").Body( + headerElements..., + ), + app.Div().Class("row").Class("text-break").Body(app.Text(prop.Description)), + ), + ) + + button := app.Button().ID("accordion-button-id-"+prop.Name+accordionID).Class("accordion-button").Type("button").DataSets( + map[string]any{ + "bs-toggle": "collapse", + "bs-target": "#accordion-collapse-for-" + prop.Name + accordionID}). + Aria("expanded", "false"). + Aria("controls", "accordion-collapse-for-"+prop.Name+accordionID). + Body( + headerContainer, + ) + + if len(prop.Properties) != 0 { + button.Class("bg-success-subtle") + } + + header := app.H2().Class("accordion-header").Class(borderOpacity).Body(button) elements = append(elements, header) + + // The next section can be skipped if there are no child properties. + if len(prop.Properties) == 0 { + continue + } + accordionDiv := app.Div().Class("accordion-collapse collapse").ID("accordion-collapse-for-"+prop.Name+accordionID).DataSet("bs-parent", "#"+accordionID) accordionBody := app.Div().Class("accordion-body") - bodyElements := []app.UI{} + var bodyElements []app.UI // add any children that the parent has if len(prop.Properties) > 0 { diff --git a/wasm/app.js b/wasm/app.js index ad40533..3b6333e 100644 --- a/wasm/app.js +++ b/wasm/app.js @@ -5,7 +5,7 @@ var goappNav = function () {}; var goappOnUpdate = function () {}; var goappOnAppInstallChange = function () {}; -const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"","GOAPP_STATIC_RESOURCES_URL":"","GOAPP_VERSION":"4b705cbe38f400c5db0320ed10fc29357d6d1889"}; +const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"","GOAPP_STATIC_RESOURCES_URL":"","GOAPP_VERSION":"e31aa1c4d4bf560a2b0d649865fab57a2bf48d9c"}; const goappLoadingLabel = "{progress}%"; const goappWasmContentLengthHeader = ""; diff --git a/wasm/index.html b/wasm/index.html index f748c26..8093a65 100644 --- a/wasm/index.html +++ b/wasm/index.html @@ -3,22 +3,22 @@ - + - + Preview CRDs - + - - + + - + @@ -27,7 +27,7 @@ - + @@ -64,7 +64,7 @@
diff --git a/wasm/main.go b/wasm/main.go index 55337b0..ad77993 100644 --- a/wasm/main.go +++ b/wasm/main.go @@ -47,7 +47,6 @@ func main() { Title: "Preview CRDs", Author: "Gergely Brautigam", HTML: func() app.HTMLHtml { return app.Html().DataSet("bs-core", "modern").DataSet("bs-theme", "dark") }, - // Body: func() app.HTMLBody { return app.Body().Class("dark-mode") }, Styles: []string{ "web/css/alert.css", "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css", diff --git a/wasm/web/app.wasm b/wasm/web/app.wasm index 1d23f8f..0d10a9d 100755 Binary files a/wasm/web/app.wasm and b/wasm/web/app.wasm differ