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

feat: [contentManagement] allow to update section input after page rendered #7651

Merged

Conversation

ruanyl
Copy link
Member

@ruanyl ruanyl commented Aug 8, 2024

This PR makes it possible to update the section input after the page is rendered, for example, when rendering a dashboard on the page, we need to apply the date range, filter and query on the fly.

Description

Issues Resolved

Screenshot

Testing the changes

Changelog

  • feat: [contentManagement] allow to update section input after page rendered

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

This makes it possible a dashboard rendered by content management plugin
to update the query, time range and filters on the fly

Signed-off-by: Yulong Ruan <[email protected]>
Copy link

codecov bot commented Aug 8, 2024

Codecov Report

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

Project coverage is 63.68%. Comparing base (0bb53dd) to head (5b4f30e).
Report is 10 commits behind head on main.

Files Patch % Lines
...s/content_management/content_management_service.ts 85.71% 0 Missing and 1 partial ⚠️
...agement/public/services/content_management/page.ts 90.90% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7651   +/-   ##
=======================================
  Coverage   63.68%   63.68%           
=======================================
  Files        3633     3633           
  Lines       80101    80122   +21     
  Branches    12690    12697    +7     
=======================================
+ Hits        51009    51026   +17     
- Misses      25985    25987    +2     
- Partials     3107     3109    +2     
Flag Coverage Δ
Linux_1 30.59% <0.00%> (-0.01%) ⬇️
Linux_2 55.58% <ø> (ø)
Linux_3 40.58% <90.00%> (+0.02%) ⬆️
Linux_4 31.29% <0.00%> (-0.02%) ⬇️
Windows_1 30.60% <0.00%> (-0.01%) ⬇️
Windows_2 55.53% <ø> (ø)
Windows_3 40.58% <90.00%> (+0.02%) ⬆️
Windows_4 31.29% <0.00%> (-0.02%) ⬇️

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.

@ruanyl ruanyl added the v2.17.0 label Aug 8, 2024
query: {
query: '',
language: 'lucene',
language: 'kuery',
Copy link
Member

@SuZhou-Joe SuZhou-Joe Aug 13, 2024

Choose a reason for hiding this comment

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

What's the difference between the language here? I guess it will be overwritten by ...section.input?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it can be override by section.input. Here it just changed the default language from lucene to kuery(DQL).

}

const updated = callback(section);
if (updated) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How would you feel about doing

if (updated.kind !== section.kind) return;

... and then a switch-case for dashboard, card, and custom?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea! I will adopt this change in the upcoming PR

Copy link
Member Author

Choose a reason for hiding this comment

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

image Seems TS compiler is not happy with that ;D

@ruanyl ruanyl merged commit b68754e into opensearch-project:main Aug 13, 2024
69 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 13, 2024
…ndered (#7651)

* feat: allow to update section input on the fly

This makes it possible a dashboard rendered by content management plugin
to update the query, time range and filters on the fly

Signed-off-by: Yulong Ruan <[email protected]>

* Changeset file for PR #7651 created/updated

* fix(linter): add license header

Signed-off-by: Yulong Ruan <[email protected]>

---------

Signed-off-by: Yulong Ruan <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit b68754e)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ruanyl pushed a commit that referenced this pull request Aug 15, 2024
…ndered (#7651) (#7694)

* feat: allow to update section input on the fly

This makes it possible a dashboard rendered by content management plugin
to update the query, time range and filters on the fly



* Changeset file for PR #7651 created/updated

* fix(linter): add license header



---------



(cherry picked from commit b68754e)

Signed-off-by: Yulong Ruan <[email protected]>
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>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants