Skip to content

Commit

Permalink
PMM-12257 Column 'database' added to Advisors tables (#675)
Browse files Browse the repository at this point in the history
* Column 'database' added to Advisors tables

* Updated the column to take family parameter from API

* Fixed type for CheckDetails

* Fixed tests

* Remove typechecking

* Advisors check do not have family property

* Map family to a more user friendly db name

---------

Co-authored-by: Artem Gavrilov <[email protected]>
  • Loading branch information
doracretu3pillar and artemgavrilov authored Jul 13, 2023
1 parent 1a38b24 commit 3507d74
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 1 deletion.
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

0 comments on commit 3507d74

Please sign in to comment.