-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api query editor #84
base: main
Are you sure you want to change the base?
Api query editor #84
Conversation
<div> | ||
{api.inputs.map((iv: InputValue, i) => { | ||
const val = value(query, i, iv.defaultValue); | ||
return <div className="gf-form" key={i}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I know gf-form
classes is legacy. Could we use InlineField
component instead?
onChange={(selected: SelectableValue<string>, _: ActionMeta) => onChangeSelect(selected, i)} | ||
/> | ||
} | ||
{!iv.choices && !iv.lookup && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like lookup
, choices
etc. are mutually exclusive and I'd suggest to rethink the InputValue
shape. I'd suggest to have something like type
field in it which can have a limited number of options like select
, asyncselect
, input
, etc. And I think value / options can be different depending on the type
.
The reason I am suggesting this is I think in this way it will be more future proof. Maybe in the future we would want to also render the options as a radio buttons, etc. And for such cases I think we should create API in a way that it's easily extendible. It might be hard to change the API when plugins start using it.
@@ -21,3 +21,4 @@ export { InlineSwitch, CertificationKey } from '@grafana/ui'; | |||
export * from './QueryEditor'; | |||
export * from './ConfigEditor'; | |||
export { CustomHeadersSettings } from './CustomHeadersSettings/CustomHeadersSettings'; | |||
export { ApiQueryEditor } from './ApiQueryEditor/ApiQueryEditor'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably also export the types so that we can consume them in plugins.
<InlineFormLabel tooltip={iv.description}> | ||
{pretty(iv.name)} | ||
</InlineFormLabel> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component for rendering rest api inputs