| 2 | import Route from '@ember/routing/route'; |
| 3 | |
| 4 | export default class ModuleRoute extends Route { |
| 5 | /** @type {import('@ember/routing/router-service').default} */ |
| 6 | @service |
| 7 | router; |
| 8 | |
| 9 | @service |
| 10 | legacyModuleMappings; |
| 11 | |
| 12 | model(params) { |
| 13 | return { |
| 14 | moduleName: params.module.substr(0, params.module.lastIndexOf('.')), |
| 15 | mappings: this.legacyModuleMappings.buildMappings( |
| 16 | this.legacyModuleMappings.legacyMappings, |
| 17 | ), |
| 18 | }; |
| 19 | } |
| 20 | |
| 21 | redirect(model) { |
| 22 | let mappingInfo = this.legacyModuleMappings.getNewModuleFromOld( |
| 23 | model.moduleName, |
| 24 | model.mappings, |
| 25 | ); |
| 26 | if (!mappingInfo.error && model.moduleName !== mappingInfo.module) { |
| 27 | return this.router.transitionTo( |
| 28 | `project-version.modules.module`, |
| 29 | 'ember', |
| 30 | 'release', |
| 31 | mappingInfo.module, |
| 32 | ); |
| 33 | } |
| 34 | return this.router.transitionTo('project-version', 'ember', 'release'); |
| 35 | } |
| 36 | } |
nothing calls this directly
no outgoing calls
no test coverage detected