refactor: 💡 replace renderTemplate with components

This commit is contained in:
Randall Morey committed 2022-01-14 16:56:59 -05:00
1 parent 0d1dfb23b2
commit cd30e05e2e
35 files changed
+576 -542

No files matched your search

@@ -0,0 +1,15 @@
{{#if (can 'delete model' @model)}}
<Rose::Dropdown
@text='{{t 'actions.manage'}}'
@dropdownRight={{true}}
as |dropdown|
>
<dropdown.button
@style='danger'
@disabled={{@model.canSave}}
{{on 'click' (route-action 'deleteAccount' @model)}}
>
{{t 'resources.account.actions.delete'}}
</dropdown.button>
</Rose::Dropdown>
{{/if}}
@@ -0,0 +1,12 @@
<h2>
{{t 'resources.account.title'}}
<DocLink @doc='account' @iconSize='large' />
</h2>
<p>{{t 'resources.account.description'}}</p>
<Copyable
@text={{@model.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{@model.id}}</code>
</Copyable>
@@ -0,0 +1,16 @@
<Rose::Nav::Tabs as |nav|>
<nav.link
@route='scopes.scope.auth-methods.auth-method.accounts.account.index'
>
{{t 'titles.details'}}
</nav.link>
{{#if @model.isPassword}}
{{#if (can 'setPassword account' @model)}}
<nav.link
@route='scopes.scope.auth-methods.auth-method.accounts.account.set-password'
>
{{t 'actions.set-password'}}
</nav.link>
{{/if}}
{{/if}}
</Rose::Nav::Tabs>
@@ -0,0 +1,93 @@
{{#if @model.isOIDC}}
<Rose::Dropdown
@text={{t (concat 'states.' @model.attributes.state)}}
@icon={{if
@model.isInactive
'flight-icons/svg/x-circle-16'
(if
@model.isPrivate
'flight-icons/svg/lock-16'
'flight-icons/svg/check-circle-16'
)
}}
@dropdownRight={{true}}
as |dropdown|
>
<dropdown.section @title={{t 'actions.change-state'}}>
<Rose::Form as |form|>
<form.radioGroup
@name='theme'
@selectedValue={{@model.attributes.state}}
@changed={{route-action 'changeState'}}
as |radioGroup|
>
{{#each @model.options.oidc.state as |state|}}
<dropdown.item>
<radioGroup.radio
@label={{t (concat 'states.' state)}}
@value={{state}}
/>
</dropdown.item>
{{/each}}
</form.radioGroup>
</Rose::Form>
</dropdown.section>
</Rose::Dropdown>
{{/if}}
<Rose::Dropdown
@text='{{t 'actions.manage'}}'
@dropdownRight={{true}}
as |dropdown|
>
{{#if (feature-flag 'primary-auth-method')}}
{{#if @model.isPrimary}}
<dropdown.button
@disabled={{@model.canSave}}
{{on 'click' (route-action 'removeAsPrimary' @model)}}
>
{{t 'resources.auth-method.actions.remove-as-primary'}}
</dropdown.button>
{{else}}
<dropdown.button
@disabled={{@model.canSave}}
{{on 'click' (route-action 'makePrimary' @model)}}
>
{{t 'resources.auth-method.actions.make-primary'}}
</dropdown.button>
{{/if}}
{{/if}}
{{#if (can 'create collection' @model collection='accounts')}}
<dropdown.link
@route='scopes.scope.auth-methods.auth-method.accounts.new'
@model={{@model}}
>
{{t 'resources.account.actions.create'}}
</dropdown.link>
{{/if}}
{{#if (feature-flag 'managed-groups')}}
{{#if (can 'create collection' @model collection='managed-groups')}}
{{#if @model.isOIDC}}
<dropdown.link
@route='scopes.scope.auth-methods.auth-method.managed-groups.new'
@model={{@model}}
>
{{t 'resources.managed-group.actions.create'}}
</dropdown.link>
{{/if}}
{{/if}}
{{/if}}
{{#if (can 'delete model' @model)}}
<dropdown.separator />
<dropdown.button
@style='danger'
@disabled={{@model.canSave}}
{{on 'click' (route-action 'delete' @model)}}
>
{{t 'resources.auth-method.actions.delete'}}
</dropdown.button>
{{/if}}
</Rose::Dropdown>
@@ -0,0 +1,21 @@
<h2>
{{t 'resources.auth-method.title'}}
{{#if (feature-flag 'primary-auth-method')}}
{{#if @model.isPrimary}}
&nbsp;
<Rose::Badge @style='success-outline'>
{{t 'states.primary'}}
</Rose::Badge>
&nbsp;
{{/if}}
{{/if}}
<DocLink @doc='auth-method' @iconSize='large' />
</h2>
<p>{{t 'resources.auth-method.description'}}</p>
<Copyable
@text={{@model.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{@model.id}}</code>
</Copyable>
@@ -0,0 +1,15 @@
{{#if (can 'delete model' @model)}}
<Rose::Dropdown
@text={{t 'actions.manage'}}
@dropdownRight={{true}}
as |dropdown|
>
<dropdown.button
@style='danger'
@disabled={{@model.canSave}}
{{on 'click' (route-action 'deleteManagedGroup' @model)}}
>
{{t 'resources.managed-group.actions.delete'}}
</dropdown.button>
</Rose::Dropdown>
{{/if}}
@@ -0,0 +1,12 @@
<h2>
{{t 'resources.managed-group.title'}}
<DocLink @doc='managed-groups' @iconSize='large' />
</h2>
<p>{{t 'resources.managed-group.description'}}</p>
<Copyable
@text={{@model.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{@model.id}}</code>
</Copyable>
@@ -0,0 +1,12 @@
<Rose::Nav::Tabs as |nav|>
<nav.link
@route='scopes.scope.auth-methods.auth-method.managed-groups.managed-group.index'
>
{{t 'titles.details'}}
</nav.link>
<nav.link
@route='scopes.scope.auth-methods.auth-method.managed-groups.managed-group.members'
>
{{t 'resources.managed-group.member.title_plural'}}
</nav.link>
</Rose::Nav::Tabs>
@@ -0,0 +1,21 @@
<Rose::Nav::Tabs as |nav|>
<nav.link @route='scopes.scope.auth-methods.auth-method.index'>
{{t 'titles.details'}}
</nav.link>
{{#if (can 'navigate collection' @model collection='accounts')}}
<nav.link @route='scopes.scope.auth-methods.auth-method.accounts'>
{{t 'resources.account.title_plural'}}
</nav.link>
{{/if}}
{{#if (feature-flag 'managed-groups')}}
{{#if (can 'navigate collection' @model collection='managed-groups')}}
{{#if @model.isOIDC}}
<nav.link @route='scopes.scope.auth-methods.auth-method.managed-groups'>
{{t 'resources.managed-group.title_plural'}}
</nav.link>
{{/if}}
{{/if}}
{{/if}}
</Rose::Nav::Tabs>