[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:
parent
2426aae832
commit
817b2cab9b
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,43 +44,45 @@
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<li data-test-tab="allocations">
|
{{#unless this.shouldHideNonParentTabs}}
|
||||||
<LinkTo
|
<li data-test-tab="allocations">
|
||||||
@route="jobs.job.allocations"
|
|
||||||
@model={{format-job-id @job.id}}
|
|
||||||
@activeClass="is-active"
|
|
||||||
>
|
|
||||||
Allocations
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
<li data-test-tab="evaluations">
|
|
||||||
<LinkTo
|
|
||||||
@route="jobs.job.evaluations"
|
|
||||||
@model={{@job}}
|
|
||||||
@activeClass="is-active"
|
|
||||||
>
|
|
||||||
Evaluations
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{#if this.shouldRenderClientsTab}}
|
|
||||||
<li data-test-tab="clients">
|
|
||||||
<LinkTo
|
<LinkTo
|
||||||
@route="jobs.job.clients"
|
@route="jobs.job.allocations"
|
||||||
|
@model={{format-job-id @job.id}}
|
||||||
|
@activeClass="is-active"
|
||||||
|
>
|
||||||
|
Allocations
|
||||||
|
</LinkTo>
|
||||||
|
</li>
|
||||||
|
<li data-test-tab="evaluations">
|
||||||
|
<LinkTo
|
||||||
|
@route="jobs.job.evaluations"
|
||||||
@model={{@job}}
|
@model={{@job}}
|
||||||
@activeClass="is-active"
|
@activeClass="is-active"
|
||||||
>
|
>
|
||||||
Clients
|
Evaluations
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{#if this.shouldRenderClientsTab}}
|
||||||
<li data-test-tab="services">
|
<li data-test-tab="clients">
|
||||||
<LinkTo
|
<LinkTo
|
||||||
@route="jobs.job.services"
|
@route="jobs.job.clients"
|
||||||
@model={{@job}}
|
@model={{@job}}
|
||||||
@activeClass="is-active"
|
@activeClass="is-active"
|
||||||
>
|
>
|
||||||
Services
|
Clients
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
</li>
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
<li data-test-tab="services">
|
||||||
|
<LinkTo
|
||||||
|
@route="jobs.job.services"
|
||||||
|
@model={{@job}}
|
||||||
|
@activeClass="is-active"
|
||||||
|
>
|
||||||
|
Services
|
||||||
|
</LinkTo>
|
||||||
|
</li>
|
||||||
|
{{/unless}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue