open-consul/ui/packages/consul-acls/app/components/consul/token/selector
wenincode 7b0a4f3eb8 Remove extra partition test 2022-10-20 16:23:53 -06:00
..
README.mdx ui: Fix up wiring or empty state login button (#11981) 2022-01-12 11:05:24 +00:00
index.hbs Remove extra partition test 2022-10-20 16:23:53 -06:00
index.js

README.mdx

# Consul::Token::Selector

A self-contained component to allow the user to 'select' their token a.k.a.
log in. The component is mostly a wrapper around a composition of `<AuthDialog
/>`, `<AuthForm />`, `<AuthProfile />` and `<ModalDialog />`. The majority of
the functionality is contained in those other components. This composition
mostly orchestrates the interactions between them i.e. wires them together.

As it uses `<AuthDialog />` (a componentized state machine), retrieving and saving
the token is all managed via that component (via `<DataSource />` and
`<DataSink />`, but this component provides the Consul specific DataSource
uri's to tell `AuthDialog` to save user tokens to a Consul namespaced user
settings area (Consul uses localStorage for saving user settings)

Please note: 

- Currently at least, you must add this inside of a `<ul>` element.
- For the moment, make sure you have enabled ACLs using developer debug
  cookies.

```hbs preview-template
<ul>
  <Consul::Token::Selector
    @dc={{hash
      Name='dc-1'
    }}
    @nspace='default'
    @partition='default'
    @onchange={{noop}}
  />
</ul>
```


## Arguments

| Argument/Attribute | Type | Default | Description |
| --- | --- | --- | --- |
| `dc` | `object` |  | The current datacenter |
| `nspace` | `string` |  | The name of the current namespace |
| `partition` | `string` |  | The name of the current partition |
| `onchange` | `function` |  | An event handler, for when the user token change, either via logging in, logging out or re-logging in.

## See

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

---