Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-12257 Column 'database' added to Advisors tables #675

Merged
merged 8 commits into from
Jul 13, 2023
5 changes: 5 additions & 0 deletions public/app/percona/check/__mocks__/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,15 @@ export const allChecksStub: CheckDetails[] = [
interval: 'STANDARD',
readMoreUrl: 'https://example.com',
category: '',
family: 'ADVISOR_CHECK_FAMILY_MONGODB',
},
{
name: 'test2',
summary: 'Test 2',
description: 'Test number 2',
interval: 'RARE',
category: '',
family: 'ADVISOR_CHECK_FAMILY_MONGODB',
},
{
name: 'test3',
Expand All @@ -187,18 +189,21 @@ export const allChecksStub: CheckDetails[] = [
disabled: true,
readMoreUrl: 'https://example.com',
category: '',
family: 'ADVISOR_CHECK_FAMILY_MONGODB',
},
{
name: 'test4',
summary: 'Test 4',
interval: 'FREQUENT',
category: '',
family: 'ADVISOR_CHECK_FAMILY_MONGODB',
},
{
name: 'test5',
summary: 'Test 5',
disabled: true,
interval: 'STANDARD',
category: '',
family: 'ADVISOR_CHECK_FAMILY_MONGODB',
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const Messages = {
description: 'Description',
category: 'Category',
status: 'Status',
family: 'Technology',
interval: 'Interval',
actions: 'Actions',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ export const AllChecksTab: FC<GrafanaRouteComponentProps<{ category: string }>>
},
],
},
{
Header: Messages.table.columns.family,
accessor: 'family',
type: FilterFieldTypes.TEXT,
noHiddenOverflow: true,
},
{
Header: Messages.table.columns.interval,
accessor: 'interval',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const TEST_CHECK: CheckDetails = {
description: 'test description',
disabled: false,
category: '',
family: 'ADVISOR_CHECK_FAMILY_MONGODB',
};

describe('ChangeCheckIntervalModal', () => {
Expand Down
1 change: 1 addition & 0 deletions public/app/percona/check/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export interface CheckDetails {
summary: string;
interval: keyof typeof Interval;
category: string;
family: string;
description?: string;
disabled?: boolean;
readMoreUrl?: string;
Expand Down
7 changes: 7 additions & 0 deletions public/app/percona/shared/services/advisors/Advisors.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ export enum Interval {
FREQUENT = 'Frequent',
}

export const Family: { [key: string]: string } = {
ADVISOR_CHECK_FAMILY_MYSQL: 'MySQL',
ADVISOR_CHECK_FAMILY_POSTGRESQL: 'PostgreSQL',
ADVISOR_CHECK_FAMILY_MONGODB: 'MongoDB',
};

export interface Advisor {
// Machine-readable name (ID) that is used in expression.
name: string;
Expand All @@ -25,6 +31,7 @@ export interface AdvisorCheck {
description: string;
summary: string;
interval: keyof typeof Interval;
family?: string;
}

export interface CategorizedAdvisor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Advisor, CategorizedAdvisor } from './Advisors.types';
import { Advisor, CategorizedAdvisor, Family } from './Advisors.types';

export const groupAdvisorsIntoCategories = (advisors: Advisor[]): CategorizedAdvisor => {
const result: CategorizedAdvisor = {};
Expand All @@ -8,6 +8,7 @@ export const groupAdvisorsIntoCategories = (advisors: Advisor[]): CategorizedAdv

const modifiedChecks = checks.map((check) => ({
...check,
family: check.family ? Family[check.family] : undefined,
disabled: check.disabled ? true : false,
}));

Expand Down
Loading