SUSE-Enceladus / blue-horizon

web-based user interface to terraforming the public cloud
GNU General Public License v3.0
11 stars 8 forks source link

Terraform plan view helper #163

Closed stefanotorresi closed 3 years ago

stefanotorresi commented 3 years ago

This PR adds a view helper to render the Terraform plan with a couple of new view templates.

The template can be selected with the newly introduced terraform_plan_view key in vendor/customization.json, e.g. "terraform_plan_view": "plans/json" will use the old template.

The new templates introduced are plans/dynamic and plans/custom:

plans/dynamic

This is a generic template that should work with any Terraform project. Screenshot from 2020-10-30 12-59-31

plans/custom

This template makes assumptions about the Terraform plan structure and is only suitable for our SAP Azure deployments. Screenshot from 2020-10-30 13-16-24

Note: The asynchronous loading of the plan is broken for both the new templates, so a full refresh of the page is needed to show the updated plan. I don't really know how to fix this at the moment, as I'm not familiar with the XHR handling within PlansController. This is why this PR is just a draft for now. Maybe @bear454 can give me some pointers in this regard?

arbulu89 commented 3 years ago

@stefanotorresi Beautiful! I prefer the custom option for our use case. I think we need to relocate some items (and add others, like the bastion host), but in general shows the essence for the format I would like to expose to the user.

codecov[bot] commented 3 years ago

Codecov Report

Merging #163 into sap-azure will decrease coverage by 6.49%. The diff coverage is 21.42%.

Impacted file tree graph

@@              Coverage Diff              @@
##           sap-azure     #163      +/-   ##
=============================================
- Coverage     100.00%   93.50%   -6.50%     
=============================================
  Files             26       25       -1     
  Lines            694      662      -32     
=============================================
- Hits             694      619      -75     
- Misses             0       43      +43     
Impacted Files Coverage Δ
app/helpers/plan_helper.rb 18.51% <18.51%> (ø)
app/controllers/plans_controller.rb 86.27% <100.00%> (-13.73%) :arrow_down:
app/decorators/cluster_size_slider_decorator.rb 45.45% <0.00%> (-54.55%) :arrow_down:
app/controllers/clusters_controller.rb 53.33% <0.00%> (-46.67%) :arrow_down:
app/controllers/variables_controller.rb 95.65% <0.00%> (-4.35%) :arrow_down:
app/models/source.rb 100.00% <0.00%> (ø)
app/models/cluster.rb 100.00% <0.00%> (ø)
app/models/variable.rb 100.00% <0.00%> (ø)
app/helpers/variables_helper.rb 100.00% <0.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 072a820...a29d128. Read the comment docs.

stefanotorresi commented 3 years ago

moved to SUSE/blue-horizon#7