Skip to content

Commit

Permalink
feat: in summary drawers use dropdown to select config format (#3445)
Browse files Browse the repository at this point in the history
As a continuation of #3414 this brings the dropdown to select the
preferred config format to all the other summary drawers.


![image](https://github.com/user-attachments/assets/7fb7f9a1-40a8-42a5-bea4-e83e306ecff6)

![Screenshot 2025-01-22 at 10 47
11](https://github.com/user-attachments/assets/f15b1472-a3fa-49aa-940f-b4bab4fe67de)

Part of #3283

---------

Signed-off-by: schogges <[email protected]>
  • Loading branch information
schogges authored Jan 22, 2025
1 parent 7fef92f commit a0a999c
Show file tree
Hide file tree
Showing 33 changed files with 1,413 additions and 850 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ Feature: application / MainNavigation
inbound:
- port: 51112
"""
And the "[data-testid='data-plane-connection-inbound-summary-stats-view-tab'].active" element exists
And the "[data-testid='data-plane-connection-inbound-summary-stats-view-tab'].active" element exists
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Feature: HostnameGenerator summary

Background:
Given the CSS selectors
| Alias | Selector |
| summary | [data-testid='summary'] |
| select-preference | $summary [data-testid='select-input'] |
| structured-view | $summary [data-testid='structured-view'] |

Scenario: Switching to YAML format and back
Given the URL "/hostnamegenerators" responds with
"""
body:
items:
- name: <HostnameGenerator>
"""
When I visit the "/hostname-generators/<HostnameGenerator>" URL
Then the "$select-preference" element exists
And the "$structured-view" element exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-yaml'] button" element
Then the URL contains "format=yaml"
And the "[data-testid='k-code-block']" element exists
And the "$structured-view" element doesn't exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists

Examples:
| HostnameGenerator |
| local-mesh-external-service |
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Feature: BuiltinGateway summary

Background:
Given the CSS selectors
| Alias | Selector |
| summary | [data-testid='summary'] |
| select-preference | $summary [data-testid='select-input'] |
| structured-view | $summary [data-testid='structured-view'] |
And the environment
"""
KUMA_MESHGATEWAY_COUNT: 1
"""
And the URL "/meshes/default/meshgateways" responds with
"""
body:
items:
- name: gateway-1
labels:
kuma.io/origin: zone
kuma.io/zone: zone-1
kuma.io/display-name: gateway-1
"""

Scenario: Switching to YAML format and back
When I visit the "<URL>" URL
Then the "$select-preference" element exists
And the "$structured-view" element exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-yaml'] button" element
Then the URL contains "format=yaml"
And the "[data-testid='k-code-block']" element exists
And the "$structured-view" element doesn't exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists

Examples:
| URL |
| /meshes/default/gateways/builtin/gateway-1 |
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ Feature: Dataplane policy summary
Background:
Given the CSS selectors
| Alias | Selector |
| summary-slideout-container | [data-testid='summary'] [data-testid='slideout-container'] |
| summary | [data-testid='summary'] |
| summary-slideout-container | $summary [data-testid='slideout-container'] |
| summary-title | $summary-slideout-container [data-testid='slideout-title'] |
| summary-content | $summary-slideout-container [data-testid='data-plane-policy-summary-view'] |
| select-preference | $summary [data-testid='select-input'] |
| structured-view | $summary [data-testid='structured-view'] |

Scenario: Policy Summary View has expected content
Given the URL "/meshes/default/meshhttproutes/the-other-http-route" responds with
Expand Down Expand Up @@ -46,4 +49,36 @@ Feature: Dataplane policy summary
And the "$summary-content" element contains "MeshGateway:foo"
And the "$summary-content" element contains "Namespace"
And the "$summary-content" element contains "kuma-system"
And the "$summary-content [data-testid='k-code-block']" element exists
And the "$select-preference" element exists

Scenario: Switching to YAML format and back
Given the URL "/meshes/default/meshhttproutes/<PolicyName>" responds with
"""
body:
type: MeshHTTPRoute
mesh: default
name: <PolicyName>
labels:
k8s.kuma.io/namespace: kuma-system
kuma.io/display-name: foo
spec:
targetRef:
kind: MeshGateway
name: foo
"""
When I visit the "/meshes/default/data-planes/dataplane-1/policies/meshhttproutes/<PolicyName>" URL
Then the "$select-preference" element exists
And the "$structured-view" element exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-yaml'] button" element
Then the URL contains "format=yaml"
And the "[data-testid='k-code-block']" element exists
And the "$structured-view" element doesn't exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists

Examples:
| PolicyName |
| the-other-http-route |
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Feature: Dataplane summary
| item | [data-testid='data-plane-collection'] tbody tr |
| summary | [data-testid='summary'] |
| close-summary-button | $summary [data-testid='slideout-close-icon'] |
| select-preference | $summary [data-testid='select-input'] |
| structured-view | $summary [data-testid='structured-view'] |
And the environment
"""
KUMA_SUBSCRIPTION_COUNT: 2
Expand Down Expand Up @@ -47,3 +49,21 @@ Feature: Dataplane summary
"""
When I visit the "/meshes/default/data-planes/test-data-plane-1?page=2&size=50" URL
Then the "$summary" element exists

Scenario: Switching to YAML format and back
Given the environment
"""
KUMA_DATAPLANE_COUNT: 1
"""
When I visit the "/meshes/default/data-planes/test-data-plane-1" URL
Then the "$select-preference" element exists
And the "$structured-view" element exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-yaml'] button" element
Then the URL contains "format=yaml"
And the "[data-testid='k-code-block']" element exists
And the "$structured-view" element doesn't exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: mesh / dataplanes / connections / clusters

Scenario: The inbound clusters tab correctly filters by 'localhost_<port>'
Given the CSS selectors
| Alias | Selector |
| Alias | Selector |
| code | [data-testid='data-plane-connection-inbound-summary-clusters-view'] [data-testid='k-code-block'] |
And the URL "/meshes/mesh-name/dataplanes/service-64cbb7b8b5-6g94n.namespace/_overview" responds with
"""
Expand Down Expand Up @@ -30,7 +30,7 @@ Feature: mesh / dataplanes / connections / clusters

Scenario: The outbound clusters tab correctly filters by '<clusterName>'
Given the CSS selectors
| Alias | Selector |
| Alias | Selector |
| code | [data-testid='data-plane-connection-outbound-summary-clusters-view'] [data-testid='k-code-block'] |
And the URL "/meshes/mesh-name/dataplanes/service-64cbb7b8b5-6g94n.namespace/stats" responds with
"""
Expand Down
20 changes: 20 additions & 0 deletions packages/kuma-gui/features/mesh/policies/PolicySummary.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Feature: Policy summary
| item | $items tbody tr |
| summary | [data-testid='summary'] |
| close-summary-button | $summary [data-testid='slideout-close-icon'] |
| select-preference | $summary [data-testid='select-input'] |
| structured-view | $summary [data-testid='structured-view'] |
And the URL "/meshes/default/meshfaultinjections" responds with
"""
body:
Expand Down Expand Up @@ -38,3 +40,21 @@ Feature: Policy summary
"""
When I visit the "/meshes/default/policies/meshfaultinjections/mfi-1?page=2&size=50" URL
Then the "$summary" element exists

Scenario: Switching to YAML format and back
Given the environment
"""
KUMA_MESHFAULTINJECTION_COUNT: 1
"""
When I visit the "/meshes/default/policies/meshfaultinjections/mfi-1" URL
Then the "$select-preference" element exists
And the "$structured-view" element exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-yaml'] button" element
Then the URL contains "format=yaml"
And the "[data-testid='k-code-block']" element exists
And the "$structured-view" element doesn't exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Feature: MeshExternalService summary

Background:
Given the CSS selectors
| Alias | Selector |
| summary | [data-testid='summary'] |
| select-preference | $summary [data-testid='select-input'] |
| structured-view | $summary [data-testid='structured-view'] |
And the environment
"""
KUMA_SERVICE_COUNT: 1
"""

Rule: In a namespaced environment

Background:
Given the environment
"""
KUMA_ENVIRONMENT: kubernetes
"""
And the URL "/meshes/default/meshexternalservices" responds with
"""
body:
items:
- name: monitor-proxy-0.kuma-demo
labels:
kuma.io/display-name: monitor-proxy-0
k8s.kuma.io/namespace: kuma-demo
"""

Scenario Outline: Switching to YAML format and back
When I visit the "<URL>" URL
Then the "$select-preference" element exists
And the "$structured-view" element exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-yaml'] button" element
Then the URL contains "format=yaml"
And the "[data-testid='k-code-block']" element exists
And the "$structured-view" element doesn't exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists

Examples:
| URL |
| /meshes/default/services/mesh-external-services/monitor-proxy-0.kuma-demo |
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Feature: MeshMultiZoneService summary

Background:
Given the CSS selectors
| Alias | Selector |
| summary | [data-testid='summary'] |
| select-preference | $summary [data-testid='select-input'] |
| structured-view | $summary [data-testid='structured-view'] |
And the environment
"""
KUMA_SERVICE_COUNT: 1
"""

Rule: In a namespaced environment

Background:
Given the environment
"""
KUMA_ENVIRONMENT: kubernetes
"""
And the URL "/meshes/default/meshmultizoneservices" responds with
"""
body:
items:
- name: monitor-proxy-0.kuma-demo
labels:
kuma.io/display-name: monitor-proxy-0
k8s.kuma.io/namespace: kuma-demo
"""

Scenario Outline: Switching to YAML format and back
When I visit the "<URL>" URL
Then the "$select-preference" element exists
And the "$structured-view" element exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-yaml'] button" element
Then the URL contains "format=yaml"
And the "[data-testid='k-code-block']" element exists
And the "$structured-view" element doesn't exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists

Examples:
| URL |
| /meshes/default/services/mesh-multi-zone-services/monitor-proxy-0.kuma-demo |
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Feature: MeshService summary

Background:
Given the CSS selectors
| Alias | Selector |
| summary | [data-testid='summary'] |
| select-preference | $summary [data-testid='select-input'] |
| structured-view | $summary [data-testid='structured-view'] |
And the environment
"""
KUMA_SERVICE_COUNT: 1
"""

Rule: In a namespaced environment

Background:
Given the environment
"""
KUMA_ENVIRONMENT: kubernetes
"""
And the URL "/meshes/default/meshservices" responds with
"""
body:
items:
- name: monitor-proxy-0.kuma-demo
labels:
kuma.io/display-name: monitor-proxy-0
k8s.kuma.io/namespace: kuma-demo
"""

Scenario Outline: Switching to YAML format and back
When I visit the "<URL>" URL
Then the "$select-preference" element exists
And the "$structured-view" element exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-yaml'] button" element
Then the URL contains "format=yaml"
And the "[data-testid='k-code-block']" element exists
And the "$structured-view" element doesn't exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists

Examples:
| URL |
| /meshes/default/services/mesh-services/monitor-proxy-0.kuma-demo |
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Feature: Zone Egress summary
| item | [data-testid='zone-egress-collection'] tbody tr |
| summary | [data-testid='summary'] |
| close-summary-button | $summary [data-testid='slideout-close-icon'] |
| select-preference | $summary [data-testid='select-input'] |
| structured-view | $summary [data-testid='structured-view'] |
And the URL "/zoneegresses/_overview" responds with
"""
body:
Expand Down Expand Up @@ -39,3 +41,21 @@ Feature: Zone Egress summary
"""
When I visit the "/zones/zone-1/egresses/zone-egress-1?page=2&size=50" URL
Then the "$summary" element exists

Scenario: Switching to YAML format and back
Given the environment
"""
KUMA_ZONEEGRESS_COUNT: 1
"""
When I visit the "/zones/zone-1/egresses/zone-egress-1" URL
Then the "$select-preference" element exists
And the "$structured-view" element exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-yaml'] button" element
Then the URL contains "format=yaml"
And the "[data-testid='k-code-block']" element exists
And the "$structured-view" element doesn't exists
When I click the "$select-preference" element
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,3 @@ Feature: Zone Ingress summary
When I click the "[data-testid='select-item-structured'] button" element
Then the URL contains "format=structured"
And the "$structured-view" element exists


Loading

0 comments on commit a0a999c

Please sign in to comment.