Presenter pattern to abstract Compute Resources UI

core

#1

Proposal for a usage of presenter pattern to solve a problem with one view per ComputeResource all over the code base.

Motivation:
We have found an N+1 queries issue in Compute Resource vm listings [1]. @Marek_Hulan has created a simple solution tested on vmware [2]. In the process of reviews we found out that the solution will work just for some ComputeResources though.

Solution:
We need a better control over the similarities and differences in ComputeResources UI (presenting) and we can do so by introducing presenter pattern and encapsulate ComputeResource UI differences in OOP fashion.

I have a little POC solving the issue described in motivation: github.com/ezr-ondrej/foreman/vmware_listing_performance

[1] Bug #26567: n+1 when listing VMs on VMware - Foreman
[2] https://github.com/theforeman/foreman/pull/6666


#2

Awesome! I think we should use the same pattern on more places. :+1: from me


#3

Yeah, if we decide to roll with it, I would like to see most of the Resource specific views removed (moved to presenters) :blush: