mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
This continues iteration on the DAS UI by adding the ability to directly navigate to a recommendation summary by (namespaced) slug and a copy button for the direct navigation link. It includes a change to CopyButton allowing it to take a block that’s rendered within the button. It also changes some instances of multi-relationship traversal to use in-summary attributes, such as summary.jobNamespace instead of summary.job.namespace.name.
34 lines
1000 B
JavaScript
34 lines
1000 B
JavaScript
import Controller from '@ember/controller';
|
|
import { action } from '@ember/object';
|
|
import { inject as controller } from '@ember/controller';
|
|
import { task } from 'ember-concurrency';
|
|
|
|
export default class OptimizeController extends Controller {
|
|
@controller('optimize/summary') summaryController;
|
|
|
|
get activeRecommendationSummary() {
|
|
return this.summaryController.model;
|
|
}
|
|
|
|
// This is a task because the accordion uses timeouts for animation
|
|
// eslint-disable-next-line require-yield
|
|
@(task(function*() {
|
|
const currentSummaryIndex = this.model.indexOf(this.activeRecommendationSummary);
|
|
const nextSummary = this.model.objectAt(currentSummaryIndex + 1);
|
|
|
|
if (nextSummary) {
|
|
this.transitionToSummary(nextSummary);
|
|
} else {
|
|
this.send('reachedEnd');
|
|
}
|
|
}).drop())
|
|
proceed;
|
|
|
|
@action
|
|
transitionToSummary(summary) {
|
|
this.transitionToRoute('optimize.summary', summary.slug, {
|
|
queryParams: { jobNamespace: summary.jobNamespace },
|
|
});
|
|
}
|
|
}
|