Skip to content

Commit

Permalink
[Dashboards] Flyouts design cleanup (#199408)
Browse files Browse the repository at this point in the history
## Summary

Updates the styles of the following flyouts to achieve consistency:

- Create control: This one has been simplified from two-column layout to
single column layout after the design process for ES|QL controls. I've
also changed the setting "expand width to fill" to `off` by default
after feedback from Graham and Nino (I also think it's the better
default).
- Control settings
- Add panel
- Create links panel
- Add link
- Add image
- Add from library (to-do: `Search` input, `Types` input and `Tags`
input should be switched to `compressed`)

This PR tries to standardize buttons in flyout footers according to
these
[guidelines](https://www.figma.com/design/y6thIbIHWSXl3v2GzOTtrE/Dashboard-new-panel-guidelines?node-id=51-364&t=rdiJ19w3v5GKYjrx-1)
which considers what we do in other applications such as Discover. For
example, this PR replaces the label `Save and close` with `Save`. The
behavior in Discover (see “Add field” flyout) is that clicking on `Save`
will `Save AND close` the flyout. I think it’s safe to assume users will
expect that behavior upon saving a flyout.

<img width="2236" alt="Frame 2"
src="https://github.com/user-attachments/assets/6df8d50a-0612-48a8-9215-25625dd40a6e">

<img width="1218" alt="Frame 3"
src="https://github.com/user-attachments/assets/abfef6d4-285a-47f8-8ba8-ab32101cec55">

<img width="1188" alt="Frame 4"
src="https://github.com/user-attachments/assets/3f76b3b5-07a3-4e0f-a837-2ae945003736">

<img width="1258" alt="Frame 5"
src="https://github.com/user-attachments/assets/9fd734b3-f35a-46a4-9340-6af75874ddfd">

<img width="1258" alt="Frame 6"
src="https://github.com/user-attachments/assets/907b362a-058c-44b5-8329-27e7c9d6ad7a">

<img width="1258" alt="Frame 7"
src="https://github.com/user-attachments/assets/42e6e3a6-fc48-4dff-9575-baf27cf1120e">

<img width="1258" alt="Frame 8"
src="https://github.com/user-attachments/assets/48eb2f9c-3a26-4589-a180-726ec701d087">

### Other changes

Additionally I've modified the behavior of the actions (`delete`,
`edit`) for `links`. Instead of always occupying a column, now they're
absolutely positioned and will appear on top of each link on hover. This
allows us to make better use of the space.

![CleanShot 2024-11-07 at 18 30
44](https://github.com/user-attachments/assets/85c07e17-06fd-4c38-a37b-8ec63d764972)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit 0e1021a)
  • Loading branch information
andreadelrio committed Nov 11, 2024
1 parent 7b081fe commit c6f126e
Show file tree
Hide file tree
Showing 33 changed files with 272 additions and 298 deletions.
2 changes: 1 addition & 1 deletion src/plugins/controls/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const CONTROL_CHAINING_OPTIONS = { NONE: 'NONE', HIERARCHICAL: 'HIERARCHI
export const DEFAULT_CONTROL_WIDTH: ControlWidth = CONTROL_WIDTH_OPTIONS.MEDIUM;
export const DEFAULT_CONTROL_LABEL_POSITION: ControlLabelPosition =
CONTROL_LABEL_POSITION_OPTIONS.ONE_LINE;
export const DEFAULT_CONTROL_GROW: boolean = true;
export const DEFAULT_CONTROL_GROW: boolean = false;
export const DEFAULT_CONTROL_CHAINING: ControlGroupChainingSystem =
CONTROL_CHAINING_OPTIONS.HIERARCHICAL;
export const DEFAULT_IGNORE_PARENT_SETTINGS = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ export const ControlGroupEditor = ({ onCancel, onSave, onDeleteAll, stateManager
return (
<>
<EuiFlyoutHeader hasBorder>
<EuiTitle size="m">
<EuiTitle size="s">
<h2>{ControlGroupStrings.management.getFlyoutTitle()}</h2>
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody data-test-subj="control-group-settings-flyout">
<EuiForm component="form" fullWidth>
<EuiFormRow label={ControlGroupStrings.management.labelPosition.getLabelPositionTitle()}>
<EuiButtonGroup
color="primary"
buttonSize="compressed"
options={CONTROL_LAYOUT_OPTIONS}
data-test-subj="control-group-layout-options"
idSelected={selectedLabelPosition}
Expand Down Expand Up @@ -193,7 +193,7 @@ export const ControlGroupEditor = ({ onCancel, onSave, onDeleteAll, stateManager
<EuiFlexItem grow={false}>
<EuiButtonEmpty
aria-label={`cancel-editing-group`}
iconType="cross"
flush="left"
onClick={() => {
onCancel();
}}
Expand All @@ -204,7 +204,7 @@ export const ControlGroupEditor = ({ onCancel, onSave, onDeleteAll, stateManager
<EuiFlexItem grow={false}>
<EuiButton
aria-label={`save-group`}
iconType="check"
fill
color="primary"
data-test-subj="control-group-editor-save"
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { i18n } from '@kbn/i18n';
export const ControlGroupStrings = {
getSaveChangesTitle: () =>
i18n.translate('controls.controlGroup.manageControl.saveChangesTitle', {
defaultMessage: 'Save and close',
defaultMessage: 'Save',
}),
getCancelTitle: () =>
i18n.translate('controls.controlGroup.manageControl.cancelTitle', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ describe('getNewControlState', () => {
test('should contain defaults when there are no existing controls', () => {
const controlsManager = initControlsManager({}, new BehaviorSubject<ControlPanelsState>({}));
expect(controlsManager.getNewControlState()).toEqual({
grow: true,
grow: false,
width: 'medium',
dataViewId: undefined,
});
Expand All @@ -284,7 +284,7 @@ describe('getNewControlState', () => {
new BehaviorSubject<ControlPanelsState>(intialControlsState)
);
expect(controlsManager.getNewControlState()).toEqual({
grow: true,
grow: false,
width: 'medium',
dataViewId: 'myOtherDataViewId',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ export const openEditControlGroupFlyout = (
'aria-label': i18n.translate('controls.controlGroup.manageControl', {
defaultMessage: 'Edit control settings',
}),
size: 'm',
maxWidth: 500,
paddingSize: 'm',
outsideClickCloses: false,
onClose: () => closeOverlay(overlay),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ export const DataControlEditorStrings = {
defaultMessage: 'Edit control',
}),
dataSource: {
getFormGroupTitle: () =>
i18n.translate('controls.controlGroup.manageControl.dataSource.formGroupTitle', {
defaultMessage: 'Data source',
}),
getFormGroupDescription: () =>
i18n.translate('controls.controlGroup.manageControl.dataSource.formGroupDescription', {
defaultMessage: 'Select the data view and field that you want to create a control for.',
}),
getSelectDataViewMessage: () =>
i18n.translate('controls.controlGroup.manageControl.dataSource.selectDataViewMessage', {
defaultMessage: 'Please select a data view',
Expand Down Expand Up @@ -95,14 +87,6 @@ export const DataControlEditorStrings = {
},
},
displaySettings: {
getFormGroupTitle: () =>
i18n.translate('controls.controlGroup.manageControl.displaySettings.formGroupTitle', {
defaultMessage: 'Display settings',
}),
getFormGroupDescription: () =>
i18n.translate('controls.controlGroup.manageControl.displaySettings.formGroupDescription', {
defaultMessage: 'Change how the control appears on your dashboard.',
}),
getTitleInputTitle: () =>
i18n.translate('controls.controlGroup.manageControl.displaySettings.titleInputTitle', {
defaultMessage: 'Label',
Expand Down Expand Up @@ -133,7 +117,7 @@ export const DataControlEditorStrings = {
},
getSaveChangesTitle: () =>
i18n.translate('controls.controlGroup.manageControl.saveChangesTitle', {
defaultMessage: 'Save and close',
defaultMessage: 'Save',
}),
getCancelTitle: () =>
i18n.translate('controls.controlGroup.manageControl.cancelTitle', {
Expand Down
Loading

0 comments on commit c6f126e

Please sign in to comment.