@fleetbase/fleetops-engine
Version:
Fleet & Transport Management Extension for Fleetbase
37 lines (32 loc) • 1.09 kB
JavaScript
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
/**
* Operations::AllocationRoute
*
* Entry point for the Dispatcher Workbench at /operations/allocation.
* The route performs an ability check and then hands off to the
* OrchestratorWorkbench component via the controller.
*/
export default class OperationsAllocationRoute extends Route {
notifications;
hostRouter;
abilities;
intl;
sidebar;
mapManager;
activate() {
this.sidebar.hide();
}
deactivate() {
this.sidebar.show();
this.mapManager.setMapInstance?.(null);
this.mapManager.setLivemap?.(null);
this.mapManager.setActiveProvider?.(this.mapManager.getConfiguredProvider?.() ?? 'leaflet');
}
beforeModel() {
if (this.abilities.cannot('fleet-ops list order')) {
this.notifications.warning(this.intl.t('common.unauthorized-access'));
return this.hostRouter.transitionTo('console.fleet-ops');
}
}
}