[Unified search] Removes the tour component of the dataview picker (#137816)

* [Unified search] Removes the tour component which introduces the new dataview picker layout

* Removes unused translations
This commit is contained in:
Stratoula Kalafateli 2022-08-03 14:23:03 +03:00 committed by GitHub
parent c0fbd11a8c
commit 5625156d7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 21 additions and 179 deletions

View file

@ -14,7 +14,6 @@ import { findTestSubject } from '@elastic/eui/lib/test';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
import { ChangeDataView } from './change_dataview';
import { EuiTourStep } from '@elastic/eui';
import { DataViewPickerPropsExtended, TextBasedLanguages } from '.';
describe('DataView component', () => {
@ -83,25 +82,6 @@ describe('DataView component', () => {
onTextLangQuerySubmit: jest.fn(),
};
});
it('should not render the tour component by default', async () => {
await act(async () => {
const component = mount(wrapDataViewComponentInContext(props, true));
expect(component.find(EuiTourStep).prop('isStepOpen')).toBe(false);
});
});
it('should render the tour component if the showNewMenuTour is true', async () => {
const component = mount(
wrapDataViewComponentInContext({ ...props, showNewMenuTour: true }, false)
);
expect(component.find(EuiTourStep).prop('isStepOpen')).toBe(true);
});
it('should not render the tour component if the showNewMenuTour is true but the hideAnnouncements setting is on', async () => {
const component = mount(
wrapDataViewComponentInContext({ ...props, showNewMenuTour: true }, false, true)
);
expect(component.find(EuiTourStep).prop('isStepOpen')).toBe(false);
});
it('should not render the add runtime field menu if addField is not given', async () => {
await act(async () => {
@ -114,10 +94,7 @@ describe('DataView component', () => {
it('should render the add runtime field menu if addField is given', async () => {
const addFieldSpy = jest.fn();
const component = mount(
wrapDataViewComponentInContext(
{ ...props, onAddField: addFieldSpy, showNewMenuTour: true },
false
)
wrapDataViewComponentInContext({ ...props, onAddField: addFieldSpy }, false)
);
findTestSubject(component, 'dataview-trigger').simulate('click');
expect(component.find('[data-test-subj="indexPattern-add-field"]').at(0).text()).toContain(
@ -138,10 +115,7 @@ describe('DataView component', () => {
it('should render the add datavuew menu if onDataViewCreated is given', async () => {
const addDataViewSpy = jest.fn();
const component = mount(
wrapDataViewComponentInContext(
{ ...props, onDataViewCreated: addDataViewSpy, showNewMenuTour: true },
false
)
wrapDataViewComponentInContext({ ...props, onDataViewCreated: addDataViewSpy }, false)
);
findTestSubject(component, 'dataview-trigger').simulate('click');
expect(component.find('[data-test-subj="dataview-create-new"]').at(0).text()).toContain(
@ -156,7 +130,6 @@ describe('DataView component', () => {
wrapDataViewComponentInContext(
{
...props,
showNewMenuTour: true,
textBasedLanguages: [TextBasedLanguages.ESQL, TextBasedLanguages.SQL],
textBasedLanguage: TextBasedLanguages.SQL,
},

View file

@ -18,9 +18,7 @@ import {
useEuiTheme,
useGeneratedHtmlId,
EuiIcon,
EuiLink,
EuiText,
EuiTourStep,
EuiContextMenuPanelProps,
EuiFlexGroup,
EuiFlexItem,
@ -36,31 +34,9 @@ import type { TextBasedLanguagesListProps } from './text_languages_list';
import type { TextBasedLanguagesTransitionModalProps } from './text_languages_transition_modal';
import { changeDataViewStyles } from './change_dataview.styles';
const hideAnnouncementsUISetting = 'hideAnnouncements';
// local storage key for the tour component
const NEW_DATA_VIEW_MENU_STORAGE_KEY = 'data.newDataViewMenu';
// local storage key for the text based languages transition modal
const TEXT_LANG_TRANSITION_MODAL_KEY = 'data.textLangTransitionModal';
const newMenuTourTitle = i18n.translate('unifiedSearch.query.dataViewMenu.newMenuTour.title', {
defaultMessage: 'A better data view menu',
});
const newMenuTourDescription = i18n.translate(
'unifiedSearch.query.dataViewMenu.newMenuTour.description',
{
defaultMessage:
'This menu now offers all the tools you need to create, find, and edit your data views.',
}
);
const newMenuTourDismissLabel = i18n.translate(
'unifiedSearch.query.dataViewMenu.newMenuTour.dismissLabel',
{
defaultMessage: 'Got it',
}
);
const Fallback = () => <div />;
const LazyTextBasedLanguagesTransitionModal = React.lazy(
@ -89,7 +65,6 @@ export function ChangeDataView({
onDataViewCreated,
trigger,
selectableProps,
showNewMenuTour = false,
textBasedLanguages,
onSaveTextLanguageQuery,
onTextLangQuerySubmit,
@ -106,40 +81,11 @@ export function ChangeDataView({
const [selectedDataViewId, setSelectedDataViewId] = useState(currentDataViewId);
const kibana = useKibana<IDataPluginServices>();
const { application, data, storage, uiSettings } = kibana.services;
const { application, data, storage } = kibana.services;
const styles = changeDataViewStyles({ fullWidth: trigger.fullWidth });
const [isTextLangTransitionModalDismissed, setIsTextLangTransitionModalDismissed] = useState(() =>
Boolean(storage.get(TEXT_LANG_TRANSITION_MODAL_KEY))
);
const isHideAnnouncementSettingsOn = Boolean(uiSettings.get(hideAnnouncementsUISetting));
const [isTourDismissed, setIsTourDismissed] = useState(() =>
Boolean(storage.get(NEW_DATA_VIEW_MENU_STORAGE_KEY))
);
const [isTourOpen, setIsTourOpen] = useState(false);
useEffect(() => {
if (
showNewMenuTour &&
!isTourDismissed &&
!isHideAnnouncementSettingsOn &&
!isTextBasedLangSelected
) {
setIsTourOpen(true);
}
}, [
isHideAnnouncementSettingsOn,
isTextBasedLangSelected,
isTourDismissed,
setIsTourOpen,
showNewMenuTour,
]);
const onTourDismiss = () => {
storage.set(NEW_DATA_VIEW_MENU_STORAGE_KEY, true);
setIsTourDismissed(true);
setIsTourOpen(false);
};
// Create a reusable id to ensure search input is the first focused item in the popover even though it's not the first item
const searchListInputId = useGeneratedHtmlId({ prefix: 'dataviewPickerListSearchInput' });
@ -176,8 +122,6 @@ export function ChangeDataView({
data-test-subj={dataTestSubj}
onClick={() => {
setPopoverIsOpen(!isPopoverOpen);
setIsTourOpen(false);
// onTourDismiss(); TODO: Decide if opening the menu should also dismiss the tour
}}
color={isMissingCurrent ? 'danger' : 'primary'}
iconSide="right"
@ -427,47 +371,23 @@ export function ChangeDataView({
return (
<>
<EuiTourStep
title={
<>
<EuiIcon type="bell" size="s" /> &nbsp; {newMenuTourTitle}
</>
}
content={
<EuiText css={styles.popoverContent}>
<p>{newMenuTourDescription}</p>
</EuiText>
}
isStepOpen={isTourOpen}
onFinish={onTourDismiss}
step={1}
stepsTotal={1}
footerAction={
<EuiLink data-test-subj="dataViewPickerTourLink" onClick={onTourDismiss}>
{newMenuTourDismissLabel}
</EuiLink>
}
repositionOnScroll
<EuiPopover
panelClassName="changeDataViewPopover"
button={createTrigger()}
panelProps={{
['data-test-subj']: 'changeDataViewPopover',
}}
isOpen={isPopoverOpen}
closePopover={() => setPopoverIsOpen(false)}
panelPaddingSize="none"
initialFocus={!isTextBasedLangSelected ? `#${searchListInputId}` : false}
display="block"
buffer={8}
>
<EuiPopover
panelClassName="changeDataViewPopover"
button={createTrigger()}
panelProps={{
['data-test-subj']: 'changeDataViewPopover',
}}
isOpen={isPopoverOpen}
closePopover={() => setPopoverIsOpen(false)}
panelPaddingSize="none"
initialFocus={!isTextBasedLangSelected ? `#${searchListInputId}` : false}
display="block"
buffer={8}
>
<div css={styles.popoverContent}>
<EuiContextMenuPanel size="s" items={getPanelItems()} />
</div>
</EuiPopover>
</EuiTourStep>
<div css={styles.popoverContent}>
<EuiContextMenuPanel size="s" items={getPanelItems()} />
</div>
</EuiPopover>
{modal}
</>
);

View file

@ -58,10 +58,6 @@ export interface DataViewPickerProps {
* Also works as a flag to show the create dataview button.
*/
onDataViewCreated?: () => void;
/**
* Flag to show the tour component for the first time.
*/
showNewMenuTour?: boolean;
/**
* List of the supported text based languages (SQL, ESQL) etc.
* Defined per application, if not provided, no text based languages
@ -93,7 +89,6 @@ export const DataViewPicker = ({
onDataViewCreated,
trigger,
selectableProps,
showNewMenuTour,
textBasedLanguages,
onSaveTextLanguageQuery,
onTextLangQuerySubmit,
@ -108,7 +103,6 @@ export const DataViewPicker = ({
onDataViewCreated={onDataViewCreated}
trigger={trigger}
selectableProps={selectableProps}
showNewMenuTour={showNewMenuTour}
textBasedLanguages={textBasedLanguages}
onSaveTextLanguageQuery={onSaveTextLanguageQuery}
onTextLangQuerySubmit={onTextLangQuerySubmit}

View file

@ -447,7 +447,6 @@ export const QueryBarTopRow = React.memo(
return (
<EuiFlexItem style={{ maxWidth: '100%' }} grow={isMobile}>
<DataViewPicker
showNewMenuTour
{...props.dataViewPickerComponentProps}
trigger={{ fullWidth: isMobile, ...props.dataViewPickerComponentProps.trigger }}
onTextLangQuerySubmit={props.onTextLangQuerySubmit}

View file

@ -328,7 +328,6 @@ const TopNav = ({
},
isMissingCurrent: isMissingCurrentDataView,
onChangeDataView,
showNewMenuTour: false,
}
: undefined
}

View file

@ -48,7 +48,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
isNewChartsLibraryEnabled = await PageObjects.visChart.isNewChartsLibraryEnabled();
await PageObjects.dashboard.initTests();
await PageObjects.dashboard.preserveCrossAppState();
await browser.setLocalStorageItem('data.newDataViewMenu', 'true');
if (!isNewChartsLibraryEnabled) {
await kibanaServer.uiSettings.update({

View file

@ -11,7 +11,7 @@ import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const PageObjects = getPageObjects(['common', 'header', 'home', 'timePicker', 'unifiedSearch']);
const PageObjects = getPageObjects(['common', 'header', 'home', 'timePicker']);
const appsMenu = getService('appsMenu');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
@ -37,7 +37,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// Navigate to discover app
await appsMenu.clickLink('Discover');
await PageObjects.unifiedSearch.closeTourPopoverByLocalStorage();
const discoverUrl = await browser.getCurrentUrl();
await PageObjects.timePicker.setDefaultAbsoluteRange();
const modifiedTimeDiscoverUrl = await browser.getCurrentUrl();

View file

@ -293,7 +293,6 @@ export class CommonPageObject extends FtrService {
}
if (appName === 'discover') {
await this.browser.setLocalStorageItem('data.autocompleteFtuePopover', 'true');
await this.browser.setLocalStorageItem('data.newDataViewMenu', 'true');
}
return currentUrl;
});

View file

@ -24,8 +24,6 @@ export class DiscoverPageObject extends FtrService {
private readonly kibanaServer = this.ctx.getService('kibanaServer');
private readonly queryBar = this.ctx.getService('queryBar');
private readonly unifiedSearch = this.ctx.getPageObject('unifiedSearch');
private readonly defaultFindTimeout = this.config.get('timeouts.find');
public async getChartTimespan() {
@ -570,7 +568,6 @@ export class DiscoverPageObject extends FtrService {
await this.retry.waitFor('Discover app on screen', async () => {
return await this.isDiscoverAppOnScreen();
});
await this.unifiedSearch.closeTourPopoverByLocalStorage();
}
public async showAllFilterActions() {

View file

@ -9,22 +9,9 @@
import { FtrService } from '../ftr_provider_context';
export class UnifiedSearchPageObject extends FtrService {
private readonly browser = this.ctx.getService('browser');
private readonly retry = this.ctx.getService('retry');
private readonly testSubjects = this.ctx.getService('testSubjects');
public async closeTour() {
const tourPopoverIsOpen = await this.testSubjects.exists('dataViewPickerTourLink');
if (tourPopoverIsOpen) {
await this.testSubjects.click('dataViewPickerTourLink');
}
}
public async closeTourPopoverByLocalStorage() {
await this.browser.setLocalStorageItem('data.newDataViewMenu', 'true');
await this.browser.refresh();
}
public async switchDataView(switchButtonSelector: string, dataViewTitle: string) {
await this.testSubjects.click(switchButtonSelector);

View file

@ -39,7 +39,6 @@ export class VisualizePageObject extends FtrService {
private readonly elasticChart = this.ctx.getService('elasticChart');
private readonly common = this.ctx.getPageObject('common');
private readonly header = this.ctx.getPageObject('header');
private readonly unifiedSearch = this.ctx.getPageObject('unifiedSearch');
private readonly visEditor = this.ctx.getPageObject('visEditor');
private readonly visChart = this.ctx.getPageObject('visChart');
@ -155,10 +154,6 @@ export class VisualizePageObject extends FtrService {
public async clickVisType(type: string) {
await this.testSubjects.click(`visType-${type}`);
await this.header.waitUntilLoadingHasFinished();
if (type === 'lens') {
await this.unifiedSearch.closeTour();
}
}
public async clickAreaChart() {

View file

@ -17,7 +17,6 @@ export class DashboardVisualizationsService extends FtrService {
private readonly visualize = this.ctx.getPageObject('visualize');
private readonly visEditor = this.ctx.getPageObject('visEditor');
private readonly header = this.ctx.getPageObject('header');
private readonly unifiedSearch = this.ctx.getPageObject('unifiedSearch');
private readonly discover = this.ctx.getPageObject('discover');
private readonly timePicker = this.ctx.getPageObject('timePicker');
@ -44,7 +43,6 @@ export class DashboardVisualizationsService extends FtrService {
}) {
this.log.debug(`createSavedSearch(${name})`);
await this.header.clickDiscover(true);
await this.unifiedSearch.closeTourPopoverByLocalStorage();
await this.timePicker.setHistoricalDataRange();
if (query) {

View file

@ -5875,9 +5875,6 @@
"unifiedSearch.noDataPopover.dismissAction": "Ne plus afficher",
"unifiedSearch.noDataPopover.subtitle": "Conseil",
"unifiedSearch.noDataPopover.title": "Ensemble de données vide",
"unifiedSearch.query.dataViewMenu.newMenuTour.description": "Ce menu offre maintenant tous les outils dont vous avez besoin pour créer, rechercher et modifier vos vues de données.",
"unifiedSearch.query.dataViewMenu.newMenuTour.dismissLabel": "Parfait",
"unifiedSearch.query.dataViewMenu.newMenuTour.title": "Un menu de vue de données amélioré",
"unifiedSearch.query.queryBar.clearInputLabel": "Effacer l'entrée",
"unifiedSearch.query.queryBar.comboboxAriaLabel": "Rechercher et filtrer la page {pageType}",
"unifiedSearch.query.queryBar.indexPattern.addFieldButton": "Ajouter un champ à cette vue de données",

View file

@ -5872,9 +5872,6 @@
"unifiedSearch.noDataPopover.dismissAction": "今後表示しない",
"unifiedSearch.noDataPopover.subtitle": "ヒント",
"unifiedSearch.noDataPopover.title": "空のデータセット",
"unifiedSearch.query.dataViewMenu.newMenuTour.description": "このメニューには、データビューの作成、検索、編集で必要なすべてのツールが表示されます。",
"unifiedSearch.query.dataViewMenu.newMenuTour.dismissLabel": "OK",
"unifiedSearch.query.dataViewMenu.newMenuTour.title": "データビューメニューの改善",
"unifiedSearch.query.queryBar.clearInputLabel": "インプットを消去",
"unifiedSearch.query.queryBar.comboboxAriaLabel": "{pageType} ページの検索とフィルタリング",
"unifiedSearch.query.queryBar.indexPattern.addFieldButton": "フィールドをこのデータビューに追加",

View file

@ -5878,9 +5878,6 @@
"unifiedSearch.noDataPopover.dismissAction": "不再显示",
"unifiedSearch.noDataPopover.subtitle": "提示",
"unifiedSearch.noDataPopover.title": "空数据集",
"unifiedSearch.query.dataViewMenu.newMenuTour.description": "现在,此菜单提供了您创建、查找和编辑数据视图所需的所有工具。",
"unifiedSearch.query.dataViewMenu.newMenuTour.dismissLabel": "了解",
"unifiedSearch.query.dataViewMenu.newMenuTour.title": "更强大的数据视图菜单",
"unifiedSearch.query.queryBar.clearInputLabel": "清除输入",
"unifiedSearch.query.queryBar.comboboxAriaLabel": "搜索并筛选 {pageType} 页面",
"unifiedSearch.query.queryBar.indexPattern.addFieldButton": "将字段添加到此数据视图",

View file

@ -10,7 +10,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function canvasLensTest({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const PageObjects = getPageObjects(['canvas', 'common', 'header', 'lens', 'unifiedSearch']);
const PageObjects = getPageObjects(['canvas', 'common', 'header', 'lens']);
const esArchiver = getService('esArchiver');
const dashboardAddPanel = getService('dashboardAddPanel');
const dashboardPanelActions = getService('dashboardPanelActions');
@ -68,7 +68,6 @@ export default function canvasLensTest({ getService, getPageObjects }: FtrProvid
await PageObjects.canvas.deleteSelectedElement();
const originalEmbeddableCount = await PageObjects.canvas.getEmbeddableCount();
await PageObjects.canvas.createNewVis('lens');
await PageObjects.unifiedSearch.closeTourPopoverByLocalStorage();
await PageObjects.lens.goToTimeRange();
await PageObjects.lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',

View file

@ -16,7 +16,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'timePicker',
'lens',
'discover',
'unifiedSearch',
]);
const find = getService('find');
@ -164,7 +163,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.dashboard.clickNewDashboard();
await dashboardAddPanel.clickCreateNewLink();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.unifiedSearch.closeTourPopoverByLocalStorage();
await PageObjects.lens.goToTimeRange();
await PageObjects.lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',

View file

@ -24,7 +24,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'visualize',
'lens',
'timePicker',
'unifiedSearch',
]);
const lensTag = 'extreme-lens-tag';
@ -37,7 +36,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.preserveCrossAppState();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.unifiedSearch.closeTourPopoverByLocalStorage();
});
after(async () => {

View file

@ -99,7 +99,6 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
return retry.try(async () => {
await testSubjects.click(`visListingTitleLink-${title}`);
await this.isLensPageOrFail();
await PageObjects.unifiedSearch.closeTourPopoverByLocalStorage();
});
},
@ -1132,7 +1131,6 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
await PageObjects.dashboard.switchToEditMode();
}
await dashboardAddPanel.clickCreateNewLink();
await PageObjects.unifiedSearch.closeTourPopoverByLocalStorage();
await this.goToTimeRange();
await this.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',

View file

@ -26,7 +26,7 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi
const retry = getService('retry');
const find = getService('find');
const ml = getService('ml');
const PageObjects = getPageObjects(['discover', 'timePicker', 'unifiedSearch']);
const PageObjects = getPageObjects(['discover', 'timePicker']);
return {
async clickNextButton() {
@ -994,7 +994,6 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi
await testSubjects.click('transformWizardCardDiscover');
await PageObjects.discover.isDiscoverAppOnScreen();
});
await PageObjects.unifiedSearch.closeTourPopoverByLocalStorage();
},
async setDiscoverTimeRange(fromTime: string, toTime: string) {