2021-12-28 15:31:49 +00:00
|
|
|
/* eslint-disable ember/no-controller-access-in-routes */
|
2020-11-04 18:22:24 +00:00
|
|
|
import Route from '@ember/routing/route';
|
|
|
|
|
|
|
|
export default class OptimizeIndexRoute extends Route {
|
2020-11-10 15:38:46 +00:00
|
|
|
async activate() {
|
|
|
|
// This runs late in the loading lifecycle to ensure .filteredSummaries is populated
|
|
|
|
const summaries = this.controllerFor('optimize').filteredSummaries;
|
2020-11-04 18:22:24 +00:00
|
|
|
|
|
|
|
if (summaries.length) {
|
|
|
|
const firstSummary = summaries.objectAt(0);
|
|
|
|
|
|
|
|
return this.transitionTo('optimize.summary', firstSummary.slug, {
|
2021-04-29 20:00:59 +00:00
|
|
|
queryParams: {
|
|
|
|
jobNamespace: firstSummary.jobNamespace || 'default',
|
|
|
|
},
|
2020-11-04 18:22:24 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|