2020-03-06 14:10:34 +00:00
|
|
|
<ModalDialog
|
2020-10-01 08:33:22 +00:00
|
|
|
class="role-selector"
|
2020-03-06 14:10:34 +00:00
|
|
|
data-test-role-form
|
2021-04-06 12:40:40 +00:00
|
|
|
id="new-role"
|
2020-03-06 14:10:34 +00:00
|
|
|
@onclose={{action (mut state) "role"}}
|
2021-04-06 12:40:40 +00:00
|
|
|
@aria={{hash
|
|
|
|
label=(if (eq state 'role') 'New Role' 'New Policy')
|
|
|
|
}}
|
2021-03-09 09:30:01 +00:00
|
|
|
as |modal|>
|
|
|
|
<Ref @target={{this}} @name="modal" @value={{modal}} />
|
2020-02-19 19:26:38 +00:00
|
|
|
<BlockSlot @name="header">
|
2019-05-01 18:09:29 +00:00
|
|
|
{{#if (eq state 'role')}}
|
|
|
|
<h2>New Role</h2>
|
|
|
|
{{else}}
|
|
|
|
<h2>New Policy</h2>
|
|
|
|
{{/if}}
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="body">
|
2019-05-01 18:09:29 +00:00
|
|
|
|
2019-05-08 09:01:26 +00:00
|
|
|
<input id="{{name}}_state_role" type="radio" name="{{name}}[state]" value="role" checked={{if (eq state 'role') 'checked'}} onchange={{action 'change'}} />
|
2021-09-15 18:50:11 +00:00
|
|
|
<RoleForm
|
|
|
|
@form={{form}}
|
|
|
|
@dc={{dc}}
|
|
|
|
@nspace={{nspace}}
|
|
|
|
@partition={{partition}}
|
|
|
|
>
|
2020-02-19 19:26:38 +00:00
|
|
|
<BlockSlot @name="policy">
|
2019-05-01 18:09:29 +00:00
|
|
|
|
2021-09-15 18:50:11 +00:00
|
|
|
<PolicySelector
|
|
|
|
@source={{source}}
|
|
|
|
@dc={{dc}}
|
|
|
|
@partition={{partition}}
|
|
|
|
@nspace={{nspace}}
|
|
|
|
@items={{item.Policies}}
|
|
|
|
>
|
2020-02-19 19:26:38 +00:00
|
|
|
<BlockSlot @name="trigger">
|
2019-05-01 18:09:29 +00:00
|
|
|
<label for="{{name}}_state_policy" data-test-create-policy class="type-dialog">
|
|
|
|
<span>Create new policy</span>
|
|
|
|
</label>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
</PolicySelector>
|
2019-05-01 18:09:29 +00:00
|
|
|
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
</RoleForm>
|
2019-05-01 18:09:29 +00:00
|
|
|
|
2019-05-08 09:01:26 +00:00
|
|
|
<input id="{{name}}_state_policy" type="radio" name="{{name}}[state]" value="policy" checked={{if (eq state 'policy') 'checked'}} onchange={{action 'change'}} />
|
2021-09-15 18:50:11 +00:00
|
|
|
<PolicyForm
|
|
|
|
data-test-policy-form
|
|
|
|
@name="role[policy]"
|
|
|
|
@form={{policyForm}}
|
|
|
|
@dc={{dc}}
|
|
|
|
@nspace={{nspace}}
|
|
|
|
@partition={{partition}}
|
|
|
|
/>
|
2019-05-01 18:09:29 +00:00
|
|
|
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="actions" as |close|>
|
2019-05-01 18:09:29 +00:00
|
|
|
|
|
|
|
{{#if (eq state 'role')}}
|
2020-11-09 09:25:35 +00:00
|
|
|
<button type="submit"
|
|
|
|
onclick={{perform this.save item items (queue (action close) (action 'reset'))}}
|
|
|
|
disabled={{if (or item.isSaving item.isPristine item.isInvalid) 'disabled'}}
|
|
|
|
>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{#if item.isSaving }}
|
|
|
|
<div class="progress indeterminate"></div>
|
|
|
|
{{/if}}
|
|
|
|
<span>Create and apply</span>
|
|
|
|
</button>
|
|
|
|
<button type="reset" disabled={{if item.isSaving 'disabled'}} {{action (queue (action close) (action 'reset'))}}>Cancel</button>
|
|
|
|
{{else}}
|
|
|
|
<button type="submit" {{action 'dispatch' 'save' (array policy item.Policies (action (mut state) 'role'))}} disabled={{if (or policy.isSaving policy.isPristine policy.isInvalid) 'disabled'}}>
|
|
|
|
{{#if policy.isSaving }}
|
|
|
|
<div class="progress indeterminate"></div>
|
|
|
|
{{/if}}
|
|
|
|
<span>Create and apply</span>
|
|
|
|
</button>
|
|
|
|
<button type="reset" disabled={{if policy.isSaving 'disabled'}} {{action (mut state) 'role'}}>Cancel</button>
|
|
|
|
{{/if}}
|
|
|
|
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
2020-03-06 14:10:34 +00:00
|
|
|
</ModalDialog>
|
2019-05-01 18:09:29 +00:00
|
|
|
|
2021-09-15 18:50:11 +00:00
|
|
|
<ChildSelector
|
|
|
|
@disabled={{disabled}}
|
|
|
|
@repo={{repo}}
|
|
|
|
@dc={{dc}}
|
|
|
|
@partition={{partition}}
|
|
|
|
@nspace={{nspace}}
|
|
|
|
@type="role"
|
|
|
|
@placeholder="Search for role"
|
|
|
|
@items={{items}}
|
|
|
|
>
|
2020-02-19 19:26:38 +00:00
|
|
|
<BlockSlot @name="label">
|
2019-05-01 18:09:29 +00:00
|
|
|
Apply an existing role
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="create">
|
2021-03-09 09:30:01 +00:00
|
|
|
<label class="type-dialog"
|
|
|
|
data-test-role-create
|
|
|
|
{{on "click" (optional this.modal.open)}}
|
|
|
|
>
|
2019-05-01 18:09:29 +00:00
|
|
|
<span>Create new role</span>
|
|
|
|
</label>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="option" as |option|>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{option.Name}}
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="set">
|
2020-03-06 14:10:34 +00:00
|
|
|
<TabularCollection
|
2019-05-01 18:09:29 +00:00
|
|
|
data-test-roles
|
2020-03-06 14:10:34 +00:00
|
|
|
@rows={{5}}
|
|
|
|
@items={{sort-by 'CreateTime:desc' 'Name:asc' items}} as |item index|
|
|
|
|
>
|
2020-02-19 19:26:38 +00:00
|
|
|
<BlockSlot @name="header">
|
2019-05-01 18:09:29 +00:00
|
|
|
<th>Name</th>
|
|
|
|
<th>Description</th>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="row">
|
2019-05-01 18:09:29 +00:00
|
|
|
<td>
|
|
|
|
<a href={{href-to 'dc.acls.roles.edit' item.ID}}>{{item.Name}}</a>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{{item.Description}}
|
|
|
|
</td>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="actions" as |index change checked|>
|
|
|
|
<PopoverMenu @expanded={{if (eq checked index) true false}} @onchange={{action change index}} @keyboardAccess={{false}}>
|
|
|
|
<BlockSlot @name="trigger">
|
2020-01-22 12:08:29 +00:00
|
|
|
More
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="menu" as |confirm send keypressClick|>
|
2020-01-22 12:08:29 +00:00
|
|
|
<li role="none">
|
2021-03-11 09:29:11 +00:00
|
|
|
<a role="menuitem" tabindex="-1" href={{href-to 'dc.acls.roles.edit' item.ID}}>
|
|
|
|
{{#if (can "edit role" item=item)}}
|
|
|
|
Edit
|
|
|
|
{{else}}
|
|
|
|
View
|
|
|
|
{{/if}}
|
|
|
|
</a>
|
2020-01-22 12:08:29 +00:00
|
|
|
</li>
|
2021-03-11 09:29:11 +00:00
|
|
|
{{#if (not disabled)}}
|
2020-01-22 12:08:29 +00:00
|
|
|
<li role="none" class="dangerous">
|
|
|
|
<label for={{confirm}} role="menuitem" tabindex="-1" onkeypress={{keypressClick}} data-test-delete>Remove</label>
|
|
|
|
<div role="menu">
|
2021-10-14 12:54:27 +00:00
|
|
|
<InformedAction
|
|
|
|
class="warning"
|
|
|
|
>
|
|
|
|
<:header>
|
|
|
|
Confirm Remove
|
|
|
|
</:header>
|
|
|
|
<:body>
|
2020-01-22 12:08:29 +00:00
|
|
|
<p>
|
|
|
|
Are you sure you want to remove this role?
|
|
|
|
</p>
|
2021-10-14 12:54:27 +00:00
|
|
|
</:body>
|
|
|
|
<:actions as |Actions|>
|
|
|
|
<Actions.Action class="dangerous">
|
|
|
|
<Action
|
|
|
|
tabindex="-1"
|
|
|
|
{{on 'click' (action send 'remove' item items)}}
|
|
|
|
>
|
|
|
|
Remove
|
|
|
|
</Action>
|
|
|
|
</Actions.Action>
|
|
|
|
<Actions.Action>
|
|
|
|
<Action
|
|
|
|
@for={{confirm}}
|
|
|
|
>
|
|
|
|
Cancel
|
|
|
|
</Action>
|
|
|
|
</Actions.Action>
|
|
|
|
</:actions>
|
|
|
|
</InformedAction>
|
2020-01-22 12:08:29 +00:00
|
|
|
</div>
|
|
|
|
</li>
|
2021-03-11 09:29:11 +00:00
|
|
|
{{/if}}
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
</PopoverMenu>
|
|
|
|
</BlockSlot>
|
2020-03-06 14:10:34 +00:00
|
|
|
</TabularCollection>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
</ChildSelector>
|