-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lens] Add metric Viz config options, title position and sizing #124124
Merged
Merged
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
dbdc290
Add lens config options
shahzad31 b093f5e
Merge branch 'main' of github.com:elastic/kibana into lens-metric
shahzad31 ba3448e
Merge branch 'main' of github.com:elastic/kibana into lens-metric
shahzad31 932545d
wip
shahzad31 b3329c2
Pr feedback
shahzad31 e1b2643
simplify align
shahzad31 c1934ed
improve typing
shahzad31 b0aaec6
update typing
shahzad31 00328a7
Merge branch 'main' of github.com:elastic/kibana into lens-metric
shahzad31 da64340
PR feedback
shahzad31 5ebd718
Design PR feedback
shahzad31 9384fa1
snapshot
shahzad31 a0514f8
Merge branch 'main' of github.com:elastic/kibana into lens-metric
shahzad31 b9f7a61
Merge branch 'main' of github.com:elastic/kibana into lens-metric
shahzad31 3bfdf0b
update snap
shahzad31 159ffd0
Merge branch 'main' of github.com:elastic/kibana into lens-metric
shahzad31 05c8b50
Merge branch 'main' into lens-metric
kibanamachine 56c0bb4
design suggestions
shahzad31 71c3162
Merge branch 'lens-metric' of github.com:shahzad31/kibana into lens-m…
shahzad31 321f8f3
Merge branch 'main' into lens-metric
kibanamachine b139f93
Use bottom as default position for title and some other small refacto…
VladLasitsa e4d3b03
Fix test
VladLasitsa cd89b4e
Fix shapshot
VladLasitsa 8726fb8
Fix shapshot
VladLasitsa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
57 changes: 57 additions & 0 deletions
57
x-pack/plugins/lens/public/metric_visualization/metric_config_panel/align_options.tsx
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,57 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiButtonGroup } from '@elastic/eui'; | ||
import { MetricState } from '../../../common/expressions'; | ||
|
||
export interface TitlePositionProps { | ||
state: MetricState; | ||
setState: (newState: MetricState) => void; | ||
} | ||
|
||
const alignButtonIcons = [ | ||
{ | ||
id: `left`, | ||
label: i18n.translate('xpack.lens.metricChart.alignLabel.left', { | ||
defaultMessage: 'Align left', | ||
}), | ||
iconType: 'editorAlignLeft', | ||
}, | ||
{ | ||
id: `center`, | ||
label: i18n.translate('xpack.lens.metricChart.alignLabel.center', { | ||
defaultMessage: 'Align center', | ||
}), | ||
iconType: 'editorAlignCenter', | ||
}, | ||
{ | ||
id: `right`, | ||
label: i18n.translate('xpack.lens.metricChart.alignLabel.right', { | ||
defaultMessage: 'Align right', | ||
}), | ||
iconType: 'editorAlignRight', | ||
}, | ||
]; | ||
|
||
export const AlignOptions: React.FC<TitlePositionProps> = ({ state, setState }) => { | ||
return ( | ||
<EuiButtonGroup | ||
legend={i18n.translate('xpack.lens.metricChart.titleAlignLabel', { | ||
defaultMessage: 'Align', | ||
})} | ||
options={alignButtonIcons} | ||
idSelected={state.textAlign ?? 'center'} | ||
onChange={(id) => { | ||
setState({ ...state, textAlign: id as MetricState['textAlign'] }); | ||
}} | ||
isIconOnly | ||
buttonSize="compressed" | ||
/> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why the default size isn't handled on the
toExpression
level like position and alignment?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed default here because we use default font size in class
lnsMetricExpression__value
and don't needed to add this class if size is not defained.