Make people, limits and usage one page, with a panel per branch
A team's members, quota and spend were on three pages that linked to each other. They are three tabs of one page now, each at its old address, and choosing anything in the tree opens its limits, capacity and use beside it, editable in place. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1b89d5cdea
commit
fffed716be
16 files changed
+635
-129
No files matched your search
@@ -87,6 +87,9 @@ type adminUsersData struct {
|
||||
Projects []store.ProjectPath
|
||||
Orgs []store.Org
|
||||
Teams []store.TeamPath
|
||||
// Sel is the branch or person whose panel is open, "team:<id>", so the
|
||||
// tree can mark it.
|
||||
Sel string
|
||||
// Open is the project whose section is shown expanded: the one just acted
|
||||
// on, so the result of a change is in view without the reader hunting for
|
||||
// it. Scripted pages keep every open section open; this is for the rest.
|
||||
@@ -115,6 +118,7 @@ type adminUsersData struct {
|
||||
// shell is no hardship. Revoking a key is here, because it only ever takes
|
||||
// access away.
|
||||
func (p *AccountPages) RegisterAdminUsers(mux *http.ServeMux, s AccountAdmin) {
|
||||
p.peopleStore = s
|
||||
mux.HandleFunc("GET /admin/users", p.adminOnly(func(w http.ResponseWriter, r *http.Request, admin store.User) {
|
||||
p.renderUsers(w, r, s, admin, "", "", r.URL.Query().Get("open"))
|
||||
}))
|
||||
@@ -480,12 +484,17 @@ func (p *AccountPages) adminAction(s AccountAdmin,
|
||||
}
|
||||
|
||||
func (p *AccountPages) renderUsers(w http.ResponseWriter, r *http.Request,
|
||||
s AccountAdmin, admin store.User, msg, errMsg, open string,
|
||||
_ AccountAdmin, admin store.User, msg, errMsg, open string,
|
||||
) {
|
||||
p.renderPeople(w, r, admin, peopleView{Tab: tabPeople, Msg: msg, Err: errMsg, Open: open})
|
||||
}
|
||||
|
||||
// buildUsers is the tree and its people, as the first tab shows them.
|
||||
func (p *AccountPages) buildUsers(r *http.Request, s AccountAdmin, admin store.User, msg, errMsg, open string) adminUsersData {
|
||||
ctx := r.Context()
|
||||
d := adminUsersData{
|
||||
Nav: navFrom(r, "people"),
|
||||
Message: msg, Error: errMsg, Open: open, AdminID: admin.ID,
|
||||
Message: msg, Error: errMsg, Open: open, AdminID: admin.ID, Sel: r.FormValue("sel"),
|
||||
CSRF: csrfFor(r),
|
||||
Version: p.version,
|
||||
HasMirror: p.hasMirror,
|
||||
@@ -558,7 +567,7 @@ func (p *AccountPages) renderUsers(w http.ResponseWriter, r *http.Request,
|
||||
d.Scopes = append(d.Scopes, scopeOption{"project:" + pp.ID, pp.Path})
|
||||
}
|
||||
sort.Slice(d.Scopes, func(i, j int) bool { return d.Scopes[i].Label < d.Scopes[j].Label })
|
||||
render(w, "admin_users", d)
|
||||
return d
|
||||
}
|
||||
|
||||
func keyState(k store.Key, now time.Time) string {
|
||||
|
||||
Reference in new issue
Block a user