forked from grafana/clickhouse-datasource
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update query builder/sqlGenerator with new state/config changes
- Loading branch information
1 parent
b9fb80f
commit b7ee093
Showing
23 changed files
with
661 additions
and
377 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { Divider as GrafanaDivider, useTheme2 } from '@grafana/ui'; | ||
import { config } from '@grafana/runtime'; | ||
import { isVersionGtOrEq } from 'utils/version'; | ||
|
||
export function Divider() { | ||
const theme = useTheme2(); | ||
return isVersionGtOrEq(config.buildInfo.version, '10.1.0') ? ( | ||
<GrafanaDivider /> | ||
) : ( | ||
<div | ||
style={{ borderTop: `1px solid ${theme.colors.border.weak}`, margin: theme.spacing(2, 0), width: '100%' }} | ||
></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
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,41 @@ | ||
import React from "react"; | ||
import { TimeUnit } from "types/queryBuilder"; | ||
import allLabels from 'labels'; | ||
import { InlineFormLabel, Select } from '@grafana/ui'; | ||
import { SelectableValue } from '@grafana/data'; | ||
import { styles } from 'styles'; | ||
|
||
interface DurationUnitSelectProps { | ||
unit: TimeUnit; | ||
onChange: (u: TimeUnit) => void; | ||
disabled?: boolean; | ||
inline?: boolean; | ||
}; | ||
|
||
const durationUnitOptions: ReadonlyArray<SelectableValue<TimeUnit>> = [ | ||
{ label: TimeUnit.Seconds, value: TimeUnit.Seconds }, | ||
{ label: TimeUnit.Milliseconds, value: TimeUnit.Milliseconds }, | ||
{ label: TimeUnit.Microseconds, value: TimeUnit.Microseconds }, | ||
{ label: TimeUnit.Nanoseconds, value: TimeUnit.Nanoseconds }, | ||
]; | ||
|
||
export const DurationUnitSelect = (props: DurationUnitSelectProps) => { | ||
const { unit, onChange, disabled, inline } = props; | ||
const { label, tooltip } = allLabels.components.TraceQueryBuilder.columns.durationUnit; | ||
|
||
return ( | ||
<div className="gf-form"> | ||
<InlineFormLabel width={12} className={`query-keyword ${inline ? styles.QueryEditor.inlineField : ''}`} tooltip={tooltip}> | ||
{label} | ||
</InlineFormLabel> | ||
<Select<TimeUnit> | ||
disabled={disabled} | ||
options={durationUnitOptions as Array<SelectableValue<TimeUnit>>} | ||
value={unit} | ||
onChange={v => onChange(v.value!)} | ||
width={inline ? 25 : 30} | ||
menuPlacement={'bottom'} | ||
/> | ||
</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
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.