diff --git a/.cypress/.DS_Store b/.cypress/.DS_Store new file mode 100644 index 0000000000..ab1b61f97e Binary files /dev/null and b/.cypress/.DS_Store differ diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..1dc11731b8 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams +* @opensearch-project/observability \ No newline at end of file diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index 1f9a96bf70..0000000000 --- a/CODEOWNERS +++ /dev/null @@ -1,2 +0,0 @@ -# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams -* @pjfitzgibbons @anirudha @ps48 @kavithacm @derek-ho @joshuali925 @dai-chen @YANG-DB @rupal-bq @mengweieric @vamsi-amazon @swiddis \ No newline at end of file diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 522b84b1b1..c1c270bc94 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -12,13 +12,4 @@ | Rupal Mahajan | [rupal-bq](https://github.com/rupal-bq) | Amazon | | Derek Ho | [derek-ho](https://github.com/derek-ho) | Amazon | | Lior Perry | [YANG-DB](https://github.com/YANG-DB) | Amazon | -| Peter Fitzgibbons | [pjfitzgibbons](https://github.com/pjfitzgibbons) | Amazon | -| Simeon Widdis | [swiddis] (https://github.com/swiddis) | Amazon | - -## Emeritus Maintainers - -| Maintainer | GitHub ID | Affiliation | -| ----------------- | ------------------------------------------------------- | ----------- | -| Charlotte Henkle | [CEHENKLE](https://github.com/CEHENKLE) | Amazon | -| Anirudha Jadhav | [anirudha](https://github.com/anirudha) | Amazon | -| Nick Knize | [nknize](https://github.com/nknize) | Amazon | +| Peter Fitzgibbons | [pjfitzgibbons](https://github.com/pjfitzgibbons) | Amazon | \ No newline at end of file diff --git a/common/constants/shared.ts b/common/constants/shared.ts index a001232212..5797994601 100644 --- a/common/constants/shared.ts +++ b/common/constants/shared.ts @@ -27,6 +27,30 @@ export const observabilityID = 'observability-logs'; export const observabilityTitle = 'Observability'; export const observabilityPluginOrder = 6000; +export const observabilityApplicationsID = 'observability-applications'; +export const observabilityApplicationsTitle = 'Applications'; +export const observabilityApplicationsPluginOrder = 5090; + +export const observabilityLogsID = 'observability-logs'; +export const observabilityLogsTitle = 'Logs'; +export const observabilityLogsPluginOrder = 5091; + +export const observabilityMetricsID = 'observability-metrics'; +export const observabilityMetricsTitle = 'Metrics'; +export const observabilityMetricsPluginOrder = 5092; + +export const observabilityTracesID = 'observability-traces'; +export const observabilityTracesTitle = 'Traces'; +export const observabilityTracesPluginOrder = 5093; + +export const observabilityNotebookID = 'observability-notebooks'; +export const observabilityNotebookTitle = 'Notebooks'; +export const observabilityNotebookPluginOrder = 5094; + +export const observabilityPanelsID = 'observability-dashboards'; +export const observabilityPanelsTitle = 'Dashboards'; +export const observabilityPanelsPluginOrder = 5095; + // Shared Constants export const SQL_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest/search-plugins/sql/index/'; export const PPL_DOCUMENTATION_URL = diff --git a/package.json b/package.json index f775172a9e..fc29a1bbf9 100644 --- a/package.json +++ b/package.json @@ -5,20 +5,11 @@ "license": "Apache-2.0", "scripts": { "osd": "node ../../scripts/osd", - "build": "yarn plugin-helpers build", + "build": "yarn plugin_helpers build", "test": "../../node_modules/.bin/jest --config ./test/jest.config.js", "cypress:run": "TZ=America/Los_Angeles cypress run", "cypress:open": "TZ=America/Los_Angeles cypress open", - "plugin-helpers": "node ../../scripts/plugin_helpers", - "prepare": "husky install", - "lint:es": "node ../../scripts/eslint", - "lint": "yarn lint:es" - }, - "lint-staged": { - "*.{ts,tsx,js,jsx}": [ - "yarn lint --fix", - "git add" - ] + "plugin_helpers": "node ../../scripts/plugin_helpers" }, "dependencies": { "@algolia/autocomplete-core": "^1.4.1", @@ -30,13 +21,13 @@ "ag-grid-react": "^27.3.0", "antlr4": "4.8.0", "antlr4ts": "^0.5.0-alpha.4", + "performance-now": "^2.1.0", "plotly.js-dist": "^2.2.0", "postinstall": "^0.7.4", "react-graph-vis": "^1.0.5", "react-paginate": "^8.1.3", "react-plotly.js": "^2.5.1", - "redux-persist": "^6.0.0", - "performance-now": "^2.1.0" + "redux-persist": "^6.0.0" }, "devDependencies": { "@cypress/skip-test": "^2.6.1", @@ -47,9 +38,7 @@ "cypress": "^6.0.0", "cypress-watch-and-reload": "^1.10.6", "eslint": "^6.8.0", - "husky": "6.0.0", "jest-dom": "^4.0.0", - "lint-staged": "^13.1.0", "ts-jest": "^29.1.0" }, "resolutions": { diff --git a/public/components/application_analytics/components/flyout_components/service_detail_flyout.tsx b/public/components/application_analytics/components/flyout_components/service_detail_flyout.tsx index f17d46e1df..ecfc017542 100644 --- a/public/components/application_analytics/components/flyout_components/service_detail_flyout.tsx +++ b/public/components/application_analytics/components/flyout_components/service_detail_flyout.tsx @@ -19,10 +19,7 @@ import { handleServiceMapRequest, handleServiceViewRequest, } from '../../../../../public/components/trace_analytics/requests/services_request_handler'; -import { - filtersToDsl, - processTimeStamp, -} from '../../../../../public/components/trace_analytics/components/common/helper_functions'; +import { filtersToDsl, processTimeStamp } from '../../../../../public/components/trace_analytics/components/common/helper_functions'; import { ServiceMap } from '../../../../../public/components/trace_analytics/components/services'; import { ServiceObject } from '../../../../../public/components/trace_analytics/components/common/plots/service_map'; import { SpanDetailTable } from '../../../../../public/components/trace_analytics/components/traces/span_detail_table'; @@ -67,7 +64,7 @@ export function ServiceDetailFlyout(props: ServiceFlyoutProps) { ), getListItem( 'Connected services', - fields.connected_services && fields.connected_services.length + fields.connected_services ? fields.connected_services.reduce((prev: string, curr: string) => { return [prev, ', ', curr]; }) @@ -121,15 +118,7 @@ export function ServiceDetailFlyout(props: ServiceFlyoutProps) { }, [serviceName, fields, serviceMap, DSL, serviceMapIdSelected]); useEffect(() => { - const serviceDSL = filtersToDsl( - mode, - filters, - query, - processTimeStamp(startTime, mode), - processTimeStamp(endTime, mode), - 'app', - appConfigs - ); + const serviceDSL = filtersToDsl(mode, filters, query, processTimeStamp(startTime, mode), processTimeStamp(endTime, mode), 'app', appConfigs); handleServiceViewRequest(serviceName, http, serviceDSL, setFields, mode); handleServiceMapRequest(http, serviceDSL, mode, setServiceMap, serviceName); const spanDSL = filtersToDsl(mode, filters, query, startTime, endTime, 'app', appConfigs); diff --git a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_table.test.tsx.snap b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_table.test.tsx.snap index 337b013063..47ad73fb7a 100644 --- a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_table.test.tsx.snap +++ b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_table.test.tsx.snap @@ -1,2861 +1,1225 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Panels Table Component renders empty panel table container 1`] = ` - + -
- -
- + +
-
- -
- -
- + +
+ +
-

- Operational panels -

- -
-
-
-
- - + Observability dashboards + +
+
+
+
+
+ -
- -
- -
- + +
+ +
-

- Panels - - ( - 0 - ) - -

- - -
- - -
+ ( + 0 + ) + + + + +
+ + - -
- Use Operational panels to create and view different visualizations on ingested observability data, using PPL (Piped Processing Language) queries. - - - - Learn more - - - - - - - -
-
-
- -
- - -
- + + + + + +
+ +
+ +
+
+ +
-
- -
- - Actions - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="none" +
+ +
-
-
+ - + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + isOpen={false} + ownFocus={true} + panelPaddingSize="none" + > +
+
+ - - - + + + + +
-
- -
- - -
- +
+
+ + - -
- -
- -
- - -
-
- -
- - -
+ + + +
+ +
+ +
+ +
+ + +
+
+ - + + +
-
-

- No Operational Panels -

- -
- - -
+ No Observability Dashboards + + +
+ + - -
- Use operational panels to dive deeper into observability -
- using PPL queries and insightful visualizations -
-
-
- -
- -
- - -
- - -
+ Use Observability Dashboards to dive deeper into observability +
+ using PPL queries and insightful visualizations +
+ +
+ +
+ +
+
+ +
+ + - - - - -
+ + + +
+
+ - - - - - -
- -
- - -
- -
- - -
- -
- -
- + + + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ `; exports[`Panels Table Component renders panel table container 1`] = ` - + -
- -
- + +
-
- -
- -
- + +
+ +
-

- Operational panels -

- -
-
-
-
- - + Observability dashboards + +
+
+
+
+
+ -
- -
- -
- + +
+ +
-

- Panels - - ( - 4 - ) - -

- - -
- - -
+ ( + 0 + ) + + + + +
+ + - -
- Use Operational panels to create and view different visualizations on ingested observability data, using PPL (Piped Processing Language) queries. - - - - Learn more - - - - - - - - - -
-
-
- -
- - -
- + + + + + + +
+ +
+ +
+
+ +
-
- -
- - Actions - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="none" +
+ +
-
-
+ - + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + isOpen={false} + ownFocus={true} + panelPaddingSize="none" + > +
+
+ - - - + + + + +
-
- -
- - -
- +
+
+ + - -
- -
- -
- - -
-
- - + + + +
+ +
+ +
+ +
+ + +
+
+
+ + +
-
- - - - -
+ No Observability Dashboards + + +
+ + - - - - - -
- -
+ Use Observability Dashboards to dive deeper into observability +
+ using PPL queries and insightful visualizations +
+ +
+
+
+
- - - -
-
- - + +
+ +
-
- -
- -
- -
- - -
- -
- -
- - -
- - -
- -
- - - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="none" - > -
-
- - - -
-
-
-
-
-
-
-
- -
- - +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - -
- -
-
- - -
- -
-
- - -
-
- - - - - -
-
- - -
- -
-
- - -
-
-
- Name -
- -
-
- Last updated -
-
- 11/04/2021 06:10 PM -
-
-
- Created -
-
- 11/02/2021 07:26 PM -
-
-
- - -
- -
-
- - -
-
-
- Name -
- -
-
- Last updated -
-
- 11/03/2021 10:51 PM -
-
-
- Created -
-
- 11/02/2021 09:44 PM -
-
-
- - -
- -
-
- - -
-
-
- Name -
- -
-
- Last updated -
-
- 11/03/2021 10:37 PM -
-
-
- Created -
-
- 10/29/2021 10:15 PM -
-
-
- - -
- -
-
- - -
-
-
- Name -
- -
-
- Last updated -
-
- 11/03/2021 09:26 PM -
-
-
- Created -
-
- 11/03/2021 09:26 PM -
-
- -
- + + + + + +
+ + -
- -
- - + - -
- -
- - - : - 10 - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="none" - > -
-
- - - -
-
-
-
-
- -
- - - -
-
-
-
-
+ Add samples + + + + + +
- +
- - -
- - -
- -
- -
- + + +
+ +
+ +
+
+ +
+
+
+ + `; diff --git a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap index 7b2eda6f26..8bd0d4395d 100644 --- a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap +++ b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap @@ -545,7 +545,7 @@ exports[`Panels View Component renders panel view container with visualizations iconType="arrowDown" onClick={[Function]} > - Panel actions + Dashboard Actions } closePopover={[Function]} @@ -640,7 +640,7 @@ exports[`Panels View Component renders panel view container with visualizations - Panel actions + Dashboard Actions @@ -2624,7 +2624,7 @@ exports[`Panels View Component renders panel view container without visualizatio iconType="arrowDown" onClick={[Function]} > - Panel actions + Dashboard Actions } closePopover={[Function]} @@ -2714,7 +2714,7 @@ exports[`Panels View Component renders panel view container without visualizatio - Panel actions + Dashboard Actions diff --git a/public/components/custom_panels/__tests__/custom_panel_table.test.tsx b/public/components/custom_panels/__tests__/custom_panel_table.test.tsx index 811bbf9c84..b3bcd71af8 100644 --- a/public/components/custom_panels/__tests__/custom_panel_table.test.tsx +++ b/public/components/custom_panels/__tests__/custom_panel_table.test.tsx @@ -3,13 +3,18 @@ * SPDX-License-Identifier: Apache-2.0 */ +import { applyMiddleware, createStore } from '@reduxjs/toolkit'; +import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import { configure, mount } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import React from 'react'; -import { CustomPanelTable } from '../custom_panel_table'; -import { waitFor, render, screen, fireEvent } from '@testing-library/react'; -import { panelBreadCrumbs, panelsData } from '../../../../test/panels_constants'; +import { Provider } from 'react-redux'; +import thunk from 'redux-thunk'; import { CustomPanelListType } from '../../../../common/types/custom_panels'; +import { panelBreadCrumbs, panelsData } from '../../../../test/panels_constants'; +import { coreRefs } from '../../../framework/core_refs'; +import { rootReducer } from '../../../framework/redux/reducers'; +import { CustomPanelTable } from '../custom_panel_table'; jest.mock('react-router-dom', () => ({ useLocation: jest.fn().mockReturnValue({ @@ -19,11 +24,18 @@ jest.mock('react-router-dom', () => ({ state: null, key: '', }), - useHistory: jest.fn() + useHistory: jest.fn(), })); describe('Panels Table Component', () => { configure({ adapter: new Adapter() }); + const store = createStore(rootReducer, applyMiddleware(thunk)); + coreRefs.savedObjectsClient.find = jest.fn(() => + Promise.resolve({ + savedObjects: [], + then: () => Promise.resolve(), + }) + ); it('renders empty panel table container', async () => { const loading = false; @@ -38,18 +50,20 @@ describe('Panels Table Component', () => { const addSamplePanels = jest.fn(); const wrapper = mount( - + + + ); wrapper.update(); @@ -71,18 +85,20 @@ describe('Panels Table Component', () => { const addSamplePanels = jest.fn(); const wrapper = mount( - + + + ); wrapper.update(); @@ -102,24 +118,26 @@ describe('Panels Table Component', () => { const cloneCustomPanel = jest.fn(); const deleteCustomPanelList = jest.fn(); const addSamplePanels = jest.fn(); - + const utils = render( - + + + ); - fireEvent.click(screen.getAllByText('Create panel')[0]); + fireEvent.click(screen.getAllByText('Create Dashboard')[0]); await waitFor(() => { - expect(global.window.location.href).toContain('/create') + expect(global.window.location.href).toContain('/create'); }); }); }); diff --git a/public/components/custom_panels/helpers/__tests__/utils.test.tsx b/public/components/custom_panels/helpers/__tests__/utils.test.tsx index ba4c6b27bd..9ea806c5b5 100644 --- a/public/components/custom_panels/helpers/__tests__/utils.test.tsx +++ b/public/components/custom_panels/helpers/__tests__/utils.test.tsx @@ -3,20 +3,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +import { DurationRange } from '@elastic/eui/src/components/date_picker/types'; import { configure, mount } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import moment from 'moment'; -import { DurationRange } from '@elastic/eui/src/components/date_picker/types'; - -import { - isNameValid, - convertDateTime, - mergeLayoutAndVisualizations, - onTimeChange, - isDateValid, - isPPLFilterValid, - displayVisualization, -} from '../utils'; +import React from 'react'; +import { PPL_DATE_FORMAT } from '../../../../../common/constants/shared'; import { sampleLayout, sampleMergedVisualizations, @@ -26,11 +18,16 @@ import { sampleSavedVisualization, sampleSavedVisualizationForHorizontalBar, sampleSavedVisualizationForLine, - sampleSavedVisualizationForPie, - sampleSavedVisualizationForTreeMap, } from '../../../../../test/panels_constants'; -import { PPL_DATE_FORMAT } from '../../../../../common/constants/shared'; -import React from 'react'; +import { + convertDateTime, + displayVisualization, + isDateValid, + isNameValid, + isPPLFilterValid, + mergeLayoutAndVisualizations, + onTimeChange, +} from '../utils'; describe('Utils helper functions', () => { configure({ adapter: new Adapter() }); @@ -56,23 +53,22 @@ describe('Utils helper functions', () => { }); it('validates onTimeChange function', () => { - const setRecentlyUsedRanges = jest.fn((x) => x); - const setStart = jest.fn(); - const setEnd = jest.fn(); const recentlyUsedRanges: DurationRange[] = []; - onTimeChange( + const result = onTimeChange( '2022-01-30T18:44:40.577Z', '2022-02-25T19:18:33.075Z', - recentlyUsedRanges, - setRecentlyUsedRanges, - setStart, - setEnd + recentlyUsedRanges ); - expect(setRecentlyUsedRanges).toHaveBeenCalledWith([ - { start: '2022-01-30T18:44:40.577Z', end: '2022-02-25T19:18:33.075Z' }, - ]); - expect(setStart).toHaveBeenCalledWith('2022-01-30T18:44:40.577Z'); - expect(setEnd).toHaveBeenCalledWith('2022-02-25T19:18:33.075Z'); + expect(result).toEqual({ + start: '2022-01-30T18:44:40.577Z', + end: '2022-02-25T19:18:33.075Z', + updatedRanges: [ + { + start: '2022-01-30T18:44:40.577Z', + end: '2022-02-25T19:18:33.075Z', + }, + ], + }); }); it('validates isDateValid function', () => { diff --git a/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap b/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap index acc9e820ea..cbc6c696c2 100644 --- a/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap +++ b/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap @@ -1,553 +1,608 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Saved query table component Renders saved query table 1`] = ` - + - -

- Custom operational dashboards/application -

-
- -
+ Custom operational dashboards/application + + +
- -
- +
- -
- + - - - - + } + color="hollow" + iconOnClick={[Function]} + iconOnClickAriaLabel="Remove [Logs] Web traffic Panel from selection in this group" + iconSide="right" + iconType="cross" + panel={ + Object { + "dateCreated": 1637781403888, + "dateModified": 1637781403888, + "id": "uRZgU30B661cwDZT-ILw", + "name": "[Logs] Web traffic Panel", + } + } + title="[Logs] Web traffic Panel" + > + - [Logs] Web traffic Panel - - + > + + + + + - - - - - - + + + + - - - - + } + color="hollow" + iconOnClick={[Function]} + iconOnClickAriaLabel="Remove [Logs] Web traffic Panel 2 from selection in this group" + iconSide="right" + iconType="cross" + panel={ + Object { + "dateCreated": 1637781403888, + "dateModified": 1637781403888, + "id": "uRZgU30B661cwDZT-ILw", + "name": "[Logs] Web traffic Panel", + } + } + title="[Logs] Web traffic Panel 2" + > + - [Logs] Web traffic Panel 2 - - + > + + + + + - - - - - - -
+ + + + -
-
-
-
- + +
+
+
+
+ -
- - + + + + + - - - - - -
-
+ +
+ +
-
- - -
- - -
+ +
+ + - Search existing dashboards or applications by name -
- +
+ Search existing dashboards or applications by name +
+ +
- - - -

+ - Name -

-
- -
+ Name + + +
- - -
- - - - + + + + +
-
- - - -
+ + - Name for your savings -
-
+
+ Name for your savings +
+ +
- -
- -
+
- - - -
- + + Save as Metric - - - Save as Metric - -
-
-
-
+
+ + + +
- -
-
+ +
+ `; diff --git a/public/components/event_analytics/explorer/save_panel/__tests__/save_panel.test.tsx b/public/components/event_analytics/explorer/save_panel/__tests__/save_panel.test.tsx index a35b7b58ac..0ffab1acbc 100644 --- a/public/components/event_analytics/explorer/save_panel/__tests__/save_panel.test.tsx +++ b/public/components/event_analytics/explorer/save_panel/__tests__/save_panel.test.tsx @@ -3,46 +3,60 @@ * SPDX-License-Identifier: Apache-2.0 */ +import { applyMiddleware, createStore } from '@reduxjs/toolkit'; +import { waitFor } from '@testing-library/react'; import { configure, mount } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import React from 'react'; -import { waitFor } from '@testing-library/react'; -import { SavePanel } from '../save_panel'; +import { Provider } from 'react-redux'; +import thunk from 'redux-thunk'; import { SELECTED_PANELS_OPTIONS } from '../../../../../../test/event_analytics_constants'; -import SavedObjects from '../../../../../services/saved_objects/event_analytics/saved_objects'; import httpClientMock from '../../../../../../test/__mocks__/httpClientMock'; +import { coreRefs } from '../../../../../framework/core_refs'; +import { rootReducer } from '../../../../../framework/redux/reducers'; +import SavedObjects from '../../../../../services/saved_objects/event_analytics/saved_objects'; +import { SavePanel } from '../save_panel'; describe('Saved query table component', () => { configure({ adapter: new Adapter() }); + const store = createStore(rootReducer, applyMiddleware(thunk)); + coreRefs.savedObjectsClient.find = jest.fn(() => + Promise.resolve({ + savedObjects: [], + then: () => Promise.resolve(), + }) + ); it('Renders saved query table', async () => { const handleNameChange = jest.fn(); const handleOptionChange = jest.fn(); const setMetricLabel = jest.fn(); const savedObjects = new SavedObjects(httpClientMock); - + const wrapper = mount( - + + + ); - + wrapper.update(); await waitFor(() => { expect(wrapper).toMatchSnapshot(); }); }); -}); \ No newline at end of file +}); diff --git a/public/components/event_analytics/explorer/save_panel/save_panel.tsx b/public/components/event_analytics/explorer/save_panel/save_panel.tsx index d6ee5940c4..3d0bc0c91d 100644 --- a/public/components/event_analytics/explorer/save_panel/save_panel.tsx +++ b/public/components/event_analytics/explorer/save_panel/save_panel.tsx @@ -61,6 +61,20 @@ export const SavePanel = ({ dispatch(fetchPanels()); }, []); + const getCustomPabnelList = async (svobj: SavedObjects) => { + const optionRes = await svobj + .fetchCustomPanels() + .then((res: any) => { + return res; + }) + .catch((error: any) => setSvpnlError(error)); + setOptions(optionRes?.panels || []); + }; + + useEffect(() => { + getCustomPabnelList(savedObjects); + }); + const onToggleChange = (e: { target: { checked: React.SetStateAction } }) => { setChecked(e.target.checked); if (e.target.checked) { diff --git a/public/components/event_analytics/explorer/visualizations/config_panel/__tests__/__snapshots__/config_panel.test.tsx.snap b/public/components/event_analytics/explorer/visualizations/config_panel/__tests__/__snapshots__/config_panel.test.tsx.snap index 67c7e58376..a712df4bb4 100644 --- a/public/components/event_analytics/explorer/visualizations/config_panel/__tests__/__snapshots__/config_panel.test.tsx.snap +++ b/public/components/event_analytics/explorer/visualizations/config_panel/__tests__/__snapshots__/config_panel.test.tsx.snap @@ -604,13 +604,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -927,13 +920,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -1233,13 +1219,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -2630,13 +2609,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -2968,13 +2940,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -3311,13 +3276,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -3589,13 +3547,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -3933,13 +3884,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -4247,13 +4191,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -4729,13 +4666,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], } } @@ -5339,13 +5269,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -5672,13 +5595,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], } } @@ -6282,13 +6198,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -6656,13 +6565,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], } } @@ -7266,13 +7168,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -7978,13 +7873,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -8957,13 +8845,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -10435,13 +10316,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -11934,13 +11808,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] }, ], }, - Object { - "editor": [Function], - "id": "color-theme", - "mapTo": "colorTheme", - "name": "Color theme", - "schemas": Array [], - }, ], }, Object { @@ -14374,831 +14241,6 @@ exports[`Config panel component Renders config panel with visualization data 1`] - -
-
- - -
-
- -
-
- -
-
- - - - - - -
- -
-
- -
-
- - -
-
-
diff --git a/public/components/notebooks/components/main.tsx b/public/components/notebooks/components/main.tsx index 229f3d61c8..3ec21b0cb8 100644 --- a/public/components/notebooks/components/main.tsx +++ b/public/components/notebooks/components/main.tsx @@ -2,7 +2,6 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ -/* eslint-disable no-console */ import { EuiGlobalToastList, EuiLink } from '@elastic/eui'; import { Toast } from '@elastic/eui/src/components/toast/global_toast_list'; @@ -94,7 +93,7 @@ export class Main extends React.Component { createNotebook = (newNoteName: string) => { if (newNoteName.length >= 50 || newNoteName.length === 0) { this.setToast('Invalid notebook name', 'danger'); - window.location.assign('#/notebooks'); + window.location.assign('#/'); return; } const newNoteObject = { @@ -107,7 +106,7 @@ export class Main extends React.Component { }) .then(async (res) => { this.setToast(`Notebook "${newNoteName}" successfully created!`); - window.location.assign(`#/notebooks/${res}`); + window.location.assign(`#/${res}`); }) .catch((err) => { this.setToast( @@ -309,28 +308,26 @@ export class Main extends React.Component { ( - - - + )} /> ( { cloneNotebook={this.cloneNotebook} deleteNotebook={this.deleteNotebook} setToast={this.setToast} - location={this.props.location} - history={this.props.history} + location={props.location} + history={props.history} /> )} /> diff --git a/public/components/notebooks/components/note_table.tsx b/public/components/notebooks/components/note_table.tsx index 3c5da6df8f..465e6e1988 100644 --- a/public/components/notebooks/components/note_table.tsx +++ b/public/components/notebooks/components/note_table.tsx @@ -74,7 +74,7 @@ export function NoteTable(props: NoteTableProps) { props.parentBreadcrumb, { text: 'Notebooks', - href: '#/notebooks', + href: '#/', }, ]); props.fetchNotebooks(); @@ -110,9 +110,8 @@ export function NoteTable(props: NoteTableProps) { }; const onDelete = async () => { - const toastMessage = `Notebook${ - selectedNotebooks.length > 1 ? 's' : ' "' + selectedNotebooks[0].path + '"' - } successfully deleted!`; + const toastMessage = `Notebook${selectedNotebooks.length > 1 ? 's' : ' "' + selectedNotebooks[0].path + '"' + } successfully deleted!`; await deleteNotebook( selectedNotebooks.map((note) => note.id), toastMessage @@ -253,7 +252,7 @@ export function NoteTable(props: NoteTableProps) { sortable: true, truncateText: true, render: (value, record) => ( - {_.truncate(value, { length: 100 })} + {_.truncate(value, { length: 100 })} ), }, { @@ -319,7 +318,7 @@ export function NoteTable(props: NoteTableProps) { - + Create notebook @@ -341,8 +340,8 @@ export function NoteTable(props: NoteTableProps) { items={ searchQuery ? notebooks.filter((notebook) => - notebook.path.toLowerCase().includes(searchQuery.toLowerCase()) - ) + notebook.path.toLowerCase().includes(searchQuery.toLowerCase()) + ) : notebooks } itemId="id" diff --git a/public/components/notebooks/components/notebook.tsx b/public/components/notebooks/components/notebook.tsx index 072e7ab3c6..6f0aadba36 100644 --- a/public/components/notebooks/components/notebook.tsx +++ b/public/components/notebooks/components/notebook.tsx @@ -631,11 +631,11 @@ export class Notebook extends Component { this.props.parentBreadcrumb, { text: 'Notebooks', - href: '#/notebooks', + href: '#/', }, { text: path, - href: `#/notebooks/${this.props.openedNoteId}`, + href: `#/${this.props.openedNoteId}`, }, ]); } diff --git a/public/components/trace_analytics/components/dashboard/dashboard_content.tsx b/public/components/trace_analytics/components/dashboard/dashboard_content.tsx index fe56704a04..9cf1d8cd9e 100644 --- a/public/components/trace_analytics/components/dashboard/dashboard_content.tsx +++ b/public/components/trace_analytics/components/dashboard/dashboard_content.tsx @@ -73,13 +73,17 @@ export function DashboardContent(props: DashboardProps) { useEffect(() => { if (showTimeoutToast === true && toasts.length === 0) { - setToast!('Query took too long to execute.', 'danger', 'Reduce time range or filter your data. If issue persists, consider increasing your cluster size.') + setToast!( + 'Query took too long to execute.', + 'danger', + 'Reduce time range or filter your data. If issue persists, consider increasing your cluster size.' + ); } setShowTimeoutToast(false); - }, [showTimeoutToast]) + }, [showTimeoutToast]); useEffect(() => { - chrome.setBreadcrumbs([...parentBreadcrumbs, ...childBreadcrumbs]); + chrome.setBreadcrumbs([parentBreadcrumb, ...childBreadcrumbs]); const validFilters = getValidFilterFields(mode, page); setFilters([ ...filters.map((filter) => ({ @@ -106,8 +110,22 @@ export function DashboardContent(props: DashboardProps) { } } setFilteredService(newFilteredService); - if (!redirect && ((mode === 'data_prepper' && dataPrepperIndicesExist) || (mode === 'jaeger' && jaegerIndicesExist))) refresh(newFilteredService); - }, [filters, startTime, endTime, appConfigs, redirect, mode, dataPrepperIndicesExist, jaegerIndicesExist]); + if ( + !redirect && + ((mode === 'data_prepper' && dataPrepperIndicesExist) || + (mode === 'jaeger' && jaegerIndicesExist)) + ) + refresh(newFilteredService); + }, [ + filters, + startTime, + endTime, + appConfigs, + redirect, + mode, + dataPrepperIndicesExist, + jaegerIndicesExist, + ]); const refresh = async (currService?: string) => { setLoading(true); @@ -159,7 +177,7 @@ export function DashboardContent(props: DashboardProps) { // } // }, setPercentileMap - ).finally(() => setLoading(false)) + ).finally(() => setLoading(false)); handleJaegerErrorDashboardRequest( http, DSL, @@ -295,7 +313,8 @@ export function DashboardContent(props: DashboardProps) { mode={mode} /> - {((mode === 'data_prepper' && dataPrepperIndicesExist) || mode === 'jaeger' && jaegerIndicesExist) ? ( + {(mode === 'data_prepper' && dataPrepperIndicesExist) || + (mode === 'jaeger' && jaegerIndicesExist) ? (
{mode === 'data_prepper' ? ( <> @@ -359,7 +378,7 @@ export function DashboardContent(props: DashboardProps) { )}
) : ( - + )} ); diff --git a/public/embeddable/observability_embeddable_factory.tsx b/public/embeddable/observability_embeddable_factory.tsx index 53e7b7859f..5392881567 100644 --- a/public/embeddable/observability_embeddable_factory.tsx +++ b/public/embeddable/observability_embeddable_factory.tsx @@ -20,7 +20,7 @@ import { OnSaveProps, SavedObjectMetaData, } from '../../../../src/plugins/saved_objects/public'; -import { observabilityID } from '../../common/constants/shared'; +import { observabilityID, observabilityLogsID } from '../../common/constants/shared'; import { VisualizationSavedObjectAttributes, VISUALIZATION_SAVED_OBJECT, @@ -63,8 +63,8 @@ export class ObservabilityEmbeddableFactoryDefinition input: SavedObjectEmbeddableInput, parent?: IContainer ) { - const editPath = `#/event_analytics/explorer/${VISUALIZATION_SAVED_OBJECT}:${savedObjectId}`; - const editUrl = `/app/${observabilityID}${editPath}`; + const editPath = `#/explorer/${VISUALIZATION_SAVED_OBJECT}:${savedObjectId}`; + const editUrl = `/app/${observabilityLogsID}${editPath}`; return new ObservabilityEmbeddable( { editUrl, diff --git a/public/index.ts b/public/index.ts index 97037a9f7d..a43ed0e205 100644 --- a/public/index.ts +++ b/public/index.ts @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import './variables.scss'; import './components/trace_analytics/index.scss'; import './components/notebooks/index.scss' diff --git a/server/saved_objects/observability_saved_object.ts b/server/saved_objects/observability_saved_object.ts index 5c47a0c223..d8f8ca32d0 100644 --- a/server/saved_objects/observability_saved_object.ts +++ b/server/saved_objects/observability_saved_object.ts @@ -4,7 +4,7 @@ */ import { SavedObjectsType } from '../../../../src/core/server'; -import { observabilityID } from '../../common/constants/shared'; +import { observabilityID, observabilityLogsID } from '../../common/constants/shared'; import { VISUALIZATION_SAVED_OBJECT } from '../../common/types/observability_saved_object_attributes'; export const visualizationSavedObject: SavedObjectsType = { @@ -19,8 +19,8 @@ export const visualizationSavedObject: SavedObjectsType = { return obj.attributes.title; }, getInAppUrl(obj) { - const editPath = `#/event_analytics/explorer/${VISUALIZATION_SAVED_OBJECT}:${obj.id}`; - const editUrl = `/app/${observabilityID}${editPath}`; + const editPath = `#/explorer/${VISUALIZATION_SAVED_OBJECT}:${obj.id}`; + const editUrl = `/app/${observabilityLogsID}${editPath}`; return { path: editUrl, uiCapabilitiesPath: 'observability.show', diff --git a/test/setup.jest.ts b/test/setup.jest.ts index 7f612f9085..6bbbefb80e 100644 --- a/test/setup.jest.ts +++ b/test/setup.jest.ts @@ -6,6 +6,7 @@ // import '@testing-library/jest-dom/extend-expect'; import { configure } from '@testing-library/react'; import { setOSDHttp, setOSDSavedObjectsClient } from '../common/utils'; +import { coreRefs } from '../public/framework/core_refs'; import { coreStartMock } from './__mocks__/coreMocks'; configure({ testIdAttribute: 'data-test-subj' }); @@ -57,3 +58,5 @@ jest.setTimeout(30000); setOSDHttp(coreStartMock.http); setOSDSavedObjectsClient(coreStartMock.savedObjects.client); +coreRefs.http = coreStartMock.http; +coreRefs.savedObjectsClient = coreStartMock.savedObjects.client; diff --git a/yarn.lock b/yarn.lock index c57b4d842f..b7446cc855 100644 --- a/yarn.lock +++ b/yarn.lock @@ -603,7 +603,7 @@ braces@^3.0.2, braces@~3.0.2: resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== dependencies: - fast-json-stable-stringify "2.x" + fill-range "^7.0.1" bs-logger@0.x: version "0.2.6" @@ -3277,16 +3277,6 @@ yargs-parser@^21.0.1: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yaml@^2.1.3: - version "2.2.1" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.2.1.tgz#3014bf0482dcd15147aa8e56109ce8632cd60ce4" - integrity sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw== - -yargs-parser@^21.0.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" - integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== - yauzl@^2.10.0: version "2.10.0" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"