Add project "stat-"entry for Terraform State in Project overview page (when Terraform State file exists)
Problem to solve
In Manage / admin the GitLab Managed State we want to allow a Project maintainer administer the State files included in a GitLa project. To that end we are introducing a Terraform submenu item under Operations where the user will be able to see the State file listing.
However, the user might never navigate to Operations to discover the Terraform menu and the ability to view and manage State file. The scope of this issue is to work on a solution to make the user aware of the State files UI in their project and facilitate them to navigate to them.
Also, the State file information is critical information for a Terraform project and adding it below the Project title follows GitLab's patterns and will enhance the information provided for this kind of project.
Intended users
Same as parent project.
User experience goal
- Make the users aware of the existence of a State file.
- Give the users an easy and quick way to navigate to the project's state files.
Proposal
(We need to review the icon as it is a repetition of the files size) /cc @jeldergl
Further details
- The link will become visible as soon as a Terraform State file exists within the project.
Permissions and Security
- The link is available to click to any user who has access to the project.
What does success look like, and how can we measure that?
We can track the clicks on the link.
What is the type of buyer?
Is this a cross-stage feature?
Yes, this will need to be implemented in the Project details page.
Links / references
Implementation plan
- Update
app/presenters/project_presenter.rb
adding Terraform states data- use
@project.terraform_states.exists?
method to check if the terraform state exists within the project (as we don't want to show the item if no states are available for the project) - use
current_user.can?(:read_terraform_state, project)
to check if the user can read the terraform state - use
terraform_states.count
to get the states quantity - use
project_terraform_index_path(project)
to get the states index path
- use
- Include the Terraform states data to the
statistics_anchors
- Update
spec/presenters/project_presenter_spec.rb
to include corresponding tests