-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to new form styling in config and query editors (#332)
- Loading branch information
1 parent
389d857
commit 4048b6d
Showing
11 changed files
with
282 additions
and
793 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
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 |
---|---|---|
@@ -1,39 +1,24 @@ | ||
import React from 'react'; | ||
import { InlineField, InlineSwitch, Switch } from '@grafana/ui'; | ||
import { 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 in the browser that are older than 15 minutes. This will improve performance for repeated queries with relative time range." | ||
> | ||
<Switch id="clientCache" value={clientCache} onChange={onClientCacheChange} /> | ||
</EditorField> | ||
</EditorFieldGroup> | ||
</EditorRow> | ||
); | ||
} | ||
|
||
export const ClientCacheRow = ({ clientCache, onClientCacheChange }: Props) => { | ||
return ( | ||
<div className="gf-form"> | ||
<InlineField | ||
<EditorRow> | ||
<EditorFieldGroup> | ||
<EditorField | ||
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> | ||
tooltip="Enable to cache results in the browser that are older than 15 minutes. This will improve performance for repeated queries with relative time range." | ||
> | ||
<Switch id="clientCache" value={clientCache} onChange={onClientCacheChange} /> | ||
</EditorField> | ||
</EditorFieldGroup> | ||
</EditorRow> | ||
); | ||
}; |
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
Oops, something went wrong.