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

Preserve selected instrument when switching resources #5083

Merged
merged 4 commits into from
Aug 2, 2024

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Jul 26, 2024

Change metrics page to preserve the selected instrument when switching resources if the new resource also has that instrument.

For example, http.client.request.duration is selected in App1. Switching to App2 keeps http.client.request.duration selected if App2 also has values. If App2 doesn't have http.client.request.duration then the instrument is cleared (current behavior).

The goal is to make switching between resources more seamless.


Also, I wrote a bunit test for the metrics page that tests this change.

Microsoft Reviewers: Open in CodeFlow

Comment on lines +35 to +40
private static void ValuedChanged(string value)
{
// Do nothing. Required for bunit change to trigger SelectedOptionChanged.
}
Copy link
Member Author

@JamesNK JamesNK Jul 26, 2024

Choose a reason for hiding this comment

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

@vnbaaij I'm confused why this is needed. I found that it is required for the other change event to trigger in a unit test.

This is what is in the unit test:

        var resourceSelect = cut.FindComponent<ResourceSelect>();
        var innerSelect = resourceSelect.Find("fluent-select");
        innerSelect.Change("TestApp2");

If ValueChanged isn't bound on FluentSelect then SelectedOptionChanged is never called. Adding ValueChanged makes it work 🤷

@JamesNK JamesNK force-pushed the jamesnk/metrics-component-tests branch from dc93dba to a953e5b Compare August 1, 2024 23:08
@JamesNK JamesNK enabled auto-merge (squash) August 2, 2024 01:52
@JamesNK JamesNK merged commit ceb5d5a into main Aug 2, 2024
11 checks passed
@JamesNK JamesNK deleted the jamesnk/metrics-component-tests branch August 2, 2024 02:39
@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants