Skip to content

Commit

Permalink
fix: [M3-8923] - Fix Account Maintenance Account X-Filter (linode#11277)
Browse files Browse the repository at this point in the history
* create const and use it

* Added changeset: Incorrect Account Maintenance X-Filter

---------

Co-authored-by: Banks Nussman <banks@nussman.us>
  • Loading branch information
bnussman-akamai and bnussman authored Nov 21, 2024
1 parent 26988f3 commit d8812c4
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11277-fixed-1732027147462.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Incorrect Account Maintenance X-Filter ([#11277](https://github.com/linode/manager/pull/11277))
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -22,7 +23,7 @@ export const MaintenanceBanner = React.memo((props: Props) => {

const { data: accountMaintenanceData } = useAllAccountMaintenanceQuery(
{},
{ status: { '+or': ['pending, started'] } }
PENDING_MAINTENANCE_FILTER
);

const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -70,7 +71,7 @@ export const MaintenanceTable = ({ type }: Props) => {
*/
const filters: Record<Props['type'], Filter> = {
completed: { status: 'completed' },
pending: { status: { '+or': ['pending', 'started'] } },
pending: PENDING_MAINTENANCE_FILTER,
};

const filter: Filter = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const PENDING_MAINTENANCE_FILTER = Object.freeze({
status: { '+or': ['pending', 'started'] },
});
Original file line number Diff line number Diff line change
@@ -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));
Expand All @@ -24,7 +26,7 @@ const Notifications = () => {

const { data: accountMaintenanceData } = useAllAccountMaintenanceQuery(
{},
{ status: { '+or': ['pending, started'] } }
PENDING_MAINTENANCE_FILTER
);

const maintenanceForThisLinode = accountMaintenanceData?.find(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -18,7 +19,7 @@ export const LinodesLandingCSVDownload = () => {

const { data: accountMaintenance } = useAllAccountMaintenanceQuery(
{},
{ status: { '+or': ['pending, started'] } }
PENDING_MAINTENANCE_FILTER
);

const downloadCSV = async () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/manager/src/features/Linodes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d8812c4

Please sign in to comment.