Skip to content

Commit

Permalink
fix panel visualization preview, new viz workflow (opensearch-project…
Browse files Browse the repository at this point in the history
…#401)

Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 authored Apr 19, 2023
1 parent 05ef180 commit 78347d9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 2 additions & 0 deletions public/components/custom_panels/custom_panel_view_so.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ interface CustomPanelViewProps {
appId?: string;
updateAvailabilityVizId?: any;
onAddClick?: any;
pplService: PPLService;
dslService: DSLService;
}

export const CustomPanelViewSO = (props: CustomPanelViewProps) => {
Expand Down
2 changes: 2 additions & 0 deletions public/components/custom_panels/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ export const Home = ({
<CustomPanelViewSO
panelId={props.match.params.id}
chrome={chrome}
pplService={pplService}
dslService={dslService}
parentBreadcrumbs={customPanelBreadCrumbs}
deleteCustomPanel={deleteCustomPanel}
setToast={setToast}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ import React, { useEffect, useState } from 'react';
import { v4 as uuidv4 } from 'uuid';
import { useDispatch, useSelector } from 'react-redux';
import { FlyoutContainers } from '../../../common/flyout_containers';
import { displayVisualization, getQueryResponse, isDateValid } from '../../helpers/utils';
import {
displayVisualization,
getQueryResponse,
isDateValid,
parseSavedVisualizations,
} from '../../helpers/utils';
import { convertDateTime } from '../../helpers/utils';
import PPLService from '../../../../services/requests/ppl';
import { CoreStart } from '../../../../../../../src/core/public';
Expand All @@ -53,6 +58,12 @@ import './visualization_flyout.scss';
import { uiSettingsService } from '../../../../../common/utils';
import { ILegacyScopedClusterClient } from '../../../../../../../src/core/server';
import { replaceVizInPanel, selectPanel } from '../../redux/panel_slice';
import { SavedObjectsActions } from '../../../../services/saved_objects/saved_object_client/saved_objects_actions';
import {
ObservabilitySavedObject,
ObservabilitySavedVisualization,
} from '../../../../services/saved_objects/saved_object_client/types';
import { SAVED_VISUALIZATION } from '../../../../../common/constants/explorer';

/*
* VisaulizationFlyoutSO - This module create a flyout to add visualization for SavedObjects custom Panels
Expand Down Expand Up @@ -351,8 +362,14 @@ export const VisaulizationFlyoutSO = ({

// Fetch all saved visualizations
const fetchSavedVisualizations = async () => {
return http
.get(`${CUSTOM_PANELS_API_PREFIX}/visualizations`)
return SavedObjectsActions.getBulk<ObservabilitySavedVisualization>({
objectType: [SAVED_VISUALIZATION],
sortOrder: 'desc',
fromIndex: 0,
})
.then((response) => ({
visualizations: response.observabilityObjectList.map(parseSavedVisualizations),
}))
.then((res) => {
if (res.visualizations.length > 0) {
setSavedVisualizations(res.visualizations);
Expand Down

0 comments on commit 78347d9

Please sign in to comment.