mirror of https://github.com/status-im/consul.git
Merge pull request #4225 from hashicorp/bugfix/hide-anon-acl-delete
[BUGFIX] Remove anonymous ACL delete button in the listing
This commit is contained in:
commit
71cef8b8cd
|
@ -39,17 +39,19 @@
|
||||||
{{#action-group index=index onchange=(action change) checked=(if (eq checked index) 'checked')}}
|
{{#action-group index=index onchange=(action change) checked=(if (eq checked index) 'checked')}}
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href={{href-to 'dc.acls.edit' item.ID}}>Edit</a>
|
<a data-test-edit href={{href-to 'dc.acls.edit' item.ID}}>Edit</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a onclick={{queue (action confirm 'use' item) (action change)}}>Use</a>
|
<a data-test-use onclick={{queue (action confirm 'use' item) (action change)}}>Use</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a onclick={{action 'sendClone' item}}>Clone</a>
|
<a data-test-clone onclick={{action 'sendClone' item}}>Clone</a>
|
||||||
</li>
|
</li>
|
||||||
|
{{# if (not-eq item.ID 'anonymous') }}
|
||||||
<li>
|
<li>
|
||||||
<a onclick={{action confirm 'delete' item}}>Delete</a>
|
<a data-test-delete onclick={{action confirm 'delete' item}}>Delete</a>
|
||||||
</li>
|
</li>
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
{{/action-group}}
|
{{/action-group}}
|
||||||
{{/block-slot}}
|
{{/block-slot}}
|
||||||
|
|
|
@ -51,10 +51,10 @@
|
||||||
{{#action-group index=index onchange=(action change) checked=(if (eq checked index) 'checked')}}
|
{{#action-group index=index onchange=(action change) checked=(if (eq checked index) 'checked')}}
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href={{href-to (if item.isFolder 'dc.kv.folder' 'dc.kv.edit') item.Key}}>{{if item.isFolder 'View' 'Edit'}}</a>
|
<a data-test-edit href={{href-to (if item.isFolder 'dc.kv.folder' 'dc.kv.edit') item.Key}}>{{if item.isFolder 'View' 'Edit'}}</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a onclick={{action confirm 'delete' item}}>Delete</a>
|
<a data-test-delete onclick={{action confirm 'delete' item}}>Delete</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{/action-group}}
|
{{/action-group}}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
@setupApplicationTest
|
||||||
|
Feature: dc / acls / index: ACL List
|
||||||
|
|
||||||
|
Scenario:
|
||||||
|
Given 1 datacenter model with the value "dc-1"
|
||||||
|
And 3 acl models
|
||||||
|
When I visit the acls page for yaml
|
||||||
|
---
|
||||||
|
dc: dc-1
|
||||||
|
---
|
||||||
|
Then the url should be /dc-1/acls
|
||||||
|
And I click actions on the acls
|
||||||
|
Then I don't see delete on the acls
|
||||||
|
Then I see 3 acl models
|
|
@ -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);
|
||||||
|
});
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ export default create({
|
||||||
name: attribute('data-test-acl', '[data-test-acl]'),
|
name: attribute('data-test-acl', '[data-test-acl]'),
|
||||||
acl: clickable('a'),
|
acl: clickable('a'),
|
||||||
actions: clickable('label'),
|
actions: clickable('label'),
|
||||||
delete: clickable('li:last-child a'),
|
delete: clickable('[data-test-delete]'),
|
||||||
confirmDelete: clickable('button.type-delete'),
|
confirmDelete: clickable('button.type-delete'),
|
||||||
}),
|
}),
|
||||||
filter: filter,
|
filter: filter,
|
||||||
|
|
|
@ -6,7 +6,7 @@ export default create({
|
||||||
name: attribute('data-test-kv', '[data-test-kv]'),
|
name: attribute('data-test-kv', '[data-test-kv]'),
|
||||||
kv: clickable('a'),
|
kv: clickable('a'),
|
||||||
actions: clickable('label'),
|
actions: clickable('label'),
|
||||||
delete: clickable('li:last-child a'),
|
delete: clickable('[data-test-delete]'),
|
||||||
confirmDelete: clickable('button.type-delete'),
|
confirmDelete: clickable('button.type-delete'),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -227,7 +227,48 @@ export default function(assert) {
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(['I see $property on the $component'], function(property, component) {
|
.then(['I see $property on the $component'], function(property, component) {
|
||||||
assert.ok(currentPage[component][property], `Expected to see ${property} on ${component}`);
|
// TODO: Time to work on repetition
|
||||||
|
// Collection
|
||||||
|
var obj;
|
||||||
|
if (typeof currentPage[component].objectAt === 'function') {
|
||||||
|
obj = currentPage[component].objectAt(0);
|
||||||
|
} else {
|
||||||
|
obj = currentPage[component];
|
||||||
|
}
|
||||||
|
let _component;
|
||||||
|
if (typeof obj === 'function') {
|
||||||
|
const func = obj[property].bind(obj);
|
||||||
|
try {
|
||||||
|
_component = func();
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
throw new Error(
|
||||||
|
`The '${property}' property on the '${component}' page object doesn't exist`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_component = obj;
|
||||||
|
}
|
||||||
|
assert.ok(_component[property], `Expected to see ${property} on ${component}`);
|
||||||
|
})
|
||||||
|
.then(["I don't see $property on the $component"], function(property, component) {
|
||||||
|
// Collection
|
||||||
|
var obj;
|
||||||
|
if (typeof currentPage[component].objectAt === 'function') {
|
||||||
|
obj = currentPage[component].objectAt(0);
|
||||||
|
} else {
|
||||||
|
obj = currentPage[component];
|
||||||
|
}
|
||||||
|
const func = obj[property].bind(obj);
|
||||||
|
assert.throws(
|
||||||
|
function() {
|
||||||
|
func();
|
||||||
|
},
|
||||||
|
function(e) {
|
||||||
|
return e.toString().indexOf('Element not found') !== -1;
|
||||||
|
},
|
||||||
|
`Expected to not see ${property} on ${component}`
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.then(['I see $property'], function(property, component) {
|
.then(['I see $property'], function(property, component) {
|
||||||
assert.ok(currentPage[property], `Expected to see ${property}`);
|
assert.ok(currentPage[property], `Expected to see ${property}`);
|
||||||
|
|
Loading…
Reference in New Issue