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/operational panels backend #130

Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const observabilityPluginOrder = 6000;
export const UI_DATE_FORMAT = 'MM/DD/YYYY hh:mm A';
export const PPL_DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss';
export const PPL_INDEX_REGEX = /(search source|source|index)\s*=\s*([^|\s]+)/i;
export const PPL_CONTAINS_TIMESTAMP_REGEX = /\|\s*.*\s*[<|<=|=|>=|>]\s*timestamp\([^\)]+\)/i;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need this timestamp regex in custom panel? This was added previously but the new requirement asks to not check if a query contains a date range anymore, I've already removed on my side.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is added here cause, I still need to remove time range from queries in "savedVisualization" data modal.

  1. If we are still allowing the users to add time range in query in event analytics, then I need to remove them explicitly in panels' visualizations.
  2. If we are not allowing users to add time range in query in event analytics, then I'll remove this check.
    Please let me know if got something wrong here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

When saving the query and visualization, date range will not be added to query and only be added as that separate selected date range in data model. After having the new requirement, date range is only added to query on the background when searching for query data.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yes, I understand this point that date range is stored separately and only added in runtime. But, I would like to know what happens if the user adds a time range in the query? Do we explicitly remove? Or Do we throw an error toast saying "adding time range is not allowed in query"? If we have such checks I'll remove the checks from my side.


// Observability plugin URI
const BASE_OBSERVABILITY_URI = '/_plugins/_observability';
Expand Down
44 changes: 44 additions & 0 deletions common/types/custom_panels.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

export type VisualizationType = {
id: string;
title: string;
x: number;
y: number;
w: number;
h: number;
query: string;
type: string;
timeField: string;
};

export type PanelType = {
name: string;
visualizations: VisualizationType[];
timeRange: { to: string; from: string };
queryFilter: { query: string; language: string };
};

export type SavedVisualizationType = {
id: string;
name: string;
query: string;
type: string;
timeField: string;
};

export type pplResponse = {
data: any;
metadata: any;
size: number;
status: number;
};
Loading