Skip to content

Modify the adding sample data part for timeline#6919

Merged
zhyuanqi merged 1 commit intoopensearch-project:mainfrom
zhyuanqi:timeline
Jun 5, 2024
Merged

Modify the adding sample data part for timeline#6919
zhyuanqi merged 1 commit intoopensearch-project:mainfrom
zhyuanqi:timeline

Conversation

@zhyuanqi
Copy link
Copy Markdown
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

@codecov
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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


const isVegaVisualization = (savedObject: SavedObject) => {
export const extractTimelineExpression = (savedObject: SavedObject) => {
if (confirmVisualizationType(savedObject, 'timelion')) {
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.

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

Copy link
Copy Markdown
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

Comment thread src/core/server/saved_objects/import/utils.ts
@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
Copy Markdown
Contributor

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
Copy Markdown
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
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