refact: move conditional rendering logic from job-page to job-client-status-summary
This commit is contained in:
parent
28af157d35
commit
d130dea4e0
|
@ -18,12 +18,10 @@
|
|||
</span>
|
||||
</:before-namespace>
|
||||
</jobPage.ui.StatsBox>
|
||||
{{#if this.job.hasClientStatus}}
|
||||
<jobPage.ui.JobClientStatusSummary
|
||||
@gotoClients={{this.gotoClients}}
|
||||
@jobClientStatus={{this.jobClientStatus}}
|
||||
/>
|
||||
{{/if}}
|
||||
<jobPage.ui.JobClientStatusSummary
|
||||
@gotoClients={{this.gotoClients}}
|
||||
@jobClientStatus={{this.jobClientStatus}}
|
||||
/>
|
||||
<jobPage.ui.Summary @forceCollapsed={{@job.hasClientStatus}} />
|
||||
<jobPage.ui.PlacementFailures />
|
||||
<jobPage.ui.TaskGroups
|
||||
|
|
|
@ -1,75 +1,77 @@
|
|||
<ListAccordion
|
||||
data-test-job-summary
|
||||
@source={{array this.job}}
|
||||
@key="id"
|
||||
@startExpanded={{this.isExpanded}}
|
||||
@onToggle={{action this.persist}} as |a|
|
||||
>
|
||||
<a.head @buttonLabel={{if a.isOpen "collapse" "expand"}}>
|
||||
<div class="columns">
|
||||
<div class="column is-minimum nowrap">
|
||||
Job Status in Client
|
||||
<span class="badge {{if a.isOpen "is-white" "is-light"}}">
|
||||
{{this.jobClientStatus.totalNodes}}
|
||||
</span>
|
||||
<span
|
||||
class="tooltip multiline"
|
||||
aria-label="Aggreate status of job's allocations in each client."
|
||||
>
|
||||
{{x-icon "info-circle-outline" class="is-faded"}}
|
||||
</span>
|
||||
</div>
|
||||
{{#unless a.isOpen}}
|
||||
<div class="column">
|
||||
<div class="inline-chart bumper-left">
|
||||
<JobClientStatusBar
|
||||
@onSliceClick={{action this.onSliceClick}}
|
||||
@job={{this.job}}
|
||||
@jobClientStatus={{this.jobClientStatus}}
|
||||
@isNarrow={{true}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
</div>
|
||||
</a.head>
|
||||
<a.body>
|
||||
<JobClientStatusBar
|
||||
@onSliceClick={{action this.onSliceClick}}
|
||||
@job={{this.job}}
|
||||
@jobClientStatus={{this.jobClientStatus}}
|
||||
class="split-view" as |chart|
|
||||
>
|
||||
<ol data-test-legend class="legend">
|
||||
{{#each chart.data as |datum index|}}
|
||||
<li
|
||||
data-test-legent-label="{{datum.className}}"
|
||||
class="{{datum.className}}
|
||||
|
||||
{{if (eq datum.label chart.activeDatum.label) "is-active"}}
|
||||
|
||||
{{if (eq datum.value 0) "is-empty" "is-clickable"}}"
|
||||
{{#if @job.hasClientStatus}}
|
||||
<ListAccordion
|
||||
data-test-job-summary
|
||||
@source={{array this.job}}
|
||||
@key="id"
|
||||
@startExpanded={{this.isExpanded}}
|
||||
@onToggle={{action this.persist}} as |a|
|
||||
>
|
||||
<a.head @buttonLabel={{if a.isOpen "collapse" "expand"}}>
|
||||
<div class="columns">
|
||||
<div class="column is-minimum nowrap">
|
||||
Job Status in Client
|
||||
<span class="badge {{if a.isOpen "is-white" "is-light"}}">
|
||||
{{this.jobClientStatus.totalNodes}}
|
||||
</span>
|
||||
<span
|
||||
class="tooltip multiline"
|
||||
aria-label="Aggreate status of job's allocations in each client."
|
||||
>
|
||||
{{#if (gt datum.value 0)}}
|
||||
<LinkTo
|
||||
@route="jobs.job.clients"
|
||||
@model={{this.job}}
|
||||
@query={{datum.legendLink.queryParams}}
|
||||
>
|
||||
{{x-icon "info-circle-outline" class="is-faded"}}
|
||||
</span>
|
||||
</div>
|
||||
{{#unless a.isOpen}}
|
||||
<div class="column">
|
||||
<div class="inline-chart bumper-left">
|
||||
<JobClientStatusBar
|
||||
@onSliceClick={{action this.onSliceClick}}
|
||||
@job={{this.job}}
|
||||
@jobClientStatus={{this.jobClientStatus}}
|
||||
@isNarrow={{true}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
</div>
|
||||
</a.head>
|
||||
<a.body>
|
||||
<JobClientStatusBar
|
||||
@onSliceClick={{action this.onSliceClick}}
|
||||
@job={{this.job}}
|
||||
@jobClientStatus={{this.jobClientStatus}}
|
||||
class="split-view" as |chart|
|
||||
>
|
||||
<ol data-test-legend class="legend">
|
||||
{{#each chart.data as |datum index|}}
|
||||
<li
|
||||
data-test-legent-label="{{datum.className}}"
|
||||
class="{{datum.className}}
|
||||
|
||||
{{if (eq datum.label chart.activeDatum.label) "is-active"}}
|
||||
|
||||
{{if (eq datum.value 0) "is-empty" "is-clickable"}}"
|
||||
>
|
||||
{{#if (gt datum.value 0)}}
|
||||
<LinkTo
|
||||
@route="jobs.job.clients"
|
||||
@model={{this.job}}
|
||||
@query={{datum.legendLink.queryParams}}
|
||||
>
|
||||
<JobPage::Parts::SummaryLegendItem
|
||||
@datum={{datum}}
|
||||
@index={{index}}
|
||||
/>
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
<JobPage::Parts::SummaryLegendItem
|
||||
@datum={{datum}}
|
||||
@index={{index}}
|
||||
/>
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
<JobPage::Parts::SummaryLegendItem
|
||||
@datum={{datum}}
|
||||
@index={{index}}
|
||||
/>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/each}}
|
||||
</ol>
|
||||
</JobClientStatusBar>
|
||||
</a.body>
|
||||
</ListAccordion>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/each}}
|
||||
</ol>
|
||||
</JobClientStatusBar>
|
||||
</a.body>
|
||||
</ListAccordion>
|
||||
{{/if}}
|
|
@ -18,9 +18,7 @@
|
|||
</span>
|
||||
</:before-namespace>
|
||||
</jobPage.ui.StatsBox>
|
||||
{{#if @job.hasClientStatus}}
|
||||
<jobPage.ui.JobClientStatusSummary @gotoClients={{@gotoClients}} />
|
||||
{{/if}}
|
||||
<jobPage.ui.JobClientStatusSummary @gotoClients={{@gotoClients}} />
|
||||
<jobPage.ui.Summary @forceCollapsed={{@job.hasClientStatus}} />
|
||||
<jobPage.ui.PlacementFailures />
|
||||
<jobPage.ui.TaskGroups
|
||||
|
|
Loading…
Reference in a new issue