Skip to content

Commit b692e34

Browse files
authored
[Dashboard Usability] Unified dashboard settings (#153862)
## Summary Adds flyout for changing individual dashboard settings such as title, description, tags, and save time with dashboard. This also moves the existing dashboard options (show panel titles, sync colors, use margins, sync cursor, and sync tooltips) into the flyout. Fixes #144532 [Flaky test runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2055) ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [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] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
1 parent 7ebfc6e commit b692e34

File tree

24 files changed

+791
-324
lines changed

24 files changed

+791
-324
lines changed

docs/user/dashboard/dashboard.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ Apply a set of design options to the entire dashboard.
363363

364364
. If you're in view mode, click *Edit* in the toolbar.
365365

366-
. In the toolbar, *Options*, then use the following options:
366+
. In the toolbar, click *Settings*, to open the *Dashboard settings* flyout, then use the following options:
367367

368368
* *Use margins between panels* — Adds a margin of space between each panel.
369369

src/plugins/dashboard/public/dashboard_app/_dashboard_app_strings.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,12 @@ export const topNavStrings = {
323323
defaultMessage: 'Share Dashboard',
324324
}),
325325
},
326-
options: {
327-
label: i18n.translate('dashboard.topNave.optionsButtonAriaLabel', {
328-
defaultMessage: 'options',
326+
settings: {
327+
label: i18n.translate('dashboard.topNave.settingsButtonAriaLabel', {
328+
defaultMessage: 'settings',
329329
}),
330-
description: i18n.translate('dashboard.topNave.optionsConfigDescription', {
331-
defaultMessage: 'Options',
330+
description: i18n.translate('dashboard.topNave.settingsConfigDescription', {
331+
defaultMessage: 'Open dashboard settings',
332332
}),
333333
},
334334
clone: {

src/plugins/dashboard/public/dashboard_app/top_nav/use_dashboard_menu_items.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const useDashboardMenuItems = ({
5555
const dispatch = useEmbeddableDispatch();
5656

5757
const hasUnsavedChanges = select((state) => state.componentState.hasUnsavedChanges);
58+
const hasOverlays = select((state) => state.componentState.hasOverlays);
5859
const lastSavedId = select((state) => state.componentState.lastSavedId);
5960
const dashboardTitle = select((state) => state.explicitInput.title);
6061

@@ -169,13 +170,13 @@ export const useDashboardMenuItems = ({
169170
emphasize: true,
170171
isLoading: isSaveInProgress,
171172
testId: 'dashboardQuickSaveMenuItem',
172-
disableButton: !hasUnsavedChanges || isSaveInProgress,
173+
disableButton: !hasUnsavedChanges || isSaveInProgress || hasOverlays,
173174
run: () => quickSaveDashboard(),
174175
} as TopNavMenuData,
175176

176177
saveAs: {
177178
description: topNavStrings.saveAs.description,
178-
disableButton: isSaveInProgress,
179+
disableButton: isSaveInProgress || hasOverlays,
179180
id: 'save',
180181
emphasize: !Boolean(lastSavedId),
181182
testId: 'dashboardSaveMenuItem',
@@ -187,7 +188,7 @@ export const useDashboardMenuItems = ({
187188
switchToViewMode: {
188189
...topNavStrings.switchToViewMode,
189190
id: 'cancel',
190-
disableButton: isSaveInProgress || !lastSavedId,
191+
disableButton: isSaveInProgress || !lastSavedId || hasOverlays,
191192
testId: 'dashboardViewOnlyMode',
192193
run: () => returnToViewMode(),
193194
} as TopNavMenuData,
@@ -196,16 +197,16 @@ export const useDashboardMenuItems = ({
196197
...topNavStrings.share,
197198
id: 'share',
198199
testId: 'shareTopNavButton',
199-
disableButton: isSaveInProgress,
200+
disableButton: isSaveInProgress || hasOverlays,
200201
run: showShare,
201202
} as TopNavMenuData,
202203

203-
options: {
204-
...topNavStrings.options,
205-
id: 'options',
206-
testId: 'dashboardOptionsButton',
207-
disableButton: isSaveInProgress,
208-
run: (anchor) => dashboardContainer.showOptions(anchor),
204+
settings: {
205+
...topNavStrings.settings,
206+
id: 'settings',
207+
testId: 'dashboardSettingsButton',
208+
disableButton: isSaveInProgress || hasOverlays,
209+
run: () => dashboardContainer.showSettings(),
209210
} as TopNavMenuData,
210211

211212
clone: {
@@ -220,6 +221,7 @@ export const useDashboardMenuItems = ({
220221
quickSaveDashboard,
221222
dashboardContainer,
222223
hasUnsavedChanges,
224+
hasOverlays,
223225
setFullScreenMode,
224226
isSaveInProgress,
225227
returnToViewMode,
@@ -252,7 +254,7 @@ export const useDashboardMenuItems = ({
252254
} else {
253255
editModeItems.push(menuItems.switchToViewMode, menuItems.saveAs);
254256
}
255-
return [...labsMenuItem, menuItems.options, ...shareMenuItem, ...editModeItems];
257+
return [...labsMenuItem, menuItems.settings, ...shareMenuItem, ...editModeItems];
256258
}, [lastSavedId, menuItems, share, isLabsEnabled]);
257259

258260
return { viewModeTopNavConfig, editModeTopNavConfig };
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
export { DashboardSettings } from './settings_flyout';

0 commit comments

Comments
 (0)