Skip to content

Commit

Permalink
Updated dashboard link
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Dong <[email protected]>
  • Loading branch information
danieldong51 committed Aug 20, 2024
1 parent 2c4efb4 commit 95cbcdd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
EuiTitle,
} from '@elastic/eui';
import { coreRefs } from '../../../../public/framework/core_refs';
import { fetchDashboardIds, fetchIndexPatternIds } from './utils';
import { fetchDashboardIds, fetchIndexPatternIds, redirectToDashboards } from './utils';

interface QueryAndAnalyzeProps {
isOpen: boolean;
Expand Down Expand Up @@ -52,12 +52,6 @@ export const QueryAndAnalyze: React.FC<QueryAndAnalyzeProps> = ({
}
};

const redirectToDashboards = (path: string) => {
coreRefs?.application!.navigateToApp('dashboards', {
path: `#/${path}`,
});
};

useEffect(() => {
if (selectedTechnology !== '') {
fetchIndexPatternContent();
Expand Down
6 changes: 6 additions & 0 deletions public/components/getting_started/components/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ export const fetchIndexPatternIds = async (tutorialId: string) => {
console.error(err.message);
}
};

export const redirectToDashboards = (path: string) => {
coreRefs?.application!.navigateToApp('dashboards', {
path: `#/${path}`,
});
};
3 changes: 2 additions & 1 deletion public/components/overview/components/dashboard_controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import React from 'react';
import { OnTimeChangeProps } from '@opensearch-project/oui/src/eui_components/date_picker/super_date_picker/super_date_picker';
import { coreRefs } from '../../../framework/core_refs';
import { HOME_CONTENT_AREAS } from '../../../plugin_helpers/plugin_overview';
import { redirectToDashboards } from '../../getting_started/components/utils';

interface Props {
dashboardTitle: string;
Expand Down Expand Up @@ -52,7 +53,7 @@ export function DashboardControls(props: Props) {
<EuiFlexGroup gutterSize="s" justifyContent="spaceBetween">
<EuiFlexItem grow={true}>
<EuiText size="s">
<EuiLink href={'dashboards#/view/' + props.dashboardId}>
<EuiLink onClick={() => redirectToDashboards('/view/' + props.dashboardId)}>
<h2>{props.dashboardTitle}</h2>
</EuiLink>
</EuiText>
Expand Down

0 comments on commit 95cbcdd

Please sign in to comment.