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(DataSource): Persist the last selected data source #60

Merged
merged 4 commits into from
Jul 16, 2024

Conversation

grafakus
Copy link
Contributor

✨ Description

Related issue(s): #42

📖 Summary of the changes

Now, when a user selects a different data source in the UI, it is stored in local storage.
This value is then used as default when the user revisits the Explore Profiles app.

🧪 How to test?

Manually, in an instance with multiple data sources:

  • Land on the page for the first time, select a different data source
  • Navigate to (e.g.) a dashboard
  • Go back to Explore Profiles
  • The data source that was selected in the 1st step is selected

Copy link
Contributor

github-actions bot commented Jul 16, 2024

Unit test coverage

Lines Statements Branches Functions
Coverage: 12%
12.89% (457/3543) 10.42% (136/1305) 9.81% (105/1070)

@grafakus grafakus changed the title feat(DataSource): Store selected data source in local storage feat(DataSource): Persist the last selected data source Jul 16, 2024
});

describe('if there is NO data source uid in the URL', () => {
describe('if there is a data source in local storage', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New unit test

expect(apiClient.baseUrl).toBe(expectedApiBaseUrl);
});
});
function setupMocks(options?: { appUrl?: string; bootData?: Record<string, any>; dataSources?: Record<string, any> }) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took the opportunity to refactor these tests by creating the setupMocks helper function.

Copy link
Contributor

@simonswine simonswine left a comment

Choose a reason for hiding this comment

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

LGTM

@grafakus grafakus merged commit 9f7ede1 into main Jul 16, 2024
6 checks passed
@grafakus grafakus deleted the feat/ds-in-local-storage branch July 16, 2024 16:38
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.

3 participants