diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2025-12-29 13:07:53 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2025-12-29 12:30:40 +0000 |
| commit | 4e5820c0c41b0c979471b66497f055f5631dfd65 (patch) | |
| tree | 5b3c3f48bc12b1e1d5e83375e4326cb3f2f349e8 /dashboard | |
| parent | a938fefbe14c4cb1c83bf75cd9caecced7ae25e8 (diff) | |
dashboard/app: wire more admin handlers
Make it possible 3 more admin handlers that look useful for future and safe.
Now that we don't deploy the app from local machines, it's problematic
to call them without this wiring.
Remove one old handler that we don't need anymore.
Diffstat (limited to 'dashboard')
| -rw-r--r-- | dashboard/app/admin.go | 31 | ||||
| -rw-r--r-- | dashboard/app/main.go | 6 |
2 files changed, 6 insertions, 31 deletions
diff --git a/dashboard/app/admin.go b/dashboard/app/admin.go index 9ff871776..14fd7c2dc 100644 --- a/dashboard/app/admin.go +++ b/dashboard/app/admin.go @@ -226,33 +226,6 @@ func updateBugReporting(c context.Context, w http.ResponseWriter, r *http.Reques }) } -// updateBugTitles adds missing MergedTitles/AltTitles to bugs. -// This can be used to migrate datastore to the new scheme introduced: -// by commit fd1036219797 ("dashboard/app: merge duplicate crashes"). -func updateBugTitles(c context.Context, w http.ResponseWriter, r *http.Request) error { - if accessLevel(c, r) != AccessAdmin { - return fmt.Errorf("admin only") - } - var keys []*db.Key - if err := foreachBug(c, nil, func(bug *Bug, key *db.Key) error { - if len(bug.MergedTitles) == 0 || len(bug.AltTitles) == 0 { - keys = append(keys, key) - } - return nil - }); err != nil { - return err - } - log.Warningf(c, "fetched %v bugs for update", len(keys)) - return updateBatch(c, keys, func(_ *db.Key, bug *Bug) { - if len(bug.MergedTitles) == 0 { - bug.MergedTitles = []string{bug.Title} - } - if len(bug.AltTitles) == 0 { - bug.AltTitles = []string{bug.Title} - } - }) -} - // updateCrashPriorities regenerates priorities for crashes. // This has become necessary after the "dashboard: support per-Manager priority" commit. // For now, the method only considers the crashes referenced from bug origin. @@ -406,10 +379,6 @@ func updateBatch[T any](c context.Context, keys []*db.Key, transform func(key *d // Prevent warnings about dead code. var ( _ = dropNamespace - _ = updateBugReporting - _ = updateBugTitles - _ = restartFailedBisections - _ = setMissingBugFields _ = adminSendEmail _ = updateHeadReproLevel _ = updateCrashPriorities diff --git a/dashboard/app/main.go b/dashboard/app/main.go index 95bd08919..a2025215e 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -967,6 +967,12 @@ func handleAdmin(c context.Context, w http.ResponseWriter, r *http.Request) erro } case "invalidate_bisection": return handleInvalidateBisection(c, w, r) + case "updateBugReporting": + return updateBugReporting(c, w, r) + case "restartFailedBisections": + return restartFailedBisections(c, w, r) + case "setMissingBugFields": + return setMissingBugFields(c, w, r) case "emergency_stop": if err := recordEmergencyStop(c); err != nil { return fmt.Errorf("failed to record an emergency stop: %w", err) |
