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 { message GetDashboardComponentsResponse {
string title = 1; string title = 1;
repeated Action actions = 2; repeated Action actions = 2;
repeated Entity entities = 3; repeated Entity entities = 3;
repeated DashboardComponent dashboards = 4; repeated DashboardComponent dashboards = 4;
string authenticated_user = 5;
} }
message GetDashboardComponentsRequest {} message GetDashboardComponentsRequest {}

View File

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

View File

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

View File

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

View File

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