Make navbar responsive

This does not work currently because we do not include bootstrap js
This commit is contained in:
Jan Eitzinger 2022-02-11 16:51:49 +01:00
parent 992518f2c7
commit e6b664f16c
2 changed files with 78 additions and 71 deletions

View File

@ -103,6 +103,8 @@ func setupRoutes(router *mux.Router, routes []Route) {
route.Title = strings.Replace(route.Title, "<ID>", id.(string), 1) route.Title = strings.Replace(route.Title, "<ID>", id.(string), 1)
} }
infos["clusters"] = config.Clusters
page := templates.Page{ page := templates.Page{
Title: route.Title, Title: route.Title,
Config: conf, Config: conf,

View File

@ -23,83 +23,88 @@
<img alt="ClusterCockpit Logo" src="/img/logo.png" class="d-inline-block align-top"> <img alt="ClusterCockpit Logo" src="/img/logo.png" class="d-inline-block align-top">
{{end}} {{end}}
</a> </a>
{{block "navigation" .}} <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<ul class="navbar-nav mr-auto"> <span class="navbar-toggler-icon"></span>
{{block "navitem_joblist" .}} </button>
<li class="nav-item"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="nav-link fs-5" href="/monitoring/jobs/"> {{block "navigation" .}}
<span class="cc-nav-text">Joblist</span> <ul class="navbar-nav mr-auto">
<i class="bi-card-list"></i> {{block "navitem_joblist" .}}
</a>
</li>
{{end}}
{{if .Infos.admin }}
{{block "navitem_analysis" .}}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link fs-5" href="/monitoring/analysis/"> <a class="nav-link fs-5" href="/monitoring/jobs/">
<span class="cc-nav-text">Analysis</span> <span class="cc-nav-text">Joblist</span>
<i class="bi-graph-up"></i> <i class="bi-card-list"></i>
</a> </a>
</li> </li>
{{end}} {{end}}
{{block "navitem_systems" .}} {{if .Infos.admin }}
<li class="nav-item"> {{block "navitem_analysis" .}}
<a class="nav-link fs-5" href="/monitoring/systems/"> <li class="nav-item ">
<span class="cc-nav-text">Systems</span> <a class="nav-link disabled fs-5" href="/monitoring/analysis/">
<i class="bi-graph-up"></i> <span class="cc-nav-text">Analysis</span>
</a> <i class="bi-graph-up"></i>
</li> </a>
{{end}} </li>
{{block "navitem_users" .}}
<li class="nav-item">
<a class="nav-link fs-5" href="/monitoring/users/">
<span class="cc-nav-text">Users</span>
<i class="bi-people-fill"></i>
</a>
</li>
{{end}}
{{block "navitem_tags" .}}
<li class="nav-item">
<a class="nav-link fs-5" href="/monitoring/tags/">
<span class="cc-nav-text">Tags</span>
<i class="bi-tag-fill"></i>
</a>
</li>
{{end}}
{{else}}
{{block "navitem_stats" .}}
<li class="nav-item">
<a class="nav-link fs-5" href="/monitoring/user/admin">
<span class="cc-nav-text">Statistics</span>
<i class="bi-bar-chart-line-fill"></i>
</a>
</li>
{{end}}
{{end}}
</ul>
{{if .Infos.loginId }}
<div class="d-flex align-items-end">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<form method="post" action="/logout">
<button type="submit" class="btn btn-link nav-link fs-5">
<span class="cc-nav-text">{{ .Infos.loginId }} Logout</span>
<i class="bi-box-arrow-right"></i>
</button>
</form>
</li>
</ul>
<form class="d-flex my-0" onsubmit="this.action='/search';">
{{if .Infos.admin }}
<input class="form-control me-2" type="search" name="searchId" placeholder="jobId / userId" id="searchId" aria-label="Search">
{{else}}
<input class="form-control me-2" type="search" name="searchId" placeholder="jobId" id="searchId" aria-label="Search">
{{end}} {{end}}
<button class="btn btn-outline-success fs-6" type="submit">Search</button> {{block "navitem_systems" .}}
</form> <li class="nav-item ">
</div> <a class="nav-link disabled fs-5" href="/monitoring/systems/">
<span class="cc-nav-text">Systems</span>
<i class="bi-graph-up"></i>
</a>
</li>
{{end}}
{{block "navitem_users" .}}
<li class="nav-item">
<a class="nav-link fs-5" href="/monitoring/users/">
<span class="cc-nav-text">Users</span>
<i class="bi-people-fill"></i>
</a>
</li>
{{end}}
{{block "navitem_tags" .}}
<li class="nav-item">
<a class="nav-link fs-5" href="/monitoring/tags/">
<span class="cc-nav-text">Tags</span>
<i class="bi-tag-fill"></i>
</a>
</li>
{{end}}
{{else}}
{{block "navitem_stats" .}}
<li class="nav-item">
<a class="nav-link fs-5" href="/monitoring/user/admin">
<span class="cc-nav-text">Statistics</span>
<i class="bi-bar-chart-line-fill"></i>
</a>
</li>
{{end}}
{{end}}
</ul>
</div>
{{if .Infos.loginId }}
<div class="d-flex align-items-end">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<form method="post" action="/logout">
<button type="submit" class="btn btn-link nav-link fs-5">
<span class="cc-nav-text">{{ .Infos.loginId }} Logout</span>
<i class="bi-box-arrow-right"></i>
</button>
</form>
</li>
</ul>
<form class="d-flex my-0" onsubmit="this.action='/search';">
{{if .Infos.admin }}
<input class="form-control me-2" type="search" name="searchId" placeholder="jobId / userId" id="searchId" aria-label="Search">
{{else}}
<input class="form-control me-2" type="search" name="searchId" placeholder="jobId" id="searchId" aria-label="Search">
{{end}}
<button class="btn btn-outline-success fs-6" type="submit">Search</button>
</form>
</div>
{{end}}
{{end}} {{end}}
{{end}}
</div> </div>
</nav> </nav>
</header> </header>