mirror of
https://github.com/grafana/grafana.git
synced 2025-09-28 04:33:58 +08:00
Add unique ids to query editor fields (#28376)
* Add unique ids to query editor fields * Update public/app/plugins/datasource/testdata/components/RandomWalkEditor.tsx Co-authored-by: Ryan McKinley <ryantxu@gmail.com> Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
@ -131,7 +131,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
|
|||||||
<InlineField label="String Input">
|
<InlineField label="String Input">
|
||||||
<Input
|
<Input
|
||||||
width={32}
|
width={32}
|
||||||
id="stringInput"
|
id={`stringInput-${query.refId}`}
|
||||||
name="stringInput"
|
name="stringInput"
|
||||||
placeholder={query.stringInput}
|
placeholder={query.stringInput}
|
||||||
value={query.stringInput}
|
value={query.stringInput}
|
||||||
@ -142,7 +142,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
|
|||||||
<InlineField label="Alias" labelWidth={14}>
|
<InlineField label="Alias" labelWidth={14}>
|
||||||
<Input
|
<Input
|
||||||
width={32}
|
width={32}
|
||||||
id="alias"
|
id={`alias-${query.refId}`}
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="optional"
|
placeholder="optional"
|
||||||
pattern='[^<>&\\"]+'
|
pattern='[^<>&\\"]+'
|
||||||
@ -170,7 +170,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
|
|||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
width={32}
|
width={32}
|
||||||
id="labels"
|
id={`labels-${query.refId}`}
|
||||||
name="labels"
|
name="labels"
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
value={query?.labels}
|
value={query?.labels}
|
||||||
|
@ -30,7 +30,7 @@ export const CSVWaveEditor = ({ onChange, query }: EditorProps) => {
|
|||||||
width={grow ? undefined : 32}
|
width={grow ? undefined : 32}
|
||||||
type={type}
|
type={type}
|
||||||
name={id}
|
name={id}
|
||||||
id={`csvWave.${id}`}
|
id={`csvWave.${id}-${query.refId}`}
|
||||||
value={query.csvWave?.[id]}
|
value={query.csvWave?.[id]}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
@ -42,7 +42,7 @@ export const ManualEntryEditor = ({ onChange, query, onRunQuery }: Props) => {
|
|||||||
width={32}
|
width={32}
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="value"
|
placeholder="value"
|
||||||
id="newPointValue"
|
id={`newPointValue-${query.refId}`}
|
||||||
name="newPointValue"
|
name="newPointValue"
|
||||||
ref={register}
|
ref={register}
|
||||||
/>
|
/>
|
||||||
@ -50,7 +50,7 @@ export const ManualEntryEditor = ({ onChange, query, onRunQuery }: Props) => {
|
|||||||
<InlineField label="Time" labelWidth={14}>
|
<InlineField label="Time" labelWidth={14}>
|
||||||
<Input
|
<Input
|
||||||
width={32}
|
width={32}
|
||||||
id="newPointTime"
|
id={`newPointTime-${query.refId}`}
|
||||||
placeholder="time"
|
placeholder="time"
|
||||||
name="newPointTime"
|
name="newPointTime"
|
||||||
ref={register}
|
ref={register}
|
||||||
|
@ -43,7 +43,7 @@ export const PredictablePulseEditor = ({ onChange, query }: EditorProps) => {
|
|||||||
width={32}
|
width={32}
|
||||||
type="number"
|
type="number"
|
||||||
name={id}
|
name={id}
|
||||||
id={`pulseWave.${id}`}
|
id={`pulseWave.${id}-${query.refId}`}
|
||||||
value={query.pulseWave?.[id as keyof PulseWaveQuery]}
|
value={query.pulseWave?.[id as keyof PulseWaveQuery]}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
|
@ -27,7 +27,7 @@ export const RandomWalkEditor = ({ onChange, query }: EditorProps) => {
|
|||||||
width={32}
|
width={32}
|
||||||
name={id}
|
name={id}
|
||||||
type="number"
|
type="number"
|
||||||
id={id}
|
id={`randomWalk-${id}-${query.refId}`}
|
||||||
min={min}
|
min={min}
|
||||||
step={step}
|
step={step}
|
||||||
value={query[id as keyof TestDataQuery] || placeholder}
|
value={query[id as keyof TestDataQuery] || placeholder}
|
||||||
|
@ -40,7 +40,7 @@ export const StreamingClientEditor = ({ onChange, query }: EditorProps) => {
|
|||||||
<Input
|
<Input
|
||||||
width={32}
|
width={32}
|
||||||
type="number"
|
type="number"
|
||||||
id={`stream.${id}`}
|
id={`stream.${id}-${query.refId}`}
|
||||||
name={id}
|
name={id}
|
||||||
min={min}
|
min={min}
|
||||||
step={step}
|
step={step}
|
||||||
@ -57,7 +57,7 @@ export const StreamingClientEditor = ({ onChange, query }: EditorProps) => {
|
|||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
name="url"
|
name="url"
|
||||||
id="stream.url"
|
id={`stream.url-${query.refId}`}
|
||||||
value={query?.stream?.url}
|
value={query?.stream?.url}
|
||||||
placeholder="Fetch URL"
|
placeholder="Fetch URL"
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
Reference in New Issue
Block a user