Skip to content

Commit

Permalink
Please code reviewers
Browse files Browse the repository at this point in the history
  • Loading branch information
machadoum committed Jun 30, 2023
1 parent 879dfd6 commit f8ecd7a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 2 additions & 6 deletions packages/kbn-cell-actions/src/actions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { isBoolean, isNumber, isString } from 'lodash/fp';
import { Serializable, SerializableArray } from '@kbn/utility-types/src/serializable';
import { DefaultActionsSupportedValue, NonNullableSerializable } from './types';
import { CellActionFieldValue } from '../types';

export const SUPPORTED_KBN_TYPES = [
KBN_FIELD_TYPES.DATE,
Expand All @@ -23,18 +22,15 @@ export const SUPPORTED_KBN_TYPES = [
export const isTypeSupportedByDefaultActions = (kbnFieldType: KBN_FIELD_TYPES) =>
SUPPORTED_KBN_TYPES.includes(kbnFieldType);

const isNonNullablePrimitiveValue = (
value: CellActionFieldValue
): value is string | number | boolean => isString(value) || isNumber(value) || isBoolean(value);

const isNonMixedTypeArray = (
value: Array<string | number | boolean>
): value is string[] | number[] | boolean[] => value.every((v) => typeof v === typeof value[0]);

export const isValueSupportedByDefaultActions = (
value: NonNullableSerializable[]
): value is DefaultActionsSupportedValue =>
value.every(isNonNullablePrimitiveValue) && isNonMixedTypeArray(value);
value.every((v): v is string | number | boolean => isString(v) || isNumber(v) || isBoolean(v)) &&
isNonMixedTypeArray(value);

export const filterOutNullableValues = (value: SerializableArray): NonNullableSerializable[] =>
value.filter<NonNullableSerializable>((v): v is NonNullableSerializable => v != null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ export const DiscoverGrid = ({
? visibleColumns.map((columnName) => {
const field = dataView.getFieldByName(columnName);
if (!field) {
// disable custom actions on object columns
return {
name: '',
type: '',
Expand Down

0 comments on commit f8ecd7a

Please sign in to comment.