Skip to content

Commit

Permalink
Use dashboard constant
Browse files Browse the repository at this point in the history
  • Loading branch information
cqliu1 committed Apr 12, 2021
1 parent 7f031a6 commit 5437689
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { TopNavIds } from './top_nav_ids';
import { ShowShareModal } from './show_share_modal';
import { confirmDiscardOrKeepUnsavedChanges } from '../listing/confirm_overlays';
import { OverlayRef } from '../../../../../core/public';
import { DashboardConstants } from '../../dashboard_constants';
import { getNewDashboardTitle, unsavedChangesBadge } from '../../dashboard_strings';
import { DASHBOARD_PANELS_UNSAVED_ID } from '../lib/dashboard_panel_storage';
import { DashboardContainer } from '..';
Expand Down Expand Up @@ -109,6 +110,8 @@ export function DashboardTopNav({
const [state, setState] = useState<DashboardTopNavState>({ chromeIsVisible: false });
const [isSaveInProgress, setIsSaveInProgress] = useState(false);

const stateTransferService = embeddable.getStateTransfer();

useEffect(() => {
const visibleSubscription = chrome.getIsVisible$().subscribe((chromeIsVisible) => {
setState((s) => ({ ...s, chromeIsVisible }));
Expand Down Expand Up @@ -163,14 +166,14 @@ export function DashboardTopNav({

const createNewVisType = useCallback(
(newVisType: string) => async () => {
embeddable.getStateTransfer().navigateToEditor('visualize', {
stateTransferService.navigateToEditor('visualize', {
path: `#/create?type=${encodeURIComponent(newVisType)}`,
state: {
originatingApp: 'dashboards',
originatingApp: DashboardConstants.DASHBOARDS_ID,
},
});
},
[embeddable]
[stateTransferService]
);

const clearAddPanel = useCallback(() => {
Expand Down

0 comments on commit 5437689

Please sign in to comment.