@stolostron/multicluster-sdk 0.4.1 → 0.5.0
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 +62 -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/useFleetSearchPoll.d.ts +71 -0
- package/lib/api/useFleetSearchPoll.d.ts.map +1 -0
- package/lib/api/{search/useFleetSearchPoll.js → useFleetSearchPoll.js} +91 -5
- package/lib/api/useFleetSearchPoll.js.map +1 -0
- package/lib/api/useHubClusterName.d.ts.map +1 -1
- package/lib/api/useHubClusterName.js +4 -2
- package/lib/api/useHubClusterName.js.map +1 -1
- package/lib/internal/cachedHubClusterName.d.ts.map +1 -1
- package/lib/internal/cachedHubClusterName.js +11 -4
- package/lib/internal/cachedHubClusterName.js.map +1 -1
- package/lib/internal/search/search-client.d.ts.map +1 -0
- package/lib/{api → internal}/search/search-client.js +1 -1
- package/lib/internal/search/search-client.js.map +1 -0
- package/lib/internal/search/search-sdk.d.ts.map +1 -0
- package/lib/internal/search/search-sdk.js.map +1 -0
- package/lib/internal/search/searchUtils.d.ts.map +1 -0
- package/lib/internal/search/searchUtils.js.map +1 -0
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/types/fleet.d.ts +2 -0
- package/lib/types/fleet.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/lib/types/search.d.ts +7 -0
- package/lib/types/search.d.ts.map +1 -0
- package/lib/{api/search/types.js → types/search.js} +1 -1
- package/lib/types/search.js.map +1 -0
- package/package.json +1 -1
- package/lib/api/FleetSupport.d.ts +0 -6
- package/lib/api/FleetSupport.d.ts.map +0 -1
- package/lib/api/FleetSupport.js +0 -45
- package/lib/api/FleetSupport.js.map +0 -1
- package/lib/api/search/search-client.d.ts.map +0 -1
- package/lib/api/search/search-client.js.map +0 -1
- package/lib/api/search/search-sdk.d.ts.map +0 -1
- package/lib/api/search/search-sdk.js.map +0 -1
- package/lib/api/search/searchUtils.d.ts.map +0 -1
- package/lib/api/search/searchUtils.js.map +0 -1
- package/lib/api/search/types.d.ts +0 -9
- package/lib/api/search/types.d.ts.map +0 -1
- package/lib/api/search/types.js.map +0 -1
- package/lib/api/search/useFleetSearchPoll.d.ts +0 -3
- package/lib/api/search/useFleetSearchPoll.d.ts.map +0 -1
- package/lib/api/search/useFleetSearchPoll.js.map +0 -1
- package/lib/api/search/useMulticlusterSearchWatch.d.ts +0 -3
- package/lib/api/search/useMulticlusterSearchWatch.d.ts.map +0 -1
- package/lib/api/search/useMulticlusterSearchWatch.js +0 -69
- package/lib/api/search/useMulticlusterSearchWatch.js.map +0 -1
- package/lib/api/use-fleet-k8s-watch-resource/index.d.ts +0 -2
- package/lib/api/use-fleet-k8s-watch-resource/index.d.ts.map +0 -1
- package/lib/api/use-fleet-k8s-watch-resource/index.js +0 -8
- package/lib/api/use-fleet-k8s-watch-resource/index.js.map +0 -1
- package/lib/api/use-fleet-k8s-watch-resource/use-fleet-k8s-watch-resource.d.ts +0 -4
- package/lib/api/use-fleet-k8s-watch-resource/use-fleet-k8s-watch-resource.d.ts.map +0 -1
- package/lib/api/use-fleet-k8s-watch-resource/use-fleet-k8s-watch-resource.js +0 -132
- package/lib/api/use-fleet-k8s-watch-resource/use-fleet-k8s-watch-resource.js.map +0 -1
- package/lib/api/use-fleet-k8s-watch-resource/utils.d.ts +0 -2
- package/lib/api/use-fleet-k8s-watch-resource/utils.d.ts.map +0 -1
- package/lib/api/use-fleet-k8s-watch-resource/utils.js +0 -56
- package/lib/api/use-fleet-k8s-watch-resource/utils.js.map +0 -1
- package/lib/api/useFleetAccessReview/access-review.d.ts +0 -20
- package/lib/api/useFleetAccessReview/access-review.d.ts.map +0 -1
- package/lib/api/useFleetAccessReview/access-review.js +0 -47
- package/lib/api/useFleetAccessReview/access-review.js.map +0 -1
- package/lib/api/useFleetAccessReview/checkAccess.d.ts +0 -19
- package/lib/api/useFleetAccessReview/checkAccess.d.ts.map +0 -1
- package/lib/api/useFleetAccessReview/checkAccess.js +0 -54
- package/lib/api/useFleetAccessReview/checkAccess.js.map +0 -1
- package/lib/api/useFleetAccessReview/index.d.ts +0 -2
- package/lib/api/useFleetAccessReview/index.d.ts.map +0 -1
- package/lib/api/useFleetAccessReview/index.js +0 -7
- package/lib/api/useFleetAccessReview/index.js.map +0 -1
- package/lib/components/FleetResourceEventStream/FleetResourceEventStream.d.ts +0 -77
- package/lib/components/FleetResourceEventStream/FleetResourceEventStream.d.ts.map +0 -1
- package/lib/components/FleetResourceEventStream/FleetResourceEventStream.js +0 -255
- package/lib/components/FleetResourceEventStream/FleetResourceEventStream.js.map +0 -1
- package/lib/components/FleetResourceEventStream.d.ts +0 -77
- package/lib/components/FleetResourceEventStream.d.ts.map +0 -1
- package/lib/components/FleetResourceEventStream.js +0 -266
- package/lib/components/FleetResourceEventStream.js.map +0 -1
- package/lib/components/FleetResourceLink.d.ts +0 -53
- package/lib/components/FleetResourceLink.d.ts.map +0 -1
- package/lib/components/FleetResourceLink.js +0 -197
- package/lib/components/FleetResourceLink.js.map +0 -1
- package/lib/extensions/index.d.ts +0 -2
- package/lib/extensions/index.d.ts.map +0 -1
- package/lib/extensions/index.js +0 -19
- package/lib/extensions/index.js.map +0 -1
- package/lib/extensions/resource.d.ts +0 -41
- package/lib/extensions/resource.d.ts.map +0 -1
- package/lib/extensions/resource.js +0 -15
- package/lib/extensions/resource.js.map +0 -1
- package/lib/extensions/resourceRouteExtension.d.ts +0 -25
- package/lib/extensions/resourceRouteExtension.d.ts.map +0 -1
- package/lib/extensions/resourceRouteExtension.js +0 -7
- package/lib/extensions/resourceRouteExtension.js.map +0 -1
- package/lib/internal/FleetResourceEventStream/EventComponent.d.ts +0 -5
- package/lib/internal/FleetResourceEventStream/EventComponent.d.ts.map +0 -1
- package/lib/internal/FleetResourceEventStream/EventComponent.js +0 -52
- package/lib/internal/FleetResourceEventStream/EventComponent.js.map +0 -1
- package/lib/internal/FleetResourceEventStream/EventStreamList.d.ts +0 -17
- package/lib/internal/FleetResourceEventStream/EventStreamList.d.ts.map +0 -1
- package/lib/internal/FleetResourceEventStream/EventStreamList.js +0 -92
- package/lib/internal/FleetResourceEventStream/EventStreamList.js.map +0 -1
- package/lib/internal/FleetResourceEventStream/TogglePlay.d.ts +0 -8
- package/lib/internal/FleetResourceEventStream/TogglePlay.d.ts.map +0 -1
- package/lib/internal/FleetResourceEventStream/TogglePlay.js +0 -17
- package/lib/internal/FleetResourceEventStream/TogglePlay.js.map +0 -1
- package/lib/internal/FleetResourceEventStream/WithScrollContainer.d.ts +0 -7
- package/lib/internal/FleetResourceEventStream/WithScrollContainer.d.ts.map +0 -1
- package/lib/internal/FleetResourceEventStream/WithScrollContainer.js +0 -51
- package/lib/internal/FleetResourceEventStream/WithScrollContainer.js.map +0 -1
- package/lib/internal/FleetResourceEventStream/constants.d.ts +0 -30
- package/lib/internal/FleetResourceEventStream/constants.d.ts.map +0 -1
- package/lib/internal/FleetResourceEventStream/constants.js +0 -6
- package/lib/internal/FleetResourceEventStream/constants.js.map +0 -1
- package/lib/internal/FleetResourceEventStream/utils.d.ts +0 -16
- package/lib/internal/FleetResourceEventStream/utils.d.ts.map +0 -1
- package/lib/internal/FleetResourceEventStream/utils.js +0 -143
- package/lib/internal/FleetResourceEventStream/utils.js.map +0 -1
- package/lib/internal/context/FleetSupportContext.d.ts +0 -7
- package/lib/internal/context/FleetSupportContext.d.ts.map +0 -1
- package/lib/internal/context/FleetSupportContext.js +0 -7
- package/lib/internal/context/FleetSupportContext.js.map +0 -1
- package/lib/internal/fleetResourceHelpers.d.ts +0 -82
- package/lib/internal/fleetResourceHelpers.d.ts.map +0 -1
- package/lib/internal/fleetResourceHelpers.js +0 -101
- package/lib/internal/fleetResourceHelpers.js.map +0 -1
- package/lib/internal/hooks/index.d.ts +0 -2
- package/lib/internal/hooks/index.d.ts.map +0 -1
- package/lib/internal/hooks/index.js +0 -19
- package/lib/internal/hooks/index.js.map +0 -1
- package/lib/internal/hooks/useFleetSupport.d.ts +0 -2
- package/lib/internal/hooks/useFleetSupport.d.ts.map +0 -1
- package/lib/internal/hooks/useFleetSupport.js +0 -10
- package/lib/internal/hooks/useFleetSupport.js.map +0 -1
- package/lib/internal/index.d.ts +0 -3
- package/lib/internal/index.d.ts.map +0 -1
- package/lib/internal/index.js +0 -20
- package/lib/internal/index.js.map +0 -1
- package/lib/internal/types/index.d.ts +0 -2
- package/lib/internal/types/index.d.ts.map +0 -1
- package/lib/internal/types/index.js +0 -19
- package/lib/internal/types/index.js.map +0 -1
- package/lib/internal/types/multicluster-sdk.d.ts +0 -18
- package/lib/internal/types/multicluster-sdk.d.ts.map +0 -1
- package/lib/internal/types/multicluster-sdk.js +0 -10
- package/lib/internal/types/multicluster-sdk.js.map +0 -1
- package/lib/internal/utils/shouldUseFleetSupport.d.ts +0 -3
- package/lib/internal/utils/shouldUseFleetSupport.d.ts.map +0 -1
- package/lib/internal/utils/shouldUseFleetSupport.js +0 -8
- package/lib/internal/utils/shouldUseFleetSupport.js.map +0 -1
- /package/lib/{api → internal}/search/search-client.d.ts +0 -0
- /package/lib/{api → internal}/search/search-sdk.d.ts +0 -0
- /package/lib/{api → internal}/search/search-sdk.js +0 -0
- /package/lib/{api → internal}/search/searchUtils.d.ts +0 -0
- /package/lib/{api → internal}/search/searchUtils.js +0 -0
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SelfSubjectAccessReviewModel = exports.checkAccess = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
const apiRequests_1 = require("../apiRequests");
|
|
9
|
-
/**
|
|
10
|
-
* Memoizes the result so it is possible to only make the request once for each access review.
|
|
11
|
-
* This does mean that the user will have to refresh the page to see updates.
|
|
12
|
-
* Function takes in the destructured resource attributes so that the cache keys are stable.
|
|
13
|
-
* `JSON.stringify` is not guaranteed to give the same result for equivalent objects.
|
|
14
|
-
* Impersonate headers are added automatically by `k8sCreate`.
|
|
15
|
-
* @param group resource group.
|
|
16
|
-
* @param resource resource string.
|
|
17
|
-
* @param subresource subresource string.
|
|
18
|
-
* @param verb K8s verb.
|
|
19
|
-
* @param namespace namespace.
|
|
20
|
-
* @param impersonateKey parameter to include in the cache key even though it's not used in the function body.
|
|
21
|
-
* @returns Memoized result of the access review.
|
|
22
|
-
*/
|
|
23
|
-
exports.checkAccess = lodash_1.default.memoize((group, resource, subresource, verb, name, namespace, cluster) => {
|
|
24
|
-
const reviewNamespace = group === 'project.openshift.io' && resource === 'projects' ? name : namespace;
|
|
25
|
-
const selfSubjectAccessReview = {
|
|
26
|
-
apiVersion: 'authorization.k8s.io/v1',
|
|
27
|
-
kind: 'SelfSubjectAccessReview',
|
|
28
|
-
spec: {
|
|
29
|
-
resourceAttributes: {
|
|
30
|
-
group,
|
|
31
|
-
resource,
|
|
32
|
-
subresource,
|
|
33
|
-
verb,
|
|
34
|
-
name,
|
|
35
|
-
namespace: reviewNamespace,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
return (0, apiRequests_1.fleetK8sCreate)({
|
|
40
|
-
model: exports.SelfSubjectAccessReviewModel,
|
|
41
|
-
data: selfSubjectAccessReview,
|
|
42
|
-
cluster,
|
|
43
|
-
});
|
|
44
|
-
}, (...args) => args.join('~'));
|
|
45
|
-
exports.SelfSubjectAccessReviewModel = {
|
|
46
|
-
abbr: 'SSAR',
|
|
47
|
-
kind: 'SelfSubjectAccessReview',
|
|
48
|
-
label: 'SelfSubjectAccessReview',
|
|
49
|
-
labelPlural: 'SelfSubjectAccessReviews',
|
|
50
|
-
plural: 'selfsubjectaccessreviews',
|
|
51
|
-
apiVersion: 'v1',
|
|
52
|
-
apiGroup: 'authorization.k8s.io',
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=checkAccess.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkAccess.js","sourceRoot":"","sources":["../../../src/api/useFleetAccessReview/checkAccess.ts"],"names":[],"mappings":";;;;;;AAEA,oDAAsB;AACtB,gDAA+C;AAE/C;;;;;;;;;;;;;GAaG;AACU,QAAA,WAAW,GAAG,gBAAC,CAAC,OAAO,CAClC,CACE,KAAa,EACb,QAAgB,EAChB,WAAmB,EACnB,IAAa,EACb,IAAY,EACZ,SAAiB,EACjB,OAAe,EACuB,EAAE;IACxC,MAAM,eAAe,GAAG,KAAK,KAAK,sBAAsB,IAAI,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IACtG,MAAM,uBAAuB,GAAgC;QAC3D,UAAU,EAAE,yBAAyB;QACrC,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE;YACJ,kBAAkB,EAAE;gBAClB,KAAK;gBACL,QAAQ;gBACR,WAAW;gBACX,IAAI;gBACJ,IAAI;gBACJ,SAAS,EAAE,eAAe;aAC3B;SACF;KACF,CAAA;IACD,OAAO,IAAA,4BAAc,EAAC;QACpB,KAAK,EAAE,oCAA4B;QACnC,IAAI,EAAE,uBAAuB;QAC7B,OAAO;KACR,CAAC,CAAA;AACJ,CAAC,EACD,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAC5B,CAAA;AAEY,QAAA,4BAA4B,GAAa;IACpD,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,yBAAyB;IAC/B,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,0BAA0B;IACvC,MAAM,EAAE,0BAA0B;IAClC,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,sBAAsB;CACjC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/useFleetAccessReview/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useFleetAccessReview = void 0;
|
|
4
|
-
/* Copyright Contributors to the Open Cluster Management project */
|
|
5
|
-
var access_review_1 = require("./access-review");
|
|
6
|
-
Object.defineProperty(exports, "useFleetAccessReview", { enumerable: true, get: function () { return access_review_1.useFleetAccessReview; } });
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/useFleetAccessReview/index.ts"],"names":[],"mappings":";;;AAAA,mEAAmE;AACnE,iDAAsD;AAA7C,qHAAA,oBAAoB,OAAA"}
|
|
@@ -1,77 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,255 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,QAAQ,EAAE,EAAE,EAAE;;IAC1F,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAA;IAC1C,MAAM,CAAC,UAAU,CAAC,G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,oBAAoB,aACjC,iCAAK,SAAS,EAAC,4BAA4B,aACzC,gCAAK,SAAS,EAAC,wCAAwC,YAAE,YAAY,GAAO,EAC5E,gCAAK,SAAS,EAAC,sDAAsD,eAAW,cAAc,YAC3F,YAAY,GACT,IACF,EAEN,iCAAK,SAAS,EAAE,KAAK,aACnB,uBAAC,oBAAU,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAC,mCAAmC,GAAG,EACnG,gCAAK,SAAS,EAAC,2CAA2C,YAAE,CAAC,CAAC,qCAAqC,CAAC,GAAO,IACvG,EACL,KAAK,GAAG,CAAC,IAAI,uBAAC,iCAAe,IAAC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,wBAAc,GAAI,EACtF,cAAc,IACX,GACM,GACb,CACJ,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,wBAAwB,CAAA"}
|
|
@@ -1,77 +0,0 @@
|
|
|
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 on managed clusters. Provides equivalent functionality to the OpenShift console's
|
|
6
|
-
* ResourceEventStream for resources on managed clusters.
|
|
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
|
-
* @see {@link https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#resourceeventstream} OpenShift Console Dynamic Plugin SDK ResourceEventStream
|
|
13
|
-
*
|
|
14
|
-
* @component
|
|
15
|
-
*
|
|
16
|
-
* @param {Object} props - Component properties
|
|
17
|
-
* @param {FleetK8sResourceCommon} props.resource - The Kubernetes resource to show events for.
|
|
18
|
-
* Must include standard K8s metadata (name, namespace, uid, kind) and an optional cluster property.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // Display events for a resource on a managed cluster
|
|
22
|
-
* <FleetResourceEventStream
|
|
23
|
-
* resource={{
|
|
24
|
-
* metadata: { name: 'my-pod', namespace: 'default', uid: '123' },
|
|
25
|
-
* kind: 'Pod',
|
|
26
|
-
* cluster: 'managed-cluster-1'
|
|
27
|
-
* }}
|
|
28
|
-
* />
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* // Display events for a hub cluster resource (falls back to OpenShift console component)
|
|
32
|
-
* <FleetResourceEventStream
|
|
33
|
-
* resource={{
|
|
34
|
-
* metadata: { name: 'my-deployment', namespace: 'openshift-gitops', uid: '456' },
|
|
35
|
-
* kind: 'Deployment'
|
|
36
|
-
* // No cluster property - uses hub cluster
|
|
37
|
-
* }}
|
|
38
|
-
* />
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* // Display events for a cluster-scoped resource on a managed cluster
|
|
42
|
-
* <FleetResourceEventStream
|
|
43
|
-
* resource={{
|
|
44
|
-
* metadata: { name: 'my-node', uid: '789' },
|
|
45
|
-
* kind: 'Node',
|
|
46
|
-
* cluster: 'edge-cluster-2'
|
|
47
|
-
* }}
|
|
48
|
-
* />
|
|
49
|
-
*
|
|
50
|
-
* @returns {JSX.Element} A rendered event stream component showing real-time Kubernetes events
|
|
51
|
-
*
|
|
52
|
-
* @remarks
|
|
53
|
-
* **Behavior:**
|
|
54
|
-
* - When `resource.cluster` is set and differs from hub cluster: Uses fleet websocket connection
|
|
55
|
-
* - When `resource.cluster` is undefined or equals hub cluster: Falls back to OpenShift console ResourceEventStream
|
|
56
|
-
* - Automatically handles connection lifecycle (open, close, error, reconnect)
|
|
57
|
-
* - Supports both namespaced and cluster-scoped resources
|
|
58
|
-
* - Displays up to 50 most recent events with real-time streaming
|
|
59
|
-
* - Provides play/pause controls for event streaming
|
|
60
|
-
*
|
|
61
|
-
* **Event Filtering:**
|
|
62
|
-
* Events are filtered by `involvedObject.uid`, `involvedObject.name`, and `involvedObject.kind`
|
|
63
|
-
* to show only events related to the specified resource.
|
|
64
|
-
*
|
|
65
|
-
* **Error Handling:**
|
|
66
|
-
* - Shows loading spinner during initial connection
|
|
67
|
-
* - Displays error states for connection failures
|
|
68
|
-
* - Shows empty state when no events exist
|
|
69
|
-
* - Automatically attempts reconnection on websocket errors
|
|
70
|
-
*
|
|
71
|
-
* @see {@link FleetK8sResourceCommon} for resource type definition
|
|
72
|
-
* @see {@link https://github.com/openshift/console/tree/master/frontend/packages/console-dynamic-plugin-sdk} OpenShift Console Dynamic Plugin SDK
|
|
73
|
-
*/
|
|
74
|
-
export declare const FleetResourceEventStream: FC<{
|
|
75
|
-
resource: FleetK8sResourceCommon;
|
|
76
|
-
}>;
|
|
77
|
-
//# sourceMappingURL=FleetResourceEventStream.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FleetResourceEventStream.d.ts","sourceRoot":"","sources":["../../src/components/FleetResourceEventStream.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAA;AAMvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAajD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,sBAAsB,CAAA;CAAE,CA4L7E,CAAA"}
|