Commit 9746e1f6 by Torkel Ödegaard Committed by GitHub

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>
parent 90a5a85e
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment