@stolostron/multicluster-sdk 0.3.5 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -17
- package/lib/api/FleetResourceLink.js +1 -1
- package/lib/api/FleetResourceLink.js.map +1 -1
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +1 -1
- package/lib/api/index.js.map +1 -1
- package/lib/api/search/types.d.ts +7 -8
- package/lib/api/search/types.d.ts.map +1 -1
- package/lib/api/search/useFleetSearchPoll.d.ts +3 -0
- package/lib/api/search/useFleetSearchPoll.d.ts.map +1 -0
- package/lib/api/search/useFleetSearchPoll.js +104 -0
- package/lib/api/search/useFleetSearchPoll.js.map +1 -0
- package/lib/api/use-fleet-k8s-watch-resource/index.d.ts +2 -0
- package/lib/api/use-fleet-k8s-watch-resource/index.d.ts.map +1 -0
- package/lib/api/use-fleet-k8s-watch-resource/index.js +8 -0
- package/lib/api/use-fleet-k8s-watch-resource/index.js.map +1 -0
- package/lib/api/useFleetK8sWatchResource.d.ts +32 -0
- package/lib/api/useFleetK8sWatchResource.d.ts.map +1 -1
- package/lib/api/useFleetK8sWatchResource.js +176 -3
- package/lib/api/useFleetK8sWatchResource.js.map +1 -1
- package/lib/api/useHubClusterName.d.ts +5 -0
- package/lib/api/useHubClusterName.d.ts.map +1 -1
- package/lib/api/useHubClusterName.js +40 -8
- package/lib/api/useHubClusterName.js.map +1 -1
- package/lib/components/FleetResourceEventStream/FleetResourceEventStream.d.ts +77 -0
- package/lib/components/FleetResourceEventStream/FleetResourceEventStream.d.ts.map +1 -0
- package/lib/components/FleetResourceEventStream/FleetResourceEventStream.js +255 -0
- package/lib/components/FleetResourceEventStream/FleetResourceEventStream.js.map +1 -0
- package/lib/components/FleetResourceEventStream.d.ts +77 -0
- package/lib/components/FleetResourceEventStream.d.ts.map +1 -0
- package/lib/components/FleetResourceEventStream.js +266 -0
- package/lib/components/FleetResourceEventStream.js.map +1 -0
- package/lib/components/FleetResourceLink.d.ts +53 -0
- package/lib/components/FleetResourceLink.d.ts.map +1 -0
- package/lib/components/FleetResourceLink.js +197 -0
- package/lib/components/FleetResourceLink.js.map +1 -0
- package/lib/extensions/index.d.ts +1 -1
- package/lib/extensions/index.d.ts.map +1 -1
- package/lib/extensions/index.js +1 -1
- package/lib/extensions/index.js.map +1 -1
- package/lib/extensions/resource.d.ts.map +1 -1
- package/lib/extensions/resourceRouteExtension.d.ts +25 -0
- package/lib/extensions/resourceRouteExtension.d.ts.map +1 -0
- package/lib/extensions/resourceRouteExtension.js +7 -0
- package/lib/extensions/resourceRouteExtension.js.map +1 -0
- package/lib/internal/FleetResourceEventStream/EventComponent.d.ts +5 -0
- package/lib/internal/FleetResourceEventStream/EventComponent.d.ts.map +1 -0
- package/lib/internal/FleetResourceEventStream/EventComponent.js +52 -0
- package/lib/internal/FleetResourceEventStream/EventComponent.js.map +1 -0
- package/lib/internal/FleetResourceEventStream/EventStreamList.d.ts +17 -0
- package/lib/internal/FleetResourceEventStream/EventStreamList.d.ts.map +1 -0
- package/lib/internal/FleetResourceEventStream/EventStreamList.js +92 -0
- package/lib/internal/FleetResourceEventStream/EventStreamList.js.map +1 -0
- package/lib/internal/FleetResourceEventStream/TogglePlay.d.ts +8 -0
- package/lib/internal/FleetResourceEventStream/TogglePlay.d.ts.map +1 -0
- package/lib/internal/FleetResourceEventStream/TogglePlay.js +17 -0
- package/lib/internal/FleetResourceEventStream/TogglePlay.js.map +1 -0
- package/lib/internal/FleetResourceEventStream/WithScrollContainer.d.ts +7 -0
- package/lib/internal/FleetResourceEventStream/WithScrollContainer.d.ts.map +1 -0
- package/lib/internal/FleetResourceEventStream/WithScrollContainer.js +51 -0
- package/lib/internal/FleetResourceEventStream/WithScrollContainer.js.map +1 -0
- package/lib/internal/FleetResourceEventStream/constants.d.ts +30 -0
- package/lib/internal/FleetResourceEventStream/constants.d.ts.map +1 -0
- package/lib/internal/FleetResourceEventStream/constants.js +6 -0
- package/lib/internal/FleetResourceEventStream/constants.js.map +1 -0
- package/lib/internal/FleetResourceEventStream/utils.d.ts +16 -0
- package/lib/internal/FleetResourceEventStream/utils.d.ts.map +1 -0
- package/lib/internal/FleetResourceEventStream/utils.js +143 -0
- package/lib/internal/FleetResourceEventStream/utils.js.map +1 -0
- package/lib/internal/cachedHubClusterName.d.ts +3 -0
- package/lib/internal/cachedHubClusterName.d.ts.map +1 -0
- package/lib/internal/cachedHubClusterName.js +32 -0
- package/lib/internal/cachedHubClusterName.js.map +1 -0
- package/lib/internal/fleetK8sWatchResource.d.ts +29 -0
- package/lib/internal/fleetK8sWatchResource.d.ts.map +1 -0
- package/lib/internal/fleetK8sWatchResource.js +89 -0
- package/lib/internal/fleetK8sWatchResource.js.map +1 -0
- package/lib/internal/fleetResourceHelpers.d.ts +82 -0
- package/lib/internal/fleetResourceHelpers.d.ts.map +1 -0
- package/lib/internal/fleetResourceHelpers.js +101 -0
- package/lib/internal/fleetResourceHelpers.js.map +1 -0
- package/lib/internal/types/multicluster-sdk.d.ts.map +1 -1
- package/lib/setupTests.d.ts +3 -0
- package/lib/setupTests.d.ts.map +1 -0
- package/lib/setupTests.js +106 -0
- package/lib/setupTests.js.map +1 -0
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -3
|
@@ -1,12 +1,185 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
2
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
23
|
exports.useFleetK8sWatchResource = void 0;
|
|
4
24
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
5
25
|
const useHubClusterName_1 = require("./useHubClusterName");
|
|
6
|
-
const
|
|
26
|
+
const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
|
|
27
|
+
const useFleetK8sAPIPath_1 = require("./useFleetK8sAPIPath");
|
|
28
|
+
const useIsFleetAvailable_1 = require("./useIsFleetAvailable");
|
|
29
|
+
const react_1 = require("react");
|
|
30
|
+
const apiRequests_1 = require("./apiRequests");
|
|
31
|
+
const fleetK8sWatchResource_1 = require("../internal/fleetK8sWatchResource");
|
|
32
|
+
/**
|
|
33
|
+
* A hook for watching Kubernetes resources with support for multi-cluster environments.
|
|
34
|
+
* It is equivalent to the [`useK8sWatchResource`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#usek8swatchresource)
|
|
35
|
+
* hook from the [OpenShift Console Dynamic Plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk)
|
|
36
|
+
* but allows you to retrieve data from any cluster managed by Red Hat Advanced Cluster Management.
|
|
37
|
+
*
|
|
38
|
+
* It automatically detects the hub cluster and handles resource watching on both hub
|
|
39
|
+
* and remote clusters using WebSocket connections for real-time updates.
|
|
40
|
+
*
|
|
41
|
+
* @param initResource - The resource to watch. Can be null to disable the watch.
|
|
42
|
+
* @param initResource.cluster - The managed cluster on which the resource resides; null for the hub cluster
|
|
43
|
+
* @returns A tuple containing the watched resource data, a boolean indicating if the data is loaded,
|
|
44
|
+
* and any error that occurred. The hook returns live-updating data.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // Watch pods on a remote cluster
|
|
49
|
+
* const [pods, loaded, error] = useFleetK8sWatchResource({
|
|
50
|
+
* groupVersionKind: { version: 'v1', kind: 'Pod' },
|
|
51
|
+
* isList: true,
|
|
52
|
+
* cluster: 'remote-cluster',
|
|
53
|
+
* namespace: 'default'
|
|
54
|
+
* })
|
|
55
|
+
*
|
|
56
|
+
* // Watch a specific deployment on hub cluster
|
|
57
|
+
* const [deployment, loaded, error] = useFleetK8sWatchResource({
|
|
58
|
+
* groupVersionKind: { group: 'apps', version: 'v1', kind: 'Deployment' },
|
|
59
|
+
* name: 'my-app',
|
|
60
|
+
* namespace: 'default'
|
|
61
|
+
* })
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
7
64
|
const useFleetK8sWatchResource = (initResource) => {
|
|
8
|
-
|
|
9
|
-
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
const [hubClusterName, hubClusterNameLoaded] = (0, useHubClusterName_1.useHubClusterName)();
|
|
67
|
+
const clusterSpecified = (initResource === null || initResource === void 0 ? void 0 : initResource.cluster) !== undefined;
|
|
68
|
+
const shouldWaitForHubClusterName = clusterSpecified && !hubClusterNameLoaded;
|
|
69
|
+
const _d = initResource !== null && initResource !== void 0 ? initResource : {}, { cluster } = _d, resource = __rest(_d, ["cluster"]);
|
|
70
|
+
const nullResource = !initResource || !(resource === null || resource === void 0 ? void 0 : resource.groupVersionKind);
|
|
71
|
+
const { isList, groupVersionKind, namespace, name } = resource !== null && resource !== void 0 ? resource : {};
|
|
72
|
+
const [model] = (0, dynamic_plugin_sdk_1.useK8sModel)(groupVersionKind);
|
|
73
|
+
const [backendAPIPath, backendPathLoaded] = (0, useFleetK8sAPIPath_1.useFleetK8sAPIPath)(cluster);
|
|
74
|
+
const isFleetAvailable = (0, useIsFleetAvailable_1.useIsFleetAvailable)();
|
|
75
|
+
const isRemoteCluster = !!cluster && cluster !== hubClusterName;
|
|
76
|
+
const useFleet = isFleetAvailable && !shouldWaitForHubClusterName && isRemoteCluster;
|
|
77
|
+
const useFallback = !isFleetAvailable || (!shouldWaitForHubClusterName && !isRemoteCluster);
|
|
78
|
+
const noCachedValue = (0, react_1.useMemo)(() => (isList ? [] : undefined), [isList]);
|
|
79
|
+
const requestPath = (0, react_1.useMemo)(() => backendPathLoaded && model
|
|
80
|
+
? (0, apiRequests_1.buildResourceURL)({
|
|
81
|
+
model,
|
|
82
|
+
ns: namespace,
|
|
83
|
+
name,
|
|
84
|
+
cluster,
|
|
85
|
+
basePath: backendAPIPath,
|
|
86
|
+
})
|
|
87
|
+
: '', [model, namespace, name, cluster, backendPathLoaded, backendAPIPath]);
|
|
88
|
+
const [data, setData] = (0, react_1.useState)((_a = fleetK8sWatchResource_1.fleetResourceCache[requestPath]) !== null && _a !== void 0 ? _a : noCachedValue);
|
|
89
|
+
const [loaded, setLoaded] = (0, react_1.useState)(!!fleetK8sWatchResource_1.fleetResourceCache[requestPath]);
|
|
90
|
+
const [error, setError] = (0, react_1.useState)(undefined);
|
|
91
|
+
(0, react_1.useEffect)(() => {
|
|
92
|
+
let socket;
|
|
93
|
+
const fetchData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
var _a;
|
|
95
|
+
setError(undefined);
|
|
96
|
+
if (!useFleet || nullResource) {
|
|
97
|
+
setData(noCachedValue);
|
|
98
|
+
setLoaded(false);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (!backendPathLoaded || fleetK8sWatchResource_1.fleetResourceCache[requestPath]) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const data = (yield (0, dynamic_plugin_sdk_1.consoleFetchJSON)(requestPath, 'GET'));
|
|
106
|
+
const processedData = (isList
|
|
107
|
+
? data.items.map((i) => (Object.assign({ cluster }, i)))
|
|
108
|
+
: Object.assign({ cluster }, data));
|
|
109
|
+
fleetK8sWatchResource_1.fleetResourceCache[requestPath] = processedData;
|
|
110
|
+
const watchQuery = {
|
|
111
|
+
ns: namespace,
|
|
112
|
+
cluster,
|
|
113
|
+
};
|
|
114
|
+
if (name) {
|
|
115
|
+
watchQuery.fieldSelector = `metadata.name=${name}`;
|
|
116
|
+
}
|
|
117
|
+
if (isList) {
|
|
118
|
+
watchQuery.resourceVersion = (_a = data === null || data === void 0 ? void 0 : data.metadata) === null || _a === void 0 ? void 0 : _a.resourceVersion;
|
|
119
|
+
}
|
|
120
|
+
const socketKey = (0, fleetK8sWatchResource_1.getCacheKey)({ model, cluster, namespace, name });
|
|
121
|
+
const cachedSocket = fleetK8sWatchResource_1.fleetSocketCache[socketKey];
|
|
122
|
+
if (!cachedSocket || cachedSocket.readyState !== WebSocket.OPEN) {
|
|
123
|
+
socket = (0, apiRequests_1.fleetWatch)(model, watchQuery, backendAPIPath);
|
|
124
|
+
fleetK8sWatchResource_1.fleetSocketCache[socketKey] = socket;
|
|
125
|
+
socket.onmessage = (event) => {
|
|
126
|
+
try {
|
|
127
|
+
(0, fleetK8sWatchResource_1.handleWebsocketEvent)(event, requestPath, setData, isList, fleetK8sWatchResource_1.fleetResourceCache, cluster);
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
console.error('Failed to parse WebSocket message', e);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
socket.onclose = () => {
|
|
134
|
+
delete fleetK8sWatchResource_1.fleetSocketCache[socketKey];
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
socket = cachedSocket;
|
|
139
|
+
}
|
|
140
|
+
setData(processedData);
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
setError(err);
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
setLoaded(true);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
fetchData();
|
|
150
|
+
// Cleanup function to close the WebSocket if it was created by this effect
|
|
151
|
+
return () => {
|
|
152
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
153
|
+
socket.close();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}, [
|
|
157
|
+
cluster,
|
|
158
|
+
isList,
|
|
159
|
+
requestPath,
|
|
160
|
+
name,
|
|
161
|
+
namespace,
|
|
162
|
+
nullResource,
|
|
163
|
+
noCachedValue,
|
|
164
|
+
useFleet,
|
|
165
|
+
backendPathLoaded,
|
|
166
|
+
model,
|
|
167
|
+
backendAPIPath,
|
|
168
|
+
]);
|
|
169
|
+
const fallbackResult = (0, dynamic_plugin_sdk_1.useK8sWatchResource)(useFallback ? resource : null);
|
|
170
|
+
if (!nullResource && useFallback) {
|
|
171
|
+
return fallbackResult;
|
|
172
|
+
}
|
|
173
|
+
else if (!nullResource && useFleet) {
|
|
174
|
+
return [
|
|
175
|
+
(_c = (_b = fleetK8sWatchResource_1.fleetResourceCache[requestPath]) !== null && _b !== void 0 ? _b : data) !== null && _c !== void 0 ? _c : noCachedValue,
|
|
176
|
+
fleetK8sWatchResource_1.fleetResourceCache[requestPath] ? true : loaded,
|
|
177
|
+
error,
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
return [undefined, false, undefined];
|
|
182
|
+
}
|
|
10
183
|
};
|
|
11
184
|
exports.useFleetK8sWatchResource = useFleetK8sWatchResource;
|
|
12
185
|
//# sourceMappingURL=useFleetK8sWatchResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFleetK8sWatchResource.js","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFleetK8sWatchResource.js","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,2DAAuD;AAEvD,8EAA0G;AAC1G,6DAAyD;AACzD,+DAA2D;AAC3D,iCAAoD;AACpD,+CAA4D;AAC5D,6EAK0C;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACI,MAAM,wBAAwB,GAA6B,CAGhE,YAA0C,EAC1C,EAAE;;IACF,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC,GAAG,IAAA,qCAAiB,GAAE,CAAA;IAElE,MAAM,gBAAgB,GAAG,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,MAAK,SAAS,CAAA;IAC5D,MAAM,2BAA2B,GAAG,gBAAgB,IAAI,CAAC,oBAAoB,CAAA;IAE7E,MAAM,KAA2B,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,EAA7C,EAAE,OAAO,OAAoC,EAA/B,QAAQ,cAAtB,WAAwB,CAAqB,CAAA;IACnD,MAAM,YAAY,GAAG,CAAC,YAAY,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,gBAAgB,CAAA,CAAA;IAEjE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAA;IACpE,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,gCAAW,EAAC,gBAAgB,CAAC,CAAA;IAC7C,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,uCAAkB,EAAC,OAAO,CAAC,CAAA;IACvE,MAAM,gBAAgB,GAAG,IAAA,yCAAmB,GAAE,CAAA;IAC9C,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AC,CAAC,CAAC,IAAI,CAAC,CAAA;IAE5E,IAAI,CAAC,YAAY,IAAI,WAAW,EAAE,CAAC;QACjC,OAAO,cAAc,CAAA;IACvB,CAAC;SAAM,IAAI,CAAC,YAAY,IAAI,QAAQ,EAAE,CAAC;QACrC,OAAO;YACL,MAAA,MAAA,0CAAkB,CAAC,WAAW,CAAC,mCAAI,IAAI,mCAAI,aAAa;YACxD,0CAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;YAC/C,KAAK;SACN,CAAA;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;IACtC,CAAC;AACH,CAAC,CAAA;AAhJY,QAAA,wBAAwB,4BAgJpC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { UseHubClusterName } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook that provides hub cluster name.
|
|
4
|
+
*
|
|
5
|
+
* @returns Array with `hubclustername`, `loaded` and `error` values.
|
|
6
|
+
*/
|
|
2
7
|
export declare const useHubClusterName: UseHubClusterName;
|
|
3
8
|
//# sourceMappingURL=useHubClusterName.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHubClusterName.d.ts","sourceRoot":"","sources":["../../src/api/useHubClusterName.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"useHubClusterName.d.ts","sourceRoot":"","sources":["../../src/api/useHubClusterName.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAI5C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBA6B/B,CAAA"}
|
|
@@ -1,17 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.useHubClusterName = void 0;
|
|
4
13
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
5
|
-
const
|
|
6
|
-
const constants_1 = require("../internal/constants");
|
|
7
|
-
const models_1 = require("../internal/models");
|
|
14
|
+
const cachedHubClusterName_1 = require("../internal/cachedHubClusterName");
|
|
8
15
|
const react_1 = require("react");
|
|
16
|
+
const useIsFleetAvailable_1 = require("./useIsFleetAvailable");
|
|
17
|
+
/**
|
|
18
|
+
* Hook that provides hub cluster name.
|
|
19
|
+
*
|
|
20
|
+
* @returns Array with `hubclustername`, `loaded` and `error` values.
|
|
21
|
+
*/
|
|
9
22
|
const useHubClusterName = () => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
23
|
+
const cachedHubClusterName = (0, cachedHubClusterName_1.getCachedHubClusterName)();
|
|
24
|
+
const [hubClusterName, setHubClusterName] = (0, react_1.useState)(cachedHubClusterName);
|
|
25
|
+
const [loaded, setLoaded] = (0, react_1.useState)(!!cachedHubClusterName);
|
|
26
|
+
const [error, setError] = (0, react_1.useState)(undefined);
|
|
27
|
+
const fleetAvailable = (0, useIsFleetAvailable_1.useIsFleetAvailable)();
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
if (!fleetAvailable) {
|
|
30
|
+
setHubClusterName(undefined);
|
|
31
|
+
setLoaded(false);
|
|
32
|
+
setError('A version of RHACM that is compatible with the multicluster SDK is not available');
|
|
33
|
+
}
|
|
34
|
+
if (!cachedHubClusterName) {
|
|
35
|
+
void (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
const hubName = yield (0, cachedHubClusterName_1.fetchHubClusterName)();
|
|
38
|
+
setHubClusterName(hubName);
|
|
39
|
+
setLoaded(true);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
setError(err);
|
|
43
|
+
}
|
|
44
|
+
}))();
|
|
45
|
+
}
|
|
46
|
+
}, [fleetAvailable, cachedHubClusterName]);
|
|
15
47
|
return (0, react_1.useMemo)(() => [hubClusterName, loaded, error], [hubClusterName, loaded, error]);
|
|
16
48
|
};
|
|
17
49
|
exports.useHubClusterName = useHubClusterName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHubClusterName.js","sourceRoot":"","sources":["../../src/api/useHubClusterName.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useHubClusterName.js","sourceRoot":"","sources":["../../src/api/useHubClusterName.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAmE;AACnE,2EAA+F;AAE/F,iCAAoD;AACpD,+DAA2D;AAE3D;;;;GAIG;AACI,MAAM,iBAAiB,GAAsB,GAAG,EAAE;IACvD,MAAM,oBAAoB,GAAG,IAAA,8CAAuB,GAAE,CAAA;IACtD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAqB,oBAAoB,CAAC,CAAA;IAC9F,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAU,CAAC,CAAC,oBAAoB,CAAC,CAAA;IACrE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAM,SAAS,CAAC,CAAA;IAElD,MAAM,cAAc,GAAG,IAAA,yCAAmB,GAAE,CAAA;IAE5C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,iBAAiB,CAAC,SAAS,CAAC,CAAA;YAC5B,SAAS,CAAC,KAAK,CAAC,CAAA;YAChB,QAAQ,CAAC,kFAAkF,CAAC,CAAA;QAC9F,CAAC;QAED,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1B,KAAK,CAAC,GAAS,EAAE;gBACf,IAAI,CAAC;oBACH,MAAM,OAAO,GAAG,MAAM,IAAA,0CAAmB,GAAE,CAAA;oBAC3C,iBAAiB,CAAC,OAAO,CAAC,CAAA;oBAC1B,SAAS,CAAC,IAAI,CAAC,CAAA;gBACjB,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,QAAQ,CAAC,GAAG,CAAC,CAAA;gBACf,CAAC;YACH,CAAC,CAAA,CAAC,EAAE,CAAA;QACN,CAAC;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC,CAAA;IAE1C,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;AACxF,CAAC,CAAA;AA7BY,QAAA,iBAAiB,qBA6B7B"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FleetK8sResourceCommon } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* A multicluster-aware ResourceEventStream component that displays real-time Kubernetes events
|
|
5
|
+
* for resources across multiple clusters. Extends the OpenShift console's ResourceEventStream
|
|
6
|
+
* with fleet management capabilities.
|
|
7
|
+
*
|
|
8
|
+
* For managed cluster resources, this component establishes a websocket connection to stream
|
|
9
|
+
* events from the specified cluster. For hub cluster resources or when no cluster is specified,
|
|
10
|
+
* it falls back to the standard OpenShift console ResourceEventStream component.
|
|
11
|
+
*
|
|
12
|
+
* @component
|
|
13
|
+
* @since 2.15.0
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} props - Component properties
|
|
16
|
+
* @param {FleetK8sResourceCommon} props.resource - The Kubernetes resource to show events for.
|
|
17
|
+
* Must include standard K8s metadata (name, namespace, uid, kind) and an optional cluster property.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Display events for a resource on a managed cluster
|
|
21
|
+
* <FleetResourceEventStream
|
|
22
|
+
* resource={{
|
|
23
|
+
* metadata: { name: 'my-pod', namespace: 'default', uid: '123' },
|
|
24
|
+
* kind: 'Pod',
|
|
25
|
+
* cluster: 'managed-cluster-1'
|
|
26
|
+
* }}
|
|
27
|
+
* />
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Display events for a hub cluster resource (falls back to OpenShift console component)
|
|
31
|
+
* <FleetResourceEventStream
|
|
32
|
+
* resource={{
|
|
33
|
+
* metadata: { name: 'my-deployment', namespace: 'openshift-gitops', uid: '456' },
|
|
34
|
+
* kind: 'Deployment'
|
|
35
|
+
* // No cluster property - uses hub cluster
|
|
36
|
+
* }}
|
|
37
|
+
* />
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Display events for a cluster-scoped resource on a managed cluster
|
|
41
|
+
* <FleetResourceEventStream
|
|
42
|
+
* resource={{
|
|
43
|
+
* metadata: { name: 'my-node', uid: '789' },
|
|
44
|
+
* kind: 'Node',
|
|
45
|
+
* cluster: 'edge-cluster-2'
|
|
46
|
+
* }}
|
|
47
|
+
* />
|
|
48
|
+
*
|
|
49
|
+
* @returns {JSX.Element} A rendered event stream component showing real-time Kubernetes events
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* **Behavior:**
|
|
53
|
+
* - When `resource.cluster` is set and differs from hub cluster: Uses fleet websocket connection
|
|
54
|
+
* - When `resource.cluster` is undefined or equals hub cluster: Falls back to OpenShift console ResourceEventStream
|
|
55
|
+
* - Automatically handles connection lifecycle (open, close, error, reconnect)
|
|
56
|
+
* - Supports both namespaced and cluster-scoped resources
|
|
57
|
+
* - Displays up to 50 most recent events with real-time streaming
|
|
58
|
+
* - Provides play/pause controls for event streaming
|
|
59
|
+
*
|
|
60
|
+
* **Event Filtering:**
|
|
61
|
+
* Events are filtered by `involvedObject.uid`, `involvedObject.name`, and `involvedObject.kind`
|
|
62
|
+
* to show only events related to the specified resource.
|
|
63
|
+
*
|
|
64
|
+
* **Error Handling:**
|
|
65
|
+
* - Shows loading spinner during initial connection
|
|
66
|
+
* - Displays error states for connection failures
|
|
67
|
+
* - Shows empty state when no events exist
|
|
68
|
+
* - Automatically attempts reconnection on websocket errors
|
|
69
|
+
*
|
|
70
|
+
* @see {@link FleetK8sResourceCommon} for resource type definition
|
|
71
|
+
* @see {@link https://github.com/openshift/console/tree/master/frontend/packages/console-dynamic-plugin-sdk} OpenShift Console Dynamic Plugin SDK
|
|
72
|
+
*/
|
|
73
|
+
declare const FleetResourceEventStream: FC<{
|
|
74
|
+
resource: FleetK8sResourceCommon;
|
|
75
|
+
}>;
|
|
76
|
+
export default FleetResourceEventStream;
|
|
77
|
+
//# sourceMappingURL=FleetResourceEventStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FleetResourceEventStream.d.ts","sourceRoot":"","sources":["../../../src/components/FleetResourceEventStream/FleetResourceEventStream.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAA;AAMvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAapD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH,QAAA,MAAM,wBAAwB,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,sBAAsB,CAAA;CAAE,CAoLtE,CAAA;AAED,eAAe,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
40
|
+
/* Copyright Contributors to the Open Cluster Management project */
|
|
41
|
+
const react_1 = require("react");
|
|
42
|
+
// References translations directly from OpenShift console - not from plugins
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
44
|
+
const react_i18next_1 = require("react-i18next");
|
|
45
|
+
const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
|
|
46
|
+
const _ = __importStar(require("lodash"));
|
|
47
|
+
const api_1 = require("../../api");
|
|
48
|
+
const utils_1 = require("./utils");
|
|
49
|
+
const constants_1 = require("./constants");
|
|
50
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
51
|
+
const react_styles_1 = require("@patternfly/react-styles");
|
|
52
|
+
const TogglePlay_1 = __importDefault(require("./TogglePlay"));
|
|
53
|
+
const EventStreamList_1 = require("./EventStreamList");
|
|
54
|
+
const EventComponent_1 = __importDefault(require("./EventComponent"));
|
|
55
|
+
/**
|
|
56
|
+
* A multicluster-aware ResourceEventStream component that displays real-time Kubernetes events
|
|
57
|
+
* for resources across multiple clusters. Extends the OpenShift console's ResourceEventStream
|
|
58
|
+
* with fleet management capabilities.
|
|
59
|
+
*
|
|
60
|
+
* For managed cluster resources, this component establishes a websocket connection to stream
|
|
61
|
+
* events from the specified cluster. For hub cluster resources or when no cluster is specified,
|
|
62
|
+
* it falls back to the standard OpenShift console ResourceEventStream component.
|
|
63
|
+
*
|
|
64
|
+
* @component
|
|
65
|
+
* @since 2.15.0
|
|
66
|
+
*
|
|
67
|
+
* @param {Object} props - Component properties
|
|
68
|
+
* @param {FleetK8sResourceCommon} props.resource - The Kubernetes resource to show events for.
|
|
69
|
+
* Must include standard K8s metadata (name, namespace, uid, kind) and an optional cluster property.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* // Display events for a resource on a managed cluster
|
|
73
|
+
* <FleetResourceEventStream
|
|
74
|
+
* resource={{
|
|
75
|
+
* metadata: { name: 'my-pod', namespace: 'default', uid: '123' },
|
|
76
|
+
* kind: 'Pod',
|
|
77
|
+
* cluster: 'managed-cluster-1'
|
|
78
|
+
* }}
|
|
79
|
+
* />
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* // Display events for a hub cluster resource (falls back to OpenShift console component)
|
|
83
|
+
* <FleetResourceEventStream
|
|
84
|
+
* resource={{
|
|
85
|
+
* metadata: { name: 'my-deployment', namespace: 'openshift-gitops', uid: '456' },
|
|
86
|
+
* kind: 'Deployment'
|
|
87
|
+
* // No cluster property - uses hub cluster
|
|
88
|
+
* }}
|
|
89
|
+
* />
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* // Display events for a cluster-scoped resource on a managed cluster
|
|
93
|
+
* <FleetResourceEventStream
|
|
94
|
+
* resource={{
|
|
95
|
+
* metadata: { name: 'my-node', uid: '789' },
|
|
96
|
+
* kind: 'Node',
|
|
97
|
+
* cluster: 'edge-cluster-2'
|
|
98
|
+
* }}
|
|
99
|
+
* />
|
|
100
|
+
*
|
|
101
|
+
* @returns {JSX.Element} A rendered event stream component showing real-time Kubernetes events
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* **Behavior:**
|
|
105
|
+
* - When `resource.cluster` is set and differs from hub cluster: Uses fleet websocket connection
|
|
106
|
+
* - When `resource.cluster` is undefined or equals hub cluster: Falls back to OpenShift console ResourceEventStream
|
|
107
|
+
* - Automatically handles connection lifecycle (open, close, error, reconnect)
|
|
108
|
+
* - Supports both namespaced and cluster-scoped resources
|
|
109
|
+
* - Displays up to 50 most recent events with real-time streaming
|
|
110
|
+
* - Provides play/pause controls for event streaming
|
|
111
|
+
*
|
|
112
|
+
* **Event Filtering:**
|
|
113
|
+
* Events are filtered by `involvedObject.uid`, `involvedObject.name`, and `involvedObject.kind`
|
|
114
|
+
* to show only events related to the specified resource.
|
|
115
|
+
*
|
|
116
|
+
* **Error Handling:**
|
|
117
|
+
* - Shows loading spinner during initial connection
|
|
118
|
+
* - Displays error states for connection failures
|
|
119
|
+
* - Shows empty state when no events exist
|
|
120
|
+
* - Automatically attempts reconnection on websocket errors
|
|
121
|
+
*
|
|
122
|
+
* @see {@link FleetK8sResourceCommon} for resource type definition
|
|
123
|
+
* @see {@link https://github.com/openshift/console/tree/master/frontend/packages/console-dynamic-plugin-sdk} OpenShift Console Dynamic Plugin SDK
|
|
124
|
+
*/
|
|
125
|
+
const FleetResourceEventStream = ({ resource }) => {
|
|
126
|
+
var _a, _b, _c;
|
|
127
|
+
const [active, setActive] = (0, react_1.useState)(true);
|
|
128
|
+
const [hubCluster] = (0, api_1.useHubClusterName)();
|
|
129
|
+
const { t } = (0, react_i18next_1.useTranslation)('public');
|
|
130
|
+
const [sortedEvents, setSortedEvents] = (0, react_1.useState)([]);
|
|
131
|
+
const [error, setError] = (0, react_1.useState)(false);
|
|
132
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
133
|
+
const ws = (0, react_1.useRef)();
|
|
134
|
+
const [backendAPIPath, loaded] = (0, api_1.useFleetK8sAPIPath)(resource === null || resource === void 0 ? void 0 : resource.cluster);
|
|
135
|
+
const fieldSelector = `involvedObject.uid=${(_a = resource === null || resource === void 0 ? void 0 : resource.metadata) === null || _a === void 0 ? void 0 : _a.uid},involvedObject.name=${(_b = resource === null || resource === void 0 ? void 0 : resource.metadata) === null || _b === void 0 ? void 0 : _b.name},involvedObject.kind=${resource === null || resource === void 0 ? void 0 : resource.kind}`;
|
|
136
|
+
const namespace = (_c = resource === null || resource === void 0 ? void 0 : resource.metadata) === null || _c === void 0 ? void 0 : _c.namespace;
|
|
137
|
+
// Handle websocket setup and teardown when dependent props change
|
|
138
|
+
(0, react_1.useEffect)(() => {
|
|
139
|
+
var _a;
|
|
140
|
+
if (!resource.cluster || resource.cluster === hubCluster || !loaded)
|
|
141
|
+
return;
|
|
142
|
+
(_a = ws.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
143
|
+
const watchURLOptions = Object.assign(Object.assign({ cluster: resource.cluster }, (namespace ? { ns: namespace } : {})), (fieldSelector
|
|
144
|
+
? {
|
|
145
|
+
fieldSelector,
|
|
146
|
+
}
|
|
147
|
+
: {}));
|
|
148
|
+
if (!ws.current) {
|
|
149
|
+
ws.current = (0, api_1.fleetWatch)(utils_1.EventModel, watchURLOptions, backendAPIPath);
|
|
150
|
+
if (ws.current === undefined)
|
|
151
|
+
return;
|
|
152
|
+
ws.current.onmessage = (message) => {
|
|
153
|
+
if (!active)
|
|
154
|
+
return;
|
|
155
|
+
const eventdataParsed = JSON.parse(message.data);
|
|
156
|
+
if (!eventdataParsed)
|
|
157
|
+
return;
|
|
158
|
+
const eventType = eventdataParsed.type;
|
|
159
|
+
const object = eventdataParsed.object;
|
|
160
|
+
setSortedEvents((currentSortedEvents) => {
|
|
161
|
+
var _a;
|
|
162
|
+
const topEvents = currentSortedEvents.slice(0, constants_1.MAX_MESSAGES);
|
|
163
|
+
const uid = ((_a = object === null || object === void 0 ? void 0 : object.metadata) === null || _a === void 0 ? void 0 : _a.uid) || '';
|
|
164
|
+
const eventAlreadyExists = topEvents.find((e) => { var _a; return ((_a = e === null || e === void 0 ? void 0 : e.metadata) === null || _a === void 0 ? void 0 : _a.uid) === uid; });
|
|
165
|
+
switch (eventType) {
|
|
166
|
+
case 'ADDED':
|
|
167
|
+
case 'MODIFIED':
|
|
168
|
+
if (eventAlreadyExists &&
|
|
169
|
+
(eventAlreadyExists === null || eventAlreadyExists === void 0 ? void 0 : eventAlreadyExists.count) !== undefined &&
|
|
170
|
+
(object === null || object === void 0 ? void 0 : object.count) !== undefined &&
|
|
171
|
+
eventAlreadyExists.count > object.count) {
|
|
172
|
+
// We already have a more recent version of this message stored, so skip this one
|
|
173
|
+
return topEvents;
|
|
174
|
+
}
|
|
175
|
+
return (0, utils_1.sortEvents)([...topEvents, object]);
|
|
176
|
+
case 'DELETED':
|
|
177
|
+
return topEvents.filter((e) => { var _a; return ((_a = e === null || e === void 0 ? void 0 : e.metadata) === null || _a === void 0 ? void 0 : _a.uid) !== uid; });
|
|
178
|
+
default:
|
|
179
|
+
// eslint-disable-next-line no-console
|
|
180
|
+
console.error(`UNHANDLED EVENT: ${eventType}`);
|
|
181
|
+
return topEvents;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
ws.current.onopen = () => {
|
|
186
|
+
setActive(true);
|
|
187
|
+
setError(false);
|
|
188
|
+
setLoading(false);
|
|
189
|
+
};
|
|
190
|
+
ws.current.onclose = (evt) => {
|
|
191
|
+
setActive(false);
|
|
192
|
+
if ((evt === null || evt === void 0 ? void 0 : evt.wasClean) === false) {
|
|
193
|
+
setError(evt.reason || t('public~Connection did not close cleanly.'));
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
ws.current.onerror = () => {
|
|
197
|
+
setActive(false);
|
|
198
|
+
setError(true);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
return () => {
|
|
202
|
+
var _a;
|
|
203
|
+
(_a = ws.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
204
|
+
};
|
|
205
|
+
}, [namespace, fieldSelector, active, t, resource.cluster, hubCluster, loaded, backendAPIPath]);
|
|
206
|
+
// return early after all hooks are called
|
|
207
|
+
if (!resource.cluster || resource.cluster === hubCluster)
|
|
208
|
+
return (0, jsx_runtime_1.jsx)(dynamic_plugin_sdk_1.ResourceEventStream, { resource: resource });
|
|
209
|
+
const count = sortedEvents.length;
|
|
210
|
+
const noEvents = count === 0;
|
|
211
|
+
const noMatches = count > 0 && count === 0;
|
|
212
|
+
let sysEventStatus, statusBtnTxt;
|
|
213
|
+
if (noEvents || (noMatches && resource)) {
|
|
214
|
+
sysEventStatus = (0, jsx_runtime_1.jsx)(react_core_1.EmptyState, { title: t('public~No events') });
|
|
215
|
+
}
|
|
216
|
+
if (noMatches && !resource) {
|
|
217
|
+
sysEventStatus = ((0, jsx_runtime_1.jsx)(react_core_1.EmptyState, { title: t('public~No matching events'), children: count >= constants_1.MAX_MESSAGES
|
|
218
|
+
? t('public~{{count}}+ event exist, but none match the current filter', {
|
|
219
|
+
count: constants_1.MAX_MESSAGES,
|
|
220
|
+
})
|
|
221
|
+
: t('public~{{count}} event exist, but none match the current filter', {
|
|
222
|
+
count,
|
|
223
|
+
}) }));
|
|
224
|
+
}
|
|
225
|
+
if (error) {
|
|
226
|
+
statusBtnTxt = ((0, jsx_runtime_1.jsx)("span", { className: "co-sysevent-stream__connection-error", children: _.isString(error)
|
|
227
|
+
? t('public~Error connecting to event stream: { error }', {
|
|
228
|
+
error,
|
|
229
|
+
})
|
|
230
|
+
: t('public~Error connecting to event stream') }));
|
|
231
|
+
sysEventStatus = ((0, jsx_runtime_1.jsx)(react_core_1.EmptyState, { title: t('public~Error loading events'), id: "empty-state", children: t('public~An error occurred during event retrieval. Attempting to reconnect...') }));
|
|
232
|
+
}
|
|
233
|
+
else if (loading) {
|
|
234
|
+
statusBtnTxt = (0, jsx_runtime_1.jsx)("span", { children: t('public~Loading events...') });
|
|
235
|
+
sysEventStatus = (0, jsx_runtime_1.jsx)(react_core_1.Spinner, { id: "spinner" });
|
|
236
|
+
}
|
|
237
|
+
else if (active) {
|
|
238
|
+
statusBtnTxt = (0, jsx_runtime_1.jsx)("span", { children: t('public~Streaming events...') });
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
statusBtnTxt = (0, jsx_runtime_1.jsx)("span", { children: t('public~Event stream is paused.') });
|
|
242
|
+
}
|
|
243
|
+
const klass = (0, react_styles_1.css)('co-sysevent-stream__timeline', {
|
|
244
|
+
'co-sysevent-stream__timeline--empty': !count,
|
|
245
|
+
});
|
|
246
|
+
const messageCount = count < constants_1.MAX_MESSAGES
|
|
247
|
+
? t('public~Showing {{count}} event', { count })
|
|
248
|
+
: t('public~Showing most recent {{count}} event', { count });
|
|
249
|
+
const toggleStream = () => {
|
|
250
|
+
setActive((prev) => !prev);
|
|
251
|
+
};
|
|
252
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_core_1.PageSection, { children: (0, jsx_runtime_1.jsxs)("div", { className: "co-sysevent-stream", children: [(0, jsx_runtime_1.jsxs)("div", { className: "co-sysevent-stream__status", children: [(0, jsx_runtime_1.jsx)("div", { className: "co-sysevent-stream__timeline__btn-text", children: statusBtnTxt }), (0, jsx_runtime_1.jsx)("div", { className: "co-sysevent-stream__totals pf-v6-u-text-color-subtle", "data-test": "event-totals", children: messageCount })] }), (0, jsx_runtime_1.jsxs)("div", { className: klass, children: [(0, jsx_runtime_1.jsx)(TogglePlay_1.default, { active: active, onClick: toggleStream, className: "co-sysevent-stream__timeline__btn" }), (0, jsx_runtime_1.jsx)("div", { className: "co-sysevent-stream__timeline__end-message", children: t('public~Older events are not stored.') })] }), count > 0 && (0, jsx_runtime_1.jsx)(EventStreamList_1.EventStreamList, { events: sortedEvents, EventComponent: EventComponent_1.default }), sysEventStatus] }) }) }));
|
|
253
|
+
};
|
|
254
|
+
exports.default = FleetResourceEventStream;
|
|
255
|
+
//# sourceMappingURL=FleetResourceEventStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FleetResourceEventStream.js","sourceRoot":"","sources":["../../../src/components/FleetResourceEventStream/FleetResourceEventStream.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,iCAAuD;AAEvD,6EAA6E;AAC7E,oEAAoE;AACpE,iDAA8C;AAC9C,8EAA2E;AAG3E,0CAA2B;AAC3B,mCAA6E;AAC7E,mCAAgD;AAChD,2CAAqD;AACrD,uDAAyE;AAEzE,2DAA8C;AAC9C,8DAAqC;AACrC,uDAAmD;AACnD,sEAA6C;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH,MAAM,wBAAwB,GAA6C,CAAC,E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