|
|
|
@ -9,6 +9,7 @@ import React from 'react'; |
|
|
|
|
import { Counter, Field, HorizontalGroup, IconButton, Label, stylesFactory, useTheme } from '@grafana/ui'; |
|
|
|
|
import { css, cx } from '@emotion/css'; |
|
|
|
|
import { OptionsPaneCategory } from './OptionsPaneCategory'; |
|
|
|
|
import Highlighter from 'react-highlight-words'; |
|
|
|
|
|
|
|
|
|
interface DynamicConfigValueEditorProps { |
|
|
|
|
property: DynamicConfigValue; |
|
|
|
@ -17,6 +18,7 @@ interface DynamicConfigValueEditorProps { |
|
|
|
|
context: FieldOverrideContext; |
|
|
|
|
onRemove: () => void; |
|
|
|
|
isSystemOverride?: boolean; |
|
|
|
|
searchQuery: string; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const DynamicConfigValueEditor: React.FC<DynamicConfigValueEditorProps> = ({ |
|
|
|
@ -26,6 +28,7 @@ export const DynamicConfigValueEditor: React.FC<DynamicConfigValueEditorProps> = |
|
|
|
|
onChange, |
|
|
|
|
onRemove, |
|
|
|
|
isSystemOverride, |
|
|
|
|
searchQuery, |
|
|
|
|
}) => { |
|
|
|
|
const theme = useTheme(); |
|
|
|
|
const styles = getStyles(theme); |
|
|
|
@ -48,7 +51,11 @@ export const DynamicConfigValueEditor: React.FC<DynamicConfigValueEditorProps> = |
|
|
|
|
const renderLabel = (includeDescription = true, includeCounter = false) => (isExpanded = false) => ( |
|
|
|
|
<HorizontalGroup justify="space-between"> |
|
|
|
|
<Label category={labelCategory} description={includeDescription ? item.description : undefined}> |
|
|
|
|
{item.name} |
|
|
|
|
<Highlighter |
|
|
|
|
textToHighlight={item.name} |
|
|
|
|
searchWords={[searchQuery]} |
|
|
|
|
highlightClassName={'search-fragment-highlight'} |
|
|
|
|
/> |
|
|
|
|
{!isExpanded && includeCounter && item.getItemsCount && <Counter value={item.getItemsCount(property.value)} />} |
|
|
|
|
</Label> |
|
|
|
|
{!isSystemOverride && ( |
|
|
|
|