mirror of
https://github.com/fleetdm/fleet
synced 2026-05-19 06:58:30 +00:00
for #29451 # Details This PR does a slight refactor of the MainContent, HostDetailsBanners and HostDetailsPage components to prevent host-details-specific banner from being shown on the Host Details page if any app-wide banners are being displayed. It does this by allowing the child of a `<MainContent>` node to be a function which takes a parameter indicating whether app-wide banners are present. The HostDetailsPage uses this new functionality to suppress host details banners when that's the case. The HostDetailsBanners component is updated to remove logic that previously attempted to detect app-wide banners, using similar logic to what MainContent does to decide whether to show banners. Instead of repeating this logic in two places, HostDetailsBanners now just renders banners. # Checklist for submitter - [X] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. - [X] Manual QA for all new/changed functionality I tested this by temporarily forcing an app-wide banner (by setting [this code](52cd0588b6/frontend/components/MainContent/MainContent.tsx (L61)) to `if (true)`), then similarly doing the same for host banners by changing [this code](89cdf9f61a/frontend/pages/hosts/details/HostDetailsPage/components/HostDetailsBanners/HostDetailsBanners.tsx (L79-L85)) to always run. On the main branch, this shows two banners: <img width="1142" height="186" alt="image" src="https://github.com/user-attachments/assets/30645470-d1db-476d-bb76-2b48fedcc75a" /> On this branch, only the app-wide banner is shown. Note that this was _only_ happening in the case of the disk encryption banner, since there was logic in place in HostDetailsBanners to prevent showing host banners if an app-wide banner was present. That logic was just missing from the disk encryption case, and we'd have to continue to keep that logic in sync with the login in MainContent any time we added a new host banner. This refactor DRYs out the code a bit so we don't have that concern going forward.
2 lines
98 B
TypeScript
2 lines
98 B
TypeScript
export { default } from "./MainContent";
|
|
export type { IMainContentConfig } from "./MainContent";
|