-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/release-9.x' into main-9
- Loading branch information
Showing
18 changed files
with
343 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
9.5.14 | ||
9.5.15 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,53 @@ | ||
import React from 'react' | ||
import { InlineField, SegmentInput, Switch } from '@grafana/ui' | ||
|
||
export interface ValueOverrideSwitchProps { | ||
override: boolean | ||
setOverride: (value: boolean) => void | ||
value: string | ||
setValue: (value: any) => void | ||
label?: string | ||
placeholder?: string | ||
tooltip?: string | ||
} | ||
|
||
export const ValueOverrideSwitch = (props: ValueOverrideSwitchProps) => { | ||
const defaultLabel = 'Enter value:' | ||
const defaultPlaceholder = 'Enter variable or value' | ||
const defaultTooltip = 'Enter a value or template variable manually' | ||
|
||
return ( | ||
<> | ||
<style> | ||
{` | ||
.value-override-switch-field .value-override-switch-wrapper { | ||
display: flex; | ||
align-items: center; | ||
height: 32px; | ||
width: 32px; | ||
} | ||
.value-override-switch-field .value-override-switch-wrapper label { | ||
min-width: 32px; | ||
width: 32px; | ||
} | ||
`} | ||
</style> | ||
<InlineField className='value-override-switch-field' label={props.label || defaultLabel} tooltip={props.tooltip || defaultTooltip}> | ||
<div className='value-override-switch-wrapper'> | ||
<Switch | ||
value={props.override} | ||
onChange={() => props.setOverride(!props.override)} /> | ||
</div> | ||
</InlineField> | ||
{ | ||
(props.override || !!props.value?.length) && | ||
<SegmentInput | ||
disabled={!props.override} | ||
value={props.value} | ||
placeholder={props.placeholder || defaultPlaceholder} | ||
onChange={(value) => props.setValue(value.toString())} | ||
/> | ||
} | ||
</> | ||
) | ||
} |
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,61 @@ | ||
import React from 'react' | ||
import { DataSourceSettings } from '@grafana/data' | ||
import { InlineField, Switch } from '@grafana/ui' | ||
import { PerformanceDataSourceOptions } from './types' | ||
|
||
interface Props { | ||
onOptionsChange: (o: DataSourceSettings<PerformanceDataSourceOptions>) => void | ||
options: DataSourceSettings<PerformanceDataSourceOptions> | ||
} | ||
|
||
export const ManualOverrideExtensionConfig: React.FC<Props> = ({ onOptionsChange, options}) => { | ||
const tooltipText = 'Enable manual override UI components for some fields, e.g. Performance Attribute Node, ' + | ||
'where you can enter a template variable or other value manually. ' + | ||
'Generally should not be needed.' | ||
|
||
const onChange = (value: boolean) => { | ||
const newOptions = { | ||
...options, | ||
jsonData: { | ||
...options.jsonData, | ||
allowManualOverrideExtensions: value | ||
} | ||
} | ||
|
||
onOptionsChange(newOptions) | ||
} | ||
|
||
return ( | ||
<> | ||
<style> | ||
{ | ||
` | ||
.spacer { | ||
margin-top: 10px; | ||
margin-bottom: 10px; | ||
} | ||
.perf-config-editor-switch { | ||
display: flex; | ||
align-items: center; | ||
height: 32px; | ||
width: 32px; | ||
} | ||
.perf-config-editor-switch label { | ||
min-width: 32px; | ||
width: 32px; | ||
} | ||
` | ||
} | ||
</style> | ||
<h3 className='spacer'>Additional Options</h3> | ||
|
||
<InlineField className='perf-config-editor-switch-field' label='Allow manual override extensions:' tooltip={tooltipText}> | ||
<div className='perf-config-editor-switch'> | ||
<Switch | ||
value={options.jsonData.allowManualOverrideExtensions} | ||
onChange={() => onChange(!options.jsonData.allowManualOverrideExtensions)} /> | ||
</div> | ||
</InlineField> | ||
</> | ||
) | ||
} |
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,16 +1,24 @@ | ||
import React from 'react'; | ||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; | ||
import { DataSourceHttpSettings } from '@grafana/ui'; | ||
import { ManualOverrideExtensionConfig } from './ManualOverrideExtensionConfig' | ||
import { PerformanceDataSourceOptions } from './types'; | ||
|
||
interface Props extends DataSourcePluginOptionsEditorProps<PerformanceDataSourceOptions> { } | ||
|
||
export const PerformanceConfigEditor: React.FC<Props> = ({ onOptionsChange, options }) => { | ||
return ( | ||
<DataSourceHttpSettings | ||
defaultUrl="https://api.example.com" | ||
dataSourceConfig={options} | ||
onChange={onOptionsChange} | ||
/> | ||
<> | ||
<DataSourceHttpSettings | ||
defaultUrl="https://api.example.com" | ||
dataSourceConfig={options} | ||
onChange={onOptionsChange} | ||
/> | ||
|
||
<ManualOverrideExtensionConfig | ||
onOptionsChange={onOptionsChange} | ||
options={options} | ||
/> | ||
</> | ||
) | ||
} |
Oops, something went wrong.