open-nomad/ui/app/routes/optimize/summary.js
Michael Lange e8593ec1bb
ui: Update namespaces design (#10444)
This rethinks namespaces as a filter on list pages rather than a global setting.

The biggest net-new feature here is being able to select All (*) to list all jobs
or CSI volumes across namespaces.
2021-04-29 15:00:59 -05:00

30 lines
749 B
JavaScript

import Route from '@ember/routing/route';
import notifyError from 'nomad-ui/utils/notify-error';
export default class OptimizeSummaryRoute extends Route {
breadcrumbs(model) {
if (!model) return [];
return [
{
label: model.slug.replace('/', ' / '),
args: ['optimize.summary', model.slug],
},
];
}
async model({ jobNamespace, slug }) {
const model = this.modelFor('optimize').summaries.find(
summary => summary.slug === slug && summary.jobNamespace === jobNamespace
);
if (!model) {
const error = new Error(`Unable to find summary for ${slug} in namespace ${jobNamespace}`);
error.code = 404;
notifyError(this)(error);
} else {
return model;
}
}
}