open-consul/ui/packages/consul-ui/app/components/auth-dialog
John Cowen 124fa8f168
ui: Notifications re-organization/re-style (#11577)
- Moves where they appear up to the <App /> component.
- Instead of a <Notification /> wrapping component to move whatever you use for a notification up to where they need to appear (via ember-cli-flash), we now use a {{notification}} modifier now we have modifiers.
- Global notifications/flashes are no longer special styles of their own. You just use the {{notification}} modifier to hoist whatever component/element you want up to the top of the page. This means we can re-use our existing <Notice /> component for all our global UI notifications (this is the user visible change here)
2021-11-24 18:14:07 +00:00
..
README.mdx ui: Support for SSO with Admin Partitions (#11604) 2021-11-24 14:53:12 +00:00
chart.xstate.js
index.hbs ui: Notifications re-organization/re-style (#11577) 2021-11-24 18:14:07 +00:00
index.js

README.mdx

---
class: ember
---
# AuthDialog

```hbs preview-template
<AuthDialog
  @dc={{'dc-1'}}
  @nspace={{'default'}}
  @partition={{'default'}}
  @onchange={{action (noop)}}
as |api components|>
  {{#let components.AuthForm components.AuthProfile as |AuthForm AuthProfile|}}
    <BlockSlot @name="unauthorized">
      Here's the login form:
      <AuthForm />
    </BlockSlot>
    <BlockSlot @name="authorized">
      Here's your profile:
      <AuthProfile />
      <button onclick={{action api.logout}}>Logout</button>
    </BlockSlot>
  {{/let}}
</AuthDialog>
```

### Arguments

A component to help orchestrate a login/logout flow.

| Argument | Type | Default | Description |
| --- | --- | --- | --- |
| `dc` | `String` | | The name of the current datacenter |
| `nspace` | `String` | | The name of the current namespace |
| `partition` | `String` | | The name of the current partition |
| `onchange` | `Function` | | An action to fire when the users token has changed (logged in/logged out/token changed) |

### Methods/Actions/api

| Method/Action |  Description |
| --- | --- |
| `login` | Login with a specified token |
| `logout` | Logout (delete token) |
| `token` | The current token itself (as a property not a method) |

### Components

| Name |  Description |
| --- | --- |
| [`AuthForm`](../auth-form/README.mdx) | Renders an Authorization form |
| [`AuthProfile`](../auth-profile/README.mdx) | Renders a User Profile |

### Slots

| Name  | Description |
| --- | --- |
| `unauthorized` | This slot is only rendered when the user doesn't have a token |
| `authorized`   | This slot is only rendered whtn the user has a token.|

### See

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

---