Skip to content

Commit

Permalink
Map family to a more user friendly db name
Browse files Browse the repository at this point in the history
  • Loading branch information
doracretu3pillar committed Jul 5, 2023
1 parent 91cae9e commit 6331e1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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 6331e1d

Please sign in to comment.