open-nomad/ui/app/components/job-subnav.js
Phil Renaud 817b2cab9b
[ui] Remove unnecessary subnav for parent jobs (#17190)
* Nest job subnav in a parent-check

* Move the evaluation tab test to withn an else of the children condition
2023-05-16 16:07:12 -04:00

27 lines
745 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { inject as service } from '@ember/service';
import Component from '@glimmer/component';
export default class JobSubnav extends Component {
@service can;
@service keyboard;
get shouldRenderClientsTab() {
const { job } = this.args;
return (
job?.hasClientStatus && !job?.hasChildren && this.can.can('read client')
);
}
// Periodic and Parameterized jobs "parents" are not jobs unto themselves, but more like summaries.
// They should not have tabs for allocations, evaluations, etc.
// but their child jobs, and other job types generally, should.
get shouldHideNonParentTabs() {
return this.args.job?.hasChildren;
}
}