Skip to content

Commit

Permalink
ui: Ensure we show a special readonly page for intentions (#11767)
Browse files Browse the repository at this point in the history
  • Loading branch information
johncowen authored and hc-github-team-consul-core committed Dec 13, 2021
1 parent a421bff commit dc8b8b7
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/11767.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Ensure we show a readonly designed page for readonly intentions
```
Original file line number Diff line number Diff line change
Expand Up @@ -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|}}
Expand Down Expand Up @@ -193,6 +196,7 @@ as |api|>
</div>
</form>
{{else}}

{{#if item.IsManagedByCRD}}
<Notice
class="crd"
Expand All @@ -215,8 +219,10 @@ as |api|>
</notice.Footer>
</Notice>
{{/if}}

<Consul::Intention::View
@item={{item}}
data-test-readonly
/>
{{/if}}
{{/let}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<div class="consul-intention-view">
<div
class="consul-intention-view"
...attributes
>

<div class="definition-table">
<dl>
Expand Down
2 changes: 1 addition & 1 deletion ui/packages/consul-ui/mock-api/v1/connect/intentions/exact
Original file line number Diff line number Diff line change
Expand Up @@ -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'])}"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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);
});
}

0 comments on commit dc8b8b7

Please sign in to comment.