feature: Custom navigation links in the nav (sidebar/topbar)
This commit is contained in:
parent
0b66bc7bbd
commit
706441799f
|
|
@ -115,6 +115,8 @@ type Config struct {
|
||||||
AuthJwtPubKeyPath string // will read pub key from file on disk
|
AuthJwtPubKeyPath string // will read pub key from file on disk
|
||||||
AuthHttpHeaderUsername string
|
AuthHttpHeaderUsername string
|
||||||
AuthHttpHeaderUserGroup string
|
AuthHttpHeaderUserGroup string
|
||||||
|
AuthLoginUrl string
|
||||||
|
AuthAllowGuest bool
|
||||||
DefaultPermissions PermissionsList
|
DefaultPermissions PermissionsList
|
||||||
AccessControlLists []*AccessControlList
|
AccessControlLists []*AccessControlList
|
||||||
WebUIDir string
|
WebUIDir string
|
||||||
|
|
@ -130,12 +132,16 @@ type Config struct {
|
||||||
DefaultIconForActions string
|
DefaultIconForActions string
|
||||||
DefaultIconForDirectories string
|
DefaultIconForDirectories string
|
||||||
DefaultIconForBack string
|
DefaultIconForBack string
|
||||||
AuthLoginUrl string
|
AdditionalNavigationLinks []*NavigationLink
|
||||||
AuthAllowGuest bool
|
|
||||||
|
|
||||||
usedConfigDir string
|
usedConfigDir string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NavigationLink struct {
|
||||||
|
Title string
|
||||||
|
Url string
|
||||||
|
}
|
||||||
|
|
||||||
type SaveLogsConfig struct {
|
type SaveLogsConfig struct {
|
||||||
ResultsDirectory string
|
ResultsDirectory string
|
||||||
OutputDirectory string
|
OutputDirectory string
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ type webUISettings struct {
|
||||||
SshFoundConfig string
|
SshFoundConfig string
|
||||||
EnableCustomJs bool
|
EnableCustomJs bool
|
||||||
AuthLoginUrl string
|
AuthLoginUrl string
|
||||||
|
AdditionalLinks []*config.NavigationLink
|
||||||
}
|
}
|
||||||
|
|
||||||
func findWebuiDir() string {
|
func findWebuiDir() string {
|
||||||
|
|
@ -119,6 +120,7 @@ func generateWebUISettings(w http.ResponseWriter, r *http.Request) {
|
||||||
SshFoundConfig: installationinfo.Runtime.SshFoundConfig,
|
SshFoundConfig: installationinfo.Runtime.SshFoundConfig,
|
||||||
EnableCustomJs: cfg.EnableCustomJs,
|
EnableCustomJs: cfg.EnableCustomJs,
|
||||||
AuthLoginUrl: cfg.AuthLoginUrl,
|
AuthLoginUrl: cfg.AuthLoginUrl,
|
||||||
|
AdditionalLinks: cfg.AdditionalNavigationLinks,
|
||||||
})
|
})
|
||||||
|
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
|
|
|
||||||
|
|
@ -126,11 +126,27 @@ function processWebuiSettingsJson (settings) {
|
||||||
if (titleElem) titleElem.innerText = window.pageTitle
|
if (titleElem) titleElem.innerText = window.pageTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processAdditionaLinks(settings.AdditionalLinks)
|
||||||
|
|
||||||
window.settings = settings
|
window.settings = settings
|
||||||
|
|
||||||
refreshDiagnostics()
|
refreshDiagnostics()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function processAdditionaLinks (links) {
|
||||||
|
for (const link of links) {
|
||||||
|
const linkA = document.createElement('a')
|
||||||
|
linkA.href = link.Url
|
||||||
|
linkA.innerText = link.Title
|
||||||
|
linkA.target = '_blank'
|
||||||
|
|
||||||
|
const linkLi = document.createElement('li')
|
||||||
|
linkLi.appendChild(linkA)
|
||||||
|
|
||||||
|
document.getElementById('supplemental-links').prepend(linkLi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function main () {
|
function main () {
|
||||||
initMarshaller()
|
initMarshaller()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue