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

[Feature] Dashboards-List integrations #151

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e3db068
Observability - Dashboard Lists Integration
Oct 24, 2022
d655d4b
Added missing component file
Jan 4, 2023
1293b1b
Add Observability module links to OSD Left-Nav
Jan 4, 2023
929fd4e
Update Observability left-nav link names and Dashboard Creators link …
Jan 5, 2023
5734b97
Use custom icon for Left-Nav Observability Group
Jan 5, 2023
26d00cb
Change OpenSearch Observability left-nav group to No-Icon.
Jan 6, 2023
626eb60
WIP - fixing Observability Routing
Jan 10, 2023
46f2545
correct ppl leran more link (#154)
mengweieric Jan 5, 2023
6e0c5a3
Fix explorer dark mode issue and restructure scss (#157)
mengweieric Jan 5, 2023
b2cff40
Fix event analytics field blank margin (#174)
joshuali925 Jan 6, 2023
fa1d3dc
Fix show legend in bar charts (#175)
joshuali925 Jan 6, 2023
f72aa0f
Update 2.x to be the same as observability repo (#158) (#177)
opensearch-trigger-bot[bot] Jan 9, 2023
458d4ad
Updated MAINTAINERS.md to match recommended opensearch-project format…
dblock Jan 9, 2023
266cd70
Fixed PPL Error in containers & added tool tip to date picker (#179) …
opensearch-trigger-bot[bot] Jan 9, 2023
b9b5b07
Few fixes regarding issues for visualization rendering (#185)
mengweieric Jan 10, 2023
9413597
Observability - Dashboard Lists Integration
Oct 24, 2022
5e957c5
Use custom icon for Left-Nav Observability Group
Jan 5, 2023
ddcc4e6
Correct issues with Dashboard-List items, create, and Left-Nav
Jan 11, 2023
f483dba
Merge branch 'main' into feature-dash-obs/dashboad-list-integration.4
pjfitzgibbons Jan 11, 2023
69fbcc3
Remove console logging
Jan 11, 2023
3d9a34a
Updated DashboardList associated types
Jan 11, 2023
521ddb1
Update DashboardList registration for App Analytics
Jan 23, 2023
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
Next Next commit
Observability - Dashboard Lists Integration
* Register App Analytics, Panels as "Dashboard List Providers" (requires opensearch-project/OpenSearch-Dashboards#2149)

* Register App Analytics, Event Analytics as "Dashboard Left-Nav Links", using existing app.register functions of OSD.  Create a new "top-level" Left-Nav section "Observability"

Signed-off-by: Peter Fitzgibbons <pjfitz@amazon.com>
  • Loading branch information
Peter Fitzgibbons committed Jan 4, 2023
commit e3db06801a90c5d2d876f0d87e7c3439b5c62dca
9 changes: 8 additions & 1 deletion common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
import CSS from 'csstype';
import { IField } from '../../common/types/explorer';

// Client route
export const PPL_BASE = '/api/ppl';
Expand All @@ -27,6 +26,14 @@ export const observabilityID = 'observability-dashboards';
export const observabilityTitle = 'Observability';
export const observabilityPluginOrder = 6000;

export const observabilityApplicationsID = 'observability-applications';
export const observabilityApplicationsTitle = 'Application Analytics';
export const observabilityApplicationsPluginOrder = 5090;

export const observabilityEventsID = 'observability-events';
export const observabilityEventsTitle = 'Event Analytics';
export const observabilityEventsPluginOrder = 5091;

// Shared Constants
export const SQL_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest/search-plugins/sql/index/';
export const PPL_DOCUMENTATION_URL =
Expand Down
147 changes: 18 additions & 129 deletions public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,25 @@
*/

import { I18nProvider } from '@osd/i18n/react';
import { QueryManager } from 'common/query_manager';
import React from 'react';
import { Provider } from 'react-redux';
import { HashRouter, Route, Switch } from 'react-router-dom';
import { QueryManager } from 'common/query_manager';
import { CoreStart } from '../../../../src/core/public';
import { observabilityID, observabilityTitle } from '../../common/constants/shared';
import store from '../framework/redux/store';
import { AppPluginStartDependencies } from '../types';
import { Home as ApplicationAnalyticsHome } from './application_analytics/home';
import { MetricsListener } from './common/metrics_listener';
import { Home as CustomPanelsHome } from './custom_panels/home';
import { EventAnalytics } from './event_analytics';
import { Home as MetricsHome } from './metrics/index';
import { Main as NotebooksHome } from './notebooks/components/main';
import { Home as TraceAnalyticsHome } from './trace_analytics/home';
import { AppRoutesWrapper } from './routes_wrapper';

interface ObservabilityAppDeps {
CoreStartProp: CoreStart;
DepsStart: AppPluginStartDependencies;
coreStart: CoreStart;
depsStart: AppPluginStartDependencies;
pplService: any;
dslService: any;
savedObjects: any;
timestampUtils: any;
queryManager: QueryManager;
startPage?: String;
}

// for cypress to test redux store
Expand All @@ -36,134 +31,28 @@ if (window.Cypress) {
}

export const App = ({
CoreStartProp,
DepsStart,
coreStart,
depsStart,
pplService,
dslService,
savedObjects,
timestampUtils,
queryManager,
startPage,
}: ObservabilityAppDeps) => {
const { chrome, http, notifications } = CoreStartProp;
const parentBreadcrumb = {
text: observabilityTitle,
href: `${observabilityID}#/`,
};

const customPanelBreadcrumb = {
text: 'Operational panels',
href: '#/operational_panels/',
};

return (
<Provider store={store}>
<HashRouter>
<I18nProvider>
<MetricsListener http={http}>
<Switch>
<Route
path="/metrics_analytics/"
render={(props) => {
chrome.setBreadcrumbs([
parentBreadcrumb,
{ text: 'Metrics analytics', href: '#/metrics_analytics/' },
]);
return (
<MetricsHome
http={http}
chrome={chrome}
parentBreadcrumb={parentBreadcrumb}
renderProps={props}
pplService={pplService}
savedObjects={savedObjects}
/>
);
}}
/>
<Route
path={'/application_analytics'}
render={(props) => {
return (
<ApplicationAnalyticsHome
{...props}
chrome={chrome}
http={http}
notifications={notifications}
parentBreadcrumbs={[parentBreadcrumb]}
pplService={pplService}
dslService={dslService}
savedObjects={savedObjects}
timestampUtils={timestampUtils}
queryManager={queryManager}
/>
);
}}
/>
<Route
path="/notebooks"
render={(props) => (
<NotebooksHome
{...props}
DashboardContainerByValueRenderer={
DepsStart.dashboard.DashboardContainerByValueRenderer
}
http={http}
pplService={pplService}
setBreadcrumbs={chrome.setBreadcrumbs}
parentBreadcrumb={parentBreadcrumb}
notifications={notifications}
/>
)}
/>
<Route
path="/operational_panels"
render={(props) => {
chrome.setBreadcrumbs([parentBreadcrumb, customPanelBreadcrumb]);
return (
<CustomPanelsHome
http={http}
chrome={chrome}
parentBreadcrumbs={[parentBreadcrumb, customPanelBreadcrumb]}
pplService={pplService}
dslService={dslService}
renderProps={props}
/>
);
}}
/>
<Route
path={['/trace_analytics', '/trace_analytics/home']}
render={(props) => (
<TraceAnalyticsHome
{...props}
chrome={chrome}
http={http}
parentBreadcrumbs={[parentBreadcrumb]}
/>
)}
/>
<Route
path={['/', '/event_analytics']}
render={(props) => {
return (
<EventAnalytics
chrome={chrome}
parentBreadcrumbs={[parentBreadcrumb]}
pplService={pplService}
dslService={dslService}
savedObjects={savedObjects}
timestampUtils={timestampUtils}
http={http}
notifications={notifications}
queryManager={queryManager}
{...props}
/>
);
}}
/>
</Switch>
</MetricsListener>
</I18nProvider>
<AppRoutesWrapper
coreStart={coreStart}
depsStart={depsStart}
pplService={pplService}
dslService={dslService}
savedObjects={savedObjects}
timestampUtils={timestampUtils}
queryManager={queryManager}
startPage={startPage}
></AppRoutesWrapper>{' '}
</HashRouter>
</Provider>
);
Expand Down
6 changes: 6 additions & 0 deletions public/components/application_analytics/helpers/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import {
init as initPatterns,
remove as removePatterns,
} from '../../event_analytics/redux/slices/patterns_slice';
import { from } from 'rxjs';
import { mergeMap } from 'rxjs/operators';

// Name validation
export const isNameValid = (name: string, existingNames: string[]) => {
Expand Down Expand Up @@ -182,6 +184,10 @@ export const initializeTabData = async (dispatch: Dispatch<any>, tabId: string,
});
};

export const fetchAppsList = (http: HttpSetup) => {
return from(http.get(`${APP_ANALYTICS_API_PREFIX}/`)).pipe(mergeMap((res) => res.data));
};

export const fetchPanelsVizIdList = async (http: HttpSetup, appPanelId: string) => {
return await http
.get(`${CUSTOM_PANELS_API_PREFIX}/panels/${appPanelId}`)
Expand Down
14 changes: 14 additions & 0 deletions public/components/custom_panels/helpers/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ import { Visualization } from '../../visualizations/visualization';
import { getVizContainerProps } from '../../../components/visualizations/charts/helpers';
import { QueryManager } from '../../../../common/query_manager';
import { getDefaultVisConfig } from '../../event_analytics/utils';
import { from } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { HttpSetup } from '../../src/core/target/types/public';
import { removeBacktick } from '../../../../common/utils';

/*
* "Utils" This file contains different reused functions in operational panels
*
* fetchPanelsList - Get list of Observability Panel from Custom Panels API
* isNameValid - Validates string to length > 0 and < 50
* convertDateTime - Converts input datetime string to required format
* mergeLayoutAndVisualizations - Function to merge current panel layout into the visualizations list
Expand All @@ -36,6 +40,16 @@ import { removeBacktick } from '../../../../common/utils';
* displayVisualization - Function to render the visualzation based of its type
*/

export const fetchPanelsList = (http: HttpSetup) => {
return from(http.get(`${CUSTOM_PANELS_API_PREFIX}/panels`)).pipe(
map((res) => res.panels),
catchError((err) => {
console.error('Issue in fetching the operational panels', err.body.message);
return from([]);
})
);
};

// Name validation 0>Name<=50
export const isNameValid = (name: string) => {
return name.length >= 50 || name.length === 0 ? false : true;
Expand Down
8 changes: 5 additions & 3 deletions public/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ export const Observability = (
dslService: any,
savedObjects: any,
timestampUtils: any,
queryManager: QueryManager
queryManager: QueryManager,
startPage?: String
) => {
ReactDOM.render(
<App
CoreStartProp={CoreStartProp}
DepsStart={DepsStart}
coreStart={CoreStartProp}
depsStart={DepsStart}
pplService={pplService}
dslService={dslService}
savedObjects={savedObjects}
timestampUtils={timestampUtils}
queryManager={queryManager}
startPage={startPage}
/>,
AppMountParametersProp.element
);
Expand Down
Loading