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

<Route
  @name={{routeName}}
as |route|>

  <DataLoader @src={{
    uri '/${partition}/${nspace}/${dc}/discovery-chain/${name}'
      (hash
        partition=route.params.partition
        nspace=route.params.nspace
        dc=route.params.dc
        name=route.params.name
      )
    }}
  as |loader|>

    <BlockSlot @name="error">
      <AppError
        @error={{loader.error}}
        @login={{route.model.app.login.open}}
      />
    </BlockSlot>

    <BlockSlot @name="loaded">
{{#let
  loader.data
as |item|}}
<AppView>
  <BlockSlot @name="breadcrumbs">
    <ol>
        <li><a data-test-back href={{href-to 'dc.services'}}>All Services</a></li>
    </ol>
  </BlockSlot>
  <BlockSlot @name="header">
    <h1>
      <route.Title @title={{item.Chain.ServiceName}} />
    </h1>
    <Consul::Source @source={{t "routes.dc.routing-config.source"}} @withInfo={{true}} />
  </BlockSlot>
  <BlockSlot @name="content">
    <div class="container">
      <Consul::DiscoveryChain
        @chain={{item.Chain}}
      />
    </div>
  </BlockSlot>
</AppView>
{{/let}}
    </BlockSlot>
  </DataLoader>
</Route>
