import { selectors } from '@grafana/e2e-selectors';
import { t } from '@grafana/i18n';
import { config } from '@grafana/runtime';
import { DataLinksInlineEditor, Input, RadioButtonGroup, Select, Switch, TextArea } from '@grafana/ui';
import { getPanelLinksVariableSuggestions } from 'app/features/panel/panellinks/link_srv';
import { GenAIPanelDescriptionButton } from '../GenAI/GenAIPanelDescriptionButton';
import { GenAIPanelTitleButton } from '../GenAI/GenAIPanelTitleButton';
import { RepeatRowSelect } from '../RepeatRowSelect/RepeatRowSelect';
import { OptionsPaneCategoryDescriptor } from './OptionsPaneCategoryDescriptor';
import { OptionsPaneItemDescriptor } from './OptionsPaneItemDescriptor';
import { OptionPaneRenderProps } from './types';
export function getPanelFrameCategory(props: OptionPaneRenderProps): OptionsPaneCategoryDescriptor {
const { dashboard, panel, onPanelConfigChange } = props;
const descriptor = new OptionsPaneCategoryDescriptor({
title: t('dashboard.get-panel-frame-category.descriptor.title.panel-options', 'Panel options'),
id: 'Panel options',
isOpenDefault: true,
});
const setPanelTitle = (title: string) => {
const input = document.getElementById('PanelFrameTitle');
if (input instanceof HTMLInputElement) {
input.value = title;
onPanelConfigChange('title', title);
}
};
const setPanelDescription = (description: string) => {
const input = document.getElementById('description-text-area');
if (input instanceof HTMLTextAreaElement) {
input.value = description;
onPanelConfigChange('description', description);
}
};
return descriptor
.addItem(
new OptionsPaneItemDescriptor({
title: t('dashboard.get-panel-frame-category.title.title', 'Title'),
id: 'PanelFrameTitle',
value: panel.title,
popularRank: 1,
render: function renderTitle(descriptor) {
return (
onPanelConfigChange('title', e.currentTarget.value)}
/>
);
},
addon: config.featureToggles.dashgpt && (
),
})
)
.addItem(
new OptionsPaneItemDescriptor({
title: t('dashboard.get-panel-frame-category.title.description', 'Description'),
id: 'description-text-area',
description: panel.description,
value: panel.description,
render: function renderDescription(descriptor) {
return (