feature: Sidebar hiding now pure CSS & theme reloading for devs (#391)
This commit is contained in:
parent
c9095b4d67
commit
ddb803d9b5
|
|
@ -87,6 +87,7 @@ type PrometheusConfig struct {
|
||||||
type Config struct {
|
type Config struct {
|
||||||
UseSingleHTTPFrontend bool
|
UseSingleHTTPFrontend bool
|
||||||
ThemeName string
|
ThemeName string
|
||||||
|
ThemeCacheDisabled bool
|
||||||
ListenAddressSingleHTTPFrontend string
|
ListenAddressSingleHTTPFrontend string
|
||||||
ListenAddressWebUI string
|
ListenAddressWebUI string
|
||||||
ListenAddressRestActions string
|
ListenAddressRestActions string
|
||||||
|
|
@ -188,6 +189,7 @@ func DefaultConfigWithBasePort(basePort int) *Config {
|
||||||
config.DefaultIconForActions = "😀"
|
config.DefaultIconForActions = "😀"
|
||||||
config.DefaultIconForDirectories = "📁"
|
config.DefaultIconForDirectories = "📁"
|
||||||
config.DefaultIconForBack = "«"
|
config.DefaultIconForBack = "«"
|
||||||
|
config.ThemeCacheDisabled = false
|
||||||
|
|
||||||
config.ListenAddressSingleHTTPFrontend = fmt.Sprintf("0.0.0.0:%d", basePort)
|
config.ListenAddressSingleHTTPFrontend = fmt.Sprintf("0.0.0.0:%d", basePort)
|
||||||
config.ListenAddressRestActions = fmt.Sprintf("localhost:%d", basePort+1)
|
config.ListenAddressRestActions = fmt.Sprintf("localhost:%d", basePort+1)
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ func setupCustomWebuiDir() {
|
||||||
func generateThemeCss(w http.ResponseWriter, r *http.Request) {
|
func generateThemeCss(w http.ResponseWriter, r *http.Request) {
|
||||||
themeCssFilename := path.Join(findCustomWebuiDir(), "themes", cfg.ThemeName, "theme.css")
|
themeCssFilename := path.Join(findCustomWebuiDir(), "themes", cfg.ThemeName, "theme.css")
|
||||||
|
|
||||||
if !customThemeCssRead {
|
if !customThemeCssRead || cfg.ThemeCacheDisabled {
|
||||||
customThemeCssRead = true
|
customThemeCssRead = true
|
||||||
|
|
||||||
if _, err := os.Stat(themeCssFilename); err == nil {
|
if _, err := os.Stat(themeCssFilename); err == nil {
|
||||||
|
|
|
||||||
|
|
@ -170,16 +170,12 @@ function setSectionNavigationVisible (visible) {
|
||||||
btn.innerHTML = '«'
|
btn.innerHTML = '«'
|
||||||
|
|
||||||
nav.classList.add('shown')
|
nav.classList.add('shown')
|
||||||
nav.style.display = 'flex'
|
|
||||||
} else {
|
} else {
|
||||||
btn.setAttribute('aria-pressed', true)
|
btn.setAttribute('aria-pressed', true)
|
||||||
btn.setAttribute('aria-label', 'Close sidebar navigation')
|
btn.setAttribute('aria-label', 'Close sidebar navigation')
|
||||||
btn.innerHTML = '☰'
|
btn.innerHTML = '☰'
|
||||||
|
|
||||||
nav.classList.remove('shown')
|
nav.classList.remove('shown')
|
||||||
setTimeout(() => {
|
|
||||||
nav.style.display = 'none'
|
|
||||||
}, 600)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
btn.disabled = true
|
btn.disabled = true
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,6 @@ nav ul li a:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
display: none;
|
|
||||||
left: -250px;
|
left: -250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,14 +114,16 @@ nav.sidebar {
|
||||||
width: 180px;
|
width: 180px;
|
||||||
height: 100dvh;
|
height: 100dvh;
|
||||||
top: 0;
|
top: 0;
|
||||||
transition: left 0.5s ease;
|
transition: left 0.5s ease, visibility 0.5s ease;
|
||||||
box-shadow: 0 0 10px 0 #444;
|
box-shadow: 0 0 10px 0 #444;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.shown {
|
nav.sidebar.shown {
|
||||||
|
visibility: visible;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue