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

Fix panel visualization preview & new viz workflow #401

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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