ui: Removes delete button form pages that show your current token (#5241)

Tokens can no longer delete themselves see:

https://github.com/hashicorp/consul/pull/5210

...so we remove the button to allow you to do that from the UI
This commit is contained in:
John Cowen 2019-01-23 13:51:36 +00:00 committed by GitHub
parent 6ec6530e03
commit 7d76fea123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 5 deletions

View File

@ -13,7 +13,7 @@
<button type="submit" {{ action "update" item}} disabled={{if item.isInvalid 'disabled'}}>Save</button>
{{/if}}
<button type="reset" {{ action "cancel" item}}>Cancel</button>
{{# if (and (not create) (not (token/is-anonymous item))) }}
{{# if (and (not create) (not (token/is-anonymous item)) (not-eq item.AccessorID token.AccessorID) ) }}
{{#confirmation-dialog message='Are you sure you want to delete this Token?'}}
{{#block-slot 'action' as |confirm|}}
<button type="button" data-test-delete class="type-delete" {{action confirm 'delete' item}}>Delete</button>

View File

@ -90,7 +90,7 @@
<a data-test-use onclick={{queue (action confirm 'use' item) (action change)}}>Use</a>
</li>
{{/if}}
{{#unless (token/is-anonymous item) }}
{{#unless (or (token/is-anonymous item) (eq item.AccessorID token.AccessorID)) }}
<li>
<a data-test-delete onclick={{action confirm 'delete' item}}>Delete</a>
</li>
@ -102,9 +102,6 @@
<p>
{{#if (eq name 'delete')}}
{{message}}
{{#if (eq item.AccessorID token.AccessorID)}}
Warning: This is the token you are currently using!
{{/if}}
{{else if (eq name 'logout')}}
Are you sure you want to stop using this ACL token? This will log you out.
{{else if (eq name 'use')}}

View File

@ -0,0 +1,37 @@
@setupApplicationTest
Feature: dc / acls / tokens / own no delete: The your current token has no delete buttons
Background:
Given 1 datacenter model with the value "dc-1"
And 1 token model from yaml
---
AccessorID: token
SecretID: ee52203d-989f-4f7a-ab5a-2bef004164ca
---
Scenario: On the listing page
Then I have settings like yaml
---
consul:token: ~
---
When I visit the tokens page for yaml
---
dc: dc-1
---
Then the url should be /dc-1/acls/tokens
And I click actions on the tokens
And I click use on the tokens
And I click confirmUse on the tokens
Then "[data-notification]" has the "notification-use" class
And "[data-notification]" has the "success" class
Then I have settings like yaml
---
consul:token: "{\"AccessorID\":\"token\",\"SecretID\":\"ee52203d-989f-4f7a-ab5a-2bef004164ca\"}"
---
And I click actions on the tokens
Then I don't see delete on the tokens
And I visit the token page for yaml
---
dc: dc-1
token: ee52203d-989f-4f7a-ab5a-2bef004164ca
---
Then the url should be /dc-1/acls/tokens/ee52203d-989f-4f7a-ab5a-2bef004164ca
Then I don't see confirmDelete

View File

@ -0,0 +1,10 @@
import steps from '../../../steps';
// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file
export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}