consul/ui/packages/consul-ui/app/components/auth-dialog
John Cowen 6589cbbd0d
ui: Move to Workspaced Structure (#8994)
* ui: Add the most basic workspace root in /ui

* We already have a LICENSE file in the repository root

* Change directory path in build scripts ui-v2 -> ui

* Make yarn install flags configurable from elsewhere

* Minimal workspace root makefile

* Call the new docker specific target

* Update yarn in the docker build image

* Reconfigure the netlify target and move to the higher makefile

* Move ui-v2 -> ui/packages/consul-ui

* Change repo root to refleect new folder structure

* Temporarily don't hoist consul-api-double

* Fixup CI configuration

* Fixup lint errors

* Fixup Netlify target
2020-10-21 15:23:16 +01:00
..
README.mdx ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
chart.xstate.js ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
index.hbs ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
index.js ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00

README.mdx

## AuthDialog

```handlebars
<AuthDialog @dc={{dc}} @nspace={{}} @onchange={{action 'change'}} 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}} />
    </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 |
| `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)

---