mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 20:22:19 +08:00

* kindsys: Adapt to new PanelCfg schema interface * building locally * Remove Panel prefix in cue files * Regenerate * Update imports * fixup! Merge branch 'remove-panel-prefix' into sdboyer/redundant-panelcfg-prefixes * Fix formatting --------- Co-authored-by: Ryan McKinley <ryantxu@gmail.com> Co-authored-by: Tania B <yalyna.ts@gmail.com>
29 lines
796 B
TypeScript
29 lines
796 B
TypeScript
import React, { FormEvent } from 'react';
|
|
|
|
import { PanelOptionsEditorProps, PanelProps } from '@grafana/data';
|
|
import { Field, Input, usePanelContext } from '@grafana/ui';
|
|
|
|
import { Options } from './panelcfg.gen';
|
|
|
|
export function StateView(props: PanelProps<Options>) {
|
|
const context = usePanelContext();
|
|
|
|
const onChangeName = (e: FormEvent<HTMLInputElement>) => {
|
|
context.onInstanceStateChange!({
|
|
name: e.currentTarget.value,
|
|
});
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Field label="State name">
|
|
<Input value={context.instanceState?.name ?? ''} onChange={onChangeName} />
|
|
</Field>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export function StateViewEditor({ value, context, onChange, item }: PanelOptionsEditorProps<string>) {
|
|
return <div>Current value: {context.instanceState?.name} </div>;
|
|
}
|