mirror of https://github.com/grafana/grafana.git
Dashboards: Edit pane variable unique key (#107212)
* Dashboards: Edit pane unique key * lint * Update public/app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor.tsx Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * lint --------- Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
parent
910454c84c
commit
713c9921ac
|
|
@ -1,4 +1,5 @@
|
|||
import { css } from '@emotion/css';
|
||||
import { uniqueId } from 'lodash';
|
||||
import { ReactNode } from 'react';
|
||||
import * as React from 'react';
|
||||
import Highlighter from 'react-highlight-words';
|
||||
|
|
@ -31,11 +32,17 @@ export interface OptionsPaneItemInfo {
|
|||
*/
|
||||
export class OptionsPaneItemDescriptor {
|
||||
parent!: OptionsPaneCategoryDescriptor;
|
||||
props: OptionsPaneItemInfo;
|
||||
|
||||
constructor(public props: OptionsPaneItemInfo) {}
|
||||
constructor(props: OptionsPaneItemInfo) {
|
||||
this.props = { ...props, id: props.id ?? props.title };
|
||||
if (this.props.id === '') {
|
||||
this.props.id = uniqueId();
|
||||
}
|
||||
}
|
||||
|
||||
render(searchQuery?: string) {
|
||||
return <OptionsPaneItem key={this.props.title} itemDescriptor={this} searchQuery={searchQuery} />;
|
||||
return <OptionsPaneItem key={this.props.id} itemDescriptor={this} searchQuery={searchQuery} />;
|
||||
}
|
||||
|
||||
useShowIf() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue