opensafely-core / job-server

A server for mediating jobs that can be run in an OpenSAFELY secure environment. q.v. job-runner
https://jobs.opensafely.org
Other
5 stars 11 forks source link

Consider merging `ProjectList` / `ProjectsDashboard` / `Copiloting` dashboard #4714

Open mikerkelly opened 3 days ago

mikerkelly commented 3 days ago

There are three views on the staff pages that list projects, with overlapping functionality and duplicated code:

All three are intended to help staff locate project pages. Can we merge some or all to streamline the codebase?

Copiloting is the most comprehensive and likely the best candidate to keep. ProjectsDashboard was forked from it, duplicating code and violating DRY principles. ProjectList takes ~50ms to load wheras the dashboard ~8/900ms, perhaps this is acceptable on these rarely used pages. If full unification isn’t possible, could we refactor to share common code? Copiloting and ProjectsDashboard directly share much of the same code. They have some implementation differences but nothing materials and perform basically the same job. Additionally, Copiloting's exclusion of specific orgs could likely be implemented as a filter.

mikerkelly commented 3 days ago

According to this Honeycomb trace users have visited /staff/projects (ProjectList) 472 times in the past 60 days, and haven't visited the dashboards at all.

In this Slack message Catherine Stables notes she sometimes uses the dashboards.

According to the commit message that created ProjectsDashboard:

This is ostensibly identical to the copilots dashboard but doesn't exclude the Datalab or LSHTM orgs. We expect these dashboards to diverge over time, hence putting them on separate pages.

Perhaps it would be better to have parameterised the copiloting dashboard rather than forking the code.