PanelEdit: Remove field label for single item categories (#25990)
* FieldConfig: Remove field label for single item categories * Update public/app/features/dashboard/components/PanelEditor/FieldConfigEditor.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
This commit is contained in:
co-authored by
Alex Khomenko
parent
90a5a85eb1
commit
9746e1f6af
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import React, { useCallback, ReactNode } from 'react';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import {
|
||||
DataFrame,
|
||||
@@ -171,12 +171,17 @@ export const DefaultFieldConfigEditor: React.FC<Props> = ({ data, onChange, conf
|
||||
: undefined
|
||||
: (defaults as any)[item.path];
|
||||
|
||||
const label = (
|
||||
let label: ReactNode | undefined = (
|
||||
<Label description={item.description} category={item.category?.slice(1)}>
|
||||
{item.name}
|
||||
</Label>
|
||||
);
|
||||
|
||||
// hide label if there is only one item and category name is same as item, name
|
||||
if (categoryItemCount === 1 && item.category?.[0] === item.name) {
|
||||
label = undefined;
|
||||
}
|
||||
|
||||
return (
|
||||
<Field label={label} key={`${item.id}/${item.isCustom}`}>
|
||||
<item.editor
|
||||
|
||||
Reference in New Issue
Block a user