Files
nomad/ui/app/templates/administration/roles/index.hbs
Phil Renaud 86c858cdc3 [ui] Sentinel Policies CRUD UI (#20483)
* Gallery allows picking stuff

* Small fixes

* added sentinel templates

* Can set enforcement level on policies

* Working on the interactive sentinel dev mode

* Very rough development flow on FE

* Changed position in gutter menu

* More sentinel stuff

* PR cleanup: removed testmode, removed unneeded mixins and deps

* Heliosification

* Index-level sentinel policy deletion and page title fixes

* Makes the Canaries sentinel policy real and then comments out the unfinished ones

* rename Access Control to Administration in prep for moving Sentinel Policies and Node Pool admin there

* Sentinel policies moved within the Administration section

* Mirage fixture for sentinel policy endpoints

* Description length check and 500 prevention

* Sync review PR feedback addressed, implied butons on radio cards

* Cull un-used sentinel policies

---------

Co-authored-by: Mike Nomitch <mail@mikenomitch.com>
2024-05-22 16:41:50 -04:00

103 lines
3.3 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
~}}
<section class="section">
<header class="acl-explainer">
<p>
ACL Roles group one or more Policies into higher-level sets of permissions. A user token can have any number of roles or policies.
</p>
<div>
{{#if (can "write role")}}
<Hds::Button
@text="Create Role"
@icon="plus"
@route="administration.roles.new"
{{keyboard-shortcut
pattern=(array "n" "r")
action=(action this.goToNewRole)
label="Create Role"
}}
data-test-create-role
/>
{{else}}
<Hds::Button
@text="Create Role"
@icon="plus"
disabled
data-test-disabled-create-role
/>
{{/if}}
</div>
</header>
{{#if this.roles.length}}
<Hds::Table @caption="A list of roles for this cluster" class="acl-table"
@model={{this.roles}}
@columns={{this.columns}}
@sortBy="name"
>
<:body as |B|>
<B.Tr
{{keyboard-shortcut
enumerated=true
action=(action "openRole" B.data)
}}
data-test-role-row={{B.data.name}}
>
<B.Td data-test-role-name={{B.data.name}}>
<LinkTo @route="administration.roles.role" @model={{B.data.id}}>{{B.data.name}}</LinkTo></B.Td>
<B.Td data-test-role-description>{{B.data.description}}</B.Td>
{{#if (can "list token")}}
<B.Td>
<span data-test-role-total-tokens>{{B.data.tokens.length}}</span>
{{#if (filter-by "isExpired" B.data.tokens)}}
<span data-test-role-expired-tokens class="number-expired">({{get (filter-by "isExpired" B.data.tokens) "length"}} expired)</span>
{{/if}}
</B.Td>
{{/if}}
{{#if (can "list policy")}}
<B.Td data-test-role-policies>
<div class="tag-group">
{{#each B.data.policyNames as |policyName|}}
{{#let (find-by "name" policyName this.model.policies) as |policy|}}
{{#if policy}}
<Hds::Tag @color="primary" @text="{{policy.name}}" @route="administration.policies.policy" @model="{{policy.name}}" />
{{else}}
<Hds::Tag
{{hds-tooltip "This policy has been deleted"}}
@text="{{policyName}}"
/>
{{/if}}
{{/let}}
{{else}}
No Policies
{{/each}}
</div>
</B.Td>
{{/if}}
{{#if (can "destroy role")}}
<B.Td>
<Hds::Button @text="Delete" @size="small" @color="critical"
{{on "click" (perform this.deleteRole B.data)}}
data-test-delete-role
/>
</B.Td>
{{/if}}
</B.Tr>
</:body>
</Hds::Table>
{{else}}
<div class="empty-message">
<h3 data-test-empty-role-list-headline class="empty-message-headline">
No Roles
</h3>
<p class="empty-message-body">
Get started by <LinkTo @route="administration.roles.new">creating a new role</LinkTo>
</p>
</div>
{{/if}}
</section>