Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaindik committed Sep 18, 2024
1 parent 7f44356 commit f89e476
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { isPlainObject } from 'lodash';
import type { Filter } from '@kbn/es-query';
import type {
DiffableAllFields,
Expand Down Expand Up @@ -77,10 +78,12 @@ export function getQueryLanguageLabel(language: string) {
}

/**
* Assigns type `Filter[]` to an array if every item in has a `meta` property.
* Assigns type `Filter[]` to an array if every item in it has a `meta` property.
*/
export function isFilters(maybeFilters: unknown[]): maybeFilters is Filter[] {
return maybeFilters.every((f) => typeof f === 'object' && f !== null && 'meta' in f);
return maybeFilters.every(
(f) => typeof f === 'object' && f !== null && 'meta' in f && isPlainObject(f.meta)
);
}

type DataSourceProps =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ import { EuiDescriptionList } from '@elastic/eui';
import * as ruleDetailsI18n from '../../../../translations';
import type { RuleDescription } from '../../../../../../../../../common/api/detection_engine';

interface DescriptionProps {
description: RuleDescription;
}

function Description({ description }: DescriptionProps) {
return <>{description}</>;
}

interface DescriptionReadOnlyProps {
description: RuleDescription;
}
Expand All @@ -34,3 +26,11 @@ export function DescriptionReadOnly({ description }: DescriptionReadOnlyProps) {
/>
);
}

interface DescriptionProps {
description: RuleDescription;
}

function Description({ description }: DescriptionProps) {
return <>{description}</>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ import { EuiDescriptionList } from '@elastic/eui';
import * as ruleDetailsI18n from '../../../../translations';
import type { RuleName } from '../../../../../../../../../common/api/detection_engine';

interface NameProps {
name: RuleName;
}

function Name({ name }: NameProps) {
return <>{name}</>;
}

interface NameReadOnlyProps {
name: RuleName;
}
Expand All @@ -34,3 +26,11 @@ export function NameReadOnly({ name }: NameReadOnlyProps) {
/>
);
}

interface NameProps {
name: RuleName;
}

function Name({ name }: NameProps) {
return <>{name}</>;
}

0 comments on commit f89e476

Please sign in to comment.