Skip to content

Commit 1ad97df

Browse files
authored
fix(dataplanes): show dataplane info even when /stats fails (#4645)
I found a tiny loading/error bug whilst working on something else. TLDR: There was a DataLoader waiting on `traffic` but not erroring on `traffic`s error. When I looked at it I don't think we should be using a DataLoader (neither a loader nor an error) and just wait for the data and show the rendered ui once its loaded. Errors are dealt with via error notifications elsewhere. I added a little test to prevent future regressions (and tested it breaks on master) Previous to this PR, the `About Dataplane` box would show an eternal loader if this errored (relatively common) even though it could show all of the data about the Dataplane. Signed-off-by: John Cowen <john.cowen@konghq.com>
1 parent e86eeee commit 1ad97df

File tree

6 files changed

+352
-351
lines changed

6 files changed

+352
-351
lines changed

packages/kuma-gui/features/mesh/legacy-dataplanes/DataplaneDetailsTraffic.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Feature: mesh / dataplanes / DataplaneDetailsTraffic
33
Background:
44
Given the CSS selectors
55
| Alias | Selector |
6+
| about-section | [data-testid='dataplane-about-section'] |
67
| detail-view | [data-testid='data-plane-detail-tabs-view'] |
78
| loading-warning | [data-testid^='notification-data-planes.notifications.stats-not-enhanced'] |
89
| traffic | [data-testid='dataplane-traffic'] |
@@ -59,6 +60,7 @@ Feature: mesh / dataplanes / DataplaneDetailsTraffic
5960
body:
6061
dataplane:
6162
networking:
63+
address: 58.25.181.133
6264
gateway: !!js/undefined
6365
dataplaneInsight:
6466
mTLS: !!js/undefined
@@ -78,3 +80,4 @@ Feature: mesh / dataplanes / DataplaneDetailsTraffic
7880
When I visit the "/meshes/default/data-planes/dpp-1-name-of-dataplane/overview" URL
7981
And the "$traffic" element exists
8082
And the "$loading-warning" element exists
83+
And the "$about-section" element contains "58.25.181.133"

packages/kuma-gui/src/app/data-planes/routes.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,43 @@ import { routes as connections, networking } from '@/app/connections/routes'
22
import { routes as subscriptions } from '@/app/subscriptions/routes'
33
import type { RouteRecordRaw } from 'vue-router'
44

5+
export const routes = () => {
6+
const item = (): RouteRecordRaw[] => [
7+
{
8+
path: '',
9+
name: 'data-plane-root-view',
10+
component: () => import('@/app/data-planes/views/RootView.vue'),
11+
children: [...dataplaneRoutes()],
12+
},
13+
]
14+
15+
const summary = (prefix?: string): RouteRecordRaw[] => {
16+
const fullPrefix = prefix?.length ? `${prefix}-` : ''
17+
18+
return [
19+
{
20+
path: ':proxy',
21+
name: `${fullPrefix}data-plane-summary-view`,
22+
component: () => import('@/app/data-planes/views/DataPlaneSummaryView.vue'),
23+
},
24+
]
25+
}
26+
27+
return {
28+
items: (): RouteRecordRaw[] => {
29+
return [
30+
{
31+
path: 'data-planes',
32+
name: 'data-plane-list-view',
33+
component: () => import('@/app/data-planes/views/DataPlaneListView.vue'),
34+
children: summary(),
35+
},
36+
]
37+
},
38+
item,
39+
summary,
40+
}
41+
}
542
export const dataplaneRoutes = (): RouteRecordRaw[] => {
643
return [
744
{
@@ -77,40 +114,3 @@ export const dataplaneRoutes = (): RouteRecordRaw[] => {
77114
]
78115
}
79116

80-
export const routes = () => {
81-
const item = (): RouteRecordRaw[] => [
82-
{
83-
path: '',
84-
name: 'data-plane-root-view',
85-
component: () => import('@/app/legacy-data-planes/views/RootView.vue'),
86-
children: [...dataplaneRoutes()],
87-
},
88-
]
89-
90-
const summary = (prefix?: string): RouteRecordRaw[] => {
91-
const fullPrefix = prefix?.length ? `${prefix}-` : ''
92-
93-
return [
94-
{
95-
path: ':proxy',
96-
name: `${fullPrefix}data-plane-summary-view`,
97-
component: () => import('@/app/data-planes/views/DataPlaneSummaryView.vue'),
98-
},
99-
]
100-
}
101-
102-
return {
103-
items: (): RouteRecordRaw[] => {
104-
return [
105-
{
106-
path: 'data-planes',
107-
name: 'data-plane-list-view',
108-
component: () => import('@/app/data-planes/views/DataPlaneListView.vue'),
109-
children: summary(),
110-
},
111-
]
112-
},
113-
item,
114-
summary,
115-
}
116-
}

packages/kuma-gui/src/app/legacy-data-planes/views/DataPlaneRouteGuard.vue renamed to packages/kuma-gui/src/app/data-planes/views/DataPlaneRouteGuard.vue

File renamed without changes.

packages/kuma-gui/src/app/legacy-data-planes/views/RootView.vue renamed to packages/kuma-gui/src/app/data-planes/views/RootView.vue

File renamed without changes.

packages/kuma-gui/src/app/legacy-data-planes/routes.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,43 @@ import { routes as connections, networking } from '@/app/connections/routes'
33
import { routes as subscriptions } from '@/app/subscriptions/routes'
44
import type { RouteRecordRaw } from 'vue-router'
55

6+
export const routes = () => {
7+
const item = (): RouteRecordRaw[] => [
8+
{
9+
path: '',
10+
name: 'data-plane-root-view',
11+
component: () => import('@/app/data-planes/views/RootView.vue'),
12+
children: [...legacyDataplaneRoutes()],
13+
},
14+
]
15+
16+
const summary = (prefix?: string): RouteRecordRaw[] => {
17+
const fullPrefix = prefix?.length ? `${prefix}-` : ''
18+
19+
return [
20+
{
21+
path: ':proxy',
22+
name: `${fullPrefix}data-plane-summary-view`,
23+
component: () => import('@/app/data-planes/views/DataPlaneSummaryView.vue'),
24+
},
25+
]
26+
}
27+
28+
return {
29+
items: (): RouteRecordRaw[] => {
30+
return [
31+
{
32+
path: 'data-planes',
33+
name: 'data-plane-list-view',
34+
component: () => import('@/app/data-planes/views/DataPlaneListView.vue'),
35+
children: summary(),
36+
},
37+
]
38+
},
39+
item,
40+
summary,
41+
}
42+
}
643
export const legacyDataplaneRoutes = (): RouteRecordRaw[] => {
744
return [
845
{
@@ -85,40 +122,3 @@ export const legacyDataplaneRoutes = (): RouteRecordRaw[] => {
85122
]
86123
}
87124

88-
export const routes = () => {
89-
const item = (): RouteRecordRaw[] => [
90-
{
91-
path: '',
92-
name: 'data-plane-root-view',
93-
component: () => import('@/app/legacy-data-planes/views/RootView.vue'),
94-
children: [...legacyDataplaneRoutes()],
95-
},
96-
]
97-
98-
const summary = (prefix?: string): RouteRecordRaw[] => {
99-
const fullPrefix = prefix?.length ? `${prefix}-` : ''
100-
101-
return [
102-
{
103-
path: ':proxy',
104-
name: `${fullPrefix}data-plane-summary-view`,
105-
component: () => import('@/app/data-planes/views/DataPlaneSummaryView.vue'),
106-
},
107-
]
108-
}
109-
110-
return {
111-
items: (): RouteRecordRaw[] => {
112-
return [
113-
{
114-
path: 'data-planes',
115-
name: 'data-plane-list-view',
116-
component: () => import('@/app/data-planes/views/DataPlaneListView.vue'),
117-
children: summary(),
118-
},
119-
]
120-
},
121-
item,
122-
summary,
123-
}
124-
}

0 commit comments

Comments
 (0)