feat: embed common client requests into the template html (#8076)

This should reduce the number of API requests a client makes
when loading the dashboard dramatically!
This commit is contained in:
Kyle Carberry
2023-06-18 13:57:27 -05:00
committed by GitHub
parent 2a10c9127f
commit 9df9ad4503
15 changed files with 409 additions and 184 deletions
+2 -1
View File
@@ -17,6 +17,7 @@ import (
"cdr.dev/slog"
"github.com/coder/coder/coderd/audit"
"github.com/coder/coder/coderd/database"
"github.com/coder/coder/coderd/database/db2sdk"
"github.com/coder/coder/coderd/httpapi"
"github.com/coder/coder/coderd/httpmw"
"github.com/coder/coder/coderd/rbac"
@@ -193,7 +194,7 @@ func (api *API) convertAuditLog(ctx context.Context, dblog database.GetAuditLogs
for _, roleName := range dblog.UserRoles {
rbacRole, _ := rbac.RoleByName(roleName)
user.Roles = append(user.Roles, convertRole(rbacRole))
user.Roles = append(user.Roles, db2sdk.Role(rbacRole))
}
}