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
(fix) urgently replace deprecated route `transitionTo` with router service method
Ronald A. Richardson2a5a68f620ab
diff --git a/console/app/controllers/auth/login.js b/console/app/controllers/auth/login.jsindex cc43fd58..3d4665ab 100644--- a/console/app/controllers/auth/login.js+++ b/console/app/controllers/auth/login.js@@ -33,6 +33,14 @@ export default class AuthLoginController extends Controller {*/@service session;++ /**+ * Inject the `router` service+ *+ * @var {Service}+ */+ @service router;+/*** Whether or not to remember the users session*@@ -124,14 +132,14 @@ export default class AuthLoginController extends Controller {* Transition user to onboarding screen*/@action transitionToOnboard() {- return this.transitionToRoute('onboard');+ return this.router.transitionTo('onboard');}/*** Transition to forgot password screen, if email is set - set it.*/@action forgotPassword() {- return this.transitionToRoute('auth.forgot-password').then(() => {+ return this.router.transitionTo('auth.forgot-password').then(() => {if (this.email) {this.forgotPasswordController.email = this.email;}diff --git a/console/app/controllers/auth/reset-password.js b/console/app/controllers/auth/reset-password.jsindex 672bbbd6..62da530a 100644--- a/console/app/controllers/auth/reset-password.js+++ b/console/app/controllers/auth/reset-password.js@@ -18,6 +18,13 @@ export default class AuthResetPasswordController extends Controller {*/@service notifications;+ /**+ * Inject the `router` service+ *+ * @memberof AuthResetPasswordController+ */+ @service router;+/*** The code param.*@@ -65,7 +72,7 @@ export default class AuthResetPasswordController extends Controller {.then(() => {this.notifications.success('Your password has been reset! Login to continue.');- return this.transitionToRoute('auth.login');+ return this.router.transitionTo('auth.login');}).catch((error) => {this.notifications.serverError(error);diff --git a/console/app/controllers/install.js b/console/app/controllers/install.jsindex 02ae88cb..045c25f6 100644--- a/console/app/controllers/install.js+++ b/console/app/controllers/install.js@@ -7,6 +7,7 @@ import { task } from 'ember-concurrency-decorators';export default class InstallController extends Controller {@service fetch;@service notifications;+ @service router;@tracked error;@tracked steps = [{ task: 'createdb', name: 'Create Database', status: 'pending' },@@ -46,7 +47,7 @@ export default class InstallController extends Controller {if (isCompleted) {this.notifications.success('Install completed successfully!');- return this.transitionToRoute('onboard');+ return this.router.transitionTo('onboard');}}diff --git a/console/app/controllers/invite/for-user.js b/console/app/controllers/invite/for-user.jsindex 0dd2291e..c62500ba 100644--- a/console/app/controllers/invite/for-user.js+++ b/console/app/controllers/invite/for-user.js@@ -8,6 +8,7 @@ export default class InviteForUserController extends Controller {@service session;@service notifications;@service modalsManager;+ @service router;@tracked code;@tracked isLoading;@@ -24,7 +25,7 @@ export default class InviteForUserController extends Controller {this.isLoading = false;- return this.transitionToRoute('console').then(() => {+ return this.router.transitionTo('console').then(() => {if (response.needs_password && response.needs_password === true) {this.setPassword();}diff --git a/console/app/controllers/onboard/index.js b/console/app/controllers/onboard/index.jsindex 7828a867..77ef988b 100644--- a/console/app/controllers/onboard/index.js+++ b/console/app/controllers/onboard/index.js@@ -21,6 +21,13 @@ export default class OnboardIndexController extends Controller {*/@service session;+ /**+ * Inject the `router` service+ *+ * @memberof OnboardIndexController+ */+ @service router;+/*** Inject the `notifications` service*@@ -122,12 +129,12 @@ export default class OnboardIndexController extends Controller {this.session.isOnboarding().manuallyAuthenticate(response.token);if (response.skipVerification === true) {- return this.transitionToRoute('console').then(() => {+ return this.router.transitionTo('console').then(() => {this.notifications.success('Welcome to Fleetbase!');});}- return this.transitionToRoute('onboard.verify-email', { queryParams: { hello: response.session } });+ return this.router.transitionTo('onboard.verify-email', { queryParams: { hello: response.session } });}}).catch((error) => {diff --git a/console/app/controllers/onboard/verify-email.js b/console/app/controllers/onboard/verify-email.jsindex 86ba8f53..1b73fc16 100644--- a/console/app/controllers/onboard/verify-email.js+++ b/console/app/controllers/onboard/verify-email.js@@ -34,6 +34,14 @@ export default class OnboardVerifyEmailController extends Controller {*/@service currentUser;++ /**+ * Inject the `router` service+ *+ * @memberof OnboardIndexController+ */+ @service router;+/*** The session paramerer.*@@ -139,7 +147,7 @@ export default class OnboardVerifyEmailController extends Controller {this.notifications.success('Email successfully verified!');this.notifications.info('Welcome to Fleetbase!');- return this.transitionToRoute('console');+ return this.router.transitionTo('console');}}).catch((error) => {diff --git a/console/app/routes/application.js b/console/app/routes/application.jsindex 5fa907dc..de253843 100644--- a/console/app/routes/application.js+++ b/console/app/routes/application.js@@ -12,6 +12,7 @@ export default class ApplicationRoute extends Route {@service modalsManager;@service intl;@tracked defaultTheme;+ @tracked router;/*** Check the installation status of Fleetbase and transition user accordingly.@@ -27,11 +28,11 @@ export default class ApplicationRoute extends Route {this.defaultTheme = defaultTheme;if (shouldInstall) {- return this.transitionTo('install');+ return this.router.transitionTo('install');}if (shouldOnboard) {- return this.transitionTo('onboard');+ return this.router.transitionTo('onboard');}}@@ -49,7 +50,7 @@ export default class ApplicationRoute extends Route {const shift = this.urlSearchParams.get('shift');if (isAuthenticated && shift) {- return this.transitionTo(pathToRoute(shift));+ return this.router.transitionTo(pathToRoute(shift));}}diff --git a/console/app/routes/console/admin.js b/console/app/routes/console/admin.jsindex a661f688..ebc0cb67 100644--- a/console/app/routes/console/admin.js+++ b/console/app/routes/console/admin.js@@ -4,11 +4,12 @@ import { inject as service } from '@ember/service';export default class ConsoleAdminRoute extends Route {@service currentUser;@service notifications;+ @service router;beforeModel() {// USER MUST BE ADMINif (!this.currentUser.user.is_admin) {- return this.transitionTo('console').then(() => {+ return this.router.transitionTo('console').then(() => {this.notifications.error('You do not have authorization to access admin!');});}