forked from grafana/iot-sitewise-datasource
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow user to disable client cache
- Loading branch information
Showing
6 changed files
with
138 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import { InlineField, InlineSwitch, Switch } from '@grafana/ui'; | ||
import { EditorField, EditorFieldGroup, EditorRow } from '@grafana/experimental'; | ||
|
||
interface Props { | ||
clientCache?: boolean; | ||
newFormStylingEnabled?: boolean; | ||
onClientCacheChange: (evt: React.SyntheticEvent<HTMLInputElement>) => void; | ||
} | ||
|
||
export const ClientCacheRow = ({clientCache, newFormStylingEnabled, onClientCacheChange}: Props) => { | ||
if (newFormStylingEnabled) { | ||
return ( | ||
<EditorRow> | ||
<EditorFieldGroup> | ||
<EditorField | ||
label="Client cache" | ||
htmlFor="clientCache" | ||
tooltip="Enable to cache results from the query in. This will improve performance for repeated queries with relative time range." | ||
> | ||
<Switch id="clientCache" value={clientCache} onChange={onClientCacheChange} /> | ||
</EditorField> | ||
</EditorFieldGroup> | ||
</EditorRow> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="gf-form"> | ||
<InlineField | ||
label="Client cache" | ||
htmlFor="clientCache" | ||
tooltip="Enable to cache results from the query. This will improve performance for repeated queries with relative time range." | ||
> | ||
<InlineSwitch value={clientCache} onChange={onClientCacheChange} /> | ||
</InlineField> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters