Always display environment selector in Metrics dashboard
What does this MR do?
A customer had dev, staging and production environments, but deployments were done only to dev and staging. When the customer opened the monitoring/metrics dashboard (Operations > Metrics), they saw no metrics (probably the "No data found" empty state) even though dev and staging should have had metrics.
What caused it
Opening Operations > Metrics redirects to the production environment's Metrics dashboard, if there is a production environment. If there is no production environment, it redirects to the oldest environment's metrics dashboard. Due to this, the production environment's metrics dashboard was being opened for the above customer. Since there was no deployment to the production environment, it displayed the "No data found" empty state.
The "No data found" empty state (and the "Failed to connect to the prometheus server" state) do not display the environment selector dropdown, which makes it difficult to change to another environment's metrics dashboard. It also makes it difficult to know which environment's metrics dashboard one is currently viewing.
More details at gitlab-ee#11164 (comment 181074520).
What this MR does
This MR causes the environment selector to be displayed in the "No data found" and "Failed to connect to the prometheus server" states. This should make it easy for the user to see which environment's metrics dashboard they are currently viewing and change it if necessary (after this bug is solved).
This does not affect Cluster Health graphs:
Does this MR meet the acceptance criteria?
- Changelog entry
- Documentation created/updated or follow-up review issue created
- Code review guidelines
- Merge request performance guidelines
- Style guides
- Database guides
- Separation of EE specific content
Performance and testing
- Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
- Tested in all supported browsers
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
Label as security and @ mention
- The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- Security reports checked/validated by a reviewer from the AppSec team