mattcasters opened a new pull request, #76600:
URL: https://github.com/apache/airflow/pull/76600

   First time contributor, long time fan.
   
   Browse → Audit Log was loading every row in `log`. On a busy install that 
page is slow, and the useful view is usually the last few days. This opens the 
standalone page on the last 7 days, says so, and makes that limit easy to 
remove.
   
   ![Browse Audit Log limited to the last 7 days](IMAGE_PLACEHOLDER)
   
   closes: #76588
   
   ## What changed
   
   - The Browse → Audit Log page (`/events`) requests events from the last 7 
days on the first load, so the unfiltered count never runs. `log` already has 
`idx_log_dttm`, and `GET /eventLogs` already accepts `after`.
   - An alert at the top reads "Showing audit logs from the last 7 days. Older 
entries are hidden." **Show all** drops the bound.
   - The date pill is labeled **When**. `after` and `before` filter `Log.dttm`, 
the When column. Removing that pill, or **Reset**, also leaves the full history.
   - Clearing sets `all_events=1` in the same URL update that removes `after`. 
Without that flag, a missing `after` is also the state before the default is 
written, and the week would come straight back. Opening **Browse → Audit Log** 
again goes to `/events` and restores the week. A shared `?all_events=1` link 
stays unbounded.
   - When has no saved sort, the When column is sorted descending and the 
header shows that. A sort already in the URL, or saved for the page, is left as 
it is.
   - Dag, Dag run, and task audit tabs are unchanged. So is `GET /eventLogs` 
when the caller omits `after`.
   
   ## Tests
   
   `airflow-core/src/airflow/ui/src/pages/Events/Events.test.tsx`
   
   - `/events` sends `after` of now minus 7 days and `orderBy: ["-when"]` on 
the first request, shows the alert, and writes `sort=-when` into the URL. The 
When header is marked descending, and the date pill's accessible name is When.
   - Opening that seeded URL again still shows the alert.
   - **Show all** sets `all_events=1`, drops `after`, and refetches without it.
   - Removing the When pill does the same.
   - An explicit `after` is kept and does not show the default alert.
   - `all_events=1` lists without `after`.
   - `?sort=event` and a saved table sort are kept.
   - A Dag audit tab does not send `after` and does not seed the URL. The 
existing regional-tab test still sends no `after`.
   
   `airflow-core/src/airflow/ui/src/utils/useFiltersHandler.test.tsx`
   
   - `adjustParams` records `all_events=1` in the same params update that 
clears a date range, and leaves the existing sort in place.
   
   ## Checks
   
   - `prek run --from-ref HEAD~1 --stage pre-commit`
   - `prek run --from-ref HEAD~1 --stage manual --skip compile-ui-assets-dev 
--skip view-skill-eval --skip run-skill-eval-codex`
   - `cd airflow-core/src/airflow/ui && pnpm exec vitest run 
src/pages/Events/Events.test.tsx src/utils/useFiltersHandler.test.tsx` (27 
passed)
   - `cd airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui && pnpm 
test` (1 passed)
   - `breeze build-docs apache-airflow` (succeeded)
   
   The newsfragment is added in a follow-up commit named after this pull 
request, which is what the template asks for.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Grok 4.7
   
   Generated-by: Grok 4.7 following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   
   ---
   Drafted-by: Grok 4.7 (no human review before posting)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to