Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
Revert "refactor: Migrate FleetbaseConsole to new Universe architecture"
roncodesd3555c7c821f
diff --git a/console/app/components/dashboard/widget-panel.js b/console/app/components/dashboard/widget-panel.jsindex 74942388..32afd371 100644--- a/console/app/components/dashboard/widget-panel.js+++ b/console/app/components/dashboard/widget-panel.js@@ -4,11 +4,11 @@ import { inject as service } from '@ember/service';import { action } from '@ember/object';export default class DashboardWidgetPanelComponent extends Component {- @service('universe/widget-service') widgetService;- @service notifications;+ @service universe;@tracked availableWidgets = [];@tracked dashboard;@tracked isOpen = true;+ @service notifications;/*** Constructs the component and applies initial state.@@ -16,7 +16,7 @@ export default class DashboardWidgetPanelComponent extends Component {constructor(owner, { dashboard }) {super(...arguments);- this.availableWidgets = this.widgetService.getWidgets('dashboard');+ this.availableWidgets = this.universe.getDashboardWidgets();this.dashboard = dashboard;}diff --git a/console/app/instance-initializers/initialize-universe.js b/console/app/instance-initializers/initialize-universe.jsdeleted file mode 100644index a3233fe4..00000000--- a/console/app/instance-initializers/initialize-universe.js+++ /dev/null@@ -1,81 +0,0 @@-import { getOwner } from '@ember/application';-import { scheduleOnce } from '@ember/runloop';-import { Widget } from '@fleetbase/ember-core/contracts';--/**- * Initializes the Universe by:- * 1. Creating console-specific registries- * 2. Registering default dashboard widgets- * 3. Loading extension.js files from enabled extensions- * 4. Executing boot callbacks- *- * This replaces the old load-extensions and initialize-widgets initializers.- *- * @param {ApplicationInstance} appInstance The application instance- */-export function initialize(appInstance) {- const universe = appInstance.lookup('service:universe');- const widgetService = appInstance.lookup('service:universe/widget-service');- const registryService = appInstance.lookup('service:universe/registry-service');- const owner = getOwner(appInstance);- const app = owner.application;-- // Set application instance on universe- universe.applicationInstance = appInstance;-- // Create console-specific registries- registryService.createRegistries(['@fleetbase/console', 'auth:login']);-- // Register default dashboard widgets- const defaultWidgets = [- new Widget({- widgetId: 'welcome',- name: 'Welcome',- description: 'Welcome widget for new users',- icon: 'hand-wave',- component: 'widget/welcome',- grid_options: { w: 12, h: 6, minW: 8, minH: 6 }- }),- new Widget({- widgetId: 'getting-started',- name: 'Getting Started',- description: 'Getting started guide',- icon: 'rocket',- component: 'widget/getting-started',- grid_options: { w: 12, h: 12, minW: 8, minH: 12 }- })- ];-- widgetService.registerDefaultWidgets(defaultWidgets);- widgetService.registerWidgets('dashboard', defaultWidgets);-- // Load extension.js files from enabled extensions- // The app.extensions array already respects config + user permissions- const extensions = app.extensions || [];-- extensions.forEach(extensionName => {- try {- // Dynamically require the extension.js file- // This is a small file with only metadata, not the full engine bundle- const setupExtension = require(`${extensionName}/extension`).default;-- if (typeof setupExtension === 'function') {- // Execute the extension setup function- // This registers menus, widgets, hooks, etc. as metadata- setupExtension(appInstance, universe);- }- } catch (error) {- // Silently fail if extension.js doesn't exist- // Extensions can migrate gradually to the new pattern- // console.warn(`Could not load extension.js for ${extensionName}:`, error);- }- });-- // Execute any boot callbacks- scheduleOnce('afterRender', universe, 'executeBootCallbacks');-}--export default {- name: 'initialize-universe',- initialize-};diff --git a/console/app/instance-initializers/initialize-widgets.js b/console/app/instance-initializers/initialize-widgets.jsnew file mode 100644index 00000000..3189e74d--- /dev/null+++ b/console/app/instance-initializers/initialize-widgets.js@@ -0,0 +1,36 @@+import { faGithub } from '@fortawesome/free-brands-svg-icons';++export function initialize(application) {+ const universe = application.lookup('service:universe');+ const defaultWidgets = [+ {+ widgetId: 'fleetbase-blog',+ name: 'Fleetbase Blog',+ description: 'Lists latest news and events from the Fleetbase official team.',+ icon: 'newspaper',+ component: 'fleetbase-blog',+ grid_options: { w: 8, h: 9, minW: 8, minH: 9 },+ options: {+ title: 'Fleetbase Blog',+ },+ },+ {+ widgetId: 'fleetbase-github-card',+ name: 'Github Card',+ description: 'Displays current Github stats from the official Fleetbase repo.',+ icon: faGithub,+ component: 'github-card',+ grid_options: { w: 4, h: 8, minW: 4, minH: 8 },+ options: {+ title: 'Github Card',+ },+ },+ ];++ universe.registerDefaultDashboardWidgets(defaultWidgets);+ universe.registerDashboardWidgets(defaultWidgets);+}++export default {+ initialize,+};diff --git a/console/app/instance-initializers/load-extensions.js b/console/app/instance-initializers/load-extensions.jsnew file mode 100644index 00000000..b262162e--- /dev/null+++ b/console/app/instance-initializers/load-extensions.js@@ -0,0 +1,11 @@+export function initialize(application) {+ const universe = application.lookup('service:universe');+ if (universe) {+ universe.createRegistries(['@fleetbase/console', 'auth:login']);+ universe.bootEngines(application);+ }+}++export default {+ initialize,+};diff --git a/console/app/models/dashboard.js b/console/app/models/dashboard.jsindex e526e1ce..fb1d4342 100644--- a/console/app/models/dashboard.js+++ b/console/app/models/dashboard.js@@ -90,9 +90,9 @@ export default class DashboardModel extends Model {getRegistry() {const owner = getOwner(this);- const widgetService = owner.lookup('service:universe/widget-service');- if (widgetService) {- return widgetService.getRegistry(this.id);+ const universe = owner.lookup('service:universe');+ if (universe) {+ return universe.getDashboardRegistry(this.id);}return undefined;diff --git a/console/app/routes/application.js b/console/app/routes/application.jsindex ed798aa4..740f4893 100644--- a/console/app/routes/application.js+++ b/console/app/routes/application.js@@ -15,8 +15,7 @@ export default class ApplicationRoute extends Route {@service intl;@service currentUser;@service router;- @service('universe/hook-service') hookService;- @service('universe/extension-manager') extensionManager;+ @service universe;@tracked defaultTheme;/**@@ -25,7 +24,7 @@ export default class ApplicationRoute extends Route {* @memberof ApplicationRoute*/@action willTransition(transition) {- this.hookService.execute('application:will-transition', this.session, this.router, transition);+ this.universe.callHooks('application:will-transition', this.session, this.router, transition);}/**@@ -46,7 +45,7 @@ export default class ApplicationRoute extends Route {* @memberof ApplicationRoute*/@action loading(transition) {- this.hookService.execute('application:loading', this.session, this.router, transition);+ this.universe.callHooks('application:loading', this.session, this.router, transition);}/**@@ -80,9 +79,9 @@ export default class ApplicationRoute extends Route {*/async beforeModel(transition) {await this.session.setup();- await this.extensionManager.waitForBoot();+ await this.universe.booting();- this.hookService.execute('application:before-model', this.session, this.router, transition);+ this.universe.callHooks('application:before-model', this.session, this.router, transition);const shift = this.urlSearchParams.get('shift');if (this.session.isAuthenticated && shift) {