Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
30968c0
use jdbc format
mengweieric Mar 7, 2023
31ad03a
use jdbc format for line
mengweieric Mar 7, 2023
eddeb8d
use josn for pie and add changes for related rendering flows
mengweieric Mar 9, 2023
d77e0d0
use jdbc for heatmap
mengweieric Mar 11, 2023
bcbd556
change viz to jdbc elsewhere and make related changes to use jdbc data
mengweieric Mar 13, 2023
ed12d1f
correct suppress naming
mengweieric Mar 13, 2023
aa672f0
added download path for issue causing app reloads
mengweieric Mar 13, 2023
62b1428
quick resolution for few tests
mengweieric Mar 13, 2023
0fd0f1d
update jest tests/snapshots
mengweieric Mar 13, 2023
e27a98d
keep viz for on calculating availability for now
mengweieric Mar 14, 2023
928fb51
add cypress downloads to gitignore
mengweieric Mar 14, 2023
c0a544f
disable no-console
mengweieric Mar 14, 2023
79862f7
better naming and type defination
mengweieric Mar 14, 2023
4d30c97
update function doc and types
mengweieric Mar 14, 2023
187af13
move fields toggle from explorer to under sidebar
mengweieric Mar 15, 2023
040ccff
missed comments removal
mengweieric Mar 15, 2023
83cf1c9
fix the bug when switching index seeing fields from old index
mengweieric Mar 15, 2023
41af428
update tests/snapshots
mengweieric Mar 15, 2023
bc43414
remove unused pattern function
mengweieric Mar 15, 2023
9eb68bf
move get data range logic to utils and resolve some linting errors
mengweieric Mar 15, 2023
a2b9858
move fields toggle from explorer to under sidebar
mengweieric Mar 15, 2023
dac21f4
fix the bug when switching index seeing fields from old index
mengweieric Mar 15, 2023
436bf2b
update tests/snapshots
mengweieric Mar 15, 2023
928612a
Merge branch 'sidebar-refactoring' into explorer-modular-and-hooks
mengweieric Mar 15, 2023
7027b01
move tab constants to constant file
mengweieric Mar 15, 2023
bb31a6d
proper browser focus attach/detach handler
mengweieric Mar 16, 2023
fb2cbed
Merge branch 'main' into explorer-modular-and-hooks
mengweieric Mar 16, 2023
cf9bd18
remove unused functions
mengweieric Mar 21, 2023
7138ea6
add new savedObject client for refactoring
mengweieric Mar 21, 2023
4eb6ff8
object saver
mengweieric Mar 23, 2023
2ddab52
remove some extra but not required code
mengweieric Mar 24, 2023
2cb37dc
Add observability visualization saved object and embeddable
joshuali925 Mar 30, 2023
d65345f
Add osd visualizations saved object client
joshuali925 Mar 30, 2023
aa6b047
Add temporary workaround for deleting objects
joshuali925 Mar 30, 2023
2880b2f
explorer saved object loader
mengweieric Mar 31, 2023
5f0b804
Fix type in loader and remove redundent await
joshuali925 Mar 31, 2023
4d8ba6f
Refactor to use saved object client factory and actions in explorer
joshuali925 Mar 31, 2023
b3dccec
Replace saved object client instantiate with getInstance
joshuali925 Mar 31, 2023
6a24e75
Disable create new for observability visualizations in core
joshuali925 Apr 3, 2023
947764f
Use consistent display name and visualization title
joshuali925 Apr 3, 2023
8abc0c3
Lint Notebook and NotebookTable in preparation for refactoring (#333)
pjfitzgibbons Mar 24, 2023
2d6c7a9
[Backport main] move performance now to run time dep (#309) (#311)
ps48 Mar 27, 2023
573172c
baseline repo permissions and groups (#314)
derek-ho Mar 31, 2023
0cb11bd
Update observability visualization id and displayed name
joshuali925 Apr 3, 2023
331251f
Fix types and object property access in ppl loader
joshuali925 Apr 4, 2023
ced9040
Fix type definition for VisualizationSavedObjectAttributes
joshuali925 Apr 4, 2023
35e2e3a
data fetcher
mengweieric Apr 4, 2023
c90b58f
use new saved object client in panel for getting visualizations
mengweieric Apr 4, 2023
50dce49
Use placeholder icon for visualization embeddable
joshuali925 Apr 4, 2023
ebdd3ea
Update panels to support vis saved in .kibana and .observability
joshuali925 Apr 4, 2023
bdfce75
Remove duplicated logic for loading a saved object in explorer
joshuali925 Apr 4, 2023
27b2505
Allow adding updated visualizations to panels
joshuali925 Apr 4, 2023
87de648
Make visualization.sub_type optional
joshuali925 Apr 4, 2023
941f497
Pass currently selected time interval ref instead of value
joshuali925 Apr 4, 2023
dde94bc
Parse user configs field in app analytics
joshuali925 Apr 4, 2023
9f829cb
Fix visualizations icon in explorer home
joshuali925 Apr 4, 2023
1189139
Allow notebooks to read saved visualiations from .kibana index
joshuali925 Apr 5, 2023
6bcefe3
adjust tab size
mengweieric Apr 5, 2023
786034d
use scss variable, make query tab more condense
mengweieric Apr 5, 2023
4578974
adjust line height again to make tab more condense to address review …
mengweieric Apr 5, 2023
8d0e517
fix update viz button issue
mengweieric Apr 5, 2023
6a0cf3c
Update ppl icon
joshuali925 Apr 6, 2023
a939098
Add mocks for unit test setup
joshuali925 Apr 6, 2023
0ab84f2
Update jest snapshots
joshuali925 Apr 6, 2023
40cc1f2
Merge branch 'main' into explorer-modular-and-hooks
joshuali925 Apr 7, 2023
5c2605a
fix bug for not getting all fields when query contains stats
mengweieric Apr 9, 2023
a18f389
Add management section to saved object
joshuali925 Apr 7, 2023
ece07f5
Create new vis tab when creating ppl in visualize
joshuali925 Apr 10, 2023
5fe84f0
Allow filter by time range without PPL query in panels
joshuali925 Apr 11, 2023
415e9e5
Fix not able to create metrics in event analytics
joshuali925 Apr 11, 2023
e9647ef
Accept generic type for saved objects get response
joshuali925 Apr 11, 2023
2a25130
Fetch vis from observability and OSD indices in metrics analytics
joshuali925 Apr 11, 2023
ad665d5
Check for routerContext existence
joshuali925 Apr 11, 2023
6813b03
Fix app analytics base query label position
joshuali925 Apr 11, 2023
a6552b9
Fix pagination in event analytics table
joshuali925 Apr 11, 2023
617482f
Fix typo in SaveAsCurrentQuery
joshuali925 Apr 13, 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
12 changes: 11 additions & 1 deletion common/constants/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

import { htmlIdGenerator } from '@elastic/eui';
import { VIS_CHART_TYPES } from './shared';
import { ThresholdUnitType } from '../../public/components/event_analytics/explorer/visualizations/config_panel/config_panes/config_controls/config_thresholds';
import { VIS_CHART_TYPES } from './shared';

export const EVENT_ANALYTICS_DOCUMENTATION_URL =
'https://opensearch.org/docs/latest/observability-plugin/event-analytics/';
Expand All @@ -31,6 +31,11 @@ export const TAB_EVENT_ID_TXT_PFX = 'main-content-events-';
export const TAB_CHART_ID_TXT_PFX = 'main-content-vis-';
export const TAB_EVENT_ID = 'main-content-events';
export const TAB_CHART_ID = 'main-content-vis';
export const CREATE_TAB_PARAM_KEY = 'create';
export const CREATE_TAB_PARAM = {
[TAB_EVENT_ID]: 'events',
[TAB_CHART_ID]: 'visualizations',
} as const;
export const HAS_SAVED_TIMESTAMP = 'hasSavedTimestamp';
export const FILTER_OPTIONS = ['Visualization', 'Query', 'Metric'];
export const SAVED_QUERY = 'savedQuery';
Expand Down Expand Up @@ -309,3 +314,8 @@ export const sampleLogPatternData = {
"Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1"',
anomalyCount: 0,
};

export const TYPE_TAB_MAPPING = {
[SAVED_QUERY]: TAB_EVENT_ID,
[SAVED_VISUALIZATION]: TAB_CHART_ID,
};
28 changes: 9 additions & 19 deletions common/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ import SavedObjects from '../../public/services/saved_objects/event_analytics/sa
import TimestampUtils from '../../public/services/timestamp/timestamp';
import PPLService from '../../public/services/requests/ppl';
import DSLService from '../../public/services/requests/dsl';
import { SavedObjectsStart } from '../../../../src/core/public/saved_objects';
import {
SavedObjectAttributes,
SavedObjectsStart,
} from '../../../../src/core/public/saved_objects';

export interface IQueryTab {
id: string;
name: React.ReactNode | string;
content: React.ReactNode;
}

export interface IField {
export interface IField extends SavedObjectAttributes {
name: string;
type: string;
label?: string;
Expand Down Expand Up @@ -152,33 +155,20 @@ export interface SavedQuery {
selected_timestamp: IField;
}

export interface SavedVisualization {
export interface SavedVisualization extends SavedObjectAttributes {
description: string;
name: string;
query: string;
selected_date_range: { start: string; end: string; text: string };
selected_fields: { text: string; tokens: [] };
selected_timestamp: IField;
type: string;
sub_type?: 'metric' | 'visualization'; // exists if sub type is metric
user_configs?: string;
units_of_measure?: string;
application_id?: string;
}

export interface SavedQueryRes {
createdTimeMs: number;
lastUpdatedTimeMs: number;
objectId: string;
savedQuery: SavedQuery;
tenant: string;
}

export interface SavedVizRes {
createdTimeMs: number;
lastUpdatedTimeMs: number;
objectId: string;
savedVisualization: SavedVisualization;
tenant: string;
}

export interface ExplorerDataType {
jsonData: object[];
jsonDataAll: object[];
Expand Down
19 changes: 19 additions & 0 deletions common/types/observability_saved_object_attributes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { SavedObjectAttributes } from '../../../../src/core/types';
import { SavedVisualization } from './explorer';

export const VISUALIZATION_SAVED_OBJECT = 'observability-visualization';
export const OBSERVABILTY_SAVED_OBJECTS = [VISUALIZATION_SAVED_OBJECT] as const;
export const SAVED_OBJECT_VERSION = 1;

export interface VisualizationSavedObjectAttributes extends SavedObjectAttributes {
title: string;
description: string;
version: number;
createdTimeMs: number;
savedVisualization: SavedVisualization;
}
Comment on lines +13 to +19
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that we are using the public service for SavedObjects. The server service has more options for something like version: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/416eb508b3b22fe81231b726dcfce09e3aad9bfb/src/core/server/saved_objects/service/saved_objects_client.ts#L47-L71
Did we take a look at it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version can be passed as a create option in server but not in frontend. https://github.com/opensearch-project/opensearch-dashboards/blob/11b98ec05483269917c335fcb1900bf98da8cac6/src/core/public/saved_objects/saved_objects_client.ts#L54

If we want to use it then saved object client should be called in server? But this seems to be the version of a specific object that will change on each update, not sure if it would be useful for us

  /**
   * An opaque version number which changes on each successful write operation.
   * Can be used in conjunction with `overwrite` for implementing optimistic concurrency control.
   **/
  version?: string;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That isn't required then. 👍🏽

41 changes: 41 additions & 0 deletions common/utils/core_services.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import {
HttpStart,
IUiSettingsClient,
NotificationsStart,
SavedObjectsClientContract,
ToastInput,
} from '../../../../src/core/public';
import { createGetterSetter } from '../../../../src/plugins/opensearch_dashboards_utils/common';
import PPLService from '../../public/services/requests/ppl';
import { QueryManager } from '../query_manager';

let uiSettings: IUiSettingsClient;
let notifications: NotificationsStart;

export const uiSettingsService = {
init: (client: IUiSettingsClient, notificationsStart: NotificationsStart) => {
uiSettings = client;
notifications = notificationsStart;
},
get: (key: string, defaultOverride?: any) => {
return uiSettings?.get(key, defaultOverride) || '';
},
set: (key: string, value: any) => {
return uiSettings?.set(key, value) || Promise.reject('uiSettings client not initialized.');
},
addToast: (toast: ToastInput) => {
return notifications.toasts.add(toast);
},
};

export const [getPPLService, setPPLService] = createGetterSetter<PPLService>('PPLService');
export const [getOSDHttp, setOSDHttp] = createGetterSetter<HttpStart>('http');
export const [getOSDSavedObjectsClient, setOSDSavedObjectsClient] = createGetterSetter<
SavedObjectsClientContract
>('SavedObjectsClient');
export const [getQueryManager, setQueryManager] = createGetterSetter<QueryManager>('QueryManager');
3 changes: 2 additions & 1 deletion common/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export {
composeFinalQuery,
removeBacktick,
} from './query_utils';
export { uiSettingsService } from './settings_service';

export * from './core_services';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use * here? Is linting allowing it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint didn't complain but I was going to remove functions in core_services. didn't find a way yet since embeddable is not rendered by observability plugin but also needs PPLService

11 changes: 9 additions & 2 deletions common/utils/query_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
PPL_INDEX_INSERT_POINT_REGEX,
PPL_INDEX_REGEX,
PPL_NEWLINE_REGEX,
PPL_STATS_REGEX,
} from '../../common/constants/shared';

/**
Expand Down Expand Up @@ -42,6 +41,7 @@ export const preprocessQuery = ({
selectedPatternField,
patternRegex,
filteredPattern,
whereClause,
}: {
rawQuery: string;
startTime: string;
Expand All @@ -51,6 +51,7 @@ export const preprocessQuery = ({
selectedPatternField?: string;
patternRegex?: string;
filteredPattern?: string;
whereClause?: string;
}) => {
let finalQuery = '';

Expand All @@ -65,7 +66,13 @@ export const preprocessQuery = ({

finalQuery = `${tokens![1]}=${
tokens![2]
} | where ${timeField} >= '${start}' and ${timeField} <= '${end}'${tokens![3]}`;
} | where ${timeField} >= '${start}' and ${timeField} <= '${end}'`;

if (whereClause) {
finalQuery += ` AND ${whereClause}`;
}
Comment on lines +71 to +73
Copy link
Copy Markdown
Member

@ps48 ps48 Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. 😄

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is temporary and will change when we support DSL in PPL where clauses


finalQuery += tokens![3];

if (isLiveQuery) {
finalQuery = finalQuery + ` | sort - ${timeField}`;
Expand Down
25 changes: 0 additions & 25 deletions common/utils/settings_service.ts

This file was deleted.

10 changes: 6 additions & 4 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
"ui": true,
"requiredPlugins": [
"charts",
"dashboard",
"data",
"embeddable",
"inspector",
"urlForwarding",
"navigation",
"opensearchDashboardsReact",
"opensearchDashboardsUtils",
"savedObjects",
"uiActions",
"dashboard",
"visualizations",
"opensearchDashboardsReact"
"urlForwarding",
"visualizations"
]
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,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",
Expand All @@ -48,7 +48,8 @@
"eslint": "^6.8.0",
"husky": "6.0.0",
"jest-dom": "^4.0.0",
"lint-staged": "^13.1.0"
"lint-staged": "^13.1.0",
"ts-jest": "^29.1.0"
},
"resolutions": {
"react-syntax-highlighter": "^15.4.3",
Expand Down
Loading