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

Add assistant capabilities to control rendering components #267

Merged
merged 14 commits into from
Sep 11, 2024

Conversation

songkant-aws
Copy link
Contributor

@songkant-aws songkant-aws commented Sep 2, 2024

Description

Add assistant feature capabilities to allow users to override capability switcher function to control whether to show assistant feature UI components.

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test.
  • New functionality has user manual doc added.
  • Commits are signed per the DCO using --signoff.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.44%. Comparing base (4f33fa0) to head (20a279e).
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #267      +/-   ##
==========================================
- Coverage   90.34%   89.44%   -0.91%     
==========================================
  Files          59       60       +1     
  Lines        1575     1668      +93     
  Branches      377      407      +30     
==========================================
+ Hits         1423     1492      +69     
- Misses        150      174      +24     
  Partials        2        2              

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

Signed-off-by: Songkan Tang <[email protected]>
@songkant-aws songkant-aws changed the title Assistant capabilities Add assistant capabilities to control rendering components Sep 3, 2024
@gaobinlong gaobinlong added backport 2.x Trigger the backport flow to 2.x v2.17.0 labels Sep 4, 2024
@@ -6,8 +6,7 @@
import { schema, TypeOf } from '@osd/config-schema';

export const configSchema = schema.object({
// TODO: add here to prevent this plugin from being loaded
// enabled: schema.boolean({ defaultValue: true }),
enabled: schema.boolean({ defaultValue: true }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

enable this will allow whole dashboard assistant been disabled, is this expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think it's upon agreement. Is it true? @ruanyl

Copy link
Member

Choose a reason for hiding this comment

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

I think so, this flag allows us to turnoff the entire plugin

Comment on lines 172 to 174
} else {
return () => {};
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want to render some tips or instructions to direct user to active the subscription?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add a default "Application Not Activated" danger tips now

Signed-off-by: Songkan Tang <[email protected]>
Signed-off-by: Songkan Tang <[email protected]>
server/plugin.ts Outdated
}

core.capabilities.registerProvider(capabilitiesProvider);
core.capabilities.registerSwitcher(capabilitiesSwitcher);
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this switcher in dashboards-assistant? The default value is true already, maybe just let whoever need to update the value to register the switcher?

Copy link
Contributor Author

@songkant-aws songkant-aws Sep 11, 2024

Choose a reason for hiding this comment

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

Sure, that also makes sense. Developers can register their own switch per requirement. Removed the switcher registration now.

@ruanyl ruanyl merged commit 4ec4f92 into opensearch-project:main Sep 11, 2024
10 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/dashboards-assistant/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/dashboards-assistant/backport-2.x
# Create a new branch
git switch --create backport/backport-267-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 4ec4f92b1ca2218fd5eb5498b73c1508f35262d0
# Push it to GitHub
git push --set-upstream origin backport/backport-267-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/dashboards-assistant/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-267-to-2.x.

@ruanyl
Copy link
Member

ruanyl commented Sep 11, 2024

@songkant-aws backport to 2.x failed.

@songkant-aws
Copy link
Contributor Author

@songkant-aws backport to 2.x failed.

Ok, will fix it. The PR is merged after this one [#266 ]. Since some conflicts are resolved based on #266, I will wait for its backport. Let me ping the owner to backport #266.

@songkant-aws songkant-aws mentioned this pull request Sep 12, 2024
4 tasks
@ruanyl ruanyl added backport 2.x Trigger the backport flow to 2.x and removed backport 2.x Trigger the backport flow to 2.x labels Sep 12, 2024
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/dashboards-assistant/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/dashboards-assistant/backport-2.x
# Create a new branch
git switch --create backport/backport-267-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 4ec4f92b1ca2218fd5eb5498b73c1508f35262d0
# Push it to GitHub
git push --set-upstream origin backport/backport-267-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/dashboards-assistant/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-267-to-2.x.

@ruanyl ruanyl added backport 2.x Trigger the backport flow to 2.x and removed backport 2.x Trigger the backport flow to 2.x labels Sep 12, 2024
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 12, 2024
* Add capabilities to check subscription active status to control assistant feature UI

Signed-off-by: Songkan Tang <[email protected]>

* Fix text2viz feature flag check in server/plugin.ts

Signed-off-by: Songkan Tang <[email protected]>

* Use assistant isSubscriptionActive capabilities to control text2viz UI

Signed-off-by: Songkan Tang <[email protected]>

* Add changelog

Signed-off-by: Songkan Tang <[email protected]>

* Add default app not activation page for text2viz if subscription is not activated

Signed-off-by: Songkan Tang <[email protected]>

* Rename assistant feature UI capabilities to a more general name

Signed-off-by: Songkan Tang <[email protected]>

* Rename changelog

Signed-off-by: Songkan Tang <[email protected]>

* Rephrase app not found page

Signed-off-by: Songkan Tang <[email protected]>

* Remove switcher registration in favor of developers adding it per their requirement

Signed-off-by: Songkan Tang <[email protected]>

---------

Signed-off-by: Songkan Tang <[email protected]>
(cherry picked from commit 4ec4f92)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
ruanyl pushed a commit that referenced this pull request Sep 12, 2024
* Add capabilities to check subscription active status to control assistant feature UI

Signed-off-by: Songkan Tang <[email protected]>

* Fix text2viz feature flag check in server/plugin.ts

Signed-off-by: Songkan Tang <[email protected]>

* Use assistant isSubscriptionActive capabilities to control text2viz UI

Signed-off-by: Songkan Tang <[email protected]>

* Add changelog

Signed-off-by: Songkan Tang <[email protected]>

* Add default app not activation page for text2viz if subscription is not activated

Signed-off-by: Songkan Tang <[email protected]>

* Rename assistant feature UI capabilities to a more general name

Signed-off-by: Songkan Tang <[email protected]>

* Rename changelog

Signed-off-by: Songkan Tang <[email protected]>

* Rephrase app not found page

Signed-off-by: Songkan Tang <[email protected]>

* Remove switcher registration in favor of developers adding it per their requirement

Signed-off-by: Songkan Tang <[email protected]>

---------

Signed-off-by: Songkan Tang <[email protected]>
(cherry picked from commit 4ec4f92)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Trigger the backport flow to 2.x failed backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants