Project

General

Profile

Actions

Refactor #19464

closed

Move Dashboard::Manager out of app/registries/ to permit autoloading

Added by Dominic Cleal almost 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Dashboard
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Dashbaord::Manager has always been excluded from autoloading as it kept a list of known widgets in a class variable. In #10927, it was moved to app/registries/ to preserve this status and keep it from being autoloaded.

It is possible to rewrite this class in an autoload-friendly manner, where the list of builtin widgets is hardcoded inside the class and then the total list of default widgets is retrieved from Foreman::Plugin when required, instead of plugins appending to the dashboard class variable.

This would:

  1. Allow the source file to be kept in app/services/, easier for people to find
  2. Allow the class to be reloaded in development, so changes to builtin widgets are immediately visible
  3. Allow initialisation to be removed from config/initializers/, speeding up the application load time
  4. Make the class more testable, by removing modifications to class variables

Related issues 1 (0 open1 closed)

Related to Foreman - Bug #10927: Resetting dashboard to default widgets adds no widgetsClosedDominic Cleal06/25/2015Actions
Actions

Also available in: Atom PDF