mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Lens] Enable report sharing (#153429)
## Summary Fixes #130438 This PR introduces the PNG/PDF reporting feature within Lens editor. **Note** each reporting tasks is generating a shortURL SO in addition of the reporting job SO. There's a reusing mechanism but it applies only to the same config within the same session. * [x] Enable reporting for ~~`lens_visualization` type~~ `lens` type * [x] Introduce disabled state within the reporter logic * [x] Extends the logic to support the custom URL types in Lens * [x] Make reporting list page to support `lens_visualization` object type * migrated `lens_visualization` to `lens` and used the app icon * [x] Extends the custom CSS styling to handle specific Lens editor layout * [x] Introduce logic for `renderComplete` within the Lens editor * [x] Loading logic * [x] Trigger `renderComplete` event for the right node * [x] Add `.hide-for-sharing` class where needed * [x] Add the `.stretch-for-sharing` where needed * Improve layout settings to have a better fit of some charts * Maybe this can be addressed as separate issue? * Check the `renderComplete` for the RegionMap external plugin => separate issue * Write tests * [x] Functional tests Reporting page: <img width="1255" alt="Screenshot 2023-03-24 at 15 25 12" src="https://user-images.githubusercontent.com/924948/227552385-1b52a0ae-8902-4972-acf3-323093a7b840.png"> **Note**: at the moment the reporting name follows the CSV naming convention of `unsaved` for unsaved Lens visualizations. The legacy Agg-based editor uses instead a namming pattern as follow: `Visualization <timestamp>.png`. Final results: | Chart type | PNG result | | ------ | ----- | | Stacked bar chart |  | | Vertical bar chart |  | | Horizontal stacked bar chart |  | | Horizontal bar chart |  | | Datatable |  | | Horizontal gauge |  | | Vertical gauge |  | | Legacy metric |  | | Metric |  | | Metric with breakdown |  | | Area chart |  | | Line chart |  | | Bar chart with annotation + reference lines |  | | Heatmap |  | | Donut chart |  | | Pie chart |  | | Treemap |  | | Mosaic |  | | Waffle |  | | Region Map |  | ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### Risk Matrix Delete this section if it is not applicable to this PR. Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release. When forming the risk matrix, consider some of the following examples and how they may potentially impact the change: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
6365d54d06
commit
41170fe64b
25 changed files with 361 additions and 124 deletions
|
@ -100,7 +100,7 @@ export const downloadCsvShareProvider = ({
|
|||
formatFactoryFn,
|
||||
}: DownloadPanelShareOpts): ShareMenuProvider => {
|
||||
const getShareMenuItems = ({ objectType, sharingData, onClose }: ShareContext) => {
|
||||
if ('lens_visualization' !== objectType) {
|
||||
if ('lens' !== objectType) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ describe('application-level user messages', () => {
|
|||
activeDatasource: {
|
||||
checkIntegrity: jest.fn(() => ['missing_pattern']),
|
||||
} as unknown as Datasource,
|
||||
activeDatasourceState: { state: {} },
|
||||
activeDatasourceState: { isLoading: false, state: {} },
|
||||
core: createCoreStartWithPermissions(),
|
||||
...irrelevantProps,
|
||||
})
|
||||
|
@ -166,7 +166,7 @@ describe('application-level user messages', () => {
|
|||
activeDatasource: {
|
||||
checkIntegrity: jest.fn(() => ['missing_pattern']),
|
||||
} as unknown as Datasource,
|
||||
activeDatasourceState: { state: {} },
|
||||
activeDatasourceState: { isLoading: false, state: {} },
|
||||
// user can go to management, but indexPatterns management is not accessible
|
||||
core: createCoreStartWithPermissions({
|
||||
navLinks: { management: true },
|
||||
|
@ -188,7 +188,7 @@ describe('application-level user messages', () => {
|
|||
activeDatasource: {
|
||||
checkIntegrity: jest.fn(() => ['missing_pattern']),
|
||||
} as unknown as Datasource,
|
||||
activeDatasourceState: { state: {} },
|
||||
activeDatasourceState: { isLoading: false, state: {} },
|
||||
// user can't go to management at all
|
||||
core: createCoreStartWithPermissions({
|
||||
navLinks: { management: false },
|
||||
|
|
|
@ -36,7 +36,7 @@ export const getApplicationUserMessages = ({
|
|||
visualization: VisualizationState | undefined;
|
||||
visualizationMap: VisualizationMap;
|
||||
activeDatasource: Datasource | null | undefined;
|
||||
activeDatasourceState: { state: unknown } | null;
|
||||
activeDatasourceState: { isLoading: boolean; state: unknown } | null;
|
||||
dataViews: DataViewsState;
|
||||
core: CoreStart;
|
||||
}): UserMessage[] => {
|
||||
|
|
|
@ -15,6 +15,8 @@ import { getEsQueryConfig } from '@kbn/data-plugin/public';
|
|||
import type { DataView } from '@kbn/data-views-plugin/public';
|
||||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
import { DataViewPickerProps } from '@kbn/unified-search-plugin/public';
|
||||
import moment from 'moment';
|
||||
import { LENS_APP_LOCATOR } from '../../common/locator/locator';
|
||||
import { ENABLE_SQL } from '../../common/constants';
|
||||
import { LensAppServices, LensTopNavActions, LensTopNavMenuProps } from './types';
|
||||
import { toggleSettingsMenuOpen } from './settings_menu';
|
||||
|
@ -457,8 +459,9 @@ export const LensTopNavMenu = ({
|
|||
isSaveable && application.capabilities.dashboard?.showWriteControls
|
||||
);
|
||||
|
||||
const unsavedTitle = i18n.translate('xpack.lens.app.unsavedFilename', {
|
||||
defaultMessage: 'unsaved',
|
||||
const defaultLensTitle = i18n.translate('xpack.lens.app.share.defaultDashboardTitle', {
|
||||
defaultMessage: 'Lens Visualization [{date}]',
|
||||
values: { date: moment().toISOString(true) },
|
||||
});
|
||||
const additionalMenuEntries = useMemo(() => {
|
||||
if (!visualization.activeId) return undefined;
|
||||
|
@ -574,13 +577,12 @@ export const LensTopNavMenu = ({
|
|||
if (!share) {
|
||||
return;
|
||||
}
|
||||
const sharingData = {
|
||||
activeData,
|
||||
csvEnabled,
|
||||
title: title || unsavedTitle,
|
||||
};
|
||||
|
||||
const { shareableUrl, savedObjectURL } = await getShareURL(
|
||||
const {
|
||||
shareableUrl,
|
||||
savedObjectURL,
|
||||
reportingLocatorParams: locatorParams,
|
||||
} = await getShareURL(
|
||||
shortUrlService,
|
||||
{ application, data },
|
||||
{
|
||||
|
@ -593,8 +595,20 @@ export const LensTopNavMenu = ({
|
|||
visualization,
|
||||
currentDoc,
|
||||
adHocDataViews: adHocDataViews.map((dataView) => dataView.toSpec()),
|
||||
}
|
||||
},
|
||||
shareUrlEnabled,
|
||||
isCurrentStateDirty
|
||||
);
|
||||
const sharingData = {
|
||||
activeData,
|
||||
csvEnabled,
|
||||
reportingDisabled: !csvEnabled,
|
||||
title: title || defaultLensTitle,
|
||||
locatorParams: {
|
||||
id: LENS_APP_LOCATOR,
|
||||
params: locatorParams,
|
||||
},
|
||||
};
|
||||
|
||||
share.toggleShareContextMenu({
|
||||
anchorElement,
|
||||
|
@ -603,7 +617,7 @@ export const LensTopNavMenu = ({
|
|||
shareableUrl: shareableUrl || '',
|
||||
shareableUrlForSavedObject: savedObjectURL.href,
|
||||
objectId: currentDoc?.savedObjectId,
|
||||
objectType: 'lens_visualization',
|
||||
objectType: 'lens',
|
||||
objectTypeTitle: i18n.translate('xpack.lens.app.share.panelTitle', {
|
||||
defaultMessage: 'visualization',
|
||||
}),
|
||||
|
@ -735,7 +749,6 @@ export const LensTopNavMenu = ({
|
|||
initialContextIsEmbedded,
|
||||
activeData,
|
||||
isSaveable,
|
||||
shortUrlService,
|
||||
application,
|
||||
getIsByValueMode,
|
||||
savingToLibraryPermitted,
|
||||
|
@ -746,7 +759,7 @@ export const LensTopNavMenu = ({
|
|||
lensInspector,
|
||||
title,
|
||||
share,
|
||||
unsavedTitle,
|
||||
shortUrlService,
|
||||
data,
|
||||
filters,
|
||||
query,
|
||||
|
@ -756,6 +769,8 @@ export const LensTopNavMenu = ({
|
|||
visualizationMap,
|
||||
visualization,
|
||||
currentDoc,
|
||||
adHocDataViews,
|
||||
defaultLensTitle,
|
||||
isCurrentStateDirty,
|
||||
onAppLeave,
|
||||
runSave,
|
||||
|
@ -770,7 +785,6 @@ export const LensTopNavMenu = ({
|
|||
isOnTextBasedMode,
|
||||
lensStore,
|
||||
theme$,
|
||||
adHocDataViews,
|
||||
]);
|
||||
|
||||
const onQuerySubmitWrapped = useCallback(
|
||||
|
@ -1072,6 +1086,7 @@ export const LensTopNavMenu = ({
|
|||
screenTitle={'lens'}
|
||||
appName={'lens'}
|
||||
displayStyle="detached"
|
||||
className="hide-for-sharing"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -45,8 +45,7 @@ function getShareURLForSavedObject(
|
|||
);
|
||||
}
|
||||
|
||||
function getShortShareableURL(
|
||||
shortUrlService: (params: LensAppLocatorParams) => Promise<string>,
|
||||
export function getLocatorParams(
|
||||
data: LensAppServices['data'],
|
||||
{
|
||||
filters,
|
||||
|
@ -57,7 +56,9 @@ function getShortShareableURL(
|
|||
visualizationMap,
|
||||
visualization,
|
||||
adHocDataViews,
|
||||
}: ShareableConfiguration
|
||||
currentDoc,
|
||||
}: ShareableConfiguration,
|
||||
isDirty: boolean
|
||||
) {
|
||||
const references = extractReferencesFromState({
|
||||
activeDatasources: Object.keys(datasourceStates).reduce(
|
||||
|
@ -80,7 +81,7 @@ function getShortShareableURL(
|
|||
const serializableDatasourceStates = datasourceStates as LensAppState['datasourceStates'] &
|
||||
SerializableRecord;
|
||||
|
||||
return shortUrlService({
|
||||
const snapshotParams = {
|
||||
filters,
|
||||
query,
|
||||
resolvedDateRange: getResolvedDateRange(data.query.timefilter.timefilter),
|
||||
|
@ -90,16 +91,38 @@ function getShortShareableURL(
|
|||
searchSessionId: data.search.session.getSessionId(),
|
||||
references,
|
||||
dataViewSpecs: adHocDataViews,
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
shareURL: snapshotParams,
|
||||
// for reporting use the shorten version when available
|
||||
reporting:
|
||||
currentDoc?.savedObjectId && !isDirty
|
||||
? {
|
||||
filters,
|
||||
query,
|
||||
resolvedDateRange: getResolvedDateRange(data.query.timefilter.timefilter),
|
||||
savedObjectId: currentDoc?.savedObjectId,
|
||||
}
|
||||
: snapshotParams,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getShareURL(
|
||||
shortUrlService: (params: LensAppLocatorParams) => Promise<string>,
|
||||
services: Pick<LensAppServices, 'application' | 'data'>,
|
||||
configuration: ShareableConfiguration
|
||||
configuration: ShareableConfiguration,
|
||||
shareUrlEnabled: boolean,
|
||||
isDirty: boolean
|
||||
) {
|
||||
const { shareURL: locatorParams, reporting: reportingLocatorParams } = getLocatorParams(
|
||||
services.data,
|
||||
configuration,
|
||||
isDirty
|
||||
);
|
||||
return {
|
||||
shareableUrl: await getShortShareableURL(shortUrlService, services.data, configuration),
|
||||
shareableUrl: await (shareUrlEnabled ? shortUrlService(locatorParams) : undefined),
|
||||
savedObjectURL: getShareURLForSavedObject(services, configuration.currentDoc),
|
||||
reportingLocatorParams,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ export function FrameLayout(props: FrameLayoutProps) {
|
|||
aria-labelledby="lns_ChartTitle"
|
||||
>
|
||||
<section
|
||||
className={classNames('lnsFrameLayout__sidebar lnsFrameLayout__sidebar--left', {})}
|
||||
className={'lnsFrameLayout__sidebar lnsFrameLayout__sidebar--left hide-for-sharing'}
|
||||
aria-labelledby="dataPanelId"
|
||||
>
|
||||
<EuiScreenReaderOnly>
|
||||
|
@ -79,12 +79,18 @@ export function FrameLayout(props: FrameLayoutProps) {
|
|||
</h2>
|
||||
</EuiScreenReaderOnly>
|
||||
{props.workspacePanel}
|
||||
<div className="lnsFrameLayout__suggestionPanel">{props.suggestionsPanel}</div>
|
||||
<div className="lnsFrameLayout__suggestionPanel hide-for-sharing">
|
||||
{props.suggestionsPanel}
|
||||
</div>
|
||||
</section>
|
||||
<section
|
||||
className={classNames('lnsFrameLayout__sidebar lnsFrameLayout__sidebar--right', {
|
||||
'lnsFrameLayout__sidebar-isFullscreen': isFullscreen,
|
||||
})}
|
||||
className={classNames(
|
||||
'lnsFrameLayout__sidebar lnsFrameLayout__sidebar--right',
|
||||
'hide-for-sharing',
|
||||
{
|
||||
'lnsFrameLayout__sidebar-isFullscreen': isFullscreen,
|
||||
}
|
||||
)}
|
||||
aria-labelledby="configPanel"
|
||||
>
|
||||
<EuiScreenReaderOnly>
|
||||
|
|
|
@ -404,10 +404,14 @@ export async function persistedStateToExpression(
|
|||
|
||||
export function getMissingIndexPattern(
|
||||
currentDatasource: Datasource | null | undefined,
|
||||
currentDatasourceState: { state: unknown } | null,
|
||||
currentDatasourceState: { isLoading: boolean; state: unknown } | null,
|
||||
indexPatterns: IndexPatternMap
|
||||
) {
|
||||
if (currentDatasourceState?.state == null || currentDatasource == null) {
|
||||
if (
|
||||
currentDatasourceState?.isLoading ||
|
||||
currentDatasourceState?.state == null ||
|
||||
currentDatasource == null
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
const missingIds = currentDatasource.checkIntegrity(currentDatasourceState.state, indexPatterns);
|
||||
|
|
|
@ -72,8 +72,8 @@ const defaultProps = {
|
|||
getSuggestionForField: () => undefined,
|
||||
lensInspector: getLensInspectorService(inspectorPluginMock.createStartContract()),
|
||||
toggleFullscreen: jest.fn(),
|
||||
getUserMessages: () => [],
|
||||
addUserMessages: () => () => {},
|
||||
getUserMessages: jest.fn(() => []),
|
||||
addUserMessages: jest.fn(() => () => {}),
|
||||
};
|
||||
|
||||
const toExpr = (
|
||||
|
@ -728,10 +728,10 @@ describe('workspace_panel', () => {
|
|||
const mounted = await mountWithProvider(
|
||||
<WorkspacePanel
|
||||
{...defaultProps}
|
||||
getUserMessages={getUserMessages}
|
||||
datasourceMap={{
|
||||
testDatasource: mockDatasource,
|
||||
}}
|
||||
getUserMessages={getUserMessages}
|
||||
/>
|
||||
);
|
||||
instance = mounted.instance;
|
||||
|
@ -752,11 +752,12 @@ describe('workspace_panel', () => {
|
|||
// but not yet applied their changes
|
||||
|
||||
let userMessages = [] as UserMessage[];
|
||||
const getUserMessageFn = jest.fn(() => userMessages);
|
||||
|
||||
const mounted = await mountWithProvider(
|
||||
<WorkspacePanel
|
||||
{...defaultProps}
|
||||
getUserMessages={() => userMessages}
|
||||
getUserMessages={getUserMessageFn}
|
||||
datasourceMap={{
|
||||
testDatasource: mockDatasource,
|
||||
}}
|
||||
|
|
|
@ -624,6 +624,26 @@ export const InnerWorkspacePanel = React.memo(function InnerWorkspacePanel({
|
|||
);
|
||||
});
|
||||
|
||||
function useReportingState(errors: UserMessage[]): {
|
||||
isRenderComplete: boolean;
|
||||
hasDynamicError: boolean;
|
||||
setIsRenderComplete: (state: boolean) => void;
|
||||
setDynamicError: (state: boolean) => void;
|
||||
nodeRef: React.RefObject<HTMLDivElement>;
|
||||
} {
|
||||
const [isRenderComplete, setIsRenderComplete] = useState(Boolean(errors?.length));
|
||||
const [hasDynamicError, setDynamicError] = useState(false);
|
||||
const nodeRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (isRenderComplete && nodeRef.current) {
|
||||
nodeRef.current.dispatchEvent(new CustomEvent('renderComplete', { bubbles: true }));
|
||||
}
|
||||
}, [isRenderComplete, errors]);
|
||||
|
||||
return { isRenderComplete, setIsRenderComplete, hasDynamicError, setDynamicError, nodeRef };
|
||||
}
|
||||
|
||||
export const VisualizationWrapper = ({
|
||||
expression,
|
||||
framePublicAPI,
|
||||
|
@ -654,6 +674,9 @@ export const VisualizationWrapper = ({
|
|||
onData$: (data: unknown, adapters?: Partial<DefaultInspectorAdapters>) => void;
|
||||
}) => {
|
||||
const context = useLensSelector(selectExecutionContext);
|
||||
// Used for reporting
|
||||
const { isRenderComplete, hasDynamicError, setIsRenderComplete, setDynamicError, nodeRef } =
|
||||
useReportingState(errors);
|
||||
const searchContext: ExecutionContextSearch = useMemo(
|
||||
() => ({
|
||||
query: context.query,
|
||||
|
@ -668,7 +691,7 @@ export const VisualizationWrapper = ({
|
|||
);
|
||||
const searchSessionId = useLensSelector(selectSearchSessionId);
|
||||
|
||||
if (errors?.length) {
|
||||
if (errors.length) {
|
||||
const showExtraErrorsAction =
|
||||
!localState.expandError && errors.length > 1 ? (
|
||||
<EuiButtonEmpty
|
||||
|
@ -690,7 +713,14 @@ export const VisualizationWrapper = ({
|
|||
const [firstMessage, ...rest] = errors;
|
||||
|
||||
return (
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexGroup
|
||||
data-shared-items-container
|
||||
data-render-complete={true}
|
||||
data-shared-item=""
|
||||
data-render-error={i18n.translate('xpack.lens.editorFrame.configurationFailureErrors', {
|
||||
defaultMessage: `A configuration error occurred`,
|
||||
})}
|
||||
>
|
||||
<EuiFlexItem>
|
||||
<EuiEmptyPrompt
|
||||
actions={showExtraErrorsAction}
|
||||
|
@ -719,7 +749,20 @@ export const VisualizationWrapper = ({
|
|||
}
|
||||
|
||||
return (
|
||||
<div className="lnsExpressionRenderer">
|
||||
<div
|
||||
className="lnsExpressionRenderer"
|
||||
data-shared-items-container
|
||||
data-render-complete={isRenderComplete}
|
||||
data-shared-item=""
|
||||
data-render-error={
|
||||
hasDynamicError
|
||||
? i18n.translate('xpack.lens.editorFrame.dataFailure', {
|
||||
defaultMessage: `An error occurred when loading data.`,
|
||||
})
|
||||
: undefined
|
||||
}
|
||||
ref={nodeRef}
|
||||
>
|
||||
<ExpressionRendererComponent
|
||||
className="lnsExpressionRenderer__component"
|
||||
padding="m"
|
||||
|
@ -729,7 +772,10 @@ export const VisualizationWrapper = ({
|
|||
onEvent={onEvent}
|
||||
hasCompatibleActions={hasCompatibleActions}
|
||||
onData$={onData$}
|
||||
onRender$={onRender$}
|
||||
onRender$={() => {
|
||||
setIsRenderComplete(true);
|
||||
onRender$();
|
||||
}}
|
||||
inspectorAdapters={lensInspector.adapters}
|
||||
executionContext={executionContext}
|
||||
renderMode="edit"
|
||||
|
@ -741,6 +787,10 @@ export const VisualizationWrapper = ({
|
|||
? [errorMessage]
|
||||
: [];
|
||||
|
||||
if (!hasDynamicError) {
|
||||
setDynamicError(true);
|
||||
}
|
||||
|
||||
return (
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexItem>
|
||||
|
|
|
@ -91,7 +91,11 @@ export function WorkspacePanelWrapper({
|
|||
mainProps={{ component: 'div' } as unknown as {}}
|
||||
>
|
||||
{!(isFullscreen && (autoApplyEnabled || userMessages?.length)) && (
|
||||
<EuiPageTemplate.Section paddingSize="none" color="transparent">
|
||||
<EuiPageTemplate.Section
|
||||
paddingSize="none"
|
||||
color="transparent"
|
||||
className="hide-for-sharing"
|
||||
>
|
||||
<EuiFlexGroup
|
||||
alignItems="flexEnd"
|
||||
gutterSize="s"
|
||||
|
@ -170,7 +174,7 @@ export function WorkspacePanelWrapper({
|
|||
contentProps={{
|
||||
className: 'lnsWorkspacePanelWrapper__content',
|
||||
}}
|
||||
className={classNames('lnsWorkspacePanelWrapper', {
|
||||
className={classNames('lnsWorkspacePanelWrapper stretch-for-sharing', {
|
||||
'lnsWorkspacePanelWrapper--fullscreen': isFullscreen,
|
||||
})}
|
||||
color="transparent"
|
||||
|
|
|
@ -609,7 +609,10 @@ export class Embeddable
|
|||
},
|
||||
visualizationMap: this.deps.visualizationMap,
|
||||
activeDatasource: this.activeDatasource,
|
||||
activeDatasourceState: { state: this.activeDatasourceState },
|
||||
activeDatasourceState: {
|
||||
isLoading: Boolean(this.activeDatasourceState),
|
||||
state: this.activeDatasourceState,
|
||||
},
|
||||
dataViews: {
|
||||
indexPatterns: this.indexPatterns,
|
||||
indexPatternRefs: this.indexPatternRefs, // TODO - are these actually used?
|
||||
|
|
|
@ -121,11 +121,7 @@ export function loadInitial(
|
|||
if (initialContext && 'query' in initialContext) {
|
||||
activeDatasourceId = 'textBased';
|
||||
}
|
||||
|
||||
if (initialStateFromLocator) {
|
||||
const locatorReferences =
|
||||
'references' in initialStateFromLocator ? initialStateFromLocator.references : undefined;
|
||||
|
||||
const newFilters = initialStateFromLocator.filters
|
||||
? cloneDeep(initialStateFromLocator.filters)
|
||||
: undefined;
|
||||
|
@ -141,61 +137,67 @@ export function loadInitial(
|
|||
};
|
||||
data.query.timefilter.timefilter.setTime(newTimeRange);
|
||||
}
|
||||
// URL Reporting is using the locator params but also passing the savedObjectId
|
||||
// so be sure to not go here as there's no full snapshot URL
|
||||
if (!initialInput) {
|
||||
const locatorReferences =
|
||||
'references' in initialStateFromLocator ? initialStateFromLocator.references : undefined;
|
||||
|
||||
return initializeSources(
|
||||
{
|
||||
datasourceMap,
|
||||
visualizationMap,
|
||||
visualizationState: emptyState.visualization,
|
||||
datasourceStates: emptyState.datasourceStates,
|
||||
initialContext,
|
||||
adHocDataViews:
|
||||
lens.persistedDoc?.state.adHocDataViews || initialStateFromLocator.dataViewSpecs,
|
||||
references: locatorReferences,
|
||||
...loaderSharedArgs,
|
||||
},
|
||||
{
|
||||
isFullEditor: true,
|
||||
}
|
||||
)
|
||||
.then(({ datasourceStates, visualizationState, indexPatterns, indexPatternRefs }) => {
|
||||
const currentSessionId =
|
||||
initialStateFromLocator?.searchSessionId || data.search.session.getSessionId();
|
||||
store.dispatch(
|
||||
setState({
|
||||
isSaveable: true,
|
||||
filters: initialStateFromLocator.filters || data.query.filterManager.getFilters(),
|
||||
query: initialStateFromLocator.query || emptyState.query,
|
||||
searchSessionId: currentSessionId,
|
||||
activeDatasourceId: emptyState.activeDatasourceId,
|
||||
visualization: {
|
||||
activeId: emptyState.visualization.activeId,
|
||||
state: visualizationState,
|
||||
},
|
||||
dataViews: getInitialDataViewsObject(indexPatterns, indexPatternRefs),
|
||||
datasourceStates: Object.entries(datasourceStates).reduce(
|
||||
(state, [datasourceId, datasourceState]) => ({
|
||||
...state,
|
||||
[datasourceId]: {
|
||||
...datasourceState,
|
||||
isLoading: false,
|
||||
},
|
||||
}),
|
||||
{}
|
||||
),
|
||||
isLoading: false,
|
||||
})
|
||||
);
|
||||
|
||||
if (autoApplyDisabled) {
|
||||
store.dispatch(disableAutoApply());
|
||||
return initializeSources(
|
||||
{
|
||||
datasourceMap,
|
||||
visualizationMap,
|
||||
visualizationState: emptyState.visualization,
|
||||
datasourceStates: emptyState.datasourceStates,
|
||||
initialContext,
|
||||
adHocDataViews:
|
||||
lens.persistedDoc?.state.adHocDataViews || initialStateFromLocator.dataViewSpecs,
|
||||
references: locatorReferences,
|
||||
...loaderSharedArgs,
|
||||
},
|
||||
{
|
||||
isFullEditor: true,
|
||||
}
|
||||
})
|
||||
.catch((e: { message: string }) => {
|
||||
notifications.toasts.addDanger({
|
||||
title: e.message,
|
||||
)
|
||||
.then(({ datasourceStates, visualizationState, indexPatterns, indexPatternRefs }) => {
|
||||
const currentSessionId =
|
||||
initialStateFromLocator?.searchSessionId || data.search.session.getSessionId();
|
||||
store.dispatch(
|
||||
setState({
|
||||
isSaveable: true,
|
||||
filters: initialStateFromLocator.filters || data.query.filterManager.getFilters(),
|
||||
query: initialStateFromLocator.query || emptyState.query,
|
||||
searchSessionId: currentSessionId,
|
||||
activeDatasourceId: emptyState.activeDatasourceId,
|
||||
visualization: {
|
||||
activeId: emptyState.visualization.activeId,
|
||||
state: visualizationState,
|
||||
},
|
||||
dataViews: getInitialDataViewsObject(indexPatterns, indexPatternRefs),
|
||||
datasourceStates: Object.entries(datasourceStates).reduce(
|
||||
(state, [datasourceId, datasourceState]) => ({
|
||||
...state,
|
||||
[datasourceId]: {
|
||||
...datasourceState,
|
||||
isLoading: false,
|
||||
},
|
||||
}),
|
||||
{}
|
||||
),
|
||||
isLoading: false,
|
||||
})
|
||||
);
|
||||
|
||||
if (autoApplyDisabled) {
|
||||
store.dispatch(disableAutoApply());
|
||||
}
|
||||
})
|
||||
.catch((e: { message: string }) => {
|
||||
notifications.toasts.addDanger({
|
||||
title: e.message,
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
|
@ -62,13 +62,21 @@ export const getPreloadedState = ({
|
|||
}: LensStoreDeps) => {
|
||||
const initialDatasourceId = getInitialDatasourceId(datasourceMap);
|
||||
const datasourceStates: LensAppState['datasourceStates'] = {};
|
||||
// Initialize an empty datasourceStates for each datasource
|
||||
if (initialDatasourceId) {
|
||||
Object.keys(datasourceMap).forEach((datasourceId) => {
|
||||
datasourceStates[datasourceId] = {
|
||||
state: null,
|
||||
isLoading: true,
|
||||
};
|
||||
});
|
||||
}
|
||||
if (initialStateFromLocator) {
|
||||
// if anything is passed via locator then populate the empty state
|
||||
if ('datasourceStates' in initialStateFromLocator) {
|
||||
Object.keys(datasourceMap).forEach((datasourceId) => {
|
||||
datasourceStates[datasourceId] = {
|
||||
state: initialStateFromLocator.datasourceStates[datasourceId],
|
||||
isLoading: true,
|
||||
};
|
||||
datasourceStates[datasourceId].state =
|
||||
initialStateFromLocator.datasourceStates[datasourceId];
|
||||
});
|
||||
}
|
||||
return {
|
||||
|
@ -82,14 +90,6 @@ export const getPreloadedState = ({
|
|||
datasourceStates,
|
||||
};
|
||||
}
|
||||
if (initialDatasourceId) {
|
||||
Object.keys(datasourceMap).forEach((datasourceId) => {
|
||||
datasourceStates[datasourceId] = {
|
||||
state: null,
|
||||
isLoading: true,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const state = {
|
||||
...initialState,
|
||||
|
|
|
@ -25,6 +25,8 @@ export const guessAppIconTypeFromObjectType = (type: string): IconType => {
|
|||
return 'visualizeApp';
|
||||
case 'canvas workpad':
|
||||
return 'canvasApp';
|
||||
case 'lens':
|
||||
return 'lensApp';
|
||||
default:
|
||||
return 'apps';
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ exports[`ScreenCapturePanelContent properly renders a view with "canvas" layout
|
|||
/>
|
||||
<div
|
||||
class="euiAccordion"
|
||||
data-test-subj="shareReportingAdvancedOptionsButton"
|
||||
>
|
||||
<div
|
||||
class="euiAccordion__triggerWrapper emotion-euiAccordion__triggerWrapper"
|
||||
|
@ -156,6 +157,7 @@ exports[`ScreenCapturePanelContent properly renders a view with "canvas" layout
|
|||
/>
|
||||
<div
|
||||
class="euiPanel euiPanel--danger euiPanel--paddingSmall euiCallOut euiCallOut--danger emotion-euiPanel-none-s-danger-euiCallOut"
|
||||
data-test-subj="shareReportingUnsavedState"
|
||||
>
|
||||
<p
|
||||
class="euiTitle euiCallOutHeader__title emotion-euiTitle-xxs-euiCallOutHeader-danger"
|
||||
|
@ -287,6 +289,7 @@ exports[`ScreenCapturePanelContent properly renders a view with "print" layout o
|
|||
/>
|
||||
<div
|
||||
class="euiAccordion"
|
||||
data-test-subj="shareReportingAdvancedOptionsButton"
|
||||
>
|
||||
<div
|
||||
class="euiAccordion__triggerWrapper emotion-euiAccordion__triggerWrapper"
|
||||
|
@ -348,6 +351,7 @@ exports[`ScreenCapturePanelContent properly renders a view with "print" layout o
|
|||
/>
|
||||
<div
|
||||
class="euiPanel euiPanel--danger euiPanel--paddingSmall euiCallOut euiCallOut--danger emotion-euiPanel-none-s-danger-euiCallOut"
|
||||
data-test-subj="shareReportingUnsavedState"
|
||||
>
|
||||
<p
|
||||
class="euiTitle euiCallOutHeader__title emotion-euiTitle-xxs-euiCallOutHeader-danger"
|
||||
|
@ -420,6 +424,7 @@ exports[`ScreenCapturePanelContent renders the default view properly 1`] = `
|
|||
/>
|
||||
<div
|
||||
class="euiAccordion"
|
||||
data-test-subj="shareReportingAdvancedOptionsButton"
|
||||
>
|
||||
<div
|
||||
class="euiAccordion__triggerWrapper emotion-euiAccordion__triggerWrapper"
|
||||
|
@ -481,6 +486,7 @@ exports[`ScreenCapturePanelContent renders the default view properly 1`] = `
|
|||
/>
|
||||
<div
|
||||
class="euiPanel euiPanel--danger euiPanel--paddingSmall euiCallOut euiCallOut--danger emotion-euiPanel-none-s-danger-euiCallOut"
|
||||
data-test-subj="shareReportingUnsavedState"
|
||||
>
|
||||
<p
|
||||
class="euiTitle euiCallOutHeader__title emotion-euiTitle-xxs-euiCallOutHeader-danger"
|
||||
|
|
|
@ -28,6 +28,7 @@ export interface ExportPanelShareOpts {
|
|||
export interface ReportingSharingData {
|
||||
title: string;
|
||||
layout: LayoutParams;
|
||||
reportingDisabled?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ export const reportingScreenshotShareProvider = ({
|
|||
isDirty,
|
||||
onClose,
|
||||
shareableUrl,
|
||||
shareableUrlForSavedObject,
|
||||
...shareOpts
|
||||
}: ShareContext) => {
|
||||
const { enableLinks, showLinks, message } = checkLicense(license.check('reporting', 'gold'));
|
||||
|
@ -95,8 +96,9 @@ export const reportingScreenshotShareProvider = ({
|
|||
if (!licenseHasScreenshotReporting) {
|
||||
return [];
|
||||
}
|
||||
const isSupportedType = ['dashboard', 'visualization', 'lens'].includes(objectType);
|
||||
|
||||
if (!['dashboard', 'visualization'].includes(objectType)) {
|
||||
if (!isSupportedType) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -104,7 +106,7 @@ export const reportingScreenshotShareProvider = ({
|
|||
return [];
|
||||
}
|
||||
|
||||
if (objectType === 'visualize' && !capabilityHasVisualizeScreenshotReporting) {
|
||||
if (isSupportedType && !capabilityHasVisualizeScreenshotReporting) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -116,7 +118,7 @@ export const reportingScreenshotShareProvider = ({
|
|||
});
|
||||
|
||||
const jobProviderOptions: JobParamsProviderOptions = {
|
||||
shareableUrl,
|
||||
shareableUrl: isDirty ? shareableUrl : shareableUrlForSavedObject ?? shareableUrl,
|
||||
objectType,
|
||||
sharingData,
|
||||
};
|
||||
|
@ -131,7 +133,7 @@ export const reportingScreenshotShareProvider = ({
|
|||
name: pngPanelTitle,
|
||||
icon: 'document',
|
||||
toolTipContent: licenseToolTipContent,
|
||||
disabled: licenseDisabled,
|
||||
disabled: licenseDisabled || sharingData.reportingDisabled,
|
||||
['data-test-subj']: 'PNGReports',
|
||||
sortOrder: 10,
|
||||
},
|
||||
|
@ -166,7 +168,7 @@ export const reportingScreenshotShareProvider = ({
|
|||
name: pdfPanelTitle,
|
||||
icon: 'document',
|
||||
toolTipContent: licenseToolTipContent,
|
||||
disabled: licenseDisabled,
|
||||
disabled: licenseDisabled || sharingData.reportingDisabled,
|
||||
['data-test-subj']: 'PDFReports',
|
||||
sortOrder: 10,
|
||||
},
|
||||
|
|
|
@ -18,7 +18,13 @@ const i18nTexts = {
|
|||
|
||||
export const ErrorUnsavedWorkPanel: FunctionComponent = () => {
|
||||
return (
|
||||
<EuiCallOut size="s" title={i18nTexts.title} iconType="warning" color="danger">
|
||||
<EuiCallOut
|
||||
size="s"
|
||||
title={i18nTexts.title}
|
||||
iconType="warning"
|
||||
color="danger"
|
||||
data-test-subj="shareReportingUnsavedState"
|
||||
>
|
||||
<EuiText size="s">
|
||||
<p>
|
||||
<FormattedMessage
|
||||
|
|
|
@ -135,7 +135,13 @@ class ReportingPanelContentUi extends Component<Props, State> {
|
|||
return (
|
||||
<EuiCopy textToCopy={this.state.absoluteUrl} anchorClassName="eui-displayBlock">
|
||||
{(copy) => (
|
||||
<EuiButton color={isUnsaved ? 'warning' : 'primary'} fullWidth onClick={copy} size="s">
|
||||
<EuiButton
|
||||
color={isUnsaved ? 'warning' : 'primary'}
|
||||
fullWidth
|
||||
onClick={copy}
|
||||
size="s"
|
||||
data-test-subj="shareReportingCopyURL"
|
||||
>
|
||||
<FormattedMessage
|
||||
id="xpack.reporting.panelContent.copyUrlButtonLabel"
|
||||
defaultMessage="Copy POST URL"
|
||||
|
@ -200,6 +206,7 @@ class ReportingPanelContentUi extends Component<Props, State> {
|
|||
defaultMessage: 'Advanced options',
|
||||
})}
|
||||
paddingSize="none"
|
||||
data-test-subj="shareReportingAdvancedOptionsButton"
|
||||
>
|
||||
<EuiSpacer size="s" />
|
||||
<EuiText size="s">
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
display: none !important;
|
||||
}
|
||||
|
||||
/* some elements needs to be stretched to be shared */
|
||||
.stretch-for-sharing {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Global overrides
|
||||
*/
|
||||
|
|
|
@ -19254,7 +19254,6 @@
|
|||
"xpack.lens.app.showUnderlyingDataMultipleLayers": "Impossible d’afficher les données sous-jacentes pour les visualisations avec plusieurs calques.",
|
||||
"xpack.lens.app.showUnderlyingDataNoData": "La visualisation ne comprend aucune donnée disponible à afficher.",
|
||||
"xpack.lens.app.showUnderlyingDataTimeShifts": "Impossible d’afficher les données sous-jacentes lorsqu’un décalage temporel est configuré.",
|
||||
"xpack.lens.app.unsavedFilename": "non enregistré",
|
||||
"xpack.lens.app.unsavedWorkConfirmBtn": "Abandonner les modifications",
|
||||
"xpack.lens.app.unsavedWorkMessage": "Quitter Lens avec un travail non enregistré ?",
|
||||
"xpack.lens.app.unsavedWorkTitle": "Modifications non enregistrées",
|
||||
|
|
|
@ -19254,7 +19254,6 @@
|
|||
"xpack.lens.app.showUnderlyingDataMultipleLayers": "複数レイヤーのビジュアライゼーションでは、基本データを表示できません",
|
||||
"xpack.lens.app.showUnderlyingDataNoData": "ビジュアライゼーションには表示するデータがありません",
|
||||
"xpack.lens.app.showUnderlyingDataTimeShifts": "時間シフトが構成されているときには基本データを表示できません",
|
||||
"xpack.lens.app.unsavedFilename": "未保存",
|
||||
"xpack.lens.app.unsavedWorkConfirmBtn": "変更を破棄",
|
||||
"xpack.lens.app.unsavedWorkMessage": "作業内容を保存せずに、Lens から移動しますか?",
|
||||
"xpack.lens.app.unsavedWorkTitle": "保存されていない変更",
|
||||
|
|
|
@ -19255,7 +19255,6 @@
|
|||
"xpack.lens.app.showUnderlyingDataMultipleLayers": "无法显示具有多个图层的可视化的底层数据",
|
||||
"xpack.lens.app.showUnderlyingDataNoData": "可视化没有可显示的可用数据",
|
||||
"xpack.lens.app.showUnderlyingDataTimeShifts": "配置了时间偏移时无法显示底层数据",
|
||||
"xpack.lens.app.unsavedFilename": "未保存",
|
||||
"xpack.lens.app.unsavedWorkConfirmBtn": "放弃更改",
|
||||
"xpack.lens.app.unsavedWorkMessage": "离开有未保存工作的 Lens?",
|
||||
"xpack.lens.app.unsavedWorkTitle": "未保存的更改",
|
||||
|
|
|
@ -9,11 +9,20 @@ import expect from '@kbn/expect';
|
|||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const PageObjects = getPageObjects(['common', 'dashboard', 'reporting', 'timePicker']);
|
||||
const PageObjects = getPageObjects([
|
||||
'common',
|
||||
'dashboard',
|
||||
'lens',
|
||||
'reporting',
|
||||
'timePicker',
|
||||
'visualize',
|
||||
]);
|
||||
const es = getService('es');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const listingTable = getService('listingTable');
|
||||
const security = getService('security');
|
||||
const browser = getService('browser');
|
||||
|
||||
describe('lens reporting', () => {
|
||||
before(async () => {
|
||||
|
@ -25,6 +34,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
[
|
||||
'test_logstash_reader',
|
||||
'global_dashboard_read',
|
||||
'global_visualize_all',
|
||||
'reporting_user', // NOTE: the built-in role granting full reporting access is deprecated. See xpack.reporting.roles.enabled
|
||||
],
|
||||
{ skipBrowserRefresh: true }
|
||||
|
@ -50,5 +60,89 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const url = await PageObjects.reporting.getReportURL(60000);
|
||||
expect(url).to.be.ok();
|
||||
});
|
||||
|
||||
for (const type of ['PNG', 'PDF'] as const) {
|
||||
describe(`${type} report`, () => {
|
||||
it(`should not allow to download reports for incomplete visualization`, async () => {
|
||||
await PageObjects.visualize.gotoVisualizationLandingPage();
|
||||
await PageObjects.visualize.navigateToNewVisualization();
|
||||
await PageObjects.visualize.clickVisType('lens');
|
||||
await PageObjects.lens.goToTimeRange();
|
||||
|
||||
await PageObjects.lens.configureDimension({
|
||||
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
|
||||
operation: 'date_histogram',
|
||||
field: '@timestamp',
|
||||
});
|
||||
await PageObjects.lens.configureDimension({
|
||||
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
|
||||
operation: 'average',
|
||||
field: 'bytes',
|
||||
});
|
||||
|
||||
// now remove a dimension to make it incomplete
|
||||
await PageObjects.lens.removeDimension('lnsXY_yDimensionPanel');
|
||||
// open the share menu and check that reporting is disabled
|
||||
await PageObjects.lens.clickShareMenu();
|
||||
|
||||
expect(await PageObjects.lens.isShareActionEnabled(`${type}Reports`));
|
||||
});
|
||||
|
||||
it(`should be able to download report of the current visualization`, async () => {
|
||||
// make the configuration complete
|
||||
await PageObjects.lens.configureDimension({
|
||||
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
|
||||
operation: 'average',
|
||||
field: 'bytes',
|
||||
});
|
||||
|
||||
await PageObjects.lens.openReportingShare(type);
|
||||
await PageObjects.reporting.clickGenerateReportButton();
|
||||
const url = await PageObjects.reporting.getReportURL(60000);
|
||||
expect(url).to.be.ok();
|
||||
});
|
||||
|
||||
it(`should show a warning message for curl reporting of unsaved visualizations`, async () => {
|
||||
await PageObjects.lens.openReportingShare(type);
|
||||
await testSubjects.click('shareReportingAdvancedOptionsButton');
|
||||
await testSubjects.existOrFail('shareReportingUnsavedState');
|
||||
expect(await testSubjects.getVisibleText('shareReportingUnsavedState')).to.eql(
|
||||
'Unsaved work\nSave your work before copying this URL.'
|
||||
);
|
||||
});
|
||||
|
||||
it(`should enable curl reporting if the visualization is saved`, async () => {
|
||||
await PageObjects.lens.save(`ASavedVisualizationToShareIn${type}`);
|
||||
|
||||
await PageObjects.lens.openReportingShare(type);
|
||||
await testSubjects.click('shareReportingAdvancedOptionsButton');
|
||||
await testSubjects.existOrFail('shareReportingCopyURL');
|
||||
expect(await testSubjects.getVisibleText('shareReportingCopyURL')).to.eql(
|
||||
'Copy POST URL'
|
||||
);
|
||||
});
|
||||
|
||||
it(`should produce a valid URL for reporting`, async () => {
|
||||
await PageObjects.reporting.clickGenerateReportButton();
|
||||
await PageObjects.reporting.getReportURL(60000);
|
||||
// navigate to the reporting page
|
||||
await PageObjects.common.navigateToUrl('management', '/insightsAndAlerting');
|
||||
await testSubjects.click('reporting');
|
||||
// find the latest Lens report
|
||||
await testSubjects.click('reportJobRow > euiCollapsedItemActionsButton');
|
||||
// click on Open in Kibana and check that all is ok
|
||||
await testSubjects.click('reportOpenInKibanaApp');
|
||||
|
||||
const [reportingWindowHandler, lensWindowHandle] = await browser.getAllWindowHandles();
|
||||
await browser.switchToWindow(lensWindowHandle);
|
||||
// verify some configuration
|
||||
expect(await PageObjects.lens.getDimensionTriggerText('lnsXY_yDimensionPanel')).to.eql(
|
||||
'Average of bytes'
|
||||
);
|
||||
await browser.closeCurrentWindow();
|
||||
await browser.switchToWindow(reportingWindowHandler);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1677,16 +1677,20 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
|
|||
return await testSubjects.isEnabled('lnsApp_shareButton');
|
||||
},
|
||||
|
||||
async isShareActionEnabled(action: 'csvDownload' | 'permalinks') {
|
||||
async isShareActionEnabled(action: 'csvDownload' | 'permalinks' | 'PNGReports' | 'PDFReports') {
|
||||
switch (action) {
|
||||
case 'csvDownload':
|
||||
return await testSubjects.isEnabled('sharePanel-CSVDownload');
|
||||
case 'permalinks':
|
||||
return await testSubjects.isEnabled('sharePanel-Permalinks');
|
||||
default:
|
||||
return await testSubjects.isEnabled(`sharePanel-${action}`);
|
||||
}
|
||||
},
|
||||
|
||||
async ensureShareMenuIsOpen(action: 'csvDownload' | 'permalinks') {
|
||||
async ensureShareMenuIsOpen(
|
||||
action: 'csvDownload' | 'permalinks' | 'PNGReports' | 'PDFReports'
|
||||
) {
|
||||
await this.clickShareMenu();
|
||||
|
||||
if (!(await testSubjects.exists('shareContextMenu'))) {
|
||||
|
@ -1739,6 +1743,11 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
|
|||
}, value);
|
||||
},
|
||||
|
||||
async openReportingShare(type: 'PNG' | 'PDF') {
|
||||
await this.ensureShareMenuIsOpen(`${type}Reports`);
|
||||
await testSubjects.click(`sharePanel-${type}Reports`);
|
||||
},
|
||||
|
||||
async getCSVContent() {
|
||||
await testSubjects.click('lnsApp_downloadCSVButton');
|
||||
return await browser.execute<
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue