Skip to content

Commit

Permalink
[8.x] [Dashboard] Remove modal for inter app from dashboard (#198619) (
Browse files Browse the repository at this point in the history
…#199235)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Dashboard] Remove modal for inter app from dashboard
(#198619)](#198619)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Rachel
Shen","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-06T21:33:25Z","message":"[Dashboard]
Remove modal for inter app from dashboard (#198619)\n\n##
Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/184257\r\nThis PR removes the
modal warning users that unsaved changes would be\r\nlost when
navigating away from dashboard to other apps within Kibana.\r\nThe modal
is not necessary since unsaved changes are saved in session\r\nstorage.
The benefit is that this removes the unnecessary click
for\r\nusers.\r\n\r\n\r\nThis does not impact the modal for switching to
view mode from edit mode\r\nwith unsaved changes as shown
below.\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/c5bdb0ec-b040-40b0-a511-fd16ad084b90\r\n\r\n\r\n###
Checklist\r\n\r\n - [x] Update
tests","sha":"4f14c4af416ca5010f9db0ec699c4f8541539f6f","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","backport:prev-major","papercut"],"title":"[Dashboard]
Remove modal for inter app from
dashboard","number":198619,"url":"https://github.com/elastic/kibana/pull/198619","mergeCommit":{"message":"[Dashboard]
Remove modal for inter app from dashboard (#198619)\n\n##
Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/184257\r\nThis PR removes the
modal warning users that unsaved changes would be\r\nlost when
navigating away from dashboard to other apps within Kibana.\r\nThe modal
is not necessary since unsaved changes are saved in session\r\nstorage.
The benefit is that this removes the unnecessary click
for\r\nusers.\r\n\r\n\r\nThis does not impact the modal for switching to
view mode from edit mode\r\nwith unsaved changes as shown
below.\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/c5bdb0ec-b040-40b0-a511-fd16ad084b90\r\n\r\n\r\n###
Checklist\r\n\r\n - [x] Update
tests","sha":"4f14c4af416ca5010f9db0ec699c4f8541539f6f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198619","number":198619,"mergeCommit":{"message":"[Dashboard]
Remove modal for inter app from dashboard (#198619)\n\n##
Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/184257\r\nThis PR removes the
modal warning users that unsaved changes would be\r\nlost when
navigating away from dashboard to other apps within Kibana.\r\nThe modal
is not necessary since unsaved changes are saved in session\r\nstorage.
The benefit is that this removes the unnecessary click
for\r\nusers.\r\n\r\n\r\nThis does not impact the modal for switching to
view mode from edit mode\r\nwith unsaved changes as shown
below.\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/c5bdb0ec-b040-40b0-a511-fd16ad084b90\r\n\r\n\r\n###
Checklist\r\n\r\n - [x] Update
tests","sha":"4f14c4af416ca5010f9db0ec699c4f8541539f6f"}}]}] BACKPORT-->

Co-authored-by: Rachel Shen <[email protected]>
  • Loading branch information
kibanamachine and rshen91 authored Nov 6, 2024
1 parent 0e8362b commit 2d180fc
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,6 @@ export const unsavedChangesBadgeStrings = {
}),
};

export const leaveConfirmStrings = {
getLeaveTitle: () =>
i18n.translate('dashboard.appLeaveConfirmModal.unsavedChangesTitle', {
defaultMessage: 'Unsaved changes',
}),
getLeaveSubtitle: () =>
i18n.translate('dashboard.appLeaveConfirmModal.unsavedChangesSubtitle', {
defaultMessage: 'Leave Dashboard with unsaved work?',
}),
getLeaveCancelButtonText: () =>
i18n.translate('dashboard.appLeaveConfirmModal.cancelButtonLabel', {
defaultMessage: 'Cancel',
}),
};

export const getCreateVisualizationButtonTitle = () =>
i18n.translate('dashboard.solutionToolbar.addPanelButtonLabel', {
defaultMessage: 'Create visualization',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
dashboardManagedBadge,
getDashboardBreadcrumb,
getDashboardTitle,
leaveConfirmStrings,
unsavedChangesBadgeStrings,
} from '../dashboard_app/_dashboard_app_strings';
import { useDashboardMountContext } from '../dashboard_app/hooks/dashboard_mount_context';
Expand All @@ -48,7 +47,6 @@ import { getDashboardRecentlyAccessedService } from '../services/dashboard_recen
import {
coreServices,
dataService,
embeddableService,
navigationService,
serverlessService,
} from '../services/kibana_services';
Expand Down Expand Up @@ -195,16 +193,6 @@ export function InternalDashboardTopNav({
*/
useEffect(() => {
onAppLeave((actions) => {
if (
viewMode === 'edit' &&
hasUnsavedChanges &&
!embeddableService.getStateTransfer().isTransferInProgress
) {
return actions.confirm(
leaveConfirmStrings.getLeaveSubtitle(),
leaveConfirmStrings.getLeaveTitle()
);
}
return actions.default();
});
return () => {
Expand Down
4 changes: 1 addition & 3 deletions test/functional/apps/dashboard/group1/edit_visualizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import expect from '@kbn/expect';

export default function ({ getService, getPageObjects }) {
const { dashboard, header, visualize, common, visEditor } = getPageObjects([
const { dashboard, header, visualize, visEditor } = getPageObjects([
'dashboard',
'header',
'visualize',
Expand Down Expand Up @@ -114,7 +114,6 @@ export default function ({ getService, getPageObjects }) {

await header.waitUntilLoadingHasFinished();
await appsMenu.clickLink('Visualize Library');
await common.clickConfirmOnModal();
expect(await testSubjects.exists('visualizationLandingPage')).to.be(true);
});

Expand All @@ -132,7 +131,6 @@ export default function ({ getService, getPageObjects }) {

await header.waitUntilLoadingHasFinished();
await appsMenu.clickLink('Visualize Library');
await common.clickConfirmOnModal();
expect(await testSubjects.exists('visualizationLandingPage')).to.be(true);
});

Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,6 @@
"dashboard.actions.toggleExpandPanelMenuItem.notExpandedDisplayName": "Maximiser",
"dashboard.addPanel.newEmbeddableAddedSuccessMessageTitle": "{savedObjectName} a été ajouté.",
"dashboard.addPanel.newEmbeddableWithNoTitleAddedSuccessMessageTitle": "Un panneau a été ajouté",
"dashboard.appLeaveConfirmModal.cancelButtonLabel": "Annuler",
"dashboard.appLeaveConfirmModal.unsavedChangesSubtitle": "Quitter Dashboard sans enregistrer ?",
"dashboard.appLeaveConfirmModal.unsavedChangesTitle": "Modifications non enregistrées",
"dashboard.badge.readOnly.text": "Lecture seule",
"dashboard.badge.readOnly.tooltip": "Impossible d'enregistrer les tableaux de bord",
"dashboard.createConfirmModal.cancelButtonLabel": "Annuler",
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,6 @@
"dashboard.actions.toggleExpandPanelMenuItem.notExpandedDisplayName": "最大化",
"dashboard.addPanel.newEmbeddableAddedSuccessMessageTitle": "{savedObjectName} が追加されました",
"dashboard.addPanel.newEmbeddableWithNoTitleAddedSuccessMessageTitle": "パネルが追加されました",
"dashboard.appLeaveConfirmModal.cancelButtonLabel": "キャンセル",
"dashboard.appLeaveConfirmModal.unsavedChangesSubtitle": "作業を保存せずにダッシュボードから移動しますか?",
"dashboard.appLeaveConfirmModal.unsavedChangesTitle": "保存されていない変更",
"dashboard.badge.readOnly.text": "読み取り専用",
"dashboard.badge.readOnly.tooltip": "ダッシュボードを保存できません",
"dashboard.createConfirmModal.cancelButtonLabel": "キャンセル",
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,6 @@
"dashboard.actions.toggleExpandPanelMenuItem.notExpandedDisplayName": "最大化",
"dashboard.addPanel.newEmbeddableAddedSuccessMessageTitle": "{savedObjectName} 已添加",
"dashboard.addPanel.newEmbeddableWithNoTitleAddedSuccessMessageTitle": "已添加一个面板",
"dashboard.appLeaveConfirmModal.cancelButtonLabel": "取消",
"dashboard.appLeaveConfirmModal.unsavedChangesSubtitle": "离开有未保存工作的仪表板?",
"dashboard.appLeaveConfirmModal.unsavedChangesTitle": "未保存的更改",
"dashboard.badge.readOnly.text": "只读",
"dashboard.badge.readOnly.tooltip": "无法保存仪表板",
"dashboard.createConfirmModal.cancelButtonLabel": "取消",
Expand Down

0 comments on commit 2d180fc

Please sign in to comment.