fix(AuditLog): Environment colours match the filter tags

Draft
AV
1d ago
+51-7

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes https://github.com/Flagsmith/flagsmith/issues/8681

In the audit log, the environment tag in each row could have a different colour from the same environment's tag in the filter above the table. The rows picked colours from the project store's environment list (sorted by name), while the filter uses the order returned by the API.

  • Audit log rows now use the same environment order as the filter, so each environment keeps one colour on the page.
  • Added a small helper with unit tests for the colour lookup.

How did you test this code?

  • Unit test for the helper (npx jest common/utils/__tests__/getEnvironmentColourIndex.test.ts), and eslint on the changed files.
  • Rendered the real EnvironmentTagSelect and AuditLog components with mocked API data (development, QA, production in API order). Before: the development and QA rows had each other's filter colours. After: all match.
  • I did not run the full app with a backend, so I have not seen this in a browser.