@stolostron/multicluster-sdk 0.10.4-preview4 → 0.10.4
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 +7 -18
- package/lib/api/fleetK8sCreate.js.map +1 -1
- package/lib/api/fleetK8sDelete.js +9 -21
- package/lib/api/fleetK8sDelete.js.map +1 -1
- package/lib/api/fleetK8sGet.js +7 -18
- package/lib/api/fleetK8sGet.js.map +1 -1
- package/lib/api/fleetK8sList.js +13 -26
- package/lib/api/fleetK8sList.js.map +1 -1
- package/lib/api/fleetK8sPatch.js +10 -21
- package/lib/api/fleetK8sPatch.js.map +1 -1
- package/lib/api/fleetK8sUpdate.js +7 -18
- package/lib/api/fleetK8sUpdate.js.map +1 -1
- package/lib/api/getFleetK8sAPIPath.js +3 -12
- package/lib/api/getFleetK8sAPIPath.js.map +1 -1
- package/lib/api/useFleetAccessReview.js +1 -2
- package/lib/api/useFleetAccessReview.js.map +1 -1
- package/lib/api/useFleetK8sWatchResource.js +1 -12
- package/lib/api/useFleetK8sWatchResource.js.map +1 -1
- package/lib/api/useFleetK8sWatchResources.js +5 -6
- package/lib/api/useFleetK8sWatchResources.js.map +1 -1
- package/lib/api/useFleetSearch.d.ts +72 -0
- package/lib/api/useFleetSearch.d.ts.map +1 -0
- package/lib/api/useFleetSearch.js +363 -0
- package/lib/api/useFleetSearch.js.map +1 -0
- package/lib/api/useFleetSearchPoll.js +6 -7
- package/lib/api/useFleetSearchPoll.js.map +1 -1
- package/lib/api/useFleetSearchSubscription.d.ts +43 -0
- package/lib/api/useFleetSearchSubscription.d.ts.map +1 -0
- package/lib/api/useFleetSearchSubscription.js +54 -0
- package/lib/api/useFleetSearchSubscription.js.map +1 -0
- package/lib/components/FleetResourceEventStream.js +18 -16
- package/lib/components/FleetResourceEventStream.js.map +1 -1
- package/lib/components/FleetResourceLink.js +10 -23
- 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 +4 -9
- package/lib/internal/FleetResourceEventStream/EventStreamList.js.map +1 -1
- package/lib/internal/FleetResourceEventStream/utils.js +1 -2
- package/lib/internal/FleetResourceEventStream/utils.js.map +1 -1
- package/lib/internal/apiRequests.js +26 -42
- package/lib/internal/apiRequests.js.map +1 -1
- package/lib/internal/cachedHubConfiguration.js +2 -11
- package/lib/internal/cachedHubConfiguration.js.map +1 -1
- package/lib/internal/clusterUtils.js +5 -8
- package/lib/internal/clusterUtils.js.map +1 -1
- package/lib/internal/fleetK8sWatchResource.d.ts.map +1 -1
- package/lib/internal/fleetK8sWatchResource.js +53 -47
- package/lib/internal/fleetK8sWatchResource.js.map +1 -1
- package/lib/internal/fleetK8sWatchResourceStore.d.ts +3 -0
- package/lib/internal/fleetK8sWatchResourceStore.d.ts.map +1 -1
- package/lib/internal/fleetK8sWatchResourceStore.js +85 -28
- package/lib/internal/fleetK8sWatchResourceStore.js.map +1 -1
- package/lib/internal/isHubRequest.js +2 -14
- package/lib/internal/isHubRequest.js.map +1 -1
- package/lib/internal/requirements.js +4 -5
- 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 +19 -18
- package/lib/internal/search/convertSearchItemToResource.js.map +1 -1
- package/lib/internal/search/search-client.js +4 -1
- 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 +8 -4
- package/lib/internal/useFleetClustersInternal.js.map +1 -1
- package/lib/internal/useHubConfigurationItem.js +1 -2
- package/lib/internal/useHubConfigurationItem.js.map +1 -1
- package/lib/internal/useSafeFetch.js +6 -9
- package/lib/internal/useSafeFetch.js.map +1 -1
- package/lib/internal/utils.js +1 -13
- package/lib/internal/utils.js.map +1 -1
- package/lib/setupTests.js +23 -26
- package/lib/setupTests.js.map +1 -1
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/internal/components/FleetK8sWatchResourceStoreViewer.d.ts +0 -2
- package/lib/internal/components/FleetK8sWatchResourceStoreViewer.d.ts.map +0 -1
- package/lib/internal/components/FleetK8sWatchResourceStoreViewer.js +0 -42
- package/lib/internal/components/FleetK8sWatchResourceStoreViewer.js.map +0 -1
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.fleetK8sCreate = fleetK8sCreate;
|
|
13
4
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
@@ -30,14 +21,12 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
30
21
|
* @returns A promise that resolves to the response of the resource created.
|
|
31
22
|
* In case of failure, the promise gets rejected with HTTP error response.
|
|
32
23
|
*/
|
|
33
|
-
function fleetK8sCreate(options) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return Object.assign(Object.assign({}, (yield result)), { cluster });
|
|
41
|
-
});
|
|
24
|
+
async function fleetK8sCreate(options) {
|
|
25
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
26
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
27
|
+
const result = (await (0, isHubRequest_1.isHubRequest)(cluster))
|
|
28
|
+
? (0, dynamic_plugin_sdk_1.k8sCreate)(optionsWithoutCluster)
|
|
29
|
+
: dynamic_plugin_sdk_1.consoleFetchJSON.post(await (0, apiRequests_1.getResourceURLFromOptions)(options, true), optionsWithoutCluster.data);
|
|
30
|
+
return { ...(await result), cluster };
|
|
42
31
|
}
|
|
43
32
|
//# 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;AACI,KAAK,UAAU,cAAc,CAClC,OAAuC;IAEvC,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;IAE/D,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,IAAA,8BAAS,EAAC,qBAAqB,CAAC;QAClC,CAAC,CAAE,qCAAgB,CAAC,IAAI,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,qBAAqB,CAAC,IAAI,CAAgB,CAAA;IACrH,OAAO,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;AACvC,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.fleetK8sDelete = fleetK8sDelete;
|
|
13
4
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
@@ -37,17 +28,14 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
37
28
|
* @returns A promise that resolves to the response of kind Status.
|
|
38
29
|
* In case of failure promise gets rejected with HTTP error response.
|
|
39
30
|
* */
|
|
40
|
-
function fleetK8sDelete(options) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
});
|
|
31
|
+
async function fleetK8sDelete(options) {
|
|
32
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
33
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
34
|
+
const { propagationPolicy } = options.model;
|
|
35
|
+
const jsonData = options.json ?? (propagationPolicy && { kind: 'DeleteOptions', apiVersion: 'v1', propagationPolicy });
|
|
36
|
+
const result = (await (0, isHubRequest_1.isHubRequest)(cluster))
|
|
37
|
+
? (0, dynamic_plugin_sdk_1.k8sDelete)(optionsWithoutCluster)
|
|
38
|
+
: dynamic_plugin_sdk_1.consoleFetchJSON.delete(await (0, apiRequests_1.getResourceURLFromOptions)(options), jsonData, options.requestInit);
|
|
39
|
+
return { ...(await result), cluster };
|
|
52
40
|
}
|
|
53
41
|
//# 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;AACC,KAAK,UAAU,cAAc,CAAmC,OAAiC;IACtG,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;IAE/D,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,IAAI,CAAC,iBAAiB,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAA;IAEtH,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,IAAA,8BAAS,EAAC,qBAAqB,CAAC;QAClC,CAAC,CAAE,qCAAgB,CAAC,MAAM,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAgB,CAAA;IACpH,OAAO,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;AACvC,CAAC"}
|
package/lib/api/fleetK8sGet.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.fleetK8sGet = fleetK8sGet;
|
|
13
4
|
const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
|
|
@@ -30,14 +21,12 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
30
21
|
* @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
|
|
31
22
|
* @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.
|
|
32
23
|
*/
|
|
33
|
-
function fleetK8sGet(options) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return Object.assign(Object.assign({}, (yield result)), { cluster });
|
|
41
|
-
});
|
|
24
|
+
async function fleetK8sGet(options) {
|
|
25
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
26
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
27
|
+
const result = (await (0, isHubRequest_1.isHubRequest)(cluster))
|
|
28
|
+
? (0, dynamic_plugin_sdk_1.k8sGet)(optionsWithoutCluster)
|
|
29
|
+
: (0, dynamic_plugin_sdk_1.consoleFetchJSON)(await (0, apiRequests_1.getResourceURLFromOptions)(options), 'GET', options.requestInit);
|
|
30
|
+
return { ...(await result), cluster };
|
|
42
31
|
}
|
|
43
32
|
//# 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;AACI,KAAK,UAAU,WAAW,CAAmC,OAA2B;IAC7F,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;IAE/D,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,IAAA,2BAAM,EAAI,qBAAqB,CAAC;QAClC,CAAC,CAAE,IAAA,qCAAgB,EAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAgB,CAAA;IAC1G,OAAO,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;AACvC,CAAC"}
|
package/lib/api/fleetK8sList.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.fleetK8sList = fleetK8sList;
|
|
13
4
|
exports.fleetK8sListItems = fleetK8sListItems;
|
|
@@ -26,19 +17,17 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
26
17
|
* @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
|
|
27
18
|
* @returns A promise that resolves to the response
|
|
28
19
|
*/
|
|
29
|
-
function fleetK8sList(options) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return (_a = (yield items)) === null || _a === void 0 ? void 0 : _a.map((i) => (Object.assign(Object.assign({}, i), { cluster })));
|
|
41
|
-
});
|
|
20
|
+
async function fleetK8sList(options) {
|
|
21
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
22
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
23
|
+
const items = (await (0, isHubRequest_1.isHubRequest)(cluster))
|
|
24
|
+
? (0, dynamic_plugin_sdk_1.k8sList)(optionsWithoutCluster)
|
|
25
|
+
: (0, dynamic_plugin_sdk_1.consoleFetchJSON)(await (0, apiRequests_1.getResourceURLFromOptions)(options), 'GET', options.requestInit).then((result) => result.items?.map((i) => ({
|
|
26
|
+
kind: options.model.kind,
|
|
27
|
+
apiVersion: result.apiVersion,
|
|
28
|
+
...i,
|
|
29
|
+
})));
|
|
30
|
+
return (await items)?.map((i) => ({ ...i, cluster }));
|
|
42
31
|
}
|
|
43
32
|
/**
|
|
44
33
|
* A fleet version of [`k8sListItems`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slistitems) from
|
|
@@ -52,9 +41,7 @@ function fleetK8sList(options) {
|
|
|
52
41
|
* @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
|
|
53
42
|
* @returns A promise that resolves to the response
|
|
54
43
|
*/
|
|
55
|
-
function fleetK8sListItems(options) {
|
|
56
|
-
return
|
|
57
|
-
return fleetK8sList(options);
|
|
58
|
-
});
|
|
44
|
+
async function fleetK8sListItems(options) {
|
|
45
|
+
return fleetK8sList(options);
|
|
59
46
|
}
|
|
60
47
|
//# 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;AACI,KAAK,UAAU,YAAY,CAAmC,OAA4B;IAC/F,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;IAE/D,MAAM,KAAK,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;QACzC,CAAC,CAAE,IAAA,4BAAO,EAAC,qBAAqB,CAAkB;QAClD,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,CAChB,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACxB,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;YACxB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,GAAG,CAAC;SACL,CAAC,CAAC,CACJ,CAAA;IACL,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;AACvD,CAAC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,iBAAiB,CAAmC,OAA4B;IACpG,OAAO,YAAY,CAAC,OAAO,CAAC,CAAA;AAC9B,CAAC"}
|
package/lib/api/fleetK8sPatch.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.fleetK8sPatch = fleetK8sPatch;
|
|
13
4
|
const lodash_1 = require("lodash");
|
|
@@ -34,17 +25,15 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
34
25
|
* @returns A promise that resolves to the response of the resource patched.
|
|
35
26
|
* In case of failure promise gets rejected with HTTP error response.
|
|
36
27
|
*/
|
|
37
|
-
function fleetK8sPatch(options) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return Object.assign(Object.assign({}, (yield result)), { cluster });
|
|
48
|
-
});
|
|
28
|
+
async function fleetK8sPatch(options) {
|
|
29
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
30
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
31
|
+
const patches = (0, lodash_1.compact)(options.data);
|
|
32
|
+
const result = (await (0, isHubRequest_1.isHubRequest)(cluster))
|
|
33
|
+
? (0, dynamic_plugin_sdk_1.k8sPatch)(optionsWithoutCluster)
|
|
34
|
+
: (0, lodash_1.isEmpty)(patches)
|
|
35
|
+
? Promise.resolve(options.resource)
|
|
36
|
+
: dynamic_plugin_sdk_1.consoleFetchJSON.patch(await (0, apiRequests_1.getResourceURLFromOptions)(options), patches);
|
|
37
|
+
return { ...(await result), cluster };
|
|
49
38
|
}
|
|
50
39
|
//# 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;AACI,KAAK,UAAU,aAAa,CAAmC,OAAgC;IACpG,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;IAE/D,MAAM,OAAO,GAAG,IAAA,gBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAErC,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,IAAA,6BAAQ,EAAC,qBAAqB,CAAC;QACjC,CAAC,CAAC,IAAA,gBAAO,EAAC,OAAO,CAAC;YAChB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;YACnC,CAAC,CAAE,qCAAgB,CAAC,KAAK,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,OAAO,CAAgB,CAAA;IAC/F,OAAO,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;AACvC,CAAC"}
|
|
@@ -1,14 +1,5 @@
|
|
|
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
|
-
};
|
|
12
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
4
|
exports.fleetK8sUpdate = fleetK8sUpdate;
|
|
14
5
|
const apiRequests_1 = require("../internal/apiRequests");
|
|
@@ -34,14 +25,12 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
34
25
|
* @returns A promise that resolves to the response of the resource updated.
|
|
35
26
|
* In case of failure promise gets rejected with HTTP error response.
|
|
36
27
|
*/
|
|
37
|
-
function fleetK8sUpdate(options) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return Object.assign(Object.assign({}, (yield result)), { cluster });
|
|
45
|
-
});
|
|
28
|
+
async function fleetK8sUpdate(options) {
|
|
29
|
+
const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
|
|
30
|
+
const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
|
|
31
|
+
const result = (await (0, isHubRequest_1.isHubRequest)(cluster))
|
|
32
|
+
? (0, dynamic_plugin_sdk_1.k8sUpdate)(optionsWithoutCluster)
|
|
33
|
+
: dynamic_plugin_sdk_1.consoleFetchJSON.put(await (0, apiRequests_1.getResourceURLFromOptions)(options), optionsWithoutCluster.data);
|
|
34
|
+
return { ...(await result), cluster };
|
|
46
35
|
}
|
|
47
36
|
//# 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;AACI,KAAK,UAAU,cAAc,CAClC,OAAuC;IAEvC,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;IAE/D,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,IAAA,8BAAS,EAAC,qBAAqB,CAAC;QAClC,CAAC,CAAE,qCAAgB,CAAC,GAAG,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC,IAAI,CAAgB,CAAA;IAC9G,OAAO,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;AACvC,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.getFleetK8sAPIPath = void 0;
|
|
13
4
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
@@ -19,13 +10,13 @@ const isHubRequest_1 = require("../internal/isHubRequest");
|
|
|
19
10
|
* @param cluster - The cluster name.
|
|
20
11
|
* @returns The k8s API path for the fleet.
|
|
21
12
|
*/
|
|
22
|
-
const getFleetK8sAPIPath = (cluster) =>
|
|
23
|
-
if (
|
|
13
|
+
const getFleetK8sAPIPath = async (cluster) => {
|
|
14
|
+
if (await (0, isHubRequest_1.isHubRequest)(cluster)) {
|
|
24
15
|
return constants_1.BASE_K8S_API_PATH;
|
|
25
16
|
}
|
|
26
17
|
else {
|
|
27
18
|
return `${constants_1.BACKEND_URL}/${constants_1.MANAGED_CLUSTER_API_PATH}/${cluster}`;
|
|
28
19
|
}
|
|
29
|
-
}
|
|
20
|
+
};
|
|
30
21
|
exports.getFleetK8sAPIPath = getFleetK8sAPIPath;
|
|
31
22
|
//# 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,KAAK,EAAE,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;AANY,QAAA,kBAAkB,sBAM9B"}
|
|
@@ -28,8 +28,7 @@ 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
|
-
|
|
32
|
-
setAllowed((_b = (_a = result.status) === null || _a === void 0 ? void 0 : _a.allowed) !== null && _b !== void 0 ? _b : false);
|
|
31
|
+
setAllowed(result.status?.allowed ?? false);
|
|
33
32
|
setLoading(false);
|
|
34
33
|
})
|
|
35
34
|
.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,OAAO,CAAC;aACtE,IAAI,CAAC,CAAC,MAAmC,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"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AAC,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"}
|
|
@@ -1,15 +1,4 @@
|
|
|
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
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.useFleetK8sWatchResource = useFleetK8sWatchResource;
|
|
15
4
|
/* Copyright Contributors to the Open Cluster Management project */
|
|
@@ -75,7 +64,7 @@ function useFleetK8sWatchResource(initResource) {
|
|
|
75
64
|
const isFleetAvailable = (0, useIsFleetAvailable_1.useIsFleetAvailable)();
|
|
76
65
|
const [hubClusterName, hubClusterNameLoaded] = (0, useHubClusterName_1.useHubClusterName)();
|
|
77
66
|
const [memoizedResource, memoizedResourceChanged] = (0, useDeepCompareMemoize_1.useDeepCompareMemoize)(initResource, true);
|
|
78
|
-
const
|
|
67
|
+
const { cluster, ...resource } = memoizedResource ?? {};
|
|
79
68
|
const { groupVersionKind } = resource;
|
|
80
69
|
const [model, modelLoading] = (0, dynamic_plugin_sdk_1.useK8sModel)(groupVersionKind);
|
|
81
70
|
const [backendAPIPath, backendPathLoaded] = (0, useFleetK8sAPIPath_1.useFleetK8sAPIPath)(cluster);
|
|
@@ -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":";;AAwEA,4DAkDC;AA1HD,mEAAmE;AACnE,2DAAuD;AAOvD,8EAAwF;AACxF,+DAA2D;AAC3D,iCAAoD;AACpD,mFAA+E;AAC/E,6DAAyD;AACzD,6EAM0C;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;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,CAAC,GAAG,IAAA,6CAAqB,EAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAC7F,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,gBAAgB,IAAI,EAAE,CAAA;IACvD,MAAM,EAAE,gBAAgB,EAAE,GAAG,QAAQ,CAAA;IACrC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,GAAG,IAAA,gCAAW,EAAC,gBAAgB,CAAC,CAAA;IAC3D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,uCAAkB,EAAC,OAAO,CAAC,CAAA;IAEvE,MAAM,wBAAwB,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAA;IACnE,MAAM,oBAAoB,GA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,iCAAS,EAAC,gBAAgB,EAAE,WAAW,EAAE,cAAc,CAAC,CAAA;YAC5E,IAAA,kCAAU,EAAC,gBAAgB,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;YAEnD,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"}
|
|
@@ -10,15 +10,14 @@ 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;
|
|
14
13
|
if (watch.groupVersionKind) {
|
|
15
14
|
const { group, version, kind } = watch.groupVersionKind;
|
|
16
15
|
const reference = [group || 'core', version, kind].join('~');
|
|
17
|
-
return
|
|
16
|
+
return models[reference] ?? models[kind];
|
|
18
17
|
}
|
|
19
18
|
else if (watch.kind) {
|
|
20
|
-
const kind =
|
|
21
|
-
return
|
|
19
|
+
const kind = watch.kind?.split('~')?.[2];
|
|
20
|
+
return models[watch.kind] ?? models[kind];
|
|
22
21
|
}
|
|
23
22
|
return undefined;
|
|
24
23
|
}
|
|
@@ -74,7 +73,7 @@ function useFleetK8sWatchResources(initResources) {
|
|
|
74
73
|
const isFleetAvailable = (0, useIsFleetAvailable_1.useIsFleetAvailable)();
|
|
75
74
|
const [hubClusterName, hubClusterNameLoaded] = (0, useHubClusterName_1.useHubClusterName)();
|
|
76
75
|
const [memoizedResources, memoizedResourceChanged] = (0, useDeepCompareMemoize_1.useDeepCompareMemoize)(initResources, true);
|
|
77
|
-
const resources = memoizedResources
|
|
76
|
+
const resources = memoizedResources ?? {};
|
|
78
77
|
const [models, modelsLoading] = (0, dynamic_plugin_sdk_1.useK8sModels)();
|
|
79
78
|
const waitingForHubClusterName = Object.values(resources).some((watch) => !!watch.cluster) && !hubClusterNameLoaded;
|
|
80
79
|
const probablyHasFleetQueries = Object.values(resources).some((watch) => !!watch.cluster && watch.cluster !== hubClusterName);
|
|
@@ -104,7 +103,7 @@ function useFleetK8sWatchResources(initResources) {
|
|
|
104
103
|
watch,
|
|
105
104
|
model,
|
|
106
105
|
path,
|
|
107
|
-
(0, fleetK8sWatchResource_1.subscribe)(watch, requestPath, (newResult) => setFleetResult((result) => (
|
|
106
|
+
(0, fleetK8sWatchResource_1.subscribe)(watch, requestPath, (newResult) => setFleetResult((result) => ({ ...result, [key]: newResult }))),
|
|
108
107
|
]);
|
|
109
108
|
}
|
|
110
109
|
for (const [watch, model, path] of watches) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFleetK8sWatchResources.js","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResources.ts"],"names":[],"mappings":";;AA4EA,8DAyEC;AArJD,mEAAmE;AACnE,2DAAuD;AAEvD,8EAAuH;AACvH,+DAA2D;AAC3D,iCAA2C;AAC3C,mFAA+E;AAC/E,6EAM0C;AAC1C,uEAAmE;AAEnE,SAAS,gBAAgB,CAAC,KAA4B,EAAE,MAAmC
|
|
1
|
+
{"version":3,"file":"useFleetK8sWatchResources.js","sourceRoot":"","sources":["../../src/api/useFleetK8sWatchResources.ts"],"names":[],"mappings":";;AA4EA,8DAyEC;AArJD,mEAAmE;AACnE,2DAAuD;AAEvD,8EAAuH;AACvH,+DAA2D;AAC3D,iCAA2C;AAC3C,mFAA+E;AAC/E,6EAM0C;AAC1C,uEAAmE;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BAC/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"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Fleet } from '../types/fleet';
|
|
2
|
+
import { SearchInput } from '../types/search';
|
|
3
|
+
/**
|
|
4
|
+
* A React hook that provides fleet-wide search functionality using the ACM search API,
|
|
5
|
+
* with optional real-time updates via a GraphQL WebSocket subscription.
|
|
6
|
+
*
|
|
7
|
+
* When `subscriptionEnabled` is `false` (the default), the hook issues a one-shot
|
|
8
|
+
* GraphQL query and returns the results. When `subscriptionEnabled` is `true`, the
|
|
9
|
+
* hook additionally opens a WebSocket subscription and patches the locally-held
|
|
10
|
+
* results as INSERT, UPDATE, and DELETE events arrive — keeping the data always
|
|
11
|
+
* up to date without polling.
|
|
12
|
+
*
|
|
13
|
+
* Pagination is supported by setting `limit` and `offset` on the `SearchInput`
|
|
14
|
+
* object. The caller is responsible for constructing those values.
|
|
15
|
+
*
|
|
16
|
+
* @param input - The search input object (filters, keywords, limit, offset, etc.).
|
|
17
|
+
* Pass `undefined` to skip the query entirely.
|
|
18
|
+
* @param subscriptionEnabled - When `true`, a WebSocket subscription is opened
|
|
19
|
+
* and the local result set is kept current via incremental event patches.
|
|
20
|
+
* Defaults to `false`.
|
|
21
|
+
*
|
|
22
|
+
* @returns A tuple of:
|
|
23
|
+
* - `data` — The current search results mapped through
|
|
24
|
+
* {@link convertSearchItemToResource}, or `undefined` before the first
|
|
25
|
+
* response arrives.
|
|
26
|
+
* - `loaded` — `true` once the initial query has completed (regardless of
|
|
27
|
+
* whether the subscription is active).
|
|
28
|
+
* - `error` — Any query or subscription error, or `undefined` on success.
|
|
29
|
+
* - `refetch` — A stable callback that re-executes the base query and resets
|
|
30
|
+
* the local state to the fresh result.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Basic query — no real-time updates
|
|
35
|
+
* const [resources, loaded, error, refetch] = useFleetSearch({
|
|
36
|
+
* filters: [
|
|
37
|
+
* { property: 'kind', values: ['Pod'] },
|
|
38
|
+
* { property: 'namespace', values: ['default'] },
|
|
39
|
+
* ],
|
|
40
|
+
* limit: 100,
|
|
41
|
+
* })
|
|
42
|
+
*
|
|
43
|
+
* // With real-time subscription — results update automatically
|
|
44
|
+
* const [resources, loaded, error, refetch] = useFleetSearch(
|
|
45
|
+
* {
|
|
46
|
+
* filters: [
|
|
47
|
+
* { property: 'kind', values: ['Pod'] },
|
|
48
|
+
* { property: 'namespace', values: ['default'] },
|
|
49
|
+
* ],
|
|
50
|
+
* },
|
|
51
|
+
* true,
|
|
52
|
+
* )
|
|
53
|
+
*
|
|
54
|
+
* // With subscription enabled and pagination/ordering — page 2 of 20 results sorted by name
|
|
55
|
+
* const PAGE_SIZE = 20
|
|
56
|
+
* const [page, setPage] = useState(1)
|
|
57
|
+
* const [resources, loaded, error, refetch] = useFleetSearch(
|
|
58
|
+
* {
|
|
59
|
+
* filters: [
|
|
60
|
+
* { property: 'kind', values: ['Pod'] },
|
|
61
|
+
* { property: 'namespace', values: ['default'] },
|
|
62
|
+
* ],
|
|
63
|
+
* limit: PAGE_SIZE,
|
|
64
|
+
* offset: (page - 1) * PAGE_SIZE,
|
|
65
|
+
* orderBy: 'name asc',
|
|
66
|
+
* },
|
|
67
|
+
* true,
|
|
68
|
+
* )
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function useFleetSearch<T extends K8sResourceCommon = K8sResourceCommon>(input: SearchInput | undefined, subscriptionEnabled?: boolean): [Fleet<T>[] | undefined, boolean, Error | undefined, () => void];
|
|
72
|
+
//# sourceMappingURL=useFleetSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFleetSearch.d.ts","sourceRoot":"","sources":["../../src/api/useFleetSearch.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAsK7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,EAC5E,KAAK,EAAE,WAAW,GAAG,SAAS,EAC9B,mBAAmB,CAAC,EAAE,OAAO,GAC5B,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE,KAAK,GAAG,SAAS,EAAE,MAAM,IAAI,CAAC,CA4KlE"}
|