# Consul::Bucket::List

A presentational component for rendering a list of Consul 'buckets'
(a single partition and/or a single namepace).

Please note this is not your usual "scrollable list component" more a list of
'buckets' that make up a partition / namespace combination.

If only a the namespace is different to the currently selected namespace, then
the namespace will be displayed, whereas if the partition is different it will
show both the partition and namespace (as a namespace called 'team-1' in
`partition-1` is different to a namespace called 'team-1' in `partition-2`)

When the passed item contains a `PeerName`, this will be displayed in place of
the `Partition`.

Showing the service name is a tiny bit awkward (different boolean type,
doesn't care about difference) and could be improved but we only use it for
the read only view of intentions.

At the time of writing, this is not currently used across the entire UI
(specifically in intentions and maybe other areas) but eventually should be.


```hbs preview-template
  <figure>
    <figcaption>Show everything</figcaption>
    <Consul::Bucket::List
      @item={{hash
        Namespace="different-nspace"
        Partition="different-partition"
        Service="service-name"
        PeerName="billing-app"
      }}
      @nspace={{'nspace'}}
      @partition={{'partition'}}
      @service={{true}}
    />
  </figure>
  <figure>
    <figcaption>Show everything without peer</figcaption>
    <Consul::Bucket::List
      @item={{hash
        Namespace="different-nspace"
        Partition="different-partition"
        Service="service-name"
      }}
      @nspace={{'nspace'}}
      @partition={{'partition'}}
      @service={{true}}
    />
  </figure>

  <figure>
    <figcaption>Show just the top-level buckets</figcaption>
    <Consul::Bucket::List
      @item={{hash
        Namespace="different-nspace"
        Partition="different-partition"
      }}
      @nspace={{'nspace'}}
      @partition={{'partition'}}
    />
  </figure>

  <figure>
    <figcaption>Show only peer-info</figcaption>
    <Consul::Bucket::List
      @item={{hash
        Namespace="default"
        PeerName="billing-app"
      }}
      @nspace={{'nspace'}}
    />
  </figure>

  <figure>
    <figcaption>Don't surface anything - no relevant info to show</figcaption>
    <Consul::Bucket::List
      @item={{hash
        Namespace="default"
        Partition="default"
      }}
      @nspace={{'default'}}
      @partition={{'default'}}
    />
  </figure>

```

## Arguments

| Argument/Attribute | Type | Default | Description |
| --- | --- | --- | --- |
| `item` | `object` |  | A Consul object that could have a `Partition`, a `Namespace`, a `PeerName` and a `Service` property |
| `nspace` | `string` | | The name of the current namespace |
| `partition` | `string` | | The name of the current partition |
| `service` | `boolean` | | Whether to show the service name on the end or not. Please note you must also pass a item.Service for it to show. We flag this incase an API request has a Service property but you don't want to show it |

## See

- [Template Source Code](./index.hbs)

---
