@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,266 +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
|
-
exports.FleetResourceEventStream = void 0;
|
|
40
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
-
/* Copyright Contributors to the Open Cluster Management project */
|
|
42
|
-
const react_1 = require("react");
|
|
43
|
-
// References translations directly from OpenShift console - not from plugins
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
45
|
-
const react_i18next_1 = require("react-i18next");
|
|
46
|
-
const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
|
|
47
|
-
const _ = __importStar(require("lodash"));
|
|
48
|
-
const api_1 = require("../api");
|
|
49
|
-
const utils_1 = require("../internal/FleetResourceEventStream/utils");
|
|
50
|
-
const constants_1 = require("../internal/FleetResourceEventStream/constants");
|
|
51
|
-
const react_core_1 = require("@patternfly/react-core");
|
|
52
|
-
const react_styles_1 = require("@patternfly/react-styles");
|
|
53
|
-
const TogglePlay_1 = __importDefault(require("../internal/FleetResourceEventStream/TogglePlay"));
|
|
54
|
-
const EventStreamList_1 = require("../internal/FleetResourceEventStream/EventStreamList");
|
|
55
|
-
const EventComponent_1 = __importDefault(require("../internal/FleetResourceEventStream/EventComponent"));
|
|
56
|
-
/**
|
|
57
|
-
* A multicluster-aware ResourceEventStream component that displays real-time Kubernetes events
|
|
58
|
-
* for resources on managed clusters. Provides equivalent functionality to the OpenShift console's
|
|
59
|
-
* ResourceEventStream for resources on managed clusters.
|
|
60
|
-
*
|
|
61
|
-
* For managed cluster resources, this component establishes a websocket connection to stream
|
|
62
|
-
* events from the specified cluster. For hub cluster resources or when no cluster is specified,
|
|
63
|
-
* it falls back to the standard OpenShift console ResourceEventStream component.
|
|
64
|
-
*
|
|
65
|
-
* @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
|
|
66
|
-
*
|
|
67
|
-
* @component
|
|
68
|
-
*
|
|
69
|
-
* @param {Object} props - Component properties
|
|
70
|
-
* @param {FleetK8sResourceCommon} props.resource - The Kubernetes resource to show events for.
|
|
71
|
-
* Must include standard K8s metadata (name, namespace, uid, kind) and an optional cluster property.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* // Display events for a resource on a managed cluster
|
|
75
|
-
* <FleetResourceEventStream
|
|
76
|
-
* resource={{
|
|
77
|
-
* metadata: { name: 'my-pod', namespace: 'default', uid: '123' },
|
|
78
|
-
* kind: 'Pod',
|
|
79
|
-
* cluster: 'managed-cluster-1'
|
|
80
|
-
* }}
|
|
81
|
-
* />
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* // Display events for a hub cluster resource (falls back to OpenShift console component)
|
|
85
|
-
* <FleetResourceEventStream
|
|
86
|
-
* resource={{
|
|
87
|
-
* metadata: { name: 'my-deployment', namespace: 'openshift-gitops', uid: '456' },
|
|
88
|
-
* kind: 'Deployment'
|
|
89
|
-
* // No cluster property - uses hub cluster
|
|
90
|
-
* }}
|
|
91
|
-
* />
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* // Display events for a cluster-scoped resource on a managed cluster
|
|
95
|
-
* <FleetResourceEventStream
|
|
96
|
-
* resource={{
|
|
97
|
-
* metadata: { name: 'my-node', uid: '789' },
|
|
98
|
-
* kind: 'Node',
|
|
99
|
-
* cluster: 'edge-cluster-2'
|
|
100
|
-
* }}
|
|
101
|
-
* />
|
|
102
|
-
*
|
|
103
|
-
* @returns {JSX.Element} A rendered event stream component showing real-time Kubernetes events
|
|
104
|
-
*
|
|
105
|
-
* @remarks
|
|
106
|
-
* **Behavior:**
|
|
107
|
-
* - When `resource.cluster` is set and differs from hub cluster: Uses fleet websocket connection
|
|
108
|
-
* - When `resource.cluster` is undefined or equals hub cluster: Falls back to OpenShift console ResourceEventStream
|
|
109
|
-
* - Automatically handles connection lifecycle (open, close, error, reconnect)
|
|
110
|
-
* - Supports both namespaced and cluster-scoped resources
|
|
111
|
-
* - Displays up to 50 most recent events with real-time streaming
|
|
112
|
-
* - Provides play/pause controls for event streaming
|
|
113
|
-
*
|
|
114
|
-
* **Event Filtering:**
|
|
115
|
-
* Events are filtered by `involvedObject.uid`, `involvedObject.name`, and `involvedObject.kind`
|
|
116
|
-
* to show only events related to the specified resource.
|
|
117
|
-
*
|
|
118
|
-
* **Error Handling:**
|
|
119
|
-
* - Shows loading spinner during initial connection
|
|
120
|
-
* - Displays error states for connection failures
|
|
121
|
-
* - Shows empty state when no events exist
|
|
122
|
-
* - Automatically attempts reconnection on websocket errors
|
|
123
|
-
*
|
|
124
|
-
* @see {@link FleetK8sResourceCommon} for resource type definition
|
|
125
|
-
* @see {@link https://github.com/openshift/console/tree/master/frontend/packages/console-dynamic-plugin-sdk} OpenShift Console Dynamic Plugin SDK
|
|
126
|
-
*/
|
|
127
|
-
const FleetResourceEventStream = ({ resource }) => {
|
|
128
|
-
var _a, _b, _c;
|
|
129
|
-
const [active, setActive] = (0, react_1.useState)(true);
|
|
130
|
-
const [hubCluster] = (0, api_1.useHubClusterName)();
|
|
131
|
-
const { t } = (0, react_i18next_1.useTranslation)('public');
|
|
132
|
-
const [sortedEvents, setSortedEvents] = (0, react_1.useState)([]);
|
|
133
|
-
const [error, setError] = (0, react_1.useState)(false);
|
|
134
|
-
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
135
|
-
const ws = (0, react_1.useRef)();
|
|
136
|
-
const [backendAPIPath, loaded] = (0, api_1.useFleetK8sAPIPath)(resource === null || resource === void 0 ? void 0 : resource.cluster);
|
|
137
|
-
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}`;
|
|
138
|
-
const namespace = (_c = resource === null || resource === void 0 ? void 0 : resource.metadata) === null || _c === void 0 ? void 0 : _c.namespace;
|
|
139
|
-
// handle websocket setup and teardown when dependent props change
|
|
140
|
-
(0, react_1.useEffect)(() => {
|
|
141
|
-
var _a;
|
|
142
|
-
if (!resource.cluster || resource.cluster === hubCluster || !loaded)
|
|
143
|
-
return;
|
|
144
|
-
// close existing connection
|
|
145
|
-
(_a = ws.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
146
|
-
ws.current = undefined;
|
|
147
|
-
const watchURLOptions = Object.assign(Object.assign({ cluster: resource.cluster }, (namespace ? { ns: namespace } : {})), (fieldSelector
|
|
148
|
-
? {
|
|
149
|
-
fieldSelector,
|
|
150
|
-
}
|
|
151
|
-
: {}));
|
|
152
|
-
// create new WebSocket connection
|
|
153
|
-
ws.current = (0, api_1.fleetWatch)(utils_1.EventModel, watchURLOptions, backendAPIPath);
|
|
154
|
-
if (ws.current === undefined)
|
|
155
|
-
return;
|
|
156
|
-
ws.current.onmessage = (message) => {
|
|
157
|
-
if (!active)
|
|
158
|
-
return;
|
|
159
|
-
try {
|
|
160
|
-
const eventdataParsed = JSON.parse(message.data);
|
|
161
|
-
if (!eventdataParsed)
|
|
162
|
-
return;
|
|
163
|
-
const eventType = eventdataParsed.type;
|
|
164
|
-
const object = eventdataParsed.object;
|
|
165
|
-
setSortedEvents((currentSortedEvents) => {
|
|
166
|
-
var _a;
|
|
167
|
-
const topEvents = currentSortedEvents.slice(0, constants_1.MAX_MESSAGES);
|
|
168
|
-
const uid = ((_a = object === null || object === void 0 ? void 0 : object.metadata) === null || _a === void 0 ? void 0 : _a.uid) || '';
|
|
169
|
-
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; });
|
|
170
|
-
switch (eventType) {
|
|
171
|
-
case 'ADDED':
|
|
172
|
-
case 'MODIFIED':
|
|
173
|
-
if (eventAlreadyExists &&
|
|
174
|
-
(eventAlreadyExists === null || eventAlreadyExists === void 0 ? void 0 : eventAlreadyExists.count) !== undefined &&
|
|
175
|
-
(object === null || object === void 0 ? void 0 : object.count) !== undefined &&
|
|
176
|
-
eventAlreadyExists.count > object.count) {
|
|
177
|
-
// We already have a more recent version of this message stored, so skip this one
|
|
178
|
-
return topEvents;
|
|
179
|
-
}
|
|
180
|
-
return (0, utils_1.sortEvents)([...topEvents, object]);
|
|
181
|
-
case 'DELETED':
|
|
182
|
-
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; });
|
|
183
|
-
default:
|
|
184
|
-
// eslint-disable-next-line no-console
|
|
185
|
-
console.error(`UNHANDLED EVENT: ${eventType}`);
|
|
186
|
-
return topEvents;
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
console.error('Error parsing WebSocket message:', error);
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
ws.current.onopen = () => {
|
|
195
|
-
setActive(true);
|
|
196
|
-
setError(false);
|
|
197
|
-
setLoading(false);
|
|
198
|
-
};
|
|
199
|
-
ws.current.onclose = (evt) => {
|
|
200
|
-
setActive(false);
|
|
201
|
-
if ((evt === null || evt === void 0 ? void 0 : evt.wasClean) === false) {
|
|
202
|
-
debugger;
|
|
203
|
-
// setError(evt.reason || t('public~Connection did not close cleanly.'))
|
|
204
|
-
setError(evt.reason || JSON.stringify(evt));
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
ws.current.onerror = () => {
|
|
208
|
-
setActive(false);
|
|
209
|
-
setError(true);
|
|
210
|
-
};
|
|
211
|
-
return () => {
|
|
212
|
-
var _a;
|
|
213
|
-
(_a = ws.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
214
|
-
ws.current = undefined;
|
|
215
|
-
};
|
|
216
|
-
}, [namespace, fieldSelector, active, t, resource.cluster, hubCluster, loaded, backendAPIPath]);
|
|
217
|
-
// return early after all hooks are called, otherwise the component will render twice
|
|
218
|
-
if (!resource.cluster || resource.cluster === hubCluster)
|
|
219
|
-
return (0, jsx_runtime_1.jsx)(dynamic_plugin_sdk_1.ResourceEventStream, { resource: resource });
|
|
220
|
-
const count = sortedEvents.length;
|
|
221
|
-
const noEvents = count === 0;
|
|
222
|
-
const noMatches = count > 0 && count === 0;
|
|
223
|
-
let sysEventStatus, statusBtnTxt;
|
|
224
|
-
if (noEvents || (noMatches && resource)) {
|
|
225
|
-
sysEventStatus = (0, jsx_runtime_1.jsx)(react_core_1.EmptyState, { title: t('public~No events') });
|
|
226
|
-
}
|
|
227
|
-
if (noMatches && !resource) {
|
|
228
|
-
sysEventStatus = ((0, jsx_runtime_1.jsx)(react_core_1.EmptyState, { title: t('public~No matching events'), children: count >= constants_1.MAX_MESSAGES
|
|
229
|
-
? t('public~{{count}}+ event exist, but none match the current filter', {
|
|
230
|
-
count: constants_1.MAX_MESSAGES,
|
|
231
|
-
})
|
|
232
|
-
: t('public~{{count}} event exist, but none match the current filter', {
|
|
233
|
-
count,
|
|
234
|
-
}) }));
|
|
235
|
-
}
|
|
236
|
-
if (error) {
|
|
237
|
-
statusBtnTxt = ((0, jsx_runtime_1.jsx)("span", { className: "co-sysevent-stream__connection-error", children: _.isString(error)
|
|
238
|
-
? t('public~Error connecting to event stream: {{error}}', {
|
|
239
|
-
error,
|
|
240
|
-
})
|
|
241
|
-
: t('public~Error connecting to event stream') }));
|
|
242
|
-
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...') }));
|
|
243
|
-
}
|
|
244
|
-
else if (loading) {
|
|
245
|
-
statusBtnTxt = (0, jsx_runtime_1.jsx)("span", { children: t('public~Loading events...') });
|
|
246
|
-
sysEventStatus = (0, jsx_runtime_1.jsx)(react_core_1.Spinner, { id: "spinner" });
|
|
247
|
-
}
|
|
248
|
-
else if (active) {
|
|
249
|
-
statusBtnTxt = (0, jsx_runtime_1.jsx)("span", { children: t('public~Streaming events...') });
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
statusBtnTxt = (0, jsx_runtime_1.jsx)("span", { children: t('public~Event stream is paused.') });
|
|
253
|
-
}
|
|
254
|
-
const klass = (0, react_styles_1.css)('co-sysevent-stream__timeline', {
|
|
255
|
-
'co-sysevent-stream__timeline--empty': !count,
|
|
256
|
-
});
|
|
257
|
-
const messageCount = count < constants_1.MAX_MESSAGES
|
|
258
|
-
? t('public~Showing {{count}} event', { count })
|
|
259
|
-
: t('public~Showing most recent {{count}} event', { count });
|
|
260
|
-
const toggleStream = () => {
|
|
261
|
-
setActive((prev) => !prev);
|
|
262
|
-
};
|
|
263
|
-
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] }) }) }));
|
|
264
|
-
};
|
|
265
|
-
exports.FleetResourceEventStream = FleetResourceEventStream;
|
|
266
|
-
//# sourceMappingURL=FleetResourceEventStream.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FleetResourceEventStream.js","sourceRoot":"","sources":["../../src/components/FleetResourceEventStream.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,iCAAuD;AAEvD,6EAA6E;AAC7E,oEAAoE;AACpE,iDAA8C;AAC9C,8EAA2E;AAG3E,0CAA2B;AAC3B,gCAA0E;AAC1E,sEAAmF;AACnF,8EAAwF;AACxF,uDAAyE;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**
|
|
4
|
-
* Enhanced ResourceLink component for ACM fleet environments.
|
|
5
|
-
*
|
|
6
|
-
* Unlike the standard OpenShift ResourceLink which always links to the OpenShift console,
|
|
7
|
-
* FleetResourceLink provides intelligent routing based on cluster context:
|
|
8
|
-
* - For managed clusters: Links to ACM search results or specialized ACM pages
|
|
9
|
-
* - For hub clusters: Context-aware routing based on current page location
|
|
10
|
-
* - For first-class ACM resources: Direct links to rich management interfaces
|
|
11
|
-
*
|
|
12
|
-
* This prevents users from having to jump between different consoles when managing
|
|
13
|
-
* multi-cluster resources.
|
|
14
|
-
*
|
|
15
|
-
* @see https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#resourcelink
|
|
16
|
-
*
|
|
17
|
-
* @param props - FleetResourceLinkProps extending ResourceLinkProps with cluster information
|
|
18
|
-
* @param props.cluster - the target cluster name for the resource
|
|
19
|
-
* @param props.groupVersionKind - K8s GroupVersionKind for the resource
|
|
20
|
-
* @param props.name - the resource name
|
|
21
|
-
* @param props.namespace - the resource namespace (required for namespaced resources)
|
|
22
|
-
* @param props.displayName - optional display name override
|
|
23
|
-
* @param props.className - additional CSS classes
|
|
24
|
-
* @param props.inline - whether to display inline
|
|
25
|
-
* @param props.hideIcon - whether to hide the resource icon
|
|
26
|
-
* @param props.children - additional content to render
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* // Hub cluster VirtualMachine - routes to ACM VM page on multicloud paths
|
|
31
|
-
* <FleetResourceLink
|
|
32
|
-
* name="my-vm"
|
|
33
|
-
* namespace="default"
|
|
34
|
-
* groupVersionKind={{ group: 'kubevirt.io', version: 'v1', kind: 'VirtualMachine' }}
|
|
35
|
-
* />
|
|
36
|
-
*
|
|
37
|
-
* // Managed cluster VirtualMachine - routes to ACM search results
|
|
38
|
-
* <FleetResourceLink
|
|
39
|
-
* name="remote-vm"
|
|
40
|
-
* namespace="default"
|
|
41
|
-
* cluster="prod-cluster"
|
|
42
|
-
* groupVersionKind={{ group: 'kubevirt.io', version: 'v1', kind: 'VirtualMachine' }}
|
|
43
|
-
* />
|
|
44
|
-
*
|
|
45
|
-
* // ManagedCluster resource (lives on hub) - cluster prop omitted
|
|
46
|
-
* <FleetResourceLink
|
|
47
|
-
* name="prod-cluster"
|
|
48
|
-
* groupVersionKind={{ group: 'cluster.open-cluster-management.io', version: 'v1', kind: 'ManagedCluster' }}
|
|
49
|
-
* />
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export declare const FleetResourceLink: React.FC<FleetResourceLinkProps>;
|
|
53
|
-
//# sourceMappingURL=FleetResourceLink.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FleetResourceLink.d.ts","sourceRoot":"","sources":["../../src/components/FleetResourceLink.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAOvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAqM9D,CAAA"}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.FleetResourceLink = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
|
|
20
|
-
const react_core_1 = require("@patternfly/react-core");
|
|
21
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
22
|
-
const searchPaths_1 = require("../api/utils/searchPaths");
|
|
23
|
-
const useHubClusterName_1 = require("../api/useHubClusterName");
|
|
24
|
-
const react_router_dom_v5_compat_1 = require("react-router-dom-v5-compat");
|
|
25
|
-
const fleetResourceHelpers_1 = require("../internal/fleetResourceHelpers");
|
|
26
|
-
/**
|
|
27
|
-
* Enhanced ResourceLink component for ACM fleet environments.
|
|
28
|
-
*
|
|
29
|
-
* Unlike the standard OpenShift ResourceLink which always links to the OpenShift console,
|
|
30
|
-
* FleetResourceLink provides intelligent routing based on cluster context:
|
|
31
|
-
* - For managed clusters: Links to ACM search results or specialized ACM pages
|
|
32
|
-
* - For hub clusters: Context-aware routing based on current page location
|
|
33
|
-
* - For first-class ACM resources: Direct links to rich management interfaces
|
|
34
|
-
*
|
|
35
|
-
* This prevents users from having to jump between different consoles when managing
|
|
36
|
-
* multi-cluster resources.
|
|
37
|
-
*
|
|
38
|
-
* @see https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#resourcelink
|
|
39
|
-
*
|
|
40
|
-
* @param props - FleetResourceLinkProps extending ResourceLinkProps with cluster information
|
|
41
|
-
* @param props.cluster - the target cluster name for the resource
|
|
42
|
-
* @param props.groupVersionKind - K8s GroupVersionKind for the resource
|
|
43
|
-
* @param props.name - the resource name
|
|
44
|
-
* @param props.namespace - the resource namespace (required for namespaced resources)
|
|
45
|
-
* @param props.displayName - optional display name override
|
|
46
|
-
* @param props.className - additional CSS classes
|
|
47
|
-
* @param props.inline - whether to display inline
|
|
48
|
-
* @param props.hideIcon - whether to hide the resource icon
|
|
49
|
-
* @param props.children - additional content to render
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* // Hub cluster VirtualMachine - routes to ACM VM page on multicloud paths
|
|
54
|
-
* <FleetResourceLink
|
|
55
|
-
* name="my-vm"
|
|
56
|
-
* namespace="default"
|
|
57
|
-
* groupVersionKind={{ group: 'kubevirt.io', version: 'v1', kind: 'VirtualMachine' }}
|
|
58
|
-
* />
|
|
59
|
-
*
|
|
60
|
-
* // Managed cluster VirtualMachine - routes to ACM search results
|
|
61
|
-
* <FleetResourceLink
|
|
62
|
-
* name="remote-vm"
|
|
63
|
-
* namespace="default"
|
|
64
|
-
* cluster="prod-cluster"
|
|
65
|
-
* groupVersionKind={{ group: 'kubevirt.io', version: 'v1', kind: 'VirtualMachine' }}
|
|
66
|
-
* />
|
|
67
|
-
*
|
|
68
|
-
* // ManagedCluster resource (lives on hub) - cluster prop omitted
|
|
69
|
-
* <FleetResourceLink
|
|
70
|
-
* name="prod-cluster"
|
|
71
|
-
* groupVersionKind={{ group: 'cluster.open-cluster-management.io', version: 'v1', kind: 'ManagedCluster' }}
|
|
72
|
-
* />
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
const FleetResourceLink = (_a) => {
|
|
76
|
-
var { cluster } = _a, resourceLinkProps = __rest(_a, ["cluster"]);
|
|
77
|
-
const [hubClusterName, hubLoaded] = (0, useHubClusterName_1.useHubClusterName)();
|
|
78
|
-
const location = (0, react_router_dom_v5_compat_1.useLocation)();
|
|
79
|
-
// hook that handles useResolvedExtensions and lookup logic
|
|
80
|
-
const { resourceRoutesResolved, getResourceRouteHandler } = (0, fleetResourceHelpers_1.useResourceRouteExtensions)();
|
|
81
|
-
// check if fleet is available (has managed clusters)
|
|
82
|
-
const isFleetAvailable = hubLoaded;
|
|
83
|
-
if (!isFleetAvailable) {
|
|
84
|
-
// fallback to default ResourceLink from OCP
|
|
85
|
-
return (0, jsx_runtime_1.jsx)(dynamic_plugin_sdk_1.ResourceLink, Object.assign({}, resourceLinkProps));
|
|
86
|
-
}
|
|
87
|
-
const { className, displayName, inline = false, groupVersionKind, name, nameSuffix, namespace, hideIcon, title, children, dataTest, onClick, truncate, } = resourceLinkProps;
|
|
88
|
-
const { kind } = groupVersionKind !== null && groupVersionKind !== void 0 ? groupVersionKind : {};
|
|
89
|
-
if (kind === 'ManagedCluster') {
|
|
90
|
-
debugger;
|
|
91
|
-
}
|
|
92
|
-
const value = displayName || name;
|
|
93
|
-
const classes = (0, classnames_1.default)('co-resource-item', className || '', {
|
|
94
|
-
'co-resource-item--inline': inline,
|
|
95
|
-
'co-resource-item--truncate': truncate,
|
|
96
|
-
});
|
|
97
|
-
// if cluster name is given but hub name is not loaded yet, show skeleton
|
|
98
|
-
if (cluster && !hubLoaded) {
|
|
99
|
-
return ((0, jsx_runtime_1.jsxs)("span", { className: classes, children: [!hideIcon && (0, jsx_runtime_1.jsx)(dynamic_plugin_sdk_1.ResourceIcon, { groupVersionKind: groupVersionKind }), (0, jsx_runtime_1.jsx)(react_core_1.Skeleton, { width: "100px" }), children] }));
|
|
100
|
-
}
|
|
101
|
-
// determine if this is a hub cluster case (no cluster or it matches hub name)
|
|
102
|
-
const isHubCluster = !cluster || cluster === hubClusterName;
|
|
103
|
-
const isMulticloudPath = location.pathname.startsWith('/multicloud/');
|
|
104
|
-
// helper function for ManagedCluster routing
|
|
105
|
-
const getManagedClusterPath = (name) => {
|
|
106
|
-
const firstClassPath = `/multicloud/infrastructure/clusters/details/${name}/${name}/overview`;
|
|
107
|
-
if (isHubCluster) {
|
|
108
|
-
if (isMulticloudPath) {
|
|
109
|
-
return { path: firstClassPath, shouldFallback: false };
|
|
110
|
-
}
|
|
111
|
-
return { path: null, shouldFallback: true };
|
|
112
|
-
}
|
|
113
|
-
return { path: firstClassPath, shouldFallback: false };
|
|
114
|
-
};
|
|
115
|
-
// helper function for extension-based routing
|
|
116
|
-
const getExtensionPath = (kind, group, version, name) => {
|
|
117
|
-
if (!resourceRoutesResolved)
|
|
118
|
-
return null;
|
|
119
|
-
const handler = getResourceRouteHandler(group, kind, version);
|
|
120
|
-
if (!handler || typeof handler !== 'function')
|
|
121
|
-
return null;
|
|
122
|
-
return handler({
|
|
123
|
-
kind,
|
|
124
|
-
cluster: cluster !== null && cluster !== void 0 ? cluster : hubClusterName,
|
|
125
|
-
namespace,
|
|
126
|
-
name,
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
// helper function for hub cluster context awareness
|
|
130
|
-
const shouldUseExtensionPath = (extensionPath) => {
|
|
131
|
-
if (!extensionPath)
|
|
132
|
-
return false;
|
|
133
|
-
if (!isHubCluster)
|
|
134
|
-
return true;
|
|
135
|
-
return isMulticloudPath;
|
|
136
|
-
};
|
|
137
|
-
// helper function for managed cluster search path
|
|
138
|
-
const getManagedClusterSearchPath = () => {
|
|
139
|
-
return `/multicloud/search/resources${(0, searchPaths_1.getURLSearchParam)({
|
|
140
|
-
cluster,
|
|
141
|
-
kind: groupVersionKind === null || groupVersionKind === void 0 ? void 0 : groupVersionKind.kind,
|
|
142
|
-
apigroup: groupVersionKind === null || groupVersionKind === void 0 ? void 0 : groupVersionKind.group,
|
|
143
|
-
apiversion: groupVersionKind === null || groupVersionKind === void 0 ? void 0 : groupVersionKind.version,
|
|
144
|
-
name,
|
|
145
|
-
namespace,
|
|
146
|
-
})}`;
|
|
147
|
-
};
|
|
148
|
-
// shared helper function for extension-based resource routing
|
|
149
|
-
const getExtensionBasedResourcePath = (name) => {
|
|
150
|
-
var _a;
|
|
151
|
-
const extensionPath = getExtensionPath((_a = groupVersionKind === null || groupVersionKind === void 0 ? void 0 : groupVersionKind.kind) !== null && _a !== void 0 ? _a : '', groupVersionKind === null || groupVersionKind === void 0 ? void 0 : groupVersionKind.group, groupVersionKind === null || groupVersionKind === void 0 ? void 0 : groupVersionKind.version, name);
|
|
152
|
-
if (shouldUseExtensionPath(extensionPath)) {
|
|
153
|
-
return { path: extensionPath, shouldFallback: false };
|
|
154
|
-
}
|
|
155
|
-
if (extensionPath && isHubCluster && !isMulticloudPath) {
|
|
156
|
-
return { path: null, shouldFallback: true };
|
|
157
|
-
}
|
|
158
|
-
if (isHubCluster) {
|
|
159
|
-
return { path: null, shouldFallback: true };
|
|
160
|
-
}
|
|
161
|
-
return { path: getManagedClusterSearchPath(), shouldFallback: false };
|
|
162
|
-
};
|
|
163
|
-
// helper function for VirtualMachine routing
|
|
164
|
-
// const getVirtualMachinePath = (name: string): { path: string | null; shouldFallback: boolean } => {
|
|
165
|
-
// return getExtensionBasedResourcePath(name)
|
|
166
|
-
// }
|
|
167
|
-
// helper function for generic resource routing
|
|
168
|
-
const getGenericResourcePath = (name) => {
|
|
169
|
-
return getExtensionBasedResourcePath(name);
|
|
170
|
-
};
|
|
171
|
-
const getResourcePath = () => {
|
|
172
|
-
if (!name) {
|
|
173
|
-
return { path: null, shouldFallback: true };
|
|
174
|
-
}
|
|
175
|
-
// core ACM resources
|
|
176
|
-
if ((groupVersionKind === null || groupVersionKind === void 0 ? void 0 : groupVersionKind.kind) === 'ManagedCluster') {
|
|
177
|
-
return getManagedClusterPath(name);
|
|
178
|
-
}
|
|
179
|
-
// extension-managed resources
|
|
180
|
-
// if (groupVersionKind?.kind === 'VirtualMachine' || groupVersionKind?.kind === 'VirtualMachineInstance') {
|
|
181
|
-
// return getVirtualMachinePath(name)
|
|
182
|
-
// }
|
|
183
|
-
// generic resources
|
|
184
|
-
if (groupVersionKind === null || groupVersionKind === void 0 ? void 0 : groupVersionKind.kind) {
|
|
185
|
-
return getGenericResourcePath(name);
|
|
186
|
-
}
|
|
187
|
-
// fallback
|
|
188
|
-
return { path: null, shouldFallback: true };
|
|
189
|
-
};
|
|
190
|
-
const { path, shouldFallback } = getResourcePath();
|
|
191
|
-
if (shouldFallback) {
|
|
192
|
-
return (0, jsx_runtime_1.jsx)(dynamic_plugin_sdk_1.ResourceLink, Object.assign({}, resourceLinkProps));
|
|
193
|
-
}
|
|
194
|
-
return ((0, jsx_runtime_1.jsxs)("span", { className: classes, children: [!hideIcon && (0, jsx_runtime_1.jsx)(dynamic_plugin_sdk_1.ResourceIcon, { groupVersionKind: groupVersionKind }), path ? ((0, jsx_runtime_1.jsxs)(react_router_dom_v5_compat_1.Link, { to: path, title: title, className: "co-resource-item__resource-name", "data-test-id": value, "data-test": dataTest !== null && dataTest !== void 0 ? dataTest : value, onClick: onClick, children: [value, nameSuffix] })) : ((0, jsx_runtime_1.jsxs)("span", { className: "co-resource-item__resource-name", children: [value, nameSuffix] })), children] }));
|
|
195
|
-
};
|
|
196
|
-
exports.FleetResourceLink = FleetResourceLink;
|
|
197
|
-
//# sourceMappingURL=FleetResourceLink.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FleetResourceLink.js","sourceRoot":"","sources":["../../src/components/FleetResourceLink.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,8EAAkF;AAClF,uDAAiD;AAEjD,4DAAmC;AACnC,0DAA4D;AAC5D,gEAA4D;AAC5D,2EAA8D;AAC9D,2EAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACI,MAAM,iBAAiB,GAAqC,CAAC,EAAiC,EAAE,EAAE;QAArC,EAAE,OAAO,OAAwB,EAAnB,iBAAiB,cAA/B,WAAiC,CAAF;IACjG,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,GAAG,IAAA,qCAAiB,GAAE,CAAA;IACvD,MAAM,QAAQ,GAAG,IAAA,wCAAW,GAAE,CAAA;IAE9B,2DAA2D;IAC3D,MAAM,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,GAAG,IAAA,iDAA0B,GAAE,CAAA;IAExF,qDAAqD;IACrD,MAAM,gBAAgB,GAAG,SAAS,CAAA;IAEl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Y,QAAA,iBAAiB,qBAqM7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA"}
|
package/lib/extensions/index.js
DELETED
|
@@ -1,19 +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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
/* Copyright Contributors to the Open Cluster Management project */
|
|
18
|
-
__exportStar(require("./resourceRouteExtension"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,2DAAwC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CodeRef, Extension, ExtensionDeclaration } from '@openshift-console/dynamic-plugin-sdk/lib/types';
|
|
2
|
-
import { ExtensionK8sGroupKindModel, ExtensionK8sModel } from '@openshift-console/dynamic-plugin-sdk';
|
|
3
|
-
import { FleetK8sResourceCommon } from '../types/fleet';
|
|
4
|
-
declare const RESOURCE_DETAILS_TYPE = "acm.resource/details";
|
|
5
|
-
declare const RESOURCE_TAB_TYPE = "acm.resource/tab";
|
|
6
|
-
export type ResourceTabComponent = React.ComponentType<{
|
|
7
|
-
/** The cluster where the resource is located. */
|
|
8
|
-
cluster: string;
|
|
9
|
-
/** The namespace where the resource is located (if the resource is namespace-scoped). */
|
|
10
|
-
namespace?: string;
|
|
11
|
-
/** The name of the resource. */
|
|
12
|
-
name: string;
|
|
13
|
-
/** The resource, augmented with cluster property. */
|
|
14
|
-
resource: FleetK8sResourceCommon;
|
|
15
|
-
/** The model for the resource. */
|
|
16
|
-
model: ExtensionK8sModel;
|
|
17
|
-
}>;
|
|
18
|
-
export type ResourceTabProps = {
|
|
19
|
-
/** The model for which this details component should be used. */
|
|
20
|
-
model: ExtensionK8sGroupKindModel;
|
|
21
|
-
/** The component to be rendered for the details tab of a matching resource. */
|
|
22
|
-
component: CodeRef<ResourceTabComponent>;
|
|
23
|
-
};
|
|
24
|
-
export type ResourceTabMetadataProps = {
|
|
25
|
-
/** A unique identifier for this resource tab. */
|
|
26
|
-
id: string;
|
|
27
|
-
/** The name of the tab. */
|
|
28
|
-
name: string;
|
|
29
|
-
/** Insert this item before the item referenced here. For arrays, the first one found in order is used. */
|
|
30
|
-
insertBefore?: string | string[];
|
|
31
|
-
/** Insert this item after the item referenced here. For arrays, the first one found in order is used. `insertBefore` takes precedence. */
|
|
32
|
-
insertAfter?: string | string[];
|
|
33
|
-
};
|
|
34
|
-
/** This extension allows plugins to replace the contents of the ACM resource details tab. */
|
|
35
|
-
export type ResourceDetails = ExtensionDeclaration<typeof RESOURCE_DETAILS_TYPE, ResourceTabProps>;
|
|
36
|
-
/** This extension allows plugins to add tabs to the ACM resource details page. */
|
|
37
|
-
export type ResourceTab = ExtensionDeclaration<typeof RESOURCE_TAB_TYPE, ResourceTabProps & ResourceTabMetadataProps>;
|
|
38
|
-
export declare const isResourceDetails: (e: Extension) => e is ResourceDetails;
|
|
39
|
-
export declare const isResourceTab: (e: Extension) => e is ResourceDetails;
|
|
40
|
-
export {};
|
|
41
|
-
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/extensions/resource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAA;AAC1G,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACrG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,QAAA,MAAM,qBAAqB,yBAAyB,CAAA;AACpD,QAAA,MAAM,iBAAiB,qBAAqB,CAAA;AAG5C,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,aAAa,CAAC;IACrD,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAA;IACf,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,qDAAqD;IACrD,QAAQ,EAAE,sBAAsB,CAAA;IAChC,kCAAkC;IAClC,KAAK,EAAE,iBAAiB,CAAA;CACzB,CAAC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iEAAiE;IACjE,KAAK,EAAE,0BAA0B,CAAA;IACjC,+EAA+E;IAC/E,SAAS,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,0GAA0G;IAC1G,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAChC,0IAA0I;IAC1I,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAChC,CAAA;AAED,6FAA6F;AAC7F,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,OAAO,qBAAqB,EAAE,gBAAgB,CAAC,CAAA;AAElG,kFAAkF;AAClF,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAC,OAAO,iBAAiB,EAAE,gBAAgB,GAAG,wBAAwB,CAAC,CAAA;AAGrH,eAAO,MAAM,iBAAiB,GAAI,GAAG,SAAS,KAAG,CAAC,IAAI,eAErD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,GAAG,SAAS,KAAG,CAAC,IAAI,eAEjD,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isResourceTab = exports.isResourceDetails = void 0;
|
|
4
|
-
const RESOURCE_DETAILS_TYPE = 'acm.resource/details';
|
|
5
|
-
const RESOURCE_TAB_TYPE = 'acm.resource/tab';
|
|
6
|
-
// Type guards
|
|
7
|
-
const isResourceDetails = (e) => {
|
|
8
|
-
return e.type === RESOURCE_DETAILS_TYPE;
|
|
9
|
-
};
|
|
10
|
-
exports.isResourceDetails = isResourceDetails;
|
|
11
|
-
const isResourceTab = (e) => {
|
|
12
|
-
return e.type === RESOURCE_TAB_TYPE;
|
|
13
|
-
};
|
|
14
|
-
exports.isResourceTab = isResourceTab;
|
|
15
|
-
//# sourceMappingURL=resource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../../src/extensions/resource.ts"],"names":[],"mappings":";;;AAKA,MAAM,qBAAqB,GAAG,sBAAsB,CAAA;AACpD,MAAM,iBAAiB,GAAG,kBAAkB,CAAA;AAwC5C,cAAc;AACP,MAAM,iBAAiB,GAAG,CAAC,CAAY,EAAwB,EAAE;IACtE,OAAO,CAAC,CAAC,IAAI,KAAK,qBAAqB,CAAA;AACzC,CAAC,CAAA;AAFY,QAAA,iBAAiB,qBAE7B;AAEM,MAAM,aAAa,GAAG,CAAC,CAAY,EAAwB,EAAE;IAClE,OAAO,CAAC,CAAC,IAAI,KAAK,iBAAiB,CAAA;AACrC,CAAC,CAAA;AAFY,QAAA,aAAa,iBAEzB"}
|