Integrate Terraform module metadata into frontend response
What does this MR do and why?
In Parse and create terraform module metadata (!148569 - merged), we added the ability to parse the uploaded terraform modules and extract the documentation data from them. Those data are then persisted in the database as metadata for the module.
In this MR, we incorporate the metadata for each module in the response back to the frontend, so that we can start displaying them in the show
page of the module in the UI.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- In
rails console
execute the following to create a terraform metadata record that we can test with:
metadatum = FactoryBot.build_stubbed(:terraform_module_metadatum)
details = ::Packages::Detail::PackagePresenter.new(metadatum.package).detail_view
=> {:id=>1020,
:created_at=>Wed, 29 May 2024 13:41:37.615253000 UTC +00:00,
:name=>"module-1/system",
:package_files=>[],
:package_type=>"terraform_module",
:status=>"default",
:project_id=>1019,
:tags=>[],
:updated_at=>Wed, 29 May 2024 13:41:37.615270000 UTC +00:00,
:version=>"1.0.0",
:terraform_module_metadatum=>
#<Packages::TerraformModule::Metadatum:0x000000033df9eb98
created_at: Wed, 29 May 2024 13:41:37.616062000 UTC +00:00,
updated_at: Wed, 29 May 2024 13:41:37.616071000 UTC +00:00,
package_id: 1020,
project_id: 1019,
fields: {"root"=>{"readme"=>"README"}}>,
:dependency_links=>[]}
terraform_module_metadatum
key & value that included in the presenter data.
Related to #438059 (closed)