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

Modify the adding sample data part for timeline #6919

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

zhyuanqi
Copy link
Collaborator

@zhyuanqi zhyuanqi commented Jun 5, 2024

Description

Modify the adding sample data part for timeline to add data source name if customer has enabled MDS

Issues Resolved

#6123

Screenshot

Screen.Recording.2024-06-05.at.12.26.50.AM.mov

Testing the changes

Please see screenshot

Changelog

  • fix: Modify the adding sample data part for timeline

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.

Project coverage is 67.43%. Comparing base (0188efe) to head (e4bce6b).

Files Patch % Lines
src/core/server/saved_objects/import/utils.ts 90.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6919   +/-   ##
=======================================
  Coverage   67.42%   67.43%           
=======================================
  Files        3443     3443           
  Lines       67782    67806   +24     
  Branches    11027    11031    +4     
=======================================
+ Hits        45705    45723   +18     
- Misses      19412    19417    +5     
- Partials     2665     2666    +1     
Flag Coverage Δ
Linux_1 33.09% <14.28%> (-0.01%) ⬇️
Linux_2 55.06% <66.66%> (+<0.01%) ⬆️
Linux_3 45.20% <14.28%> (-0.02%) ⬇️
Linux_4 34.88% <85.18%> (+0.03%) ⬆️
Windows_1 33.11% <14.28%> (-0.01%) ⬇️
Windows_2 55.01% <66.66%> (-0.02%) ⬇️
Windows_3 45.21% <14.28%> (-0.02%) ⬇️
Windows_4 34.88% <85.18%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BionIT BionIT self-assigned this Jun 5, 2024
@zhyuanqi zhyuanqi force-pushed the timeline branch 2 times, most recently from 4732241 to dcb93eb Compare June 5, 2024 20:14
const replaceCallback = (match: string, funcName: string, args: string) => {
if (!args.includes('data_source_name')) {
args = args.trim();
args = `${args}, data_source_name=${dataSourceTitle}`;
Copy link
Member

Choose a reason for hiding this comment

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

We should wrap the dataSourceTitle in "" since titles can have spaces (ex: dataSourceTitle="Some DataSource A")

Suggested change
args = `${args}, data_source_name=${dataSourceTitle}`;
args = `${args}, data_source_name="${dataSourceTitle}"`;

Copy link
Member

Choose a reason for hiding this comment

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

And update relevant test cases as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for pointing this out! Did not realize we can have name with space. Would modify and update test case

@@ -111,12 +130,22 @@ export const extractVegaSpecFromSavedObject = (savedObject: SavedObject) => {
return undefined;
};

const isVegaVisualization = (savedObject: SavedObject) => {
export const extractTimelineExpression = (savedObject: SavedObject) => {
if (confirmVisualizationType(savedObject, 'timelion')) {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Logic should be the other way around. We should terminate early and return undefined if the visualization is not timelion

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure. Would make the change

@zhyuanqi zhyuanqi force-pushed the timeline branch 2 times, most recently from bf4ab28 to 8aa3af9 Compare June 5, 2024 21:31
const replaceCallback = (match: string, funcName: string, args: string) => {
if (!args.includes('data_source_name')) {
args = args.trim();
args = `${args}, data_source_name="${dataSourceTitle}"`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

As best practice, we should not mutate the input, can we assign a new variable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure. Let me change the variable name.

@zhyuanqi zhyuanqi force-pushed the timeline branch 4 times, most recently from f88aca7 to df5591d Compare June 5, 2024 21:55
Signed-off-by: Yuanqi(Ella) Zhu <zhyuanqi@amazon.com>
@zhyuanqi zhyuanqi merged commit 48144c8 into opensearch-project:main Jun 5, 2024
67 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 5, 2024
Signed-off-by: Yuanqi(Ella) Zhu <zhyuanqi@amazon.com>
(cherry picked from commit 48144c8)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
zhyuanqi pushed a commit that referenced this pull request Jun 6, 2024
Signed-off-by: Yuanqi(Ella) Zhu <zhyuanqi@amazon.com>
(cherry picked from commit 48144c8)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
zhongnansu pushed a commit that referenced this pull request Jun 6, 2024
(cherry picked from commit 48144c8)

Signed-off-by: Yuanqi(Ella) Zhu <zhyuanqi@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
zhyuanqi added a commit to zhyuanqi/OpenSearch-Dashboards that referenced this pull request Jun 6, 2024
)

Signed-off-by: Yuanqi(Ella) Zhu <zhyuanqi@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants