| 2 | import Route from '@ember/routing/route'; |
| 3 | |
| 4 | export default class DataClassRoute 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 | mappings: this.legacyModuleMappings.buildMappings( |
| 15 | this.legacyModuleMappings.legacyMappings, |
| 16 | ), |
| 17 | className: params['class'].substr(0, params['class'].lastIndexOf('.')), |
| 18 | }; |
| 19 | } |
| 20 | |
| 21 | redirect(model) { |
| 22 | let mappingInfo = this.legacyModuleMappings.getNewClassFromOld( |
| 23 | model.className, |
| 24 | model.mappings, |
| 25 | ); |
| 26 | let { newName } = mappingInfo; |
| 27 | if (newName.substr(0, 3) === 'DS.') { |
| 28 | newName = newName.substr(3); |
| 29 | } |
| 30 | if (!mappingInfo.error) { |
| 31 | return this.router.transitionTo( |
| 32 | `project-version.classes.class`, |
| 33 | 'ember-data', |
| 34 | 'release', |
| 35 | newName, |
| 36 | ); |
| 37 | } else { |
| 38 | return this.router.transitionTo('project-version', 'ember', 'release'); |
| 39 | } |
| 40 | } |
| 41 | } |
nothing calls this directly
no outgoing calls
no test coverage detected