ui: Ensure we show a special readonly page for intentions (#11767)

This commit is contained in:
John Cowen 2021-12-13 15:02:36 +00:00 committed by GitHub
parent e4d33187b9
commit be23aab001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 3 deletions

3
.changelog/11767.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Ensure we show a readonly designed page for readonly intentions
```

View File

@ -56,7 +56,10 @@ as |api|>
</BlockSlot>
<BlockSlot @name="form">
{{#let api.data as |item|}}
{{#let
api.data
(not (can 'write intention' item=api.data))
as |item readonly|}}
{{#if (not readonly)}}
{{#let (changeset-get item 'Action') as |newAction|}}
@ -193,6 +196,7 @@ as |api|>
</div>
</form>
{{else}}
{{#if item.IsManagedByCRD}}
<Notice
class="crd"
@ -215,8 +219,10 @@ as |api|>
</notice.Footer>
</Notice>
{{/if}}
<Consul::Intention::View
@item={{item}}
data-test-readonly
/>
{{/if}}
{{/let}}

View File

@ -1,4 +1,7 @@
<div class="consul-intention-view">
<div
class="consul-intention-view"
...attributes
>
<div class="definition-table">
<dl>

View File

@ -81,7 +81,7 @@ ${fake.helpers.randomize([
],
`:``}
"Precedence": ${fake.random.number({min: 1, max: 100})},
${ !legacy && fake.random.number({min: 1, max: 10}) > 2 ? `
${ (!legacy || source[1] === "external-source") && fake.random.number({min: 1, max: 10}) > 2 ? `
"Meta": {
"external-source": "${fake.helpers.randomize(['kubernetes', 'consul-api-gateway'])}"
},

View File

@ -0,0 +1,15 @@
@setupApplicationTest
Feature: dc / intentions / read-only
Scenario: Viewing a readonly intention
Given 1 datacenter model with the value "dc1"
And 1 intention model from yaml:
---
Meta:
external-source: kubernetes
---
When I visit the intention page for yaml
---
dc: dc1
intention: default:external-source:web:default:external-source:db
---
Then I see the "[data-test-readonly]" element

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);
});
}