From 8250c64225cdc18b6cc9e6074c30bf33b42b459b Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Fri, 26 Jun 2020 14:56:55 -0700 Subject: [PATCH] removing un-used file --- .../waffle/waffle_sort_controls.tsx | 125 ------------------ 1 file changed, 125 deletions(-) delete mode 100644 x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx deleted file mode 100644 index a45ac0cee72d9..0000000000000 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React, { useCallback, useMemo, useState, ReactNode } from 'react'; -import { EuiSwitch, EuiContextMenuPanelDescriptor, EuiPopover, EuiContextMenu } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { EuiTheme, withTheme } from '../../../../../../../observability/public'; -import { WaffleSortOption } from '../../hooks/use_waffle_options'; -import { DropdownButton } from '../dropdown_button'; - -interface Props { - sort: WaffleSortOption; - onChange: (sort: WaffleSortOption) => void; -} - -const LABELS = { - name: i18n.translate('xpack.infra.waffle.sortNameLabel', { defaultMessage: 'Name' }), - value: i18n.translate('xpack.infra.waffle.sort.valueLabel', { defaultMessage: 'Metric value' }), -}; - -export const WaffleSortControls = ({ sort, onChange }: Props) => { - const [isOpen, setIsOpen] = useState(false); - - const showPopover = useCallback(() => { - setIsOpen(true); - }, [setIsOpen]); - - const closePopover = useCallback(() => { - setIsOpen(false); - }, [setIsOpen]); - - const label = LABELS[sort.by]; - - const button = ( - - {label} - - ); - - const selectName = useCallback(() => { - onChange({ ...sort, by: 'name' }); - closePopover(); - }, [closePopover, onChange, sort]); - - const selectValue = useCallback(() => { - onChange({ ...sort, by: 'value' }); - closePopover(); - }, [closePopover, onChange, sort]); - - const toggleSort = useCallback(() => { - onChange({ - ...sort, - direction: sort.direction === 'asc' ? 'desc' : 'asc', - }); - }, [sort, onChange]); - - const panels = useMemo( - () => [ - { - id: 0, - title: '', - items: [ - { - name: LABELS.name, - icon: sort.by === 'name' ? 'check' : 'empty', - onClick: selectName, - }, - { - name: LABELS.value, - icon: sort.by === 'value' ? 'check' : 'empty', - onClick: selectValue, - }, - ], - }, - ], - [sort.by, selectName, selectValue] - ); - - return ( - - - - - - - ); -}; - -interface SwitchContainerProps { - theme: EuiTheme | undefined; - children: ReactNode; -} - -const SwitchContainer = withTheme(({ children, theme }: SwitchContainerProps) => { - return ( -
- {children} -
- ); -});