[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
This commit is contained in:
Phil Renaud 2023-05-16 16:07:12 -04:00 committed by GitHub
parent 2426aae832
commit 817b2cab9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 42 deletions

View File

@ -16,4 +16,11 @@ export default class JobSubnav extends Component {
job?.hasClientStatus && !job?.hasChildren && this.can.can('read client') 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;
}
} }

View File

@ -44,6 +44,7 @@
</LinkTo> </LinkTo>
</li> </li>
{{/if}} {{/if}}
{{#unless this.shouldHideNonParentTabs}}
<li data-test-tab="allocations"> <li data-test-tab="allocations">
<LinkTo <LinkTo
@route="jobs.job.allocations" @route="jobs.job.allocations"
@ -82,5 +83,6 @@
Services Services
</LinkTo> </LinkTo>
</li> </li>
{{/unless}}
</ul> </ul>
</div> </div>

View File

@ -101,16 +101,6 @@ export default function moduleForJob(
assert.equal(decodeURIComponent(currentURL()), expectedURL); assert.equal(decodeURIComponent(currentURL()), expectedURL);
}); });
test('the subnav links to evaluations', async function (assert) {
await JobDetail.tabFor('evaluations').visit();
const expectedURL = job.namespace
? `/jobs/${job.name}@${job.namespace}/evaluations`
: `/jobs/${job.name}/evaluations`;
assert.equal(decodeURIComponent(currentURL()), expectedURL);
});
test('the title buttons are dependent on job status', async function (assert) { test('the title buttons are dependent on job status', async function (assert) {
if (job.status === 'dead') { if (job.status === 'dead') {
assert.ok(JobDetail.start.isPresent); assert.ok(JobDetail.start.isPresent);
@ -229,6 +219,16 @@ export default function moduleForJob(
'Allocations are not shown in the summary section' 'Allocations are not shown in the summary section'
); );
}); });
} else {
test('the subnav links to evaluations', async function (assert) {
await JobDetail.tabFor('evaluations').visit();
const expectedURL = job.namespace
? `/jobs/${job.name}@${job.namespace}/evaluations`
: `/jobs/${job.name}/evaluations`;
assert.equal(decodeURIComponent(currentURL()), expectedURL);
});
} }
for (var testName in additionalTests) { for (var testName in additionalTests) {