mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Canvas: Add constraint selection icons (#52504)
This commit is contained in:
parent
355489d9b4
commit
feb9960f96
@ -24,6 +24,7 @@ export const getAvailableIcons = () =>
|
|||||||
'arrow-right',
|
'arrow-right',
|
||||||
'arrow-up',
|
'arrow-up',
|
||||||
'arrows-h',
|
'arrows-h',
|
||||||
|
'arrows-v',
|
||||||
'backward',
|
'backward',
|
||||||
'bars',
|
'bars',
|
||||||
'bell',
|
'bell',
|
||||||
|
@ -3,7 +3,7 @@ import { useObservable } from 'react-use';
|
|||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
import { SelectableValue, StandardEditorProps } from '@grafana/data';
|
import { SelectableValue, StandardEditorProps } from '@grafana/data';
|
||||||
import { Field, HorizontalGroup, InlineField, InlineFieldRow, Select, VerticalGroup } from '@grafana/ui';
|
import { Field, HorizontalGroup, Icon, InlineField, InlineFieldRow, Select, VerticalGroup } from '@grafana/ui';
|
||||||
import { NumberInput } from 'app/core/components/OptionsUI/NumberInput';
|
import { NumberInput } from 'app/core/components/OptionsUI/NumberInput';
|
||||||
import { HorizontalConstraint, Placement, VerticalConstraint } from 'app/features/canvas';
|
import { HorizontalConstraint, Placement, VerticalConstraint } from 'app/features/canvas';
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ const places: Array<keyof Placement> = ['top', 'left', 'bottom', 'right', 'width
|
|||||||
const horizontalOptions: Array<SelectableValue<HorizontalConstraint>> = [
|
const horizontalOptions: Array<SelectableValue<HorizontalConstraint>> = [
|
||||||
{ label: 'Left', value: HorizontalConstraint.Left },
|
{ label: 'Left', value: HorizontalConstraint.Left },
|
||||||
{ label: 'Right', value: HorizontalConstraint.Right },
|
{ label: 'Right', value: HorizontalConstraint.Right },
|
||||||
{ label: 'Left and right', value: HorizontalConstraint.LeftRight },
|
{ label: 'Left & right', value: HorizontalConstraint.LeftRight },
|
||||||
{ label: 'Center', value: HorizontalConstraint.Center },
|
{ label: 'Center', value: HorizontalConstraint.Center },
|
||||||
{ label: 'Scale', value: HorizontalConstraint.Scale },
|
{ label: 'Scale', value: HorizontalConstraint.Scale },
|
||||||
];
|
];
|
||||||
@ -26,7 +26,7 @@ const horizontalOptions: Array<SelectableValue<HorizontalConstraint>> = [
|
|||||||
const verticalOptions: Array<SelectableValue<VerticalConstraint>> = [
|
const verticalOptions: Array<SelectableValue<VerticalConstraint>> = [
|
||||||
{ label: 'Top', value: VerticalConstraint.Top },
|
{ label: 'Top', value: VerticalConstraint.Top },
|
||||||
{ label: 'Bottom', value: VerticalConstraint.Bottom },
|
{ label: 'Bottom', value: VerticalConstraint.Bottom },
|
||||||
{ label: 'Top and bottom', value: VerticalConstraint.TopBottom },
|
{ label: 'Top & bottom', value: VerticalConstraint.TopBottom },
|
||||||
{ label: 'Center', value: VerticalConstraint.Center },
|
{ label: 'Center', value: VerticalConstraint.Center },
|
||||||
{ label: 'Scale', value: VerticalConstraint.Scale },
|
{ label: 'Scale', value: VerticalConstraint.Scale },
|
||||||
];
|
];
|
||||||
@ -99,8 +99,18 @@ export const PlacementEditor: FC<StandardEditorProps<any, CanvasEditorOptions, P
|
|||||||
currentConstraints={constraint}
|
currentConstraints={constraint}
|
||||||
/>
|
/>
|
||||||
<VerticalGroup>
|
<VerticalGroup>
|
||||||
|
<HorizontalGroup>
|
||||||
|
<Icon name="arrows-h" />
|
||||||
|
<Select
|
||||||
|
options={horizontalOptions}
|
||||||
|
onChange={onHorizontalConstraintSelect}
|
||||||
|
value={constraint.horizontal}
|
||||||
|
/>
|
||||||
|
</HorizontalGroup>
|
||||||
|
<HorizontalGroup>
|
||||||
|
<Icon name="arrows-v" />
|
||||||
<Select options={verticalOptions} onChange={onVerticalConstraintSelect} value={constraint.vertical} />
|
<Select options={verticalOptions} onChange={onVerticalConstraintSelect} value={constraint.vertical} />
|
||||||
<Select options={horizontalOptions} onChange={onHorizontalConstraintSelect} value={constraint.horizontal} />
|
</HorizontalGroup>
|
||||||
</VerticalGroup>
|
</VerticalGroup>
|
||||||
</HorizontalGroup>
|
</HorizontalGroup>
|
||||||
</Field>
|
</Field>
|
||||||
|
Loading…
Reference in New Issue
Block a user