diff --git a/packages/manager/.changeset/pr-11277-fixed-1732027147462.md b/packages/manager/.changeset/pr-11277-fixed-1732027147462.md new file mode 100644 index 00000000000..89841d5da39 --- /dev/null +++ b/packages/manager/.changeset/pr-11277-fixed-1732027147462.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Fixed +--- + +Incorrect Account Maintenance X-Filter ([#11277](https://github.com/linode/manager/pull/11277)) diff --git a/packages/manager/src/components/MaintenanceBanner/MaintenanceBanner.tsx b/packages/manager/src/components/MaintenanceBanner/MaintenanceBanner.tsx index 2c77c1d38f9..96a79f173f3 100644 --- a/packages/manager/src/components/MaintenanceBanner/MaintenanceBanner.tsx +++ b/packages/manager/src/components/MaintenanceBanner/MaintenanceBanner.tsx @@ -3,6 +3,7 @@ import * as React from 'react'; import { Link } from 'react-router-dom'; import { Typography } from 'src/components/Typography'; +import { PENDING_MAINTENANCE_FILTER } from 'src/features/Account/Maintenance/utilities'; import { useAllAccountMaintenanceQuery } from 'src/queries/account/maintenance'; import { useProfile } from 'src/queries/profile/profile'; import { formatDate } from 'src/utilities/formatDate'; @@ -22,7 +23,7 @@ export const MaintenanceBanner = React.memo((props: Props) => { const { data: accountMaintenanceData } = useAllAccountMaintenanceQuery( {}, - { status: { '+or': ['pending, started'] } } + PENDING_MAINTENANCE_FILTER ); const { diff --git a/packages/manager/src/features/Account/Maintenance/MaintenanceTable.tsx b/packages/manager/src/features/Account/Maintenance/MaintenanceTable.tsx index 2452a8b6570..05e5949d160 100644 --- a/packages/manager/src/features/Account/Maintenance/MaintenanceTable.tsx +++ b/packages/manager/src/features/Account/Maintenance/MaintenanceTable.tsx @@ -25,6 +25,7 @@ import { } from 'src/queries/account/maintenance'; import { MaintenanceTableRow } from './MaintenanceTableRow'; +import { PENDING_MAINTENANCE_FILTER } from './utilities'; import type { AccountMaintenance, Filter } from '@linode/api-v4'; @@ -70,7 +71,7 @@ export const MaintenanceTable = ({ type }: Props) => { */ const filters: Record = { completed: { status: 'completed' }, - pending: { status: { '+or': ['pending', 'started'] } }, + pending: PENDING_MAINTENANCE_FILTER, }; const filter: Filter = { diff --git a/packages/manager/src/features/Account/Maintenance/utilities.ts b/packages/manager/src/features/Account/Maintenance/utilities.ts new file mode 100644 index 00000000000..70841a9ecfa --- /dev/null +++ b/packages/manager/src/features/Account/Maintenance/utilities.ts @@ -0,0 +1,3 @@ +export const PENDING_MAINTENANCE_FILTER = Object.freeze({ + status: { '+or': ['pending', 'started'] }, +}); diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodesDetailHeader/Notifications.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodesDetailHeader/Notifications.tsx index 6dc81273dd7..52f0bf19bc0 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodesDetailHeader/Notifications.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodesDetailHeader/Notifications.tsx @@ -1,15 +1,17 @@ -import { Notification } from '@linode/api-v4/lib/account'; -import * as React from 'react'; +import React from 'react'; import { useParams } from 'react-router-dom'; import { MaintenanceBanner } from 'src/components/MaintenanceBanner/MaintenanceBanner'; import { ProductNotification } from 'src/components/ProductNotification/ProductNotification'; +import { PENDING_MAINTENANCE_FILTER } from 'src/features/Account/Maintenance/utilities'; import { useAllAccountMaintenanceQuery } from 'src/queries/account/maintenance'; import { useNotificationsQuery } from 'src/queries/account/notifications'; import { useLinodeQuery } from 'src/queries/linodes/linodes'; import { MigrationNotification } from './MigrationNotification'; +import type { Notification } from '@linode/api-v4'; + const Notifications = () => { const { linodeId } = useParams<{ linodeId: string }>(); const { data: linode } = useLinodeQuery(Number(linodeId)); @@ -24,7 +26,7 @@ const Notifications = () => { const { data: accountMaintenanceData } = useAllAccountMaintenanceQuery( {}, - { status: { '+or': ['pending, started'] } } + PENDING_MAINTENANCE_FILTER ); const maintenanceForThisLinode = accountMaintenanceData?.find( diff --git a/packages/manager/src/features/Linodes/LinodesLanding/LinodesLandingCSVDownload.tsx b/packages/manager/src/features/Linodes/LinodesLanding/LinodesLandingCSVDownload.tsx index 7b6dc0db4f4..ed9c4a4255f 100644 --- a/packages/manager/src/features/Linodes/LinodesLanding/LinodesLandingCSVDownload.tsx +++ b/packages/manager/src/features/Linodes/LinodesLanding/LinodesLandingCSVDownload.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { DownloadCSV } from 'src/components/DownloadCSV/DownloadCSV'; +import { PENDING_MAINTENANCE_FILTER } from 'src/features/Account/Maintenance/utilities'; import { useFormattedDate } from 'src/hooks/useFormattedDate'; import { useAllAccountMaintenanceQuery } from 'src/queries/account/maintenance'; import { useAllLinodesQuery } from 'src/queries/linodes/linodes'; @@ -18,7 +19,7 @@ export const LinodesLandingCSVDownload = () => { const { data: accountMaintenance } = useAllAccountMaintenanceQuery( {}, - { status: { '+or': ['pending, started'] } } + PENDING_MAINTENANCE_FILTER ); const downloadCSV = async () => { diff --git a/packages/manager/src/features/Linodes/index.tsx b/packages/manager/src/features/Linodes/index.tsx index 2081e1f9322..4be6571712c 100644 --- a/packages/manager/src/features/Linodes/index.tsx +++ b/packages/manager/src/features/Linodes/index.tsx @@ -10,6 +10,7 @@ import { useAllLinodesQuery } from 'src/queries/linodes/linodes'; import { addMaintenanceToLinodes } from 'src/utilities/linodes'; import { storage } from 'src/utilities/storage'; +import { PENDING_MAINTENANCE_FILTER } from '../Account/Maintenance/utilities'; import { linodesInTransition } from './transitions'; import type { RegionFilter } from 'src/utilities/storage'; @@ -49,7 +50,7 @@ export const LinodesRoutes = () => { export const LinodesLandingWrapper = React.memo(() => { const { data: accountMaintenanceData } = useAllAccountMaintenanceQuery( {}, - { status: { '+or': ['pending, started'] } } + PENDING_MAINTENANCE_FILTER ); const { isGeckoLAEnabled } = useIsGeckoEnabled();