{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: MPL-2.0
~}}

<section class="failed-or-lost">
  <h4>Replaced Allocations</h4>
  <div class="failed-or-lost-links">
    {{#if @supportsRescheduling}}
      <span>
        <Hds::TooltipButton @text="Allocations that have been rescheduled, on another node if possible, due to failure or manual restart" aria-label="Info">
          <FlightIcon @name="info" />
        </Hds::TooltipButton>
        <ConditionalLinkTo
          @condition={{@rescheduledAllocs.length}}
          @route="jobs.job.allocations"
          @model={{@job}}
          @query={{hash scheduling='["has-been-rescheduled"]' version=(concat '[' @job.latestDeployment.versionNumber ']')}}
          @label="View Allocations"
        >
          {{@rescheduledAllocs.length}} Rescheduled
        </ConditionalLinkTo>
      </span>
    {{/if}}

    <span>
      <Hds::TooltipButton @text="Allocations that have been restarted in-place due to a task failure or manual restart" aria-label="Info">
        <FlightIcon @name="info" />
      </Hds::TooltipButton>
      <ConditionalLinkTo
        @condition={{@restartedAllocs.length}}
        @route="jobs.job.allocations"
        @model={{@job}}
        @query={{hash scheduling='["has-been-restarted"]' version=(concat '[' @job.latestDeployment.versionNumber ']')}}
        @label="View Allocations"
      >
        {{@restartedAllocs.length}} Restarted
      </ConditionalLinkTo>
    </span>
  </div>
</section>