@stolostron/multicluster-sdk 0.10.3 → 0.10.4-preview2
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/lib/api/fleetK8sCreate.js +18 -7
- package/lib/api/fleetK8sCreate.js.map +1 -1
- package/lib/api/fleetK8sDelete.js +21 -9
- package/lib/api/fleetK8sDelete.js.map +1 -1
- package/lib/api/fleetK8sGet.js +18 -7
- package/lib/api/fleetK8sGet.js.map +1 -1
- package/lib/api/fleetK8sList.js +26 -13
- package/lib/api/fleetK8sList.js.map +1 -1
- package/lib/api/fleetK8sPatch.js +21 -10
- package/lib/api/fleetK8sPatch.js.map +1 -1
- package/lib/api/fleetK8sUpdate.js +18 -7
- package/lib/api/fleetK8sUpdate.js.map +1 -1
- package/lib/api/getFleetK8sAPIPath.js +12 -3
- package/lib/api/getFleetK8sAPIPath.js.map +1 -1
- package/lib/api/useFleetAccessReview.js +2 -1
- package/lib/api/useFleetAccessReview.js.map +1 -1
- package/lib/api/useFleetK8sWatchResource.d.ts +2 -1
- package/lib/api/useFleetK8sWatchResource.d.ts.map +1 -1
- package/lib/api/useFleetK8sWatchResource.js +15 -3
- package/lib/api/useFleetK8sWatchResource.js.map +1 -1
- package/lib/api/useFleetK8sWatchResources.d.ts +2 -1
- package/lib/api/useFleetK8sWatchResources.d.ts.map +1 -1
- package/lib/api/useFleetK8sWatchResources.js +9 -7
- package/lib/api/useFleetK8sWatchResources.js.map +1 -1
- package/lib/api/useFleetSearchPoll.js +7 -6
- package/lib/api/useFleetSearchPoll.js.map +1 -1
- package/lib/components/FleetResourceEventStream.d.ts +11 -11
- package/lib/components/FleetResourceEventStream.d.ts.map +1 -1
- package/lib/components/FleetResourceEventStream.js +59 -86
- package/lib/components/FleetResourceEventStream.js.map +1 -1
- package/lib/components/FleetResourceLink.js +23 -10
- package/lib/components/FleetResourceLink.js.map +1 -1
- package/lib/internal/FleetResourceEventStream/EventComponent.js +1 -1
- package/lib/internal/FleetResourceEventStream/EventComponent.js.map +1 -1
- package/lib/internal/FleetResourceEventStream/EventStreamList.js +9 -4
- package/lib/internal/FleetResourceEventStream/EventStreamList.js.map +1 -1
- package/lib/internal/FleetResourceEventStream/utils.js +2 -1
- package/lib/internal/FleetResourceEventStream/utils.js.map +1 -1
- package/lib/internal/apiRequests.d.ts +1 -9
- package/lib/internal/apiRequests.d.ts.map +1 -1
- package/lib/internal/apiRequests.js +43 -56
- package/lib/internal/apiRequests.js.map +1 -1
- package/lib/internal/cachedHubConfiguration.js +11 -2
- package/lib/internal/cachedHubConfiguration.js.map +1 -1
- package/lib/internal/clusterUtils.js +8 -5
- package/lib/internal/clusterUtils.js.map +1 -1
- package/lib/internal/components/FleetK8sWatchResourceStoreViewer.d.ts +2 -0
- package/lib/internal/components/FleetK8sWatchResourceStoreViewer.d.ts.map +1 -0
- package/lib/internal/components/FleetK8sWatchResourceStoreViewer.js +28 -0
- package/lib/internal/components/FleetK8sWatchResourceStoreViewer.js.map +1 -0
- package/lib/internal/fleetK8sWatchResource.d.ts +1 -2
- package/lib/internal/fleetK8sWatchResource.d.ts.map +1 -1
- package/lib/internal/fleetK8sWatchResource.js +52 -144
- package/lib/internal/fleetK8sWatchResource.js.map +1 -1
- package/lib/internal/fleetK8sWatchResourceStore.d.ts +6 -3
- package/lib/internal/fleetK8sWatchResourceStore.d.ts.map +1 -1
- package/lib/internal/fleetK8sWatchResourceStore.js +51 -58
- package/lib/internal/fleetK8sWatchResourceStore.js.map +1 -1
- package/lib/internal/isHubRequest.js +14 -2
- package/lib/internal/isHubRequest.js.map +1 -1
- package/lib/internal/requirements.js +5 -4
- package/lib/internal/requirements.js.map +1 -1
- package/lib/internal/resourceRouteUtils.js +3 -3
- package/lib/internal/resourceRouteUtils.js.map +1 -1
- package/lib/internal/search/convertSearchItemToResource.js +18 -19
- package/lib/internal/search/convertSearchItemToResource.js.map +1 -1
- package/lib/internal/search/search-client.js +1 -4
- package/lib/internal/search/search-client.js.map +1 -1
- package/lib/internal/search/search-sdk.js +24 -24
- package/lib/internal/search/search-sdk.js.map +1 -1
- package/lib/internal/search/searchUtils.js +1 -1
- package/lib/internal/search/searchUtils.js.map +1 -1
- package/lib/internal/useFleetClustersInternal.js +4 -8
- package/lib/internal/useFleetClustersInternal.js.map +1 -1
- package/lib/internal/useHubConfigurationItem.js +2 -1
- package/lib/internal/useHubConfigurationItem.js.map +1 -1
- package/lib/internal/useSafeFetch.js +9 -6
- package/lib/internal/useSafeFetch.js.map +1 -1
- package/lib/internal/utils.js +13 -1
- package/lib/internal/utils.js.map +1 -1
- package/lib/setupTests.js +26 -23
- package/lib/setupTests.js.map +1 -1
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/types/fleet.d.ts +4 -1
- package/lib/types/fleet.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,13 @@
|
|
|
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.fleetK8sCreate = fleetK8sCreate;
|
|
4
13
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
@@ -21,12 +30,14 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
21
30
|
* @returns A promise that resolves to the response of the resource created.
|
|
22
31
|
* In case of failure, the promise gets rejected with HTTP error response.
|
|
23
32
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
function fleetK8sCreate(options) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
36
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
37
|
+
const result = (yield (0, isHubRequest_1.isHubRequest)(cluster))
|
|
38
|
+
? (0, dynamic_plugin_sdk_1.k8sCreate)(optionsWithoutCluster)
|
|
39
|
+
: dynamic_plugin_sdk_1.consoleFetchJSON.post(yield (0, apiRequests_1.getResourceURLFromOptions)(options, true), optionsWithoutCluster.data);
|
|
40
|
+
return Object.assign(Object.assign({}, (yield result)), { cluster });
|
|
41
|
+
});
|
|
31
42
|
}
|
|
32
43
|
//# sourceMappingURL=fleetK8sCreate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleetK8sCreate.js","sourceRoot":"","sources":["../../src/api/fleetK8sCreate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fleetK8sCreate.js","sourceRoot":"","sources":["../../src/api/fleetK8sCreate.ts"],"names":[],"mappings":";;;;;;;;;;;AAuBA,wCAUC;AAhCD,mEAAmE;AACnE,8EAAmF;AACnF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,SAAsB,cAAc,CAClC,OAAuC;;QAEvC,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YAC1C,CAAC,CAAC,IAAA,8BAAS,EAAC,qBAAqB,CAAC;YAClC,CAAC,CAAE,qCAAgB,CAAC,IAAI,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,qBAAqB,CAAC,IAAI,CAAgB,CAAA;QACrH,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
|
|
@@ -1,4 +1,13 @@
|
|
|
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.fleetK8sDelete = fleetK8sDelete;
|
|
4
13
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
@@ -28,14 +37,17 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
28
37
|
* @returns A promise that resolves to the response of kind Status.
|
|
29
38
|
* In case of failure promise gets rejected with HTTP error response.
|
|
30
39
|
* */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
function fleetK8sDelete(options) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
var _a;
|
|
43
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
44
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
45
|
+
const { propagationPolicy } = options.model;
|
|
46
|
+
const jsonData = (_a = options.json) !== null && _a !== void 0 ? _a : (propagationPolicy && { kind: 'DeleteOptions', apiVersion: 'v1', propagationPolicy });
|
|
47
|
+
const result = (yield (0, isHubRequest_1.isHubRequest)(cluster))
|
|
48
|
+
? (0, dynamic_plugin_sdk_1.k8sDelete)(optionsWithoutCluster)
|
|
49
|
+
: dynamic_plugin_sdk_1.consoleFetchJSON.delete(yield (0, apiRequests_1.getResourceURLFromOptions)(options), jsonData, options.requestInit);
|
|
50
|
+
return Object.assign(Object.assign({}, (yield result)), { cluster });
|
|
51
|
+
});
|
|
40
52
|
}
|
|
41
53
|
//# sourceMappingURL=fleetK8sDelete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleetK8sDelete.js","sourceRoot":"","sources":["../../src/api/fleetK8sDelete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fleetK8sDelete.js","sourceRoot":"","sources":["../../src/api/fleetK8sDelete.ts"],"names":[],"mappings":";;;;;;;;;;;AA8BA,wCAWC;AAxCD,mEAAmE;AACnE,8EAAmF;AACnF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;MAsBM;AACN,SAAsB,cAAc,CAAmC,OAAiC;;;QACtG,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC3C,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,IAAI,mCAAI,CAAC,iBAAiB,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAA;QAEtH,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YAC1C,CAAC,CAAC,IAAA,8BAAS,EAAC,qBAAqB,CAAC;YAClC,CAAC,CAAE,qCAAgB,CAAC,MAAM,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAgB,CAAA;QACpH,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
|
package/lib/api/fleetK8sGet.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
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.fleetK8sGet = fleetK8sGet;
|
|
4
13
|
const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
|
|
@@ -21,12 +30,14 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
21
30
|
* @param options.requestInit - The fetch init object to use. This can have request headers, method, redirect, etc. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html
|
|
22
31
|
* @returns A promise that resolves to the response as JSON object with a resource if the name is provided, else it returns all the resources matching the model. In case of failure, the promise gets rejected with HTTP error response.
|
|
23
32
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
function fleetK8sGet(options) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
36
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
37
|
+
const result = (yield (0, isHubRequest_1.isHubRequest)(cluster))
|
|
38
|
+
? (0, dynamic_plugin_sdk_1.k8sGet)(optionsWithoutCluster)
|
|
39
|
+
: (0, dynamic_plugin_sdk_1.consoleFetchJSON)(yield (0, apiRequests_1.getResourceURLFromOptions)(options), 'GET', options.requestInit);
|
|
40
|
+
return Object.assign(Object.assign({}, (yield result)), { cluster });
|
|
41
|
+
});
|
|
31
42
|
}
|
|
32
43
|
//# sourceMappingURL=fleetK8sGet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleetK8sGet.js","sourceRoot":"","sources":["../../src/api/fleetK8sGet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fleetK8sGet.js","sourceRoot":"","sources":["../../src/api/fleetK8sGet.ts"],"names":[],"mappings":";;;;;;;;;;;AAwBA,kCAQC;AA9BD,8EAAgF;AAChF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAsB,WAAW,CAAmC,OAA2B;;QAC7F,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YAC1C,CAAC,CAAC,IAAA,2BAAM,EAAI,qBAAqB,CAAC;YAClC,CAAC,CAAE,IAAA,qCAAgB,EAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAgB,CAAA;QAC1G,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
|
package/lib/api/fleetK8sList.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
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.fleetK8sList = fleetK8sList;
|
|
4
13
|
exports.fleetK8sListItems = fleetK8sListItems;
|
|
@@ -17,17 +26,19 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
17
26
|
* @param options.requestInit - The fetch init object to use. This can have request headers, method, redirect, and so forth. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html
|
|
18
27
|
* @returns A promise that resolves to the response
|
|
19
28
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
function fleetK8sList(options) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
var _a;
|
|
32
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
33
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
34
|
+
const items = (yield (0, isHubRequest_1.isHubRequest)(cluster))
|
|
35
|
+
? (0, dynamic_plugin_sdk_1.k8sList)(optionsWithoutCluster)
|
|
36
|
+
: (0, dynamic_plugin_sdk_1.consoleFetchJSON)(yield (0, apiRequests_1.getResourceURLFromOptions)(options), 'GET', options.requestInit).then((result) => {
|
|
37
|
+
var _a;
|
|
38
|
+
return (_a = result.items) === null || _a === void 0 ? void 0 : _a.map((i) => (Object.assign({ kind: options.model.kind, apiVersion: result.apiVersion }, i)));
|
|
39
|
+
});
|
|
40
|
+
return (_a = (yield items)) === null || _a === void 0 ? void 0 : _a.map((i) => (Object.assign(Object.assign({}, i), { cluster })));
|
|
41
|
+
});
|
|
31
42
|
}
|
|
32
43
|
/**
|
|
33
44
|
* A fleet version of [`k8sListItems`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slistitems) from
|
|
@@ -41,7 +52,9 @@ async function fleetK8sList(options) {
|
|
|
41
52
|
* @param options.requestInit - The fetch init object to use. This can have request headers, method, redirect, and so forth. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html
|
|
42
53
|
* @returns A promise that resolves to the response
|
|
43
54
|
*/
|
|
44
|
-
|
|
45
|
-
return
|
|
55
|
+
function fleetK8sListItems(options) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
return fleetK8sList(options);
|
|
58
|
+
});
|
|
46
59
|
}
|
|
47
60
|
//# sourceMappingURL=fleetK8sList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleetK8sList.js","sourceRoot":"","sources":["../../src/api/fleetK8sList.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fleetK8sList.js","sourceRoot":"","sources":["../../src/api/fleetK8sList.ts"],"names":[],"mappings":";;;;;;;;;;;AAmBA,oCAoBC;AAcD,8CAEC;AArDD,8EAAiF;AACjF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;GAWG;AACH,SAAsB,YAAY,CAAmC,OAA4B;;;QAC/F,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,KAAK,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YACzC,CAAC,CAAE,IAAA,4BAAO,EAAC,qBAAqB,CAAkB;YAClD,CAAC,CACG,IAAA,qCAAgB,EAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAKtF,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;;gBAChB,OAAA,MAAA,MAAM,CAAC,KAAK,0CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBACvB,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EACxB,UAAU,EAAE,MAAM,CAAC,UAAU,IAC1B,CAAC,EACJ,CAAC,CAAA;aAAA,CACJ,CAAA;QACL,OAAO,MAAA,CAAC,MAAM,KAAK,CAAC,0CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iCAAM,CAAC,KAAE,OAAO,IAAG,CAAC,CAAA;IACvD,CAAC;CAAA;AAED;;;;;;;;;;;GAWG;AACH,SAAsB,iBAAiB,CAAmC,OAA4B;;QACpG,OAAO,YAAY,CAAC,OAAO,CAAC,CAAA;IAC9B,CAAC;CAAA"}
|
package/lib/api/fleetK8sPatch.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
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.fleetK8sPatch = fleetK8sPatch;
|
|
4
13
|
const lodash_1 = require("lodash");
|
|
@@ -25,15 +34,17 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
25
34
|
* @returns A promise that resolves to the response of the resource patched.
|
|
26
35
|
* In case of failure promise gets rejected with HTTP error response.
|
|
27
36
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
function fleetK8sPatch(options) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
40
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
41
|
+
const patches = (0, lodash_1.compact)(options.data);
|
|
42
|
+
const result = (yield (0, isHubRequest_1.isHubRequest)(cluster))
|
|
43
|
+
? (0, dynamic_plugin_sdk_1.k8sPatch)(optionsWithoutCluster)
|
|
44
|
+
: (0, lodash_1.isEmpty)(patches)
|
|
45
|
+
? Promise.resolve(options.resource)
|
|
46
|
+
: dynamic_plugin_sdk_1.consoleFetchJSON.patch(yield (0, apiRequests_1.getResourceURLFromOptions)(options), patches);
|
|
47
|
+
return Object.assign(Object.assign({}, (yield result)), { cluster });
|
|
48
|
+
});
|
|
38
49
|
}
|
|
39
50
|
//# sourceMappingURL=fleetK8sPatch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleetK8sPatch.js","sourceRoot":"","sources":["../../src/api/fleetK8sPatch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fleetK8sPatch.js","sourceRoot":"","sources":["../../src/api/fleetK8sPatch.ts"],"names":[],"mappings":";;;;;;;;;;;AA4BA,sCAYC;AAtCD,mCAAyC;AACzC,8EAAkF;AAClF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAsB,aAAa,CAAmC,OAAgC;;QACpG,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,OAAO,GAAG,IAAA,gBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAErC,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YAC1C,CAAC,CAAC,IAAA,6BAAQ,EAAC,qBAAqB,CAAC;YACjC,CAAC,CAAC,IAAA,gBAAO,EAAC,OAAO,CAAC;gBAChB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;gBACnC,CAAC,CAAE,qCAAgB,CAAC,KAAK,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,OAAO,CAAgB,CAAA;QAC/F,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
3
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
13
|
exports.fleetK8sUpdate = fleetK8sUpdate;
|
|
5
14
|
const apiRequests_1 = require("../internal/apiRequests");
|
|
@@ -25,12 +34,14 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
25
34
|
* @returns A promise that resolves to the response of the resource updated.
|
|
26
35
|
* In case of failure promise gets rejected with HTTP error response.
|
|
27
36
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
function fleetK8sUpdate(options) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
40
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
41
|
+
const result = (yield (0, isHubRequest_1.isHubRequest)(cluster))
|
|
42
|
+
? (0, dynamic_plugin_sdk_1.k8sUpdate)(optionsWithoutCluster)
|
|
43
|
+
: dynamic_plugin_sdk_1.consoleFetchJSON.put(yield (0, apiRequests_1.getResourceURLFromOptions)(options), optionsWithoutCluster.data);
|
|
44
|
+
return Object.assign(Object.assign({}, (yield result)), { cluster });
|
|
45
|
+
});
|
|
35
46
|
}
|
|
36
47
|
//# sourceMappingURL=fleetK8sUpdate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleetK8sUpdate.js","sourceRoot":"","sources":["../../src/api/fleetK8sUpdate.ts"],"names":[],"mappings":";AAAA,mEAAmE
|
|
1
|
+
{"version":3,"file":"fleetK8sUpdate.js","sourceRoot":"","sources":["../../src/api/fleetK8sUpdate.ts"],"names":[],"mappings":";AAAA,mEAAmE;;;;;;;;;;;AA4BnE,wCAUC;AAnCD,yDAAoH;AAEpH,8EAAmF;AACnF,2DAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAsB,cAAc,CAClC,OAAuC;;QAEvC,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YAC1C,CAAC,CAAC,IAAA,8BAAS,EAAC,qBAAqB,CAAC;YAClC,CAAC,CAAE,qCAAgB,CAAC,GAAG,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC,IAAI,CAAgB,CAAA;QAC9G,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
|
|
@@ -1,4 +1,13 @@
|
|
|
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.getFleetK8sAPIPath = void 0;
|
|
4
13
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
@@ -10,13 +19,13 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
10
19
|
* @param cluster - The cluster name.
|
|
11
20
|
* @returns The k8s API path for the fleet.
|
|
12
21
|
*/
|
|
13
|
-
const getFleetK8sAPIPath =
|
|
14
|
-
if (
|
|
22
|
+
const getFleetK8sAPIPath = (cluster) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
if (yield (0, isHubRequest_1.isHubRequest)(cluster)) {
|
|
15
24
|
return constants_1.BASE_K8S_API_PATH;
|
|
16
25
|
}
|
|
17
26
|
else {
|
|
18
27
|
return `${constants_1.BACKEND_URL}/${constants_1.MANAGED_CLUSTER_API_PATH}/${cluster}`;
|
|
19
28
|
}
|
|
20
|
-
};
|
|
29
|
+
});
|
|
21
30
|
exports.getFleetK8sAPIPath = getFleetK8sAPIPath;
|
|
22
31
|
//# sourceMappingURL=getFleetK8sAPIPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFleetK8sAPIPath.js","sourceRoot":"","sources":["../../src/api/getFleetK8sAPIPath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getFleetK8sAPIPath.js","sourceRoot":"","sources":["../../src/api/getFleetK8sAPIPath.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAmE;AACnE,qDAAgG;AAEhG,2DAAuD;AAEvD;;;;;GAKG;AAEI,MAAM,kBAAkB,GAAG,CAAO,OAAgB,EAAE,EAAE;IAC3D,IAAI,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,EAAE,CAAC;QAChC,OAAO,6BAAiB,CAAA;IAC1B,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,uBAAW,IAAI,oCAAwB,IAAI,OAAO,EAAE,CAAA;IAChE,CAAC;AACH,CAAC,CAAA,CAAA;AANY,QAAA,kBAAkB,sBAM9B"}
|
|
@@ -28,7 +28,8 @@ const useFleetAccessReview = ({ group = '', resource = '', subresource = '', ver
|
|
|
28
28
|
}
|
|
29
29
|
(0, checkAccess_1.checkAccess)(group, resource, subresource, verb, name, namespace, cluster)
|
|
30
30
|
.then((result) => {
|
|
31
|
-
|
|
31
|
+
var _a, _b;
|
|
32
|
+
setAllowed((_b = (_a = result.status) === null || _a === void 0 ? void 0 : _a.allowed) !== null && _b !== void 0 ? _b : false);
|
|
32
33
|
setLoading(false);
|
|
33
34
|
})
|
|
34
35
|
.catch((e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFleetAccessReview.js","sourceRoot":"","sources":["../../src/api/useFleetAccessReview.ts"],"names":[],"mappings":";;;AAEA,iCAA2C;AAC3C,yDAAqD;AAGrD;;;;;;;;;;;;GAYG;AACI,MAAM,oBAAoB,GAAG,CAAC,EACnC,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,WAAW,GAAG,EAAE,EAChB,IAAI,GAAG,EAAa,EACpB,IAAI,GAAG,EAAE,EACT,SAAS,GAAG,EAAE,EACd,OAAO,GAAG,EAAE,GACwB,EAAsB,EAAE;IAC5D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAA;IAC5C,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;IAE/C,MAAM,SAAS,GAAG,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAA;IACrC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,SAAS,EAAE,CAAC;YACd,UAAU,CAAC,KAAK,CAAC,CAAA;YACjB,UAAU,CAAC,KAAK,CAAC,CAAA;YACjB,OAAM;QACR,CAAC;QACD,IAAA,yBAAW,EAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OA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;YACvE,0EAA0E;YAC1E,iCAAiC;YACjC,UAAU,CAAC,IAAI,CAAC,CAAA;YAChB,UAAU,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC,CAAC,CAAA;IACN,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAA;IAErG,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC7B,CAAC,CAAA;AAnCY,QAAA,oBAAoB,wBAmChC"}
|
|
@@ -6,7 +6,7 @@ import { FleetK8sResourceCommon, FleetWatchK8sResource, FleetWatchK8sResult } fr
|
|
|
6
6
|
* but allows you to retrieve data from any cluster managed by Red Hat Advanced Cluster Management.
|
|
7
7
|
*
|
|
8
8
|
* It automatically detects the hub cluster and handles resource watching on both hub
|
|
9
|
-
* and remote clusters using
|
|
9
|
+
* and remote clusters using polling for near-real-time updates.
|
|
10
10
|
*
|
|
11
11
|
* @param initResource - The resource to watch. Can be null to disable the watch.
|
|
12
12
|
* @param initResource.cluster - The managed cluster on which the resource resides; null or undefined for the hub cluster
|
|
@@ -16,6 +16,7 @@ import { FleetK8sResourceCommon, FleetWatchK8sResource, FleetWatchK8sResult } fr
|
|
|
16
16
|
* @param initResource.isList - Whether to watch a list of resources (true) or a single resource (false)
|
|
17
17
|
* @param initResource.selector - Label selector to filter resources (e.g., `{ matchLabels: { app: 'myapp' } }`)
|
|
18
18
|
* @param initResource.fieldSelector - Field selector to filter resources (e.g., `status.phase=Running`)
|
|
19
|
+
* @param initResource.pollInterval - Optional polling interval in seconds. Defaults to 10. Minimum is 10.
|
|
19
20
|
* @param initResource.limit - Maximum number of resources to return (not supported yet)
|
|
20
21
|
* @param initResource.namespaced - Whether the resource is namespaced (not supported yet)
|
|
21
22
|
* @param initResource.optional - If true, errors will not be thrown when the resource is not found (not supported yet)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFleetK8sWatchResource.d.ts","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResource.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,UAAU,CAAA;AAcjB
|
|
1
|
+
{"version":3,"file":"useFleetK8sWatchResource.d.ts","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResource.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,UAAU,CAAA;AAcjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,sBAAsB,GAAG,sBAAsB,EAAE,EAClG,YAAY,EAAE,qBAAqB,GAAG,IAAI,GACzC,mBAAmB,CAAC,CAAC,CAAC,CAgDxB"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.useFleetK8sWatchResource = useFleetK8sWatchResource;
|
|
4
15
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
@@ -16,7 +27,7 @@ const fleetK8sWatchResource_1 = require("../internal/fleetK8sWatchResource");
|
|
|
16
27
|
* but allows you to retrieve data from any cluster managed by Red Hat Advanced Cluster Management.
|
|
17
28
|
*
|
|
18
29
|
* It automatically detects the hub cluster and handles resource watching on both hub
|
|
19
|
-
* and remote clusters using
|
|
30
|
+
* and remote clusters using polling for near-real-time updates.
|
|
20
31
|
*
|
|
21
32
|
* @param initResource - The resource to watch. Can be null to disable the watch.
|
|
22
33
|
* @param initResource.cluster - The managed cluster on which the resource resides; null or undefined for the hub cluster
|
|
@@ -26,6 +37,7 @@ const fleetK8sWatchResource_1 = require("../internal/fleetK8sWatchResource");
|
|
|
26
37
|
* @param initResource.isList - Whether to watch a list of resources (true) or a single resource (false)
|
|
27
38
|
* @param initResource.selector - Label selector to filter resources (e.g., `{ matchLabels: { app: 'myapp' } }`)
|
|
28
39
|
* @param initResource.fieldSelector - Field selector to filter resources (e.g., `status.phase=Running`)
|
|
40
|
+
* @param initResource.pollInterval - Optional polling interval in seconds. Defaults to 10. Minimum is 10.
|
|
29
41
|
* @param initResource.limit - Maximum number of resources to return (not supported yet)
|
|
30
42
|
* @param initResource.namespaced - Whether the resource is namespaced (not supported yet)
|
|
31
43
|
* @param initResource.optional - If true, errors will not be thrown when the resource is not found (not supported yet)
|
|
@@ -64,7 +76,7 @@ function useFleetK8sWatchResource(initResource) {
|
|
|
64
76
|
const isFleetAvailable = (0, useIsFleetAvailable_1.useIsFleetAvailable)();
|
|
65
77
|
const [hubClusterName, hubClusterNameLoaded] = (0, useHubClusterName_1.useHubClusterName)();
|
|
66
78
|
const [memoizedResource, memoizedResourceChanged] = (0, useDeepCompareMemoize_1.useDeepCompareMemoize)(initResource, true);
|
|
67
|
-
const { cluster,
|
|
79
|
+
const _a = memoizedResource !== null && memoizedResource !== void 0 ? memoizedResource : {}, { cluster } = _a, resource = __rest(_a, ["cluster"]);
|
|
68
80
|
const { groupVersionKind } = resource;
|
|
69
81
|
const [model, modelLoading] = (0, dynamic_plugin_sdk_1.useK8sModel)(groupVersionKind);
|
|
70
82
|
const [backendAPIPath, backendPathLoaded] = (0, useFleetK8sAPIPath_1.useFleetK8sAPIPath)(cluster);
|
|
@@ -90,7 +102,7 @@ function useFleetK8sWatchResource(initResource) {
|
|
|
90
102
|
if (useFleet && !isResourceNull && backendPathLoaded && backendAPIPath && !modelLoading && model) {
|
|
91
103
|
const requestPath = (0, fleetK8sWatchResource_1.getRequestPathFromResource)(memoizedResource, model, backendAPIPath);
|
|
92
104
|
const unsubscribe = (0, fleetK8sWatchResource_1.subscribe)(memoizedResource, requestPath, setFleetResult);
|
|
93
|
-
(0, fleetK8sWatchResource_1.startWatch)(memoizedResource, model, backendAPIPath);
|
|
105
|
+
(0, fleetK8sWatchResource_1.startWatch)(memoizedResource, model, backendAPIPath, memoizedResource.pollInterval);
|
|
94
106
|
return () => {
|
|
95
107
|
unsubscribe();
|
|
96
108
|
(0, fleetK8sWatchResource_1.stopWatch)(memoizedResource, model, backendAPIPath);
|
|
@@ -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":";;;;;;;;;;;;;AAyEA,4DAkDC;AA3HD,mEAAmE;AACnE,2DAAuD;AAOvD,8EAAwF;AACxF,+DAA2D;AAC3D,iCAAoD;AACpD,mFAA+E;AAC/E,6DAAyD;AACzD,6EAM0C;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,SAAgB,wBAAwB,CACtC,YAA0C;IAE1C,MAAM,gBAAgB,GAAG,IAAA,yCAAmB,GAAE,CAAA;IAC9C,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC,GAAG,IAAA,qCAAiB,GAAE,CAAA;IAElE,MAAM,CAAC,gBAAgB,EAAE,uBAAuB,C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EAAE,GAAG,WAAW,CAAA;QAC/C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;IAClC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAEjB,MAAM,WAAW,GAAG,IAAA,wCAAmB,EAAI,QAAQ,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAEzF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,QAAQ,IAAI,CAAC,cAAc,IAAI,iBAAiB,IAAI,cAAc,IAAI,CAAC,YAAY,IAAI,KAAK,EAAE,CAAC;YACjG,MAAM,WAAW,GAAG,IAAA,kDAA0B,EAAC,gBAAgB,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;YACvF,MAAM,WAAW,GAAG,IAAA,iCAAS,EAAC,gBAAgB,EAAE,WAAW,EAAE,cAAc,CAAC,CAAA;YAC5E,IAAA,kCAAU,EAAC,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAA;YAElF,OAAO,GAAG,EAAE;gBACV,WAAW,EAAE,CAAA;gBACb,IAAA,iCAAS,EAAC,gBAAgB,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;YACpD,CAAC,CAAA;QACH,CAAC;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAA;IAExG,OAAO,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAA;AAClD,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { FleetResourcesObject, FleetWatchK8sResources, FleetWatchK8sResults } fr
|
|
|
6
6
|
* but allows you to retrieve data from any cluster managed by Red Hat Advanced Cluster Management.
|
|
7
7
|
*
|
|
8
8
|
* It automatically detects the hub cluster and handles resource watching on both hub
|
|
9
|
-
* and remote clusters using
|
|
9
|
+
* and remote clusters using polling for near-real-time updates.
|
|
10
10
|
*
|
|
11
11
|
* @param initResources - An object where each key represents a resource identifier and each value is a resource watch configuration. Can be null to disable all watches.
|
|
12
12
|
* @param initResources[key].cluster - The managed cluster on which the resource resides; null or undefined for the hub cluster
|
|
@@ -16,6 +16,7 @@ import { FleetResourcesObject, FleetWatchK8sResources, FleetWatchK8sResults } fr
|
|
|
16
16
|
* @param initResources[key].isList - Whether to watch a list of resources (true) or a single resource (false)
|
|
17
17
|
* @param initResources[key].selector - Label selector to filter resources (e.g., `{ matchLabels: { app: 'myapp' } }`)
|
|
18
18
|
* @param initResources[key].fieldSelector - Field selector to filter resources (e.g., `status.phase=Running`)
|
|
19
|
+
* @param initResources[key].pollInterval - Optional polling interval in seconds. Defaults to 10. Minimum is 10.
|
|
19
20
|
* @param initResources[key].limit - Maximum number of resources to return (not supported yet)
|
|
20
21
|
* @param initResources[key].namespaced - Whether the resource is namespaced (not supported yet)
|
|
21
22
|
* @param initResources[key].optional - If true, errors will not be thrown when the resource is not found (not supported yet)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFleetK8sWatchResources.d.ts","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAyB,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AA0BpH
|
|
1
|
+
{"version":3,"file":"useFleetK8sWatchResources.d.ts","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAyB,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AA0BpH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,oBAAoB,EACtE,aAAa,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,IAAI,GAC9C,oBAAoB,CAAC,CAAC,CAAC,CAuEzB"}
|
|
@@ -10,14 +10,15 @@ const useDeepCompareMemoize_1 = require("../internal/hooks/useDeepCompareMemoize
|
|
|
10
10
|
const fleetK8sWatchResource_1 = require("../internal/fleetK8sWatchResource");
|
|
11
11
|
const getFleetK8sAPIPath_1 = require("../internal/getFleetK8sAPIPath");
|
|
12
12
|
function getModelForWatch(watch, models) {
|
|
13
|
+
var _a, _b, _c, _d;
|
|
13
14
|
if (watch.groupVersionKind) {
|
|
14
15
|
const { group, version, kind } = watch.groupVersionKind;
|
|
15
16
|
const reference = [group || 'core', version, kind].join('~');
|
|
16
|
-
return models[reference]
|
|
17
|
+
return (_a = models[reference]) !== null && _a !== void 0 ? _a : models[kind];
|
|
17
18
|
}
|
|
18
19
|
else if (watch.kind) {
|
|
19
|
-
const kind = watch.kind
|
|
20
|
-
return models[watch.kind]
|
|
20
|
+
const kind = (_c = (_b = watch.kind) === null || _b === void 0 ? void 0 : _b.split('~')) === null || _c === void 0 ? void 0 : _c[2];
|
|
21
|
+
return (_d = models[watch.kind]) !== null && _d !== void 0 ? _d : models[kind];
|
|
21
22
|
}
|
|
22
23
|
return undefined;
|
|
23
24
|
}
|
|
@@ -28,7 +29,7 @@ function getModelForWatch(watch, models) {
|
|
|
28
29
|
* but allows you to retrieve data from any cluster managed by Red Hat Advanced Cluster Management.
|
|
29
30
|
*
|
|
30
31
|
* It automatically detects the hub cluster and handles resource watching on both hub
|
|
31
|
-
* and remote clusters using
|
|
32
|
+
* and remote clusters using polling for near-real-time updates.
|
|
32
33
|
*
|
|
33
34
|
* @param initResources - An object where each key represents a resource identifier and each value is a resource watch configuration. Can be null to disable all watches.
|
|
34
35
|
* @param initResources[key].cluster - The managed cluster on which the resource resides; null or undefined for the hub cluster
|
|
@@ -38,6 +39,7 @@ function getModelForWatch(watch, models) {
|
|
|
38
39
|
* @param initResources[key].isList - Whether to watch a list of resources (true) or a single resource (false)
|
|
39
40
|
* @param initResources[key].selector - Label selector to filter resources (e.g., `{ matchLabels: { app: 'myapp' } }`)
|
|
40
41
|
* @param initResources[key].fieldSelector - Field selector to filter resources (e.g., `status.phase=Running`)
|
|
42
|
+
* @param initResources[key].pollInterval - Optional polling interval in seconds. Defaults to 10. Minimum is 10.
|
|
41
43
|
* @param initResources[key].limit - Maximum number of resources to return (not supported yet)
|
|
42
44
|
* @param initResources[key].namespaced - Whether the resource is namespaced (not supported yet)
|
|
43
45
|
* @param initResources[key].optional - If true, errors will not be thrown when the resource is not found (not supported yet)
|
|
@@ -73,7 +75,7 @@ function useFleetK8sWatchResources(initResources) {
|
|
|
73
75
|
const isFleetAvailable = (0, useIsFleetAvailable_1.useIsFleetAvailable)();
|
|
74
76
|
const [hubClusterName, hubClusterNameLoaded] = (0, useHubClusterName_1.useHubClusterName)();
|
|
75
77
|
const [memoizedResources, memoizedResourceChanged] = (0, useDeepCompareMemoize_1.useDeepCompareMemoize)(initResources, true);
|
|
76
|
-
const resources = memoizedResources
|
|
78
|
+
const resources = memoizedResources !== null && memoizedResources !== void 0 ? memoizedResources : {};
|
|
77
79
|
const [models, modelsLoading] = (0, dynamic_plugin_sdk_1.useK8sModels)();
|
|
78
80
|
const waitingForHubClusterName = Object.values(resources).some((watch) => !!watch.cluster) && !hubClusterNameLoaded;
|
|
79
81
|
const probablyHasFleetQueries = Object.values(resources).some((watch) => !!watch.cluster && watch.cluster !== hubClusterName);
|
|
@@ -103,11 +105,11 @@ function useFleetK8sWatchResources(initResources) {
|
|
|
103
105
|
watch,
|
|
104
106
|
model,
|
|
105
107
|
path,
|
|
106
|
-
(0, fleetK8sWatchResource_1.subscribe)(watch, requestPath, (newResult) => setFleetResult((result) => ({
|
|
108
|
+
(0, fleetK8sWatchResource_1.subscribe)(watch, requestPath, (newResult) => setFleetResult((result) => (Object.assign(Object.assign({}, result), { [key]: newResult })))),
|
|
107
109
|
]);
|
|
108
110
|
}
|
|
109
111
|
for (const [watch, model, path] of watches) {
|
|
110
|
-
(0, fleetK8sWatchResource_1.startWatch)(watch, model, path);
|
|
112
|
+
(0, fleetK8sWatchResource_1.startWatch)(watch, model, path, watch.pollInterval);
|
|
111
113
|
}
|
|
112
114
|
return () => {
|
|
113
115
|
for (const [watch, model, path, unsubscribe] of watches) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFleetK8sWatchResources.js","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResources.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useFleetK8sWatchResources.js","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResources.ts"],"names":[],"mappings":";;AA6EA,8DAyEC;AAtJD,mEAAmE;AACnE,2DAAuD;AAEvD,8EAAuH;AACvH,+DAA2D;AAC3D,iCAA2C;AAC3C,mFAA+E;AAC/E,6EAM0C;AAC1C,uEAAmE;AAEnE,SAAS,gBAAgB,CAAC,KAA4B,EAAE,MAAmC;;IACzF,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,gBAAgB,CAAA;QACvD,MAAM,SAAS,GAAG,CAAC,KAAK,IAAI,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC5D,OAAO,MAAA,MAAM,CAAC,SAAS,CAAC,mCAAI,MAAM,CAAC,IAAI,CAAC,CAAA;IAC1C,CAAC;SAAM,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,GAAG,MAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,KAAK,CAAC,GAAG,CAAC,0CAAG,CAAC,CAAC,CAAA;QACxC,OAAO,MAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAI,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3C,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AA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iCAAS,EAAC,KAAK,EAAE,WAAW,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,iCAAM,MAAM,KAAE,CAAC,GAAG,CAAC,EAAE,SAAS,IAAG,CAAC,CAAC;iBAC5G,CAAC,CAAA;YACJ,CAAC;YACD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE,CAAC;gBAC3C,IAAA,kCAAU,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAA;YACpD,CAAC;YACD,OAAO,GAAG,EAAE;gBACV,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,OAAO,EAAE,CAAC;oBACxD,WAAW,EAAE,CAAA;oBACb,IAAA,iCAAS,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;gBAC/B,CAAC;YACH,CAAC,CAAA;QACH,CAAC;IACH,CAAC;IACD,8DAA8D;IAC9D,uDAAuD;IACvD,CAAC,qBAAqB,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,CAAC,CAC5E,CAAA;IAED,OAAO,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAA;AAC7C,CAAC"}
|
|
@@ -78,8 +78,8 @@ const DEFAULT_POLL_INTERVAL_SECONDS = 30;
|
|
|
78
78
|
* - Minimum polling interval is 30 seconds for performance reasons
|
|
79
79
|
*/
|
|
80
80
|
function useFleetSearchPoll(watchOptions, advancedSearchFilters, pollInterval) {
|
|
81
|
-
const { cluster, groupVersionKind, limit, namespace, namespaced, name, isList } = watchOptions
|
|
82
|
-
const { group, version, kind } = groupVersionKind
|
|
81
|
+
const { cluster, groupVersionKind, limit, namespace, namespaced, name, isList } = watchOptions !== null && watchOptions !== void 0 ? watchOptions : {};
|
|
82
|
+
const { group, version, kind } = groupVersionKind !== null && groupVersionKind !== void 0 ? groupVersionKind : {};
|
|
83
83
|
// Calculate the actual polling interval in milliseconds
|
|
84
84
|
const actualPollInterval = (0, react_1.useMemo)(() => {
|
|
85
85
|
// Disable polling for false or negative values
|
|
@@ -131,7 +131,7 @@ function useFleetSearchPoll(watchOptions, advancedSearchFilters, pollInterval) {
|
|
|
131
131
|
}
|
|
132
132
|
return {
|
|
133
133
|
filters,
|
|
134
|
-
limit: limit
|
|
134
|
+
limit: limit !== null && limit !== void 0 ? limit : -1,
|
|
135
135
|
};
|
|
136
136
|
}, [cluster, group, version, kind, namespaced, namespace, name, advancedSearchFilters, limit]);
|
|
137
137
|
const { data: result, loading, error, refetch, } = (0, search_sdk_1.useSearchResultItemsQuery)({
|
|
@@ -146,10 +146,11 @@ function useFleetSearchPoll(watchOptions, advancedSearchFilters, pollInterval) {
|
|
|
146
146
|
refetch();
|
|
147
147
|
}, [refetch]);
|
|
148
148
|
const data = (0, react_1.useMemo)(() => {
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
var _a, _b, _c;
|
|
150
|
+
const convertedResources = (_c = (_b = (_a = result === null || result === void 0 ? void 0 : result.searchResult) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c.map((convertSearchItemToResource_1.convertSearchItemToResource));
|
|
151
|
+
return (isList ? convertedResources : convertedResources === null || convertedResources === void 0 ? void 0 : convertedResources[0]);
|
|
151
152
|
}, [isList, result]);
|
|
152
153
|
const nullResponse = (0, react_1.useMemo)(() => (isList ? [] : undefined), [isList]);
|
|
153
|
-
return [data
|
|
154
|
+
return [data !== null && data !== void 0 ? data : nullResponse, !loading, error, triggerRefetch];
|
|
154
155
|
}
|
|
155
156
|
//# sourceMappingURL=useFleetSearchPoll.js.map
|