Project

General

Profile

« Previous | Next » 

Revision d3f47405

Added by Dominic Cleal about 7 years ago

fixes #19464 - rewrite Dashboard::Manager to support autoloading

Replaces class-level widget storage with a static list of built-in
widgets, then appends the registered plugin widgets to get the full
default list of widgets. As a result, the class can safely be reloaded
when modified and is more testable as class-level state is removed.

View differences:

config/initializers/foreman.rb
# All are loaded and populated early but are loaded only once
require_dependency 'foreman/access_permissions'
require_dependency 'menu/loader'
require_dependency 'dashboard/loader'
require_dependency 'foreman/plugin'
# Other internal dependencies, may be autoloaded
......
#load topbar
Menu::Loader.load
#load dashboard widgets
Dashboard::Loader.load
# clear our users topbar cache
# The users table may not be exist during initial migration of the database
TopbarSweeper.expire_cache_all_users if (User.table_exists? rescue false)

Also available in: Unified diff