[Time to Visualize] Enable by Default (#88390) (#88626)

* Enable Time to Visualize by Default
This commit is contained in:
Devon Thomson 2021-01-18 16:13:39 -05:00 committed by GitHub
parent d5c4797d0a
commit ccff49ddf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 37 deletions

View file

@ -20,7 +20,7 @@
import { schema, TypeOf } from '@kbn/config-schema';
export const configSchema = schema.object({
allowByValueEmbeddables: schema.boolean({ defaultValue: false }),
allowByValueEmbeddables: schema.boolean({ defaultValue: true }),
});
export type ConfigSchema = TypeOf<typeof configSchema>;

View file

@ -99,11 +99,11 @@ export function SavedObjectSaveModalDashboard(props: DashboardSaveModalProps) {
}
hasChildLabel={false}
>
<EuiPanel color="subdued" hasShadow={false}>
<EuiPanel color="subdued" hasShadow={false} data-test-subj="add-to-dashboard-options">
<div>
<EuiRadio
checked={dashboardOption === 'existing'}
id="existing"
id="existing-dashboard-option"
name="dashboard-option"
label={i18n.translate(
'presentationUtil.saveModalDashboard.existingDashboardOptionLabel',
@ -129,7 +129,7 @@ export function SavedObjectSaveModalDashboard(props: DashboardSaveModalProps) {
<EuiRadio
checked={dashboardOption === 'new'}
id="new"
id="new-dashboard-option"
name="dashboard-option"
label={i18n.translate(
'presentationUtil.saveModalDashboard.newDashboardOptionLabel',
@ -145,7 +145,7 @@ export function SavedObjectSaveModalDashboard(props: DashboardSaveModalProps) {
<EuiRadio
checked={dashboardOption === null}
id="library"
id="add-to-library-option"
name="dashboard-option"
label={i18n.translate('presentationUtil.saveModalDashboard.libraryOptionLabel', {
defaultMessage: 'No dashboard, but add to library',

View file

@ -101,7 +101,8 @@ export const useSavedVisInstance = (
? stateTransferService.getAppNameFromId(originatingApp)
: undefined;
const redirectToOrigin = originatingApp ? () => navigateToApp(originatingApp) : undefined;
const byValueCreateMode = dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables;
const byValueCreateMode =
Boolean(originatingApp) && dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables;
if (savedVis.id) {
chrome.setBreadcrumbs(

View file

@ -20,6 +20,18 @@
import { FtrProviderContext } from '../ftr_provider_context';
import { VisualizeConstants } from '../../../src/plugins/visualize/public/application/visualize_constants';
interface VisualizeSaveModalArgs {
saveAsNew?: boolean;
redirectToOrigin?: boolean;
addToDashboard?: boolean;
dashboardId?: string;
}
type DashboardPickerOption =
| 'add-to-library-option'
| 'existing-dashboard-option'
| 'new-dashboard-option';
export function VisualizePageProvider({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
@ -346,11 +358,27 @@ export function VisualizePageProvider({ getService, getPageObjects }: FtrProvide
}
}
public async saveVisualization(
vizName: string,
{ saveAsNew = false, redirectToOrigin = false } = {}
) {
public async saveVisualization(vizName: string, saveModalArgs: VisualizeSaveModalArgs = {}) {
await this.ensureSavePanelOpen();
await this.setSaveModalValues(vizName, saveModalArgs);
log.debug('Click Save Visualization button');
await testSubjects.click('confirmSaveSavedObjectButton');
// Confirm that the Visualization has actually been saved
await testSubjects.existOrFail('saveVisualizationSuccess');
const message = await common.closeToast();
await header.waitUntilLoadingHasFinished();
await common.waitForSaveModalToClose();
return message;
}
public async setSaveModalValues(
vizName: string,
{ saveAsNew, redirectToOrigin, addToDashboard, dashboardId }: VisualizeSaveModalArgs = {}
) {
await testSubjects.setValue('savedObjectTitle', vizName);
const saveAsNewCheckboxExists = await testSubjects.exists('saveAsNewCheckbox');
@ -366,24 +394,34 @@ export function VisualizePageProvider({ getService, getPageObjects }: FtrProvide
log.debug('redirect to origin checkbox exists. Setting its state to', state);
await testSubjects.setEuiSwitch('returnToOriginModeSwitch', state);
}
log.debug('Click Save Visualization button');
await testSubjects.click('confirmSaveSavedObjectButton');
const dashboardSelectorExists = await testSubjects.exists('add-to-dashboard-options');
if (dashboardSelectorExists) {
let option: DashboardPickerOption = 'add-to-library-option';
if (addToDashboard) {
option = dashboardId ? 'existing-dashboard-option' : 'new-dashboard-option';
}
log.debug('save modal dashboard selector, choosing option:', option);
const dashboardSelector = await testSubjects.find('add-to-dashboard-options');
const label = await dashboardSelector.findByCssSelector(`label[for="${option}"]`);
await label.click();
// Confirm that the Visualization has actually been saved
await testSubjects.existOrFail('saveVisualizationSuccess');
const message = await common.closeToast();
await header.waitUntilLoadingHasFinished();
await common.waitForSaveModalToClose();
return message;
if (dashboardId) {
// TODO - selecting an existing dashboard
}
}
}
public async saveVisualizationExpectSuccess(
vizName: string,
{ saveAsNew = false, redirectToOrigin = false } = {}
{ saveAsNew, redirectToOrigin, addToDashboard, dashboardId }: VisualizeSaveModalArgs = {}
) {
const saveMessage = await this.saveVisualization(vizName, { saveAsNew, redirectToOrigin });
const saveMessage = await this.saveVisualization(vizName, {
saveAsNew,
redirectToOrigin,
addToDashboard,
dashboardId,
});
if (!saveMessage) {
throw new Error(
`Expected saveVisualization to respond with the saveMessage from the toast, got ${saveMessage}`

View file

@ -16,7 +16,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
const find = getService('find');
const comboBox = getService('comboBox');
const browser = getService('browser');
const PageObjects = getPageObjects(['header', 'timePicker', 'common']);
const PageObjects = getPageObjects(['header', 'timePicker', 'common', 'visualize']);
return logWrapper('lensPage', log, {
/**
@ -270,22 +270,22 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
/**
* Save the current Lens visualization.
*/
async save(title: string, saveAsNew?: boolean, redirectToOrigin?: boolean) {
async save(
title: string,
saveAsNew?: boolean,
redirectToOrigin?: boolean,
addToDashboard?: boolean,
dashboardId?: string
) {
await PageObjects.header.waitUntilLoadingHasFinished();
await testSubjects.click('lnsApp_saveButton');
await testSubjects.setValue('savedObjectTitle', title);
const saveAsNewCheckboxExists = await testSubjects.exists('saveAsNewCheckbox');
if (saveAsNewCheckboxExists) {
const state = saveAsNew ? 'check' : 'uncheck';
await testSubjects.setEuiSwitch('saveAsNewCheckbox', state);
}
const redirectToOriginCheckboxExists = await testSubjects.exists('returnToOriginModeSwitch');
if (redirectToOriginCheckboxExists) {
const state = redirectToOrigin ? 'check' : 'uncheck';
await testSubjects.setEuiSwitch('returnToOriginModeSwitch', state);
}
await PageObjects.visualize.setSaveModalValues(title, {
saveAsNew,
redirectToOrigin,
addToDashboard,
dashboardId,
});
await testSubjects.click('confirmSaveSavedObjectButton');
await retry.waitForWithTimeout('Save modal to disappear', 1000, () =>

View file

@ -94,7 +94,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.visEditor.clickGo();
await PageObjects.visualize.ensureSavePanelOpen();
await testSubjects.setValue('savedObjectTitle', 'My new markdown viz');
await PageObjects.visualize.setSaveModalValues('My new markdown viz');
await selectSavedObjectTags('tag-1');
await testSubjects.click('confirmSaveSavedObjectButton');
@ -118,7 +119,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.visEditor.clickGo();
await PageObjects.visualize.ensureSavePanelOpen();
await testSubjects.setValue('savedObjectTitle', 'vis-with-new-tag');
await PageObjects.visualize.setSaveModalValues('vis-with-new-tag');
await testSubjects.click('savedObjectTagSelector');
await testSubjects.click(`tagSelectorOption-action__create`);