open-nomad/ui/app/components/breadcrumbs/job.js
2023-04-10 15:36:59 +00:00

31 lines
566 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { assert } from '@ember/debug';
import { action } from '@ember/object';
import BreadcrumbsTemplate from './default';
export default class BreadcrumbsJob extends BreadcrumbsTemplate {
get job() {
return this.args.crumb.job;
}
get hasParent() {
return !!this.job.belongsTo('parent').id();
}
@action
onError(err) {
assert(`Error: ${err.message}`);
}
@action
fetchParent() {
if (this.hasParent) {
return this.job.get('parent');
}
}
}