feature: Show username in header (#270)

This commit is contained in:
James Read 2024-04-15 01:09:55 +01:00 committed by GitHub
parent 43c48aef17
commit f60ab6ce85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 1 deletions

View File

@ -39,9 +39,12 @@ message Entity {
message GetDashboardComponentsResponse {
string title = 1;
repeated Action actions = 2;
repeated Entity entities = 3;
repeated DashboardComponent dashboards = 4;
string authenticated_user = 5;
}
message GetDashboardComponentsRequest {}

View File

@ -221,6 +221,8 @@ func (api *oliveTinAPI) GetDashboardComponents(ctx ctx.Context, req *pb.GetDashb
dashboardCfgToPb(res, cfg.Dashboards)
res.AuthenticatedUser = user.Username
return res, nil
}

View File

@ -35,6 +35,8 @@
</li>
</ul>
</nav>
<span id = "username">&nbsp;</span>
</header>
<main title = "main content">

View File

@ -19,6 +19,8 @@ export function marshalDashboardComponentsJsonToHtml (json) {
marshalActionsJsonToHtml(json)
marshalDashboardStructureToHtml(json)
document.getElementById('username').innerText = json.authenticatedUser
changeDirectory(null)
}

View File

@ -72,9 +72,15 @@ nav ul li a:hover {
text-align: center;
display: inline-grid;
place-items: center;
margin-left: 1em;
padding: 0;
}
#username {
margin-right: 1em;
font-size: small;
}
nav {
display: none;
left: -250px;
@ -120,6 +126,7 @@ h1 {
display: inline;
font-size: small;
padding-left: .5em;
flex-grow: 1;
}
nav ul {
@ -375,7 +382,6 @@ header {
flex-direction: row;
z-index: 3;
align-items: center;
padding-left: 1em;
padding-bottom: .2em;
padding-top: 1em;
position: fixed;