From a923c792b0d2c56ef223b3dd8ab2afa93dcf3ddf Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 19 Dec 2017 10:22:32 -0700 Subject: [PATCH 1/7] replace KuiConfirmModal with EuiConfirmModal --- src/ui/public/react_components.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ui/public/react_components.js b/src/ui/public/react_components.js index e6e262e9b8b89..1f93edaee3d45 100644 --- a/src/ui/public/react_components.js +++ b/src/ui/public/react_components.js @@ -2,9 +2,12 @@ import 'ngreact'; import { KuiToolBarSearchBox, - KuiConfirmModal, } from 'ui_framework/components'; +import { + EuiConfirmModal, +} from '@elastic/eui'; + import { uiModules } from 'ui/modules'; const app = uiModules.get('app/kibana', ['react']); @@ -12,5 +15,5 @@ app.directive('toolBarSearchBox', function (reactDirective) { return reactDirective(KuiToolBarSearchBox); }); app.directive('confirmModal', function (reactDirective) { - return reactDirective(KuiConfirmModal); + return reactDirective(EuiConfirmModal); }); From 41895c3ea17b399bd192089c5a3e501a47af1849 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 2 Jan 2018 12:24:31 -0700 Subject: [PATCH 2/7] add titles to confirm modals. Update modal text and button text --- .../kibana/public/dashboard/dashboard_app.js | 7 +++--- .../dashboard/listing/dashboard_listing.js | 5 +++-- .../edit_index_pattern/edit_index_pattern.js | 14 +++++++----- .../scripted_fields_table.js | 7 +++--- .../source_filters_table.js | 7 +++--- .../management/sections/objects/_objects.js | 8 ++++--- .../management/sections/objects/_view.js | 5 +++-- .../listing/visualize_listing_table.js | 22 +++++++++++-------- src/core_plugins/timelion/public/app.js | 5 +++-- src/ui/public/field_editor/field_editor.js | 7 +++--- 10 files changed, 51 insertions(+), 36 deletions(-) diff --git a/src/core_plugins/kibana/public/dashboard/dashboard_app.js b/src/core_plugins/kibana/public/dashboard/dashboard_app.js index b64ca6c6bb393..c0fbbb78486a2 100644 --- a/src/core_plugins/kibana/public/dashboard/dashboard_app.js +++ b/src/core_plugins/kibana/public/dashboard/dashboard_app.js @@ -248,9 +248,10 @@ app.directive('dashboardApp', function ($injector) { { onConfirm: revertChangesAndExitEditMode, onCancel: _.noop, - confirmButtonText: 'Yes, lose changes', - cancelButtonText: 'No, keep working', - defaultFocusedButton: ConfirmationButtonTypes.CANCEL + confirmButtonText: 'Discard changes', + cancelButtonText: 'Continue editing', + defaultFocusedButton: ConfirmationButtonTypes.CANCEL, + title: 'Discard changes to dashboard?' } ); }; diff --git a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js index 5928ae6cd31ca..a6d7c6df98ab2 100644 --- a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js +++ b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js @@ -132,11 +132,12 @@ export function DashboardListingController($injector, $scope, $location) { }; confirmModal( - 'Are you sure you want to delete the selected dashboards? This action is irreversible!', + `You can't recover deleted dashboards.`, { confirmButtonText: 'Delete', onConfirm: doDelete, - defaultFocusedButton: ConfirmationButtonTypes.CANCEL + defaultFocusedButton: ConfirmationButtonTypes.CANCEL, + title: 'Delete selected dashboards?' }); }; diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.js index a10020980c4a0..5607239b00bd5 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.js @@ -92,11 +92,12 @@ uiModules.get('apps/management') $scope.refreshFields = function () { const confirmModalOptions = { - confirmButtonText: 'Refresh fields', - onConfirm: () => { $scope.indexPattern.refreshFields(); } + confirmButtonText: 'Refresh', + onConfirm: () => { $scope.indexPattern.refreshFields(); }, + title: 'Refresh field list?' }; confirmModal( - 'This will reset the field popularity counters. Are you sure you want to refresh your fields?', + 'This action resets the popularity counter of each field.', confirmModalOptions ); }; @@ -119,10 +120,11 @@ uiModules.get('apps/management') } const confirmModalOptions = { - confirmButtonText: 'Remove index pattern', - onConfirm: doRemove + confirmButtonText: 'Delete', + onConfirm: doRemove, + title: 'Delete index pattern?' }; - confirmModal('Are you sure you want to remove this index pattern?', confirmModalOptions); + confirmModal('', confirmModalOptions); }; $scope.setDefaultPattern = function () { diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.js index aed6e4ee9b29f..832d6ce2ce950 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.js @@ -109,10 +109,11 @@ uiModules.get('apps/management') $scope.remove = function (field) { const confirmModalOptions = { - confirmButtonText: 'Delete field', - onConfirm: () => { $scope.indexPattern.removeScriptedField(field.name); } + confirmButtonText: 'Delete', + onConfirm: () => { $scope.indexPattern.removeScriptedField(field.name); }, + title: `Delete scripted field ${field.name}?` }; - confirmModal(`Are you sure want to delete ${field.name}? This action is irreversible!`, confirmModalOptions); + confirmModal(`You can't recover scripted fields.`, confirmModalOptions); }; function getLanguagesInUse() { diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/source_filters_table/source_filters_table.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/source_filters_table/source_filters_table.js index f73704999c270..8ce64350fc84c 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/source_filters_table/source_filters_table.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/source_filters_table/source_filters_table.js @@ -102,10 +102,11 @@ uiModules.get('kibana') }; const confirmModalOptions = { - confirmButtonText: 'Delete filter', - onConfirm: doDelete + confirmButtonText: 'Delete', + onConfirm: doDelete, + title: 'Delete source filter?' }; - confirmModal(`Are you sure want to delete this filter?`, confirmModalOptions); + confirmModal('', confirmModalOptions); } create() { diff --git a/src/core_plugins/kibana/public/management/sections/objects/_objects.js b/src/core_plugins/kibana/public/management/sections/objects/_objects.js index 2f4d9383cf800..6d23f289efe11 100644 --- a/src/core_plugins/kibana/public/management/sections/objects/_objects.js +++ b/src/core_plugins/kibana/public/management/sections/objects/_objects.js @@ -130,11 +130,12 @@ uiModules.get('apps/management') } const confirmModalOptions = { - confirmButtonText: `Delete ${$scope.currentTab.title}`, - onConfirm: doBulkDelete + confirmButtonText: 'Delete', + onConfirm: doBulkDelete, + title: `Delete selected ${$scope.currentTab.title}?` }; confirmModal( - `Are you sure you want to delete the selected ${$scope.currentTab.title}? This action is irreversible!`, + `You can't recover deleted ${$scope.currentTab.title}.`, confirmModalOptions ); }; @@ -200,6 +201,7 @@ uiModules.get('apps/management') cancelButtonText: `No, prompt me for each one`, onConfirm: () => resolve(true), onCancel: () => resolve(false), + title: 'Automatically overwrite all existing saved objects?' } ); }) diff --git a/src/core_plugins/kibana/public/management/sections/objects/_view.js b/src/core_plugins/kibana/public/management/sections/objects/_view.js index 77a59cb4fcde4..48ada4d40678a 100644 --- a/src/core_plugins/kibana/public/management/sections/objects/_view.js +++ b/src/core_plugins/kibana/public/management/sections/objects/_view.js @@ -177,10 +177,11 @@ uiModules.get('apps/management') } const confirmModalOptions = { onConfirm: doDelete, - confirmButtonText: 'Delete object' + confirmButtonText: 'Delete', + title: 'Delete saved Kibana object?' }; confirmModal( - 'Are you sure want to delete this object? This action is irreversible!', + `You can't recover deleted objects`, confirmModalOptions ); }; diff --git a/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js b/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js index 16d9da68b602d..5a67c341cdbbc 100644 --- a/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js +++ b/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js @@ -2,14 +2,11 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import _ from 'lodash'; -import { SortableProperties } from '@elastic/eui'; import { Pager } from 'ui/pager'; import { NoVisualizationsPrompt } from './no_visualizations_prompt'; import { KuiPager, - KuiModalOverlay, - KuiConfirmModal, KuiListingTableDeleteButton, KuiListingTableCreateButton, KuiListingTable, @@ -17,6 +14,12 @@ import { KuiListingTableLoadingPrompt } from 'ui_framework/components'; +import { + EuiModalOverlay, + EuiConfirmModal, + SortableProperties, +} from '@elastic/eui'; + export class VisualizeListingTable extends Component { constructor(props) { @@ -186,16 +189,17 @@ export class VisualizeListingTable extends Component { renderConfirmDeleteModal() { return ( - - + - + > +

{`You can't recover deleted visualizations.`}

+ + ); } diff --git a/src/core_plugins/timelion/public/app.js b/src/core_plugins/timelion/public/app.js index 105f3f530afab..924a388d0ef77 100644 --- a/src/core_plugins/timelion/public/app.js +++ b/src/core_plugins/timelion/public/app.js @@ -117,9 +117,10 @@ app.controller('timelion', function ( const confirmModalOptions = { onConfirm: doDelete, - confirmButtonText: 'Delete sheet' + confirmButtonText: 'Delete', + title: `Delete Timelion sheet ${title}?` }; - confirmModal(`Are you sure you want to delete the sheet ${title}?`, confirmModalOptions); + confirmModal(`You can't recover deleted sheets.`, confirmModalOptions); }, testId: 'timelionDeleteButton', }, { diff --git a/src/ui/public/field_editor/field_editor.js b/src/ui/public/field_editor/field_editor.js index 6b874574e3655..776c5a2d63d80 100644 --- a/src/ui/public/field_editor/field_editor.js +++ b/src/ui/public/field_editor/field_editor.js @@ -99,11 +99,12 @@ uiModules }); } const confirmModalOptions = { - confirmButtonText: 'Delete field', - onConfirm: doDelete + confirmButtonText: 'Delete', + onConfirm: doDelete, + title: `Delete field ${self.field.name}?` }; confirmModal( - `Are you sure want to delete '${self.field.name}'? This action is irreversible!`, + `You can't recover a deleted field.`, confirmModalOptions ); }; From 58a302facc31be43d749a10b53fa172d43396bd9 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 2 Jan 2018 15:32:28 -0700 Subject: [PATCH 3/7] updates for newest version of EUI --- .../public/visualize/listing/visualize_listing_table.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js b/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js index 5a67c341cdbbc..4f6fb9d24f3a4 100644 --- a/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js +++ b/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js @@ -15,7 +15,7 @@ import { } from 'ui_framework/components'; import { - EuiModalOverlay, + EuiOverlayMask, EuiConfirmModal, SortableProperties, } from '@elastic/eui'; @@ -189,7 +189,7 @@ export class VisualizeListingTable extends Component { renderConfirmDeleteModal() { return ( - +

{`You can't recover deleted visualizations.`}

-
+ ); } From 94e2e6632c7effbaf8b9d16db09b913583e23747 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 2 Jan 2018 16:07:53 -0700 Subject: [PATCH 4/7] use EUI class in overlay and EUI button constants --- src/ui/public/modals/confirm_modal.js | 6 +++--- src/ui/public/modals/modal_overlay.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/public/modals/confirm_modal.js b/src/ui/public/modals/confirm_modal.js index e2dd943c5ef79..8c843633b2f68 100644 --- a/src/ui/public/modals/confirm_modal.js +++ b/src/ui/public/modals/confirm_modal.js @@ -7,9 +7,9 @@ import { ModalOverlay } from './modal_overlay'; const module = uiModules.get('kibana'); import { - KUI_MODAL_CONFIRM_BUTTON as CONFIRM_BUTTON, - KUI_MODAL_CANCEL_BUTTON as CANCEL_BUTTON, -} from 'ui_framework/components'; + EUI_MODAL_CONFIRM_BUTTON as CONFIRM_BUTTON, + EUI_MODAL_CANCEL_BUTTON as CANCEL_BUTTON, +} from '@elastic/eui'; export const ConfirmationButtonTypes = { CONFIRM: CONFIRM_BUTTON, diff --git a/src/ui/public/modals/modal_overlay.html b/src/ui/public/modals/modal_overlay.html index 7693a04aef868..2abc5768f46f1 100644 --- a/src/ui/public/modals/modal_overlay.html +++ b/src/ui/public/modals/modal_overlay.html @@ -1 +1 @@ -
+
From 04b9906535e6ae18c09b0d71a3d0b65da69da63a Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 3 Jan 2018 13:21:09 -0700 Subject: [PATCH 5/7] remove logic about changed filters in cancel dashboard editing modal, clean up wording for import saved objects modal --- .../kibana/public/dashboard/dashboard_app.js | 4 +-- .../public/dashboard/dashboard_strings.js | 27 ------------------- .../management/sections/objects/_objects.js | 8 +++--- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/core_plugins/kibana/public/dashboard/dashboard_app.js b/src/core_plugins/kibana/public/dashboard/dashboard_app.js index c0fbbb78486a2..271d9cddaa6d8 100644 --- a/src/core_plugins/kibana/public/dashboard/dashboard_app.js +++ b/src/core_plugins/kibana/public/dashboard/dashboard_app.js @@ -6,7 +6,7 @@ import { applyTheme } from 'ui/theme'; import 'ui/query_bar'; -import { getDashboardTitle, getUnsavedChangesWarningMessage } from './dashboard_strings'; +import { getDashboardTitle } from './dashboard_strings'; import { DashboardViewMode } from './dashboard_view_mode'; import { TopNavIds } from './top_nav/top_nav_ids'; import { ConfirmationButtonTypes } from 'ui/modals/confirm_modal'; @@ -244,7 +244,7 @@ app.directive('dashboardApp', function ($injector) { } confirmModal( - getUnsavedChangesWarningMessage(dashboardStateManager.getChangedFilterTypes(timefilter)), + `Once you discard your changes, there's no getting them back.`, { onConfirm: revertChangesAndExitEditMode, onCancel: _.noop, diff --git a/src/core_plugins/kibana/public/dashboard/dashboard_strings.js b/src/core_plugins/kibana/public/dashboard/dashboard_strings.js index 5243ccdf49605..041bbddb81624 100644 --- a/src/core_plugins/kibana/public/dashboard/dashboard_strings.js +++ b/src/core_plugins/kibana/public/dashboard/dashboard_strings.js @@ -1,31 +1,4 @@ import { DashboardViewMode } from './dashboard_view_mode'; -import _ from 'lodash'; - -/** - * @param list {Array.} - * @returns {string} The list of strings concatenated with commas so it can be used in a message. - * E.g. ['a', 'b', 'c'] returns 'a, b, and c'. - */ -export function createStringList(list) { - const listClone = _.clone(list); - const isPlural = list.length > 1; - const lastEntry = isPlural ? `, and ${list[list.length - 1]}` : ''; - if (isPlural) listClone.splice(-1, 1); - - return `${listClone.join(', ')}${lastEntry}`; -} - -/** - * @param changedFilters {Array.} An optional list of filter types that have changed. - * @returns {string} A warning message to display to the user that they are going to lose changes. - */ -export function getUnsavedChangesWarningMessage(changedFilters) { - const changedFilterList = createStringList(changedFilters); - - return changedFilterList ? - `Are you sure you want to cancel and lose changes, including changes made to your ${changedFilterList}?` : - `Are you sure you want to cancel and lose changes?`; -} /** * @param title {string} the current title of the dashboard diff --git a/src/core_plugins/kibana/public/management/sections/objects/_objects.js b/src/core_plugins/kibana/public/management/sections/objects/_objects.js index 6d23f289efe11..e7c809e47ceca 100644 --- a/src/core_plugins/kibana/public/management/sections/objects/_objects.js +++ b/src/core_plugins/kibana/public/management/sections/objects/_objects.js @@ -196,12 +196,12 @@ uiModules.get('apps/management') return new Promise((resolve) => { confirmModal( - `If any of the objects already exist, do you want to automatically overwrite them?`, { - confirmButtonText: `Yes, overwrite all`, - cancelButtonText: `No, prompt me for each one`, + '', { + confirmButtonText: `Yes, overwrite all objects`, + cancelButtonText: `No, prompt for each object`, onConfirm: () => resolve(true), onCancel: () => resolve(false), - title: 'Automatically overwrite all existing saved objects?' + title: 'Automatically overwrite all saved objects?' } ); }) From ec81aebc7ad0c8317005aae8fc610ddaef612bfb Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 3 Jan 2018 14:07:30 -0700 Subject: [PATCH 6/7] fix broken function test - management delete index pattern --- test/functional/apps/management/_index_pattern_create_delete.js | 2 +- test/functional/apps/management/_kibana_settings.js | 2 +- test/functional/page_objects/settings_page.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/functional/apps/management/_index_pattern_create_delete.js b/test/functional/apps/management/_index_pattern_create_delete.js index ae4ff56302ec5..3a2ab1137dba5 100644 --- a/test/functional/apps/management/_index_pattern_create_delete.js +++ b/test/functional/apps/management/_index_pattern_create_delete.js @@ -72,7 +72,7 @@ export default function ({ getService, getPageObjects }) { describe('index pattern deletion', function indexDelete() { before(function () { - const expectedAlertText = 'Are you sure you want to remove this index pattern?'; + const expectedAlertText = 'Delete index pattern?'; return PageObjects.settings.removeIndexPattern() .then(function (alertText) { expect(alertText).to.be(expectedAlertText); diff --git a/test/functional/apps/management/_kibana_settings.js b/test/functional/apps/management/_kibana_settings.js index 13c679afa41a8..31b6d8aa7a6ec 100644 --- a/test/functional/apps/management/_kibana_settings.js +++ b/test/functional/apps/management/_kibana_settings.js @@ -5,7 +5,7 @@ export default function ({ getService, getPageObjects }) { const remote = getService('remote'); const PageObjects = getPageObjects(['settings', 'common', 'dashboard', 'header']); - describe('creating and deleting default index', function describeIndexTests() { + describe('kibana settings', function describeIndexTests() { before(async function () { // delete .kibana index and then wait for Kibana to re-create it await kibanaServer.uiSettings.replace({}); diff --git a/test/functional/page_objects/settings_page.js b/test/functional/page_objects/settings_page.js index 77a7f5bd032c0..30a136c58d11a 100644 --- a/test/functional/page_objects/settings_page.js +++ b/test/functional/page_objects/settings_page.js @@ -355,7 +355,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { }); await retry.try(async () => { log.debug('getAlertText'); - alertText = await testSubjects.getVisibleText('confirmModalBodyText'); + alertText = await testSubjects.getVisibleText('confirmModalTitleText'); }); await retry.try(async () => { log.debug('acceptConfirmation'); From c7522201d3dd7202092de70540bfd1c85bb5fee8 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 8 Jan 2018 08:25:10 -0700 Subject: [PATCH 7/7] wrap names in single quotes --- .../scripted_fields_table/scripted_fields_table.js | 2 +- src/core_plugins/timelion/public/app.js | 2 +- src/ui/public/field_editor/field_editor.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.js index 832d6ce2ce950..4a11665b78b90 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.js @@ -111,7 +111,7 @@ uiModules.get('apps/management') const confirmModalOptions = { confirmButtonText: 'Delete', onConfirm: () => { $scope.indexPattern.removeScriptedField(field.name); }, - title: `Delete scripted field ${field.name}?` + title: `Delete scripted field '${field.name}'?` }; confirmModal(`You can't recover scripted fields.`, confirmModalOptions); }; diff --git a/src/core_plugins/timelion/public/app.js b/src/core_plugins/timelion/public/app.js index 924a388d0ef77..9d4d571fc24a6 100644 --- a/src/core_plugins/timelion/public/app.js +++ b/src/core_plugins/timelion/public/app.js @@ -118,7 +118,7 @@ app.controller('timelion', function ( const confirmModalOptions = { onConfirm: doDelete, confirmButtonText: 'Delete', - title: `Delete Timelion sheet ${title}?` + title: `Delete Timelion sheet '${title}'?` }; confirmModal(`You can't recover deleted sheets.`, confirmModalOptions); }, diff --git a/src/ui/public/field_editor/field_editor.js b/src/ui/public/field_editor/field_editor.js index 776c5a2d63d80..27d27b2156b4d 100644 --- a/src/ui/public/field_editor/field_editor.js +++ b/src/ui/public/field_editor/field_editor.js @@ -101,7 +101,7 @@ uiModules const confirmModalOptions = { confirmButtonText: 'Delete', onConfirm: doDelete, - title: `Delete field ${self.field.name}?` + title: `Delete field '${self.field.name}'?` }; confirmModal( `You can't recover a deleted field.`,