Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dashboard] Fixes Copy to dashboard includes filters. #136275

Merged
merged 17 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class CopyToDashboardAction implements Action<CopyToDashboardActionContex
if (!embeddable.parent || !isDashboard(embeddable.parent)) {
throw new IncompatibleActionError();
}

const session = this.overlays.openModal(
toMountPoint(
<CopyToDashboardModal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function CopyToDashboardModal({
if (!panelToCopy) {
throw new PanelNotFoundError();
}

const state = {
type: embeddable.type,
input: {
Expand All @@ -76,11 +77,12 @@ export function CopyToDashboardModal({
: `#${DashboardConstants.CREATE_NEW_DASHBOARD_URL}`;

closeModal();

stateTransfer.navigateToWithEmbeddablePackage('dashboards', {
state,
path,
});
}, [dashboardOption, embeddable, selectedDashboard, stateTransfer, closeModal]);
}, [embeddable, dashboardOption, selectedDashboard, closeModal, stateTransfer]);
Kuznietsov marked this conversation as resolved.
Show resolved Hide resolved

const titleId = 'copyToDashboardTitle';
const descriptionId = 'copyToDashboardDescription';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const stateToDashboardContainerInput = ({
dashboardState,
executionContext,
}: StateToDashboardContainerInputProps): DashboardContainerInput => {
const { filterManager, timefilter: timefilterService } = queryService;
const { timefilter: timefilterService } = queryService;
const { timefilter } = timefilterService;

const {
Expand All @@ -109,12 +109,12 @@ export const stateToDashboardContainerInput = ({
panels,
query,
title,
filters,
Kuznietsov marked this conversation as resolved.
Show resolved Hide resolved
timeRestore,
} = dashboardState;

return {
refreshConfig: timefilter.getRefreshInterval(),
filters: filterManager.getFilters(),
isFullScreenMode: fullScreenMode,
id: savedDashboard.id || '',
dashboardCapabilities,
Expand All @@ -126,6 +126,7 @@ export const stateToDashboardContainerInput = ({
description,
viewMode,
panels,
filters,
query,
title,
timeRange: {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ export class DashboardPlugin
canCreateNew: Boolean(dashboardCapabilities.createNew),
canEditExisting: Boolean(dashboardCapabilities.showWriteControls),
},
presentationUtil.ContextProvider
presentationUtil.ContextProvider,
() => data.query.filterManager.setFilters([])
);
uiActions.registerAction(copyToDashboardAction);
uiActions.attachAction(CONTEXT_MENU_TRIGGER, copyToDashboardAction.id);
Expand Down