-
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
Extract fatal notification into fatalError service, add support for EuiToast notifications #15749
Changes from all commits
5b16537
25bde88
2ebadc7
45f4af1
4db5249
4a4943e
adc1de5
88c3051
d3505f8
e8038b1
5ed6a71
b26000b
3e8e8e6
733070c
dd1e3a6
ee107e3
a5ae513
6c26726
18da564
818612b
7763316
9dede7d
78bfe67
bf0f4bb
c37ae91
cb568ae
7472600
13bbfc4
9c42f06
6404ba6
81799fc
eaa1141
c89ad15
fb7d9e4
545589d
e036a2d
a990b0c
a898367
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import angular from 'angular'; | |
import { uiModules } from 'ui/modules'; | ||
import chrome from 'ui/chrome'; | ||
import { applyTheme } from 'ui/theme'; | ||
import { toastNotifications } from 'ui/notify'; | ||
|
||
import 'ui/query_bar'; | ||
|
||
|
@@ -183,14 +184,18 @@ app.directive('dashboardApp', function ($injector) { | |
$scope.addVis = function (hit, showToast = true) { | ||
dashboardStateManager.addNewPanel(hit.id, 'visualization'); | ||
if (showToast) { | ||
notify.info(`Visualization successfully added to your dashboard`); | ||
toastNotifications.addSuccess('Added visualization to your dashboard'); | ||
} | ||
}; | ||
|
||
$scope.addSearch = function (hit) { | ||
dashboardStateManager.addNewPanel(hit.id, 'search'); | ||
notify.info(`Search successfully added to your dashboard`); | ||
toastNotifications.addSuccess({ | ||
title: 'Added saved search to your dashboard', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Saved search was added to your dashboard |
||
'data-test-subj': 'addSavedSearchToDashboardSuccess', | ||
}); | ||
}; | ||
|
||
$scope.$watch('model.hidePanelTitles', () => { | ||
dashboardStateManager.setHidePanelTitles($scope.model.hidePanelTitles); | ||
}); | ||
|
@@ -268,7 +273,11 @@ app.directive('dashboardApp', function ($injector) { | |
.then(function (id) { | ||
$scope.kbnTopNav.close('save'); | ||
if (id) { | ||
notify.info(`Saved Dashboard as "${dash.title}"`); | ||
toastNotifications.addSuccess({ | ||
title: `Saved '${dash.title}'`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dashboard '${dash.title}' was saved |
||
'data-test-subj': 'saveDashboardSuccess', | ||
}); | ||
|
||
if (dash.id !== $routeParams.id) { | ||
kbnUrl.change(createDashboardEditUrl(dash.id)); | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ import * as filterActions from 'ui/doc_table/actions/filter'; | |
import dateMath from '@elastic/datemath'; | ||
import 'ui/doc_table'; | ||
import 'ui/visualize'; | ||
import 'ui/notify'; | ||
import 'ui/fixed_scroll'; | ||
import 'ui/directives/validate_json'; | ||
import 'ui/filters/moment'; | ||
|
@@ -16,6 +15,7 @@ import 'ui/state_management/app_state'; | |
import 'ui/timefilter'; | ||
import 'ui/share'; | ||
import 'ui/query_bar'; | ||
import { toastNotifications } from 'ui/notify'; | ||
import { VisProvider } from 'ui/vis'; | ||
import { BasicResponseHandlerProvider } from 'ui/vis/response_handlers/basic'; | ||
import { DocTitleProvider } from 'ui/doc_title'; | ||
|
@@ -416,7 +416,11 @@ function discoverController( | |
$scope.kbnTopNav.close('save'); | ||
|
||
if (id) { | ||
notify.info('Saved Data Source "' + savedSearch.title + '"'); | ||
toastNotifications.addSuccess({ | ||
title: `Saved '${savedSearch.title}'`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Data source "searchSearch.title" was saved |
||
'data-test-subj': 'saveSearchSuccess', | ||
}); | ||
|
||
if (savedSearch.id !== $route.current.params.id) { | ||
kbnUrl.change('/discover/{{id}}', { id: savedSearch.id }); | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,17 +4,16 @@ import 'ui/paginated_table'; | |
import fieldControlsHtml from '../field_controls.html'; | ||
import { dateScripts } from './date_scripts'; | ||
import { uiModules } from 'ui/modules'; | ||
import { toastNotifications } from 'ui/notify'; | ||
import template from './scripted_fields_table.html'; | ||
import { getSupportedScriptingLanguages, getDeprecatedScriptingLanguages } from 'ui/scripting_languages'; | ||
import { documentationLinks } from 'ui/documentation_links/documentation_links'; | ||
|
||
uiModules.get('apps/management') | ||
.directive('scriptedFieldsTable', function (kbnUrl, Notifier, $filter, confirmModal) { | ||
.directive('scriptedFieldsTable', function (kbnUrl, $filter, confirmModal) { | ||
const rowScopes = []; // track row scopes, so they can be destroyed as needed | ||
const filter = $filter('filter'); | ||
|
||
const notify = new Notifier(); | ||
|
||
return { | ||
restrict: 'E', | ||
template, | ||
|
@@ -82,11 +81,17 @@ uiModules.get('apps/management') | |
}); | ||
|
||
if (fieldsAdded > 0) { | ||
notify.info(fieldsAdded + ' script fields created'); | ||
toastNotifications.addSuccess({ | ||
title: 'Created script fields', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that maybe this should be "added" See the button guidelines for a description. Recommendation: Scripted field "fieldname" was added or Scripted field was added Prefer one line over title and text |
||
text: `Created ${fieldsAdded}`, | ||
}); | ||
} | ||
|
||
if (conflictFields.length > 0) { | ||
notify.info('Not adding ' + conflictFields.length + ' duplicate fields: ' + conflictFields.join(', ')); | ||
toastNotifications.addWarning({ | ||
title: `Didn't add duplicate fields`, | ||
text: `${conflictFields.length} fields: ${conflictFields.join(', ')}`, | ||
}); | ||
} | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,21 +5,23 @@ import { savedObjectManagementRegistry } from 'plugins/kibana/management/saved_o | |
import objectViewHTML from 'plugins/kibana/management/sections/objects/_view.html'; | ||
import uiRoutes from 'ui/routes'; | ||
import { uiModules } from 'ui/modules'; | ||
import { fatalError, toastNotifications } from 'ui/notify'; | ||
import 'ui/accessibility/kbn_ui_ace_keyboard_mode'; | ||
import { castEsToKbnFieldTypeName } from '../../../../../../utils'; | ||
import { SavedObjectsClientProvider } from 'ui/saved_objects'; | ||
|
||
const location = 'SavedObject view'; | ||
|
||
uiRoutes | ||
.when('/management/kibana/objects/:service/:id', { | ||
template: objectViewHTML | ||
}); | ||
|
||
uiModules.get('apps/management') | ||
.directive('kbnManagementObjectsView', function (kbnIndex, Notifier, confirmModal) { | ||
.directive('kbnManagementObjectsView', function (kbnIndex, confirmModal) { | ||
return { | ||
restrict: 'E', | ||
controller: function ($scope, $injector, $routeParams, $location, $window, $rootScope, Private) { | ||
const notify = new Notifier({ location: 'SavedObject view' }); | ||
const serviceObj = savedObjectManagementRegistry.get($routeParams.service); | ||
const service = $injector.get(serviceObj.service); | ||
const savedObjectsClient = Private(SavedObjectsClientProvider); | ||
|
@@ -122,7 +124,7 @@ uiModules.get('apps/management') | |
return (orderIndex > -1) ? orderIndex : Infinity; | ||
}); | ||
}) | ||
.catch(notify.fatal); | ||
.catch(error => fatalError(error, location)); | ||
|
||
// This handles the validation of the Ace Editor. Since we don't have any | ||
// other hooks into the editors to tell us if the content is valid or not | ||
|
@@ -173,7 +175,7 @@ uiModules.get('apps/management') | |
.then(function () { | ||
return redirectHandler('deleted'); | ||
}) | ||
.catch(notify.fatal); | ||
.catch(error => fatalError(error, location)); | ||
} | ||
const confirmModalOptions = { | ||
onConfirm: doDelete, | ||
|
@@ -207,18 +209,17 @@ uiModules.get('apps/management') | |
.then(function () { | ||
return redirectHandler('updated'); | ||
}) | ||
.catch(notify.fatal); | ||
.catch(error => fatalError(error, location)); | ||
}; | ||
|
||
function redirectHandler(action) { | ||
const msg = 'You successfully ' + action + ' the "' + $scope.obj.attributes.title + '" ' + $scope.title.toLowerCase() + ' object'; | ||
|
||
$location.path('/management/kibana/objects').search({ | ||
_a: rison.encode({ | ||
tab: serviceObj.title | ||
}) | ||
}); | ||
notify.info(msg); | ||
|
||
toastNotifications.addSuccess(`${_.capitalize(action)} '${$scope.obj.attributes.title}' ${$scope.title.toLowerCase()} object`); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what this is supposed to say, but follow this format: object type > object name > was/were > past tense action |
||
} | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import 'ui/share'; | |
import 'ui/query_bar'; | ||
import chrome from 'ui/chrome'; | ||
import angular from 'angular'; | ||
import { Notifier } from 'ui/notify/notifier'; | ||
import { Notifier, toastNotifications } from 'ui/notify'; | ||
import { VisTypesRegistryProvider } from 'ui/registry/vis_types'; | ||
import { DocTitleProvider } from 'ui/doc_title'; | ||
import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; | ||
|
@@ -251,7 +251,11 @@ function VisEditor($scope, $route, timefilter, AppState, $window, kbnUrl, courie | |
$scope.kbnTopNav.close('save'); | ||
|
||
if (id) { | ||
notify.info('Saved Visualization "' + savedVis.title + '"'); | ||
toastNotifications.addSuccess({ | ||
title: `Saved '${savedVis.title}'`, | ||
'data-test-subj': 'saveVisualizationSuccess', | ||
}); | ||
|
||
if ($scope.isAddToDashMode()) { | ||
const savedVisualizationParsedUrl = new KibanaParsedUrl({ | ||
basePath: chrome.getBasePath(), | ||
|
@@ -281,7 +285,7 @@ function VisEditor($scope, $route, timefilter, AppState, $window, kbnUrl, courie | |
$scope.unlink = function () { | ||
if (!$state.linked) return; | ||
|
||
notify.info(`Unlinked Visualization "${savedVis.title}" from Saved Search "${savedVis.savedSearch.title}"`); | ||
toastNotifications.addSuccess(`Unlinked from saved search '${savedVis.savedSearch.title}'`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Visualization "savedVis.title" was unlinked from saved search "savedSearch.title" We need a better word for "unlinked" |
||
|
||
$state.linked = false; | ||
const parent = searchSource.getParent(true); | ||
|
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.
Visualization was added to your dashboard