Skip to content

Commit

Permalink
Merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
stacey-gammon committed Jan 19, 2017
1 parent 3c5e4bf commit 17a130c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 64 deletions.
30 changes: 17 additions & 13 deletions src/core_plugins/kibana/public/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,14 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,

confirmModal(
'You have unsaved changes to your dashboard. You can save them or exit without saving and lose your changes.',
saveAndExitEditMode,
exitEditMode,
noop,
'Save dashboard',
'Lose changes',
'Unsaved changes');
{
onConfirm: saveAndExitEditMode,
onCancel: exitEditMode,
onClose: noop,
confirmButtonText: 'Save dashboard',
cancelButtonText: 'Lose changes',
title: 'Unsaved changes'
});
return;
}

Expand All @@ -167,7 +169,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
};

const changedFilters = [];
if (filterBarMismatch()) { changedFilters.push('filters'); }
if (filterBarMismatch()) { changedFilters.push('filter'); }
if (queryMismatch()) { changedFilters.push('query'); }
if (timeMismatch()) { changedFilters.push('time range'); }

Expand Down Expand Up @@ -197,12 +199,14 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
const filterList = `${changedFilters.join(', ')}${lastEntry} ${isPlural ? 'are' : 'is'}`;
confirmModal(
`Your current ${filterList} different than ${isPlural ? 'those' : 'that'} stored with your dashboard.`,
onLoadSavedFilters,
() => { doModeSwitch(); $appStatus.dirty = true; },
noop,
'Load dashboard defaults',
'Use current values',
'Conflict detected');
{
onConfirm: onLoadSavedFilters,
onCancel: () => { doModeSwitch(); $appStatus.dirty = true; },
onClose: noop,
confirmButtonText: 'Load dashboard defaults',
cancelButtonText: 'Use current values',
title: 'Conflict detected'
});
} else {
doModeSwitch();
}
Expand Down
50 changes: 0 additions & 50 deletions src/ui/public/modals/confirm_modal.factory.js

This file was deleted.

9 changes: 8 additions & 1 deletion src/ui/public/modals/confirm_modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ module.factory('confirmModal', function ($rootScope, $compile) {
const defaultOptions = {
onConfirm: noop,
onCancel: noop,
onClose: undefined,
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel'
cancelButtonText: 'Cancel',
title: undefined
};

const options = Object.assign(defaultOptions, customOptions);
Expand All @@ -24,6 +26,7 @@ module.factory('confirmModal', function ($rootScope, $compile) {

const confirmScope = $rootScope.$new();

confirmScope.title = options.title;
confirmScope.message = message;
confirmScope.confirmButtonText = options.confirmButtonText;
confirmScope.cancelButtonText = options.cancelButtonText;
Expand All @@ -35,6 +38,10 @@ module.factory('confirmModal', function ($rootScope, $compile) {
destroy();
options.onCancel();
};
confirmScope.onClose = () => {
destroy();
options.onClose();
};

const modalInstance = $compile(template)(confirmScope);
modalPopover = new ModalOverlay(modalInstance);
Expand Down

0 comments on commit 17a130c

Please sign in to comment.