@stolostron/multicluster-sdk 0.8.1 → 0.9.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 CHANGED
@@ -51,6 +51,8 @@ Setup depends on your usage scenarios.
51
51
  - [getFleetK8sAPIPath](#gear-getfleetk8sapipath)
52
52
  - [useFleetAccessReview](#gear-usefleetaccessreview)
53
53
  - [useFleetClusterNames](#gear-usefleetclusternames)
54
+ - [useFleetClusterSetNames](#gear-usefleetclustersetnames)
55
+ - [useFleetClusterSets](#gear-usefleetclustersets)
54
56
  - [useFleetK8sAPIPath](#gear-usefleetk8sapipath)
55
57
  - [useFleetK8sWatchResource](#gear-usefleetk8swatchresource)
56
58
  - [useFleetK8sWatchResources](#gear-usefleetk8swatchresources)
@@ -449,7 +451,7 @@ the condition `ManagedClusterConditionAvailable` with status `True`.
449
451
 
450
452
  | Function | Type |
451
453
  | ---------- | ---------- |
452
- | `useFleetClusterNames` | `(returnAllClusters?: boolean) => [string[], boolean, any]` |
454
+ | `useFleetClusterNames` | `(returnAllClusters?: boolean or undefined) => [string[], boolean, any]` |
453
455
 
454
456
  Parameters:
455
457
 
@@ -497,7 +499,136 @@ return (
497
499
  ```
498
500
 
499
501
 
500
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetClusterNames.ts#L56)
502
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetClusterNames.ts#L51)
503
+
504
+ ### :gear: useFleetClusterSetNames
505
+
506
+ Hook that returns unique cluster set names from managed clusters with optional filtering by cluster proxy addon and availability status.
507
+
508
+ This hook watches ManagedCluster resources and by default filters them to only include clusters
509
+ that have both the label `feature.open-cluster-management.io/addon-cluster-proxy: available` AND
510
+ the condition `ManagedClusterConditionAvailable` with status `True`. It then collects unique
511
+ values from the `cluster.open-cluster-management.io/clusterset` label.
512
+
513
+ | Function | Type |
514
+ | ---------- | ---------- |
515
+ | `useFleetClusterSetNames` | `(considerAllClusters?: boolean) => [string[], boolean, any]` |
516
+
517
+ Parameters:
518
+
519
+ * `considerAllClusters`: - Optional boolean to consider all clusters regardless of labels and conditions.
520
+ Defaults to false. When false (default), only considers clusters with the
521
+ 'feature.open-cluster-management.io/addon-cluster-proxy: available' label AND
522
+ 'ManagedClusterConditionAvailable' status: 'True'.
523
+ When true, considers all clusters regardless of labels and conditions.
524
+
525
+
526
+ Returns:
527
+
528
+ A tuple containing:
529
+ - clusterSets: Array of unique cluster set names from the clusterset labels
530
+ - loaded: Boolean indicating if the resource watch has loaded
531
+ - error: Any error that occurred during the watch operation
532
+
533
+ Examples:
534
+
535
+ ```tsx
536
+ // Get cluster sets from only clusters with cluster proxy addon available AND ManagedClusterConditionAvailable: 'True' (default behavior)
537
+ const [availableClusterSets, loaded, error] = useFleetClusterSetNames()
538
+
539
+ // Get cluster sets from all clusters regardless of labels and conditions
540
+ const [allClusterSets, loaded, error] = useFleetClusterSetNames(true)
541
+
542
+ // Explicitly filter by cluster proxy addon and availability (same as default)
543
+ const [filteredClusterSets, loaded, error] = useFleetClusterSetNames(false)
544
+
545
+ if (!loaded) {
546
+ return <Loading />
547
+ }
548
+
549
+ if (error) {
550
+ return <ErrorState error={error} />
551
+ }
552
+
553
+ return (
554
+ <div>
555
+ {availableClusterSets.map(setName => (
556
+ <div key={setName}>{setName}</div>
557
+ ))}
558
+ </div>
559
+ )
560
+ ```
561
+
562
+
563
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetClusterSetNames.ts#L53)
564
+
565
+ ### :gear: useFleetClusterSets
566
+
567
+ Hook that returns cluster names organized by cluster sets with optional filtering.
568
+
569
+ This hook watches ManagedCluster resources and by default filters them to only include clusters
570
+ that have both the label `feature.open-cluster-management.io/addon-cluster-proxy: available` AND
571
+ the condition `ManagedClusterConditionAvailable` with status `True`. It then organizes cluster
572
+ names by their cluster set labels.
573
+
574
+ | Function | Type |
575
+ | ---------- | ---------- |
576
+ | `useFleetClusterSets` | `(options?: FleetClusterNamesOptions) => [ClusterSetData, boolean, any]` |
577
+
578
+ Parameters:
579
+
580
+ * `options`: - Configuration object for cluster set organization
581
+ * `options.returnAllClusters`: - Whether to return all clusters regardless of availability status. Defaults to false.
582
+ * `options.clusterSets`: - Specific cluster set names to include. If not specified, includes all cluster sets.
583
+ * `options.includeGlobal`: - Whether to include a special "global" set containing all clusters. Defaults to false.
584
+
585
+
586
+ Returns:
587
+
588
+ A tuple containing:
589
+ - clusterSetData: ClusterSetData object organized by cluster sets
590
+ - loaded: Boolean indicating if the resource watch has loaded
591
+ - error: Any error that occurred during the watch operation
592
+
593
+ Examples:
594
+
595
+ ```tsx
596
+ // Get clusters organized by cluster sets (default behavior)
597
+ const [clusterSetData, loaded, error] = useFleetClusterSets({})
598
+
599
+ // Include global set with all clusters
600
+ const [clusterSetsWithGlobal, loaded, error] = useFleetClusterSets({
601
+ includeGlobal: true
602
+ })
603
+
604
+ // Filter to specific cluster sets
605
+ const [productionAndStaging, loaded, error] = useFleetClusterSets({
606
+ clusterSets: ['production', 'staging']
607
+ })
608
+
609
+ if (!loaded) return <Loading />
610
+ if (error) return <ErrorState error={error} />
611
+
612
+ return (
613
+ <div>
614
+ {clusterSetData.global && (
615
+ <div>
616
+ <h3>All Clusters</h3>
617
+ {clusterSetData.global.map(name => <div key={name}>{name}</div>)}
618
+ </div>
619
+ )}
620
+ {Object.entries(clusterSetData).filter(([setName]) => setName !== 'global').map(([setName, clusters]) => (
621
+ <div key={setName}>
622
+ <h3>{setName}</h3>
623
+ {clusters.map(name => <div key={name}>{name}</div>)}
624
+ </div>
625
+ ))}
626
+ </div>
627
+ )
628
+ ```
629
+
630
+
631
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetClusterSets.ts#L60)
501
632
 
502
633
  ### :gear: useFleetK8sAPIPath
503
634
 
@@ -882,8 +1013,10 @@ if (error) {
882
1013
  ## :cocktail: Types
883
1014
 
884
1015
  - [AdvancedSearchFilter](#gear-advancedsearchfilter)
1016
+ - [ClusterSetData](#gear-clustersetdata)
885
1017
  - [Fleet](#gear-fleet)
886
1018
  - [FleetAccessReviewResourceAttributes](#gear-fleetaccessreviewresourceattributes)
1019
+ - [FleetClusterNamesOptions](#gear-fleetclusternamesoptions)
887
1020
  - [FleetK8sCreateUpdateOptions](#gear-fleetk8screateupdateoptions)
888
1021
  - [FleetK8sDeleteOptions](#gear-fleetk8sdeleteoptions)
889
1022
  - [FleetK8sGetOptions](#gear-fleetk8sgetoptions)
@@ -911,6 +1044,19 @@ if (error) {
911
1044
 
912
1045
  [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/search.ts#L9)
913
1046
 
1047
+ ### :gear: ClusterSetData
1048
+
1049
+ Structured data containing cluster names organized by cluster sets.
1050
+
1051
+ Clusters without an explicit cluster set label are automatically assigned to the "default" cluster set.
1052
+ The "global" key is a special set that contains all clusters (when includeGlobal is true).
1053
+
1054
+ | Type | Type |
1055
+ | ---------- | ---------- |
1056
+ | `ClusterSetData` | `Record<string, string[]>` |
1057
+
1058
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L96)
1059
+
914
1060
  ### :gear: Fleet
915
1061
 
916
1062
  | Type | Type |
@@ -927,6 +1073,16 @@ if (error) {
927
1073
 
928
1074
  [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L36)
929
1075
 
1076
+ ### :gear: FleetClusterNamesOptions
1077
+
1078
+ Options for advanced cluster name retrieval with cluster set organization.
1079
+
1080
+ | Type | Type |
1081
+ | ---------- | ---------- |
1082
+ | `FleetClusterNamesOptions` | `{ /** Whether to return all clusters regardless of availability status. Defaults to false. */ returnAllClusters?: boolean /** Specific cluster set names to include. If not specified, includes all cluster sets including "default". Should not include "global" - use includeGlobal instead. */ clusterSets?: string[] /** Whether to include a special "global" set containing all clusters. Defaults to false. */ includeGlobal?: boolean }` |
1083
+
1084
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L101)
1085
+
930
1086
  ### :gear: FleetK8sCreateUpdateOptions
931
1087
 
932
1088
  | Type | Type |
@@ -7,6 +7,8 @@ export * from './fleetK8sPatch';
7
7
  export * from './fleetK8sUpdate';
8
8
  export * from './useFleetAccessReview';
9
9
  export * from './useFleetClusterNames';
10
+ export * from './useFleetClusterSets';
11
+ export * from './useFleetClusterSetNames';
10
12
  export * from './useFleetK8sAPIPath';
11
13
  export * from './useFleetK8sWatchResource';
12
14
  export * from './useFleetK8sWatchResources';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oCAAoC,CAAA;AAClD,cAAc,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oCAAoC,CAAA;AAClD,cAAc,sBAAsB,CAAA"}
package/lib/api/index.js CHANGED
@@ -24,6 +24,8 @@ __exportStar(require("./fleetK8sPatch"), exports);
24
24
  __exportStar(require("./fleetK8sUpdate"), exports);
25
25
  __exportStar(require("./useFleetAccessReview"), exports);
26
26
  __exportStar(require("./useFleetClusterNames"), exports);
27
+ __exportStar(require("./useFleetClusterSets"), exports);
28
+ __exportStar(require("./useFleetClusterSetNames"), exports);
27
29
  __exportStar(require("./useFleetK8sAPIPath"), exports);
28
30
  __exportStar(require("./useFleetK8sWatchResource"), exports);
29
31
  __exportStar(require("./useFleetK8sWatchResources"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,8CAA2B;AAC3B,mDAAgC;AAChC,mDAAgC;AAChC,gDAA6B;AAC7B,iDAA8B;AAC9B,kDAA+B;AAC/B,mDAAgC;AAChC,yDAAsC;AACtC,yDAAsC;AACtC,uDAAoC;AACpC,6DAA0C;AAC1C,8DAA2C;AAC3C,2DAAwC;AACxC,uDAAoC;AACpC,sDAAmC;AACnC,wDAAqC;AACrC,qEAAkD;AAClD,uDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,8CAA2B;AAC3B,mDAAgC;AAChC,mDAAgC;AAChC,gDAA6B;AAC7B,iDAA8B;AAC9B,kDAA+B;AAC/B,mDAAgC;AAChC,yDAAsC;AACtC,yDAAsC;AACtC,wDAAqC;AACrC,4DAAyC;AACzC,uDAAoC;AACpC,6DAA0C;AAC1C,8DAA2C;AAC3C,2DAAwC;AACxC,uDAAoC;AACpC,sDAAmC;AACnC,wDAAqC;AACrC,qEAAkD;AAClD,uDAAoC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useFleetClusterNames.d.ts","sourceRoot":"","sources":["../../src/api/useFleetClusterNames.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,oBAAoB,CAAC,iBAAiB,GAAE,OAAe,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,CAyBjG"}
1
+ {"version":3,"file":"useFleetClusterNames.d.ts","sourceRoot":"","sources":["../../src/api/useFleetClusterNames.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,CAQ1F"}
@@ -2,10 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useFleetClusterNames = useFleetClusterNames;
4
4
  /* Copyright Contributors to the Open Cluster Management project */
5
- const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
6
- const models_1 = require("../internal/models");
7
- // Helper function to check for condition - similar to checkForCondition from status-conditions.ts
8
- const checkForCondition = (condition, conditions, status) => { var _a; return ((_a = conditions === null || conditions === void 0 ? void 0 : conditions.find((c) => c.type === condition)) === null || _a === void 0 ? void 0 : _a.status) === (status !== null && status !== void 0 ? status : 'True'); };
5
+ const react_1 = require("react");
6
+ const useFleetClustersInternal_1 = require("../internal/useFleetClustersInternal");
9
7
  /**
10
8
  * Hook that returns names of managed clusters with optional filtering by cluster proxy addon and availability status.
11
9
  *
@@ -52,25 +50,11 @@ const checkForCondition = (condition, conditions, status) => { var _a; return ((
52
50
  * )
53
51
  * ```
54
52
  */
55
- function useFleetClusterNames(returnAllClusters = false) {
56
- const [clusters, loaded, error] = (0, dynamic_plugin_sdk_1.useK8sWatchResource)({
57
- groupVersionKind: models_1.ManagedClusterListGroupVersionKind,
58
- isList: true,
59
- });
60
- const clusterNames = clusters.flatMap((cluster) => {
61
- var _a, _b, _c, _d;
62
- if (!((_a = cluster.metadata) === null || _a === void 0 ? void 0 : _a.name)) {
63
- return [];
64
- }
65
- if (returnAllClusters) {
66
- return [cluster.metadata.name];
67
- }
68
- const hasClusterProxyLabel = ((_c = (_b = cluster.metadata) === null || _b === void 0 ? void 0 : _b.labels) === null || _c === void 0 ? void 0 : _c['feature.open-cluster-management.io/addon-cluster-proxy']) === 'available';
69
- // Check if cluster has ManagedClusterConditionAvailable status: 'True'
70
- const conditions = ((_d = cluster === null || cluster === void 0 ? void 0 : cluster.status) === null || _d === void 0 ? void 0 : _d.conditions) || [];
71
- const isClusterAvailable = checkForCondition('ManagedClusterConditionAvailable', conditions);
72
- return hasClusterProxyLabel && isClusterAvailable ? [cluster.metadata.name] : [];
73
- });
74
- return [clusterNames, loaded, error];
53
+ function useFleetClusterNames(returnAllClusters) {
54
+ const [filteredClusters, loaded, error] = (0, useFleetClustersInternal_1.useFleetClustersInternal)({ returnAllClusters });
55
+ const result = (0, react_1.useMemo)(() => {
56
+ return filteredClusters.map((cluster) => cluster.metadata.name);
57
+ }, [filteredClusters]);
58
+ return [result, loaded, error];
75
59
  }
76
60
  //# sourceMappingURL=useFleetClusterNames.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFleetClusterNames.js","sourceRoot":"","sources":["../../src/api/useFleetClusterNames.ts"],"names":[],"mappings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AkC,EAAE,UAAU,CAAC,CAAA;QAE5F,OAAO,oBAAoB,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAClF,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AACtC,CAAC"}
1
+ {"version":3,"file":"useFleetClusterNames.js","sourceRoot":"","sources":["../../src/api/useFleetClusterNames.ts"],"names":[],"mappings":";;AAkDA,oDAQC;AA1DD,mEAAmE;AACnE,iCAA+B;AAC/B,mFAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,SAAgB,oBAAoB,CAAC,iBAA2B;IAC9D,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,IAAA,mDAAwB,EAAC,EAAE,iBAAiB,EAAE,CAAC,CAAA;IAEzF,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC1B,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAS,CAAC,IAAK,CAAC,CAAA;IACnE,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAA;IAEtB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAChC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Hook that returns unique cluster set names from managed clusters with optional filtering by cluster proxy addon and availability status.
3
+ *
4
+ * This hook watches ManagedCluster resources and by default filters them to only include clusters
5
+ * that have both the label `feature.open-cluster-management.io/addon-cluster-proxy: available` AND
6
+ * the condition `ManagedClusterConditionAvailable` with status `True`. It then collects unique
7
+ * values from the `cluster.open-cluster-management.io/clusterset` label.
8
+ *
9
+ * @param considerAllClusters - Optional boolean to consider all clusters regardless of labels and conditions.
10
+ * Defaults to false. When false (default), only considers clusters with the
11
+ * 'feature.open-cluster-management.io/addon-cluster-proxy: available' label AND
12
+ * 'ManagedClusterConditionAvailable' status: 'True'.
13
+ * When true, considers all clusters regardless of labels and conditions.
14
+ *
15
+ * @returns A tuple containing:
16
+ * - clusterSets: Array of unique cluster set names from the clusterset labels
17
+ * - loaded: Boolean indicating if the resource watch has loaded
18
+ * - error: Any error that occurred during the watch operation
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * // Get cluster sets from only clusters with cluster proxy addon available AND ManagedClusterConditionAvailable: 'True' (default behavior)
23
+ * const [availableClusterSets, loaded, error] = useFleetClusterSetNames()
24
+ *
25
+ * // Get cluster sets from all clusters regardless of labels and conditions
26
+ * const [allClusterSets, loaded, error] = useFleetClusterSetNames(true)
27
+ *
28
+ * // Explicitly filter by cluster proxy addon and availability (same as default)
29
+ * const [filteredClusterSets, loaded, error] = useFleetClusterSetNames(false)
30
+ *
31
+ * if (!loaded) {
32
+ * return <Loading />
33
+ * }
34
+ *
35
+ * if (error) {
36
+ * return <ErrorState error={error} />
37
+ * }
38
+ *
39
+ * return (
40
+ * <div>
41
+ * {availableClusterSets.map(setName => (
42
+ * <div key={setName}>{setName}</div>
43
+ * ))}
44
+ * </div>
45
+ * )
46
+ * ```
47
+ */
48
+ export declare function useFleetClusterSetNames(considerAllClusters?: boolean): [string[], boolean, any];
49
+ //# sourceMappingURL=useFleetClusterSetNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFleetClusterSetNames.d.ts","sourceRoot":"","sources":["../../src/api/useFleetClusterSetNames.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,uBAAuB,CAAC,mBAAmB,GAAE,OAAe,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,CAatG"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useFleetClusterSetNames = useFleetClusterSetNames;
4
+ /* Copyright Contributors to the Open Cluster Management project */
5
+ const react_1 = require("react");
6
+ const useFleetClustersInternal_1 = require("../internal/useFleetClustersInternal");
7
+ const clusterUtils_1 = require("../internal/clusterUtils");
8
+ /**
9
+ * Hook that returns unique cluster set names from managed clusters with optional filtering by cluster proxy addon and availability status.
10
+ *
11
+ * This hook watches ManagedCluster resources and by default filters them to only include clusters
12
+ * that have both the label `feature.open-cluster-management.io/addon-cluster-proxy: available` AND
13
+ * the condition `ManagedClusterConditionAvailable` with status `True`. It then collects unique
14
+ * values from the `cluster.open-cluster-management.io/clusterset` label.
15
+ *
16
+ * @param considerAllClusters - Optional boolean to consider all clusters regardless of labels and conditions.
17
+ * Defaults to false. When false (default), only considers clusters with the
18
+ * 'feature.open-cluster-management.io/addon-cluster-proxy: available' label AND
19
+ * 'ManagedClusterConditionAvailable' status: 'True'.
20
+ * When true, considers all clusters regardless of labels and conditions.
21
+ *
22
+ * @returns A tuple containing:
23
+ * - clusterSets: Array of unique cluster set names from the clusterset labels
24
+ * - loaded: Boolean indicating if the resource watch has loaded
25
+ * - error: Any error that occurred during the watch operation
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * // Get cluster sets from only clusters with cluster proxy addon available AND ManagedClusterConditionAvailable: 'True' (default behavior)
30
+ * const [availableClusterSets, loaded, error] = useFleetClusterSetNames()
31
+ *
32
+ * // Get cluster sets from all clusters regardless of labels and conditions
33
+ * const [allClusterSets, loaded, error] = useFleetClusterSetNames(true)
34
+ *
35
+ * // Explicitly filter by cluster proxy addon and availability (same as default)
36
+ * const [filteredClusterSets, loaded, error] = useFleetClusterSetNames(false)
37
+ *
38
+ * if (!loaded) {
39
+ * return <Loading />
40
+ * }
41
+ *
42
+ * if (error) {
43
+ * return <ErrorState error={error} />
44
+ * }
45
+ *
46
+ * return (
47
+ * <div>
48
+ * {availableClusterSets.map(setName => (
49
+ * <div key={setName}>{setName}</div>
50
+ * ))}
51
+ * </div>
52
+ * )
53
+ * ```
54
+ */
55
+ function useFleetClusterSetNames(considerAllClusters = false) {
56
+ const [filteredClusters, loaded, error] = (0, useFleetClustersInternal_1.useFleetClustersInternal)({
57
+ returnAllClusters: considerAllClusters,
58
+ });
59
+ const uniqueClusterSets = (0, react_1.useMemo)(() => {
60
+ const clusterSetNames = filteredClusters.map(clusterUtils_1.getClusterSetName);
61
+ // Return unique cluster set names
62
+ return Array.from(new Set(clusterSetNames));
63
+ }, [filteredClusters]);
64
+ return [uniqueClusterSets, loaded, error];
65
+ }
66
+ //# sourceMappingURL=useFleetClusterSetNames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFleetClusterSetNames.js","sourceRoot":"","sources":["../../src/api/useFleetClusterSetNames.ts"],"names":[],"mappings":";;AAoDA,0DAaC;AAjED,mEAAmE;AACnE,iCAA+B;AAC/B,mFAA+E;AAC/E,2DAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,SAAgB,uBAAuB,CAAC,sBAA+B,KAAK;IAC1E,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,IAAA,mDAAwB,EAAC;QACjE,iBAAiB,EAAE,mBAAmB;KACvC,CAAC,CAAA;IAEF,MAAM,iBAAiB,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACrC,MAAM,eAAe,GAAG,gBAAgB,CAAC,GAAG,CAAC,gCAAiB,CAAC,CAAA;QAE/D,kCAAkC;QAClC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC,CAAA;IAC7C,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAA;IAEtB,OAAO,CAAC,iBAAiB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { FleetClusterNamesOptions, ClusterSetData } from '../types/fleet';
2
+ /**
3
+ * Hook that returns cluster names organized by cluster sets with optional filtering.
4
+ *
5
+ * This hook watches ManagedCluster resources and by default filters them to only include clusters
6
+ * that have both the label `feature.open-cluster-management.io/addon-cluster-proxy: available` AND
7
+ * the condition `ManagedClusterConditionAvailable` with status `True`. It then organizes cluster
8
+ * names by their cluster set labels.
9
+ *
10
+ * @param options - Configuration object for cluster set organization
11
+ * @param options.returnAllClusters - Whether to return all clusters regardless of availability status. Defaults to false.
12
+ * @param options.clusterSets - Specific cluster set names to include. If not specified, includes all cluster sets.
13
+ * @param options.includeGlobal - Whether to include a special "global" set containing all clusters. Defaults to false.
14
+ *
15
+ * @returns A tuple containing:
16
+ * - clusterSetData: ClusterSetData object organized by cluster sets
17
+ * - loaded: Boolean indicating if the resource watch has loaded
18
+ * - error: Any error that occurred during the watch operation
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * // Get clusters organized by cluster sets (default behavior)
23
+ * const [clusterSetData, loaded, error] = useFleetClusterSets({})
24
+ *
25
+ * // Include global set with all clusters
26
+ * const [clusterSetsWithGlobal, loaded, error] = useFleetClusterSets({
27
+ * includeGlobal: true
28
+ * })
29
+ *
30
+ * // Filter to specific cluster sets
31
+ * const [productionAndStaging, loaded, error] = useFleetClusterSets({
32
+ * clusterSets: ['production', 'staging']
33
+ * })
34
+ *
35
+ * if (!loaded) return <Loading />
36
+ * if (error) return <ErrorState error={error} />
37
+ *
38
+ * return (
39
+ * <div>
40
+ * {clusterSetData.global && (
41
+ * <div>
42
+ * <h3>All Clusters</h3>
43
+ * {clusterSetData.global.map(name => <div key={name}>{name}</div>)}
44
+ * </div>
45
+ * )}
46
+ * {Object.entries(clusterSetData).filter(([setName]) => setName !== 'global').map(([setName, clusters]) => (
47
+ * <div key={setName}>
48
+ * <h3>{setName}</h3>
49
+ * {clusters.map(name => <div key={name}>{name}</div>)}
50
+ * </div>
51
+ * ))}
52
+ * </div>
53
+ * )
54
+ * ```
55
+ */
56
+ export declare function useFleetClusterSets(options?: FleetClusterNamesOptions): [ClusterSetData, boolean, any];
57
+ //# sourceMappingURL=useFleetClusterSets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFleetClusterSets.d.ts","sourceRoot":"","sources":["../../src/api/useFleetClusterSets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAGzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,wBAA6B,GAAG,CAAC,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,CAQ1G"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useFleetClusterSets = useFleetClusterSets;
4
+ /* Copyright Contributors to the Open Cluster Management project */
5
+ const react_1 = require("react");
6
+ const useFleetClustersInternal_1 = require("../internal/useFleetClustersInternal");
7
+ /**
8
+ * Hook that returns cluster names organized by cluster sets with optional filtering.
9
+ *
10
+ * This hook watches ManagedCluster resources and by default filters them to only include clusters
11
+ * that have both the label `feature.open-cluster-management.io/addon-cluster-proxy: available` AND
12
+ * the condition `ManagedClusterConditionAvailable` with status `True`. It then organizes cluster
13
+ * names by their cluster set labels.
14
+ *
15
+ * @param options - Configuration object for cluster set organization
16
+ * @param options.returnAllClusters - Whether to return all clusters regardless of availability status. Defaults to false.
17
+ * @param options.clusterSets - Specific cluster set names to include. If not specified, includes all cluster sets.
18
+ * @param options.includeGlobal - Whether to include a special "global" set containing all clusters. Defaults to false.
19
+ *
20
+ * @returns A tuple containing:
21
+ * - clusterSetData: ClusterSetData object organized by cluster sets
22
+ * - loaded: Boolean indicating if the resource watch has loaded
23
+ * - error: Any error that occurred during the watch operation
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * // Get clusters organized by cluster sets (default behavior)
28
+ * const [clusterSetData, loaded, error] = useFleetClusterSets({})
29
+ *
30
+ * // Include global set with all clusters
31
+ * const [clusterSetsWithGlobal, loaded, error] = useFleetClusterSets({
32
+ * includeGlobal: true
33
+ * })
34
+ *
35
+ * // Filter to specific cluster sets
36
+ * const [productionAndStaging, loaded, error] = useFleetClusterSets({
37
+ * clusterSets: ['production', 'staging']
38
+ * })
39
+ *
40
+ * if (!loaded) return <Loading />
41
+ * if (error) return <ErrorState error={error} />
42
+ *
43
+ * return (
44
+ * <div>
45
+ * {clusterSetData.global && (
46
+ * <div>
47
+ * <h3>All Clusters</h3>
48
+ * {clusterSetData.global.map(name => <div key={name}>{name}</div>)}
49
+ * </div>
50
+ * )}
51
+ * {Object.entries(clusterSetData).filter(([setName]) => setName !== 'global').map(([setName, clusters]) => (
52
+ * <div key={setName}>
53
+ * <h3>{setName}</h3>
54
+ * {clusters.map(name => <div key={name}>{name}</div>)}
55
+ * </div>
56
+ * ))}
57
+ * </div>
58
+ * )
59
+ * ```
60
+ */
61
+ function useFleetClusterSets(options = {}) {
62
+ const [filteredClusters, loaded, error] = (0, useFleetClustersInternal_1.useFleetClustersInternal)(options);
63
+ const result = (0, react_1.useMemo)(() => {
64
+ return (0, useFleetClustersInternal_1.organizeClustersBySet)(filteredClusters, options);
65
+ }, [filteredClusters, options]);
66
+ return [result, loaded, error];
67
+ }
68
+ //# sourceMappingURL=useFleetClusterSets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFleetClusterSets.js","sourceRoot":"","sources":["../../src/api/useFleetClusterSets.ts"],"names":[],"mappings":";;AA2DA,kDAQC;AAnED,mEAAmE;AACnE,iCAA+B;AAE/B,mFAAsG;AAEtG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,SAAgB,mBAAmB,CAAC,UAAoC,EAAE;IACxE,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,IAAA,mDAAwB,EAAC,OAAO,CAAC,CAAA;IAE3E,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC1B,OAAO,IAAA,gDAAqB,EAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IACzD,CAAC,EAAE,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAA;IAE/B,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAChC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { K8sResourceCommon } from '@openshift-console/dynamic-plugin-sdk';
2
+ import { V1CustomResourceDefinitionCondition } from '@kubernetes/client-node';
3
+ /**
4
+ * Helper function to check for condition - similar to checkForCondition from status-conditions.ts
5
+ */
6
+ export declare const checkForCondition: (condition: string, conditions: V1CustomResourceDefinitionCondition[], status?: string) => boolean;
7
+ /**
8
+ * Checks if a managed cluster meets the default filtering criteria:
9
+ * - Has the cluster proxy addon available label
10
+ * - Has ManagedClusterConditionAvailable status: 'True'
11
+ */
12
+ export declare const isClusterAvailable: (cluster: K8sResourceCommon) => boolean;
13
+ /**
14
+ * Gets the cluster set name from a ManagedCluster resource.
15
+ * Returns the cluster set label value or 'default' if not present.
16
+ */
17
+ export declare const getClusterSetName: (cluster: K8sResourceCommon) => string;
18
+ /**
19
+ * Filters clusters based on the provided criteria.
20
+ * When includeAll is false, only returns clusters that meet the default availability criteria.
21
+ * When includeAll is true, returns all clusters that have a name.
22
+ */
23
+ export declare const filterClusters: (clusters: K8sResourceCommon[], includeAll: boolean) => K8sResourceCommon[];
24
+ //# sourceMappingURL=clusterUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clusterUtils.d.ts","sourceRoot":"","sources":["../../src/internal/clusterUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAA;AAE7E;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,WAAW,MAAM,EACjB,YAAY,mCAAmC,EAAE,EACjD,SAAS,MAAM,YACgE,CAAA;AAEjF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,iBAAiB,KAAG,OAQ/D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,iBAAiB,KAAG,MAE9D,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,iBAAiB,EAAE,EAAE,YAAY,OAAO,KAAG,iBAAiB,EAQpG,CAAA"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterClusters = exports.getClusterSetName = exports.isClusterAvailable = exports.checkForCondition = void 0;
4
+ /**
5
+ * Helper function to check for condition - similar to checkForCondition from status-conditions.ts
6
+ */
7
+ const checkForCondition = (condition, conditions, status) => { var _a; return ((_a = conditions === null || conditions === void 0 ? void 0 : conditions.find((c) => c.type === condition)) === null || _a === void 0 ? void 0 : _a.status) === (status !== null && status !== void 0 ? status : 'True'); };
8
+ exports.checkForCondition = checkForCondition;
9
+ /**
10
+ * Checks if a managed cluster meets the default filtering criteria:
11
+ * - Has the cluster proxy addon available label
12
+ * - Has ManagedClusterConditionAvailable status: 'True'
13
+ */
14
+ const isClusterAvailable = (cluster) => {
15
+ var _a, _b, _c;
16
+ const hasClusterProxyLabel = ((_b = (_a = cluster.metadata) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b['feature.open-cluster-management.io/addon-cluster-proxy']) === 'available';
17
+ const conditions = ((_c = cluster === null || cluster === void 0 ? void 0 : cluster.status) === null || _c === void 0 ? void 0 : _c.conditions) || [];
18
+ const isAvailable = (0, exports.checkForCondition)('ManagedClusterConditionAvailable', conditions);
19
+ return hasClusterProxyLabel && isAvailable;
20
+ };
21
+ exports.isClusterAvailable = isClusterAvailable;
22
+ /**
23
+ * Gets the cluster set name from a ManagedCluster resource.
24
+ * Returns the cluster set label value or 'default' if not present.
25
+ */
26
+ const getClusterSetName = (cluster) => {
27
+ var _a, _b;
28
+ return ((_b = (_a = cluster.metadata) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b['cluster.open-cluster-management.io/clusterset']) || 'default';
29
+ };
30
+ exports.getClusterSetName = getClusterSetName;
31
+ /**
32
+ * Filters clusters based on the provided criteria.
33
+ * When includeAll is false, only returns clusters that meet the default availability criteria.
34
+ * When includeAll is true, returns all clusters that have a name.
35
+ */
36
+ const filterClusters = (clusters, includeAll) => {
37
+ return clusters.filter((cluster) => {
38
+ var _a;
39
+ if (!((_a = cluster.metadata) === null || _a === void 0 ? void 0 : _a.name)) {
40
+ return false;
41
+ }
42
+ return includeAll || (0, exports.isClusterAvailable)(cluster);
43
+ });
44
+ };
45
+ exports.filterClusters = filterClusters;
46
+ //# sourceMappingURL=clusterUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clusterUtils.js","sourceRoot":"","sources":["../../src/internal/clusterUtils.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAC/B,SAAiB,EACjB,UAAiD,EACjD,MAAe,EACf,EAAE,WAAC,OAAA,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,0CAAE,MAAM,MAAK,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,MAAM,CAAC,CAAA,EAAA,CAAA;AAJpE,QAAA,iBAAiB,qBAImD;AAEjF;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,OAA0B,EAAW,EAAE;;IACxE,MAAM,oBAAoB,GACxB,CAAA,MAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,MAAM,0CAAG,wDAAwD,CAAC,MAAK,WAAW,CAAA;IAEtG,MAAM,UAAU,GAAG,CAAA,MAAC,OAAe,aAAf,OAAO,uBAAP,OAAO,CAAU,MAAM,0CAAE,UAAU,KAAI,EAAE,CAAA;IAC7D,MAAM,WAAW,GAAG,IAAA,yBAAiB,EAAC,kCAAkC,EAAE,UAAU,CAAC,CAAA;IAErF,OAAO,oBAAoB,IAAI,WAAW,CAAA;AAC5C,CAAC,CAAA;AARY,QAAA,kBAAkB,sBAQ9B;AAED;;;GAGG;AACI,MAAM,iBAAiB,GAAG,CAAC,OAA0B,EAAU,EAAE;;IACtE,OAAO,CAAA,MAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,MAAM,0CAAG,+CAA+C,CAAC,KAAI,SAAS,CAAA;AACjG,CAAC,CAAA;AAFY,QAAA,iBAAiB,qBAE7B;AAED;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAAC,QAA6B,EAAE,UAAmB,EAAuB,EAAE;IACxG,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;;QACjC,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,IAAI,CAAA,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,OAAO,UAAU,IAAI,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AARY,QAAA,cAAc,kBAQ1B"}
@@ -0,0 +1,12 @@
1
+ import { K8sResourceCommon, Selector } from '@openshift-console/dynamic-plugin-sdk';
2
+ import { ClusterSetData, FleetClusterNamesOptions } from '../types/fleet';
3
+ /**
4
+ * Internal hook that provides common implementation for fleet cluster operations.
5
+ * This is shared between useFleetClusterNames and useFleetClusterSets.
6
+ */
7
+ export declare function useFleetClustersInternal({ returnAllClusters, includeGlobal, clusterSets, }: FleetClusterNamesOptions): [K8sResourceCommon[], boolean, any, Selector | undefined];
8
+ /**
9
+ * Organizes clusters into cluster set data structure
10
+ */
11
+ export declare function organizeClustersBySet(clusters: K8sResourceCommon[], options?: FleetClusterNamesOptions): ClusterSetData;
12
+ //# sourceMappingURL=useFleetClustersInternal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFleetClustersInternal.d.ts","sourceRoot":"","sources":["../../src/internal/useFleetClustersInternal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAuB,QAAQ,EAAE,MAAM,uCAAuC,CAAA;AAGxG,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAEzE;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,iBAAyB,EACzB,aAAa,EACb,WAAW,GACZ,EAAE,wBAAwB,GAAG,CAAC,iBAAiB,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC,CA4CtF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,OAAO,CAAC,EAAE,wBAAwB,GACjC,cAAc,CA0BhB"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useFleetClustersInternal = useFleetClustersInternal;
4
+ exports.organizeClustersBySet = organizeClustersBySet;
5
+ /* Copyright Contributors to the Open Cluster Management project */
6
+ const react_1 = require("react");
7
+ const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
8
+ const models_1 = require("./models");
9
+ const clusterUtils_1 = require("./clusterUtils");
10
+ /**
11
+ * Internal hook that provides common implementation for fleet cluster operations.
12
+ * This is shared between useFleetClusterNames and useFleetClusterSets.
13
+ */
14
+ function useFleetClustersInternal({ returnAllClusters = false, includeGlobal, clusterSets, }) {
15
+ // Build selector for optimization when possible
16
+ const selector = (0, react_1.useMemo)(() => {
17
+ if (!(clusterSets === null || clusterSets === void 0 ? void 0 : clusterSets.length)) {
18
+ return undefined;
19
+ }
20
+ // Only optimize if we're not including global
21
+ if (includeGlobal) {
22
+ return undefined;
23
+ }
24
+ // For single cluster set, use exact match
25
+ if (clusterSets.length === 1) {
26
+ return {
27
+ matchLabels: {
28
+ 'cluster.open-cluster-management.io/clusterset': clusterSets[0],
29
+ },
30
+ };
31
+ }
32
+ // For multiple cluster sets, use 'in' operator
33
+ return {
34
+ matchExpressions: [
35
+ {
36
+ key: 'cluster.open-cluster-management.io/clusterset',
37
+ operator: 'In',
38
+ values: clusterSets,
39
+ },
40
+ ],
41
+ };
42
+ }, [clusterSets, includeGlobal]);
43
+ const [clusters, loaded, error] = (0, dynamic_plugin_sdk_1.useK8sWatchResource)(Object.assign({ groupVersionKind: models_1.ManagedClusterListGroupVersionKind, isList: true }, (selector && { selector })));
44
+ const filteredClusters = (0, react_1.useMemo)(() => {
45
+ return (0, clusterUtils_1.filterClusters)(clusters, returnAllClusters);
46
+ }, [clusters, returnAllClusters]);
47
+ return [filteredClusters, loaded, error, selector];
48
+ }
49
+ /**
50
+ * Organizes clusters into cluster set data structure
51
+ */
52
+ function organizeClustersBySet(clusters, options) {
53
+ const clusterSetData = {};
54
+ // Organize clusters by their cluster set labels
55
+ for (const cluster of clusters) {
56
+ const clusterName = cluster.metadata.name;
57
+ const clusterSetLabel = (0, clusterUtils_1.getClusterSetName)(cluster);
58
+ // Add to global set if requested
59
+ if (options === null || options === void 0 ? void 0 : options.includeGlobal) {
60
+ if (!clusterSetData.global) {
61
+ clusterSetData.global = [];
62
+ }
63
+ clusterSetData.global.push(clusterName);
64
+ }
65
+ // Check if this cluster set should be included
66
+ if (!(options === null || options === void 0 ? void 0 : options.clusterSets) || options.clusterSets.includes(clusterSetLabel)) {
67
+ if (!clusterSetData[clusterSetLabel]) {
68
+ clusterSetData[clusterSetLabel] = [];
69
+ }
70
+ clusterSetData[clusterSetLabel].push(clusterName);
71
+ }
72
+ }
73
+ return clusterSetData;
74
+ }
75
+ //# sourceMappingURL=useFleetClustersInternal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFleetClustersInternal.js","sourceRoot":"","sources":["../../src/internal/useFleetClustersInternal.ts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AiB,CAAC,CAAC,CAAA;IAEjC,OAAO,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;AACpD,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CACnC,QAA6B,EAC7B,OAAkC;IAElC,MAAM,cAAc,GAAmB,EAAE,CAAA;IAEzC,gDAAgD;IAChD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,OAAO,CAAC,QAAS,CAAC,IAAK,CAAA;QAC3C,MAAM,eAAe,GAAG,IAAA,gCAAiB,EAAC,OAAO,CAAC,CAAA;QAElD,iCAAiC;QACjC,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,EAAE,CAAC;YAC3B,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;gBAC3B,cAAc,CAAC,MAAM,GAAG,EAAE,CAAA;YAC5B,CAAC;YACD,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACzC,CAAC;QAED,+CAA+C;QAC/C,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAA,IAAI,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YAC3E,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC;gBACrC,cAAc,CAAC,eAAe,CAAC,GAAG,EAAE,CAAA;YACtC,CAAC;YACD,cAAc,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACnD,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAA;AACvB,CAAC"}
package/lib/setupTests.js CHANGED
@@ -53,7 +53,7 @@ global.EventSource = (_c = class EventSource {
53
53
  _c.OPEN = 1,
54
54
  _c.CLOSED = 2,
55
55
  _c);
56
- global.TextEncoder = util_1.TextEncoder;
56
+ globalThis.TextEncoder = util_1.TextEncoder;
57
57
  (0, dom_1.configure)({ testIdAttribute: 'id' });
58
58
  jest.setTimeout((process.env.LAUNCH ? 3000 : 180) * 1000);
59
59
  let consoleWarnings = [];
@@ -1 +1 @@
1
- {"version":3,"file":"setupTests.js","sourceRoot":"","sources":["../src/setupTests.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,0BAA0B;;;;;;;;AAE1B,uDAAuD;AACvD,8CAAgD;AAChD,qCAAkC;AAClC,kCAA+B;AAC/B,sEAA2C;AAC3C,+BAAkC;AAClC,sDAA0B;AAC1B,oEAAoE;AACpE,iDAAgD;AAEhD,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAA;AAC7B,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,kBAAkB,CAAA;AAClD,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,EAAE,CAAA;AACvC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,QAAQ,CAAA;AAC3B,YAAA,OAAO,CAAC,GAAG,EAAC,iBAAiB,uCAAjB,iBAAiB,GAAK,GAAG,EAAA;AAErC,MAAM,CAAC,YAAY,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAS,CAAA;AAE9C,yBAAa,CAAC,WAAW,EAAE,CAAA;AAC3B,SAAS,CAAC,QAAQ,EAAE,CAAA;AAEpB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxC,MAAM,QAAQ,GACZ,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,GAAG;QAC/C,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE;QACrE,CAAC,CAAC,KAAK,CAAA;IACX,OAAO,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;AACrC,CAAC,CAAC,CAAA;AAEF,MAAM,CAA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DAA6D;AAC7D,OAAO,CAAC,KAAK,GAAG,CAAC,OAAa,EAAE,GAAG,eAAsB,EAAE,EAAE;IAC3D,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED,SAAS,eAAe;IACtB,aAAa,GAAG,EAAE,CAAA;IAClB,eAAe,GAAG,EAAE,CAAA;AACtB,CAAC;AAED,UAAU,CAAC,eAAe,CAAC,CAAA;AAE3B,iBAAI,CAAC,GAAG,CAAC,gCAAgB,CAAC,CAAC,IAAI,CAAC;IAC9B,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE;QACb,WAAW,EAAE,KAAK;KACnB;IACD,iBAAiB,EAAE,IAAI;IACvB,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,GAAG;IAChB,aAAa,EAAE,CAAC,IAAI,CAAC;IACrB,oBAAoB,EAAE,IAAI;IAC1B,GAAG,EAAE,IAAI;IACT,WAAW,EAAE,IAAI;IACjB,EAAE,EAAE,aAAa;IACjB,SAAS,EAAE;QACT,EAAE,EAAE;YACF,WAAW,EAAE,EAAE;SAChB;KACF;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,UAAU;IACf,MAAM,CAAC,UAAU;QACjB;YACE,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,cAAa,CAAC;gBAC3B,cAAc,EAAE,cAAa,CAAC;aAC/B,CAAA;QACH,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"root":["../src/globals.d.ts","../src/index.ts","../src/setupTests.ts","../src/api/constants.ts","../src/api/fleetK8sCreate.ts","../src/api/fleetK8sDelete.ts","../src/api/fleetK8sGet.ts","../src/api/fleetK8sList.ts","../src/api/fleetK8sPatch.ts","../src/api/fleetK8sUpdate.ts","../src/api/getFleetK8sAPIPath.ts","../src/api/index.ts","../src/api/useFleetAccessReview.ts","../src/api/useFleetClusterNames.ts","../src/api/useFleetK8sAPIPath.ts","../src/api/useFleetK8sWatchResource.ts","../src/api/useFleetK8sWatchResources.ts","../src/api/useFleetPrometheusPoll.ts","../src/api/useFleetSearchPoll.ts","../src/api/useHubClusterName.ts","../src/api/useIsFleetAvailable.ts","../src/api/useIsFleetObservabilityInstalled.ts","../src/components/FleetResourceEventStream.tsx","../src/components/FleetResourceLink.tsx","../src/components/index.ts","../src/extensions/index.ts","../src/extensions/resource.ts","../src/internal/apiRequests.ts","../src/internal/cachedHubConfiguration.ts","../src/internal/checkAccess.ts","../src/internal/constants.ts","../src/internal/fleetK8sWatchResource.ts","../src/internal/fleetK8sWatchResourceStore.ts","../src/internal/getFleetK8sAPIPath.ts","../src/internal/isHubRequest.ts","../src/internal/models.ts","../src/internal/requirements.ts","../src/internal/resourceRouteUtils.ts","../src/internal/useHubConfigurationItem.ts","../src/internal/usePoll.ts","../src/internal/useSafeFetch.ts","../src/internal/useURLPoll.ts","../src/internal/utils.ts","../src/internal/FleetResourceEventStream/EventComponent.tsx","../src/internal/FleetResourceEventStream/EventStreamList.tsx","../src/internal/FleetResourceEventStream/TogglePlay.tsx","../src/internal/FleetResourceEventStream/WithScrollContainer.tsx","../src/internal/FleetResourceEventStream/constants.ts","../src/internal/FleetResourceEventStream/utils.ts","../src/internal/hooks/useDeepCompareMemoize.ts","../src/internal/search/search-client.ts","../src/internal/search/search-sdk.ts","../src/internal/search/searchPaths.ts","../src/internal/search/searchUtils.ts","../src/types/fleet.ts","../src/types/index.ts","../src/types/search.ts"],"version":"5.8.2"}
1
+ {"root":["../src/globals.d.ts","../src/index.ts","../src/setupTests.ts","../src/api/constants.ts","../src/api/fleetK8sCreate.ts","../src/api/fleetK8sDelete.ts","../src/api/fleetK8sGet.ts","../src/api/fleetK8sList.ts","../src/api/fleetK8sPatch.ts","../src/api/fleetK8sUpdate.ts","../src/api/getFleetK8sAPIPath.ts","../src/api/index.ts","../src/api/useFleetAccessReview.ts","../src/api/useFleetClusterNames.ts","../src/api/useFleetClusterSetNames.ts","../src/api/useFleetClusterSets.ts","../src/api/useFleetK8sAPIPath.ts","../src/api/useFleetK8sWatchResource.ts","../src/api/useFleetK8sWatchResources.ts","../src/api/useFleetPrometheusPoll.ts","../src/api/useFleetSearchPoll.ts","../src/api/useHubClusterName.ts","../src/api/useIsFleetAvailable.ts","../src/api/useIsFleetObservabilityInstalled.ts","../src/components/FleetResourceEventStream.tsx","../src/components/FleetResourceLink.tsx","../src/components/index.ts","../src/extensions/index.ts","../src/extensions/resource.ts","../src/internal/apiRequests.ts","../src/internal/cachedHubConfiguration.ts","../src/internal/checkAccess.ts","../src/internal/clusterUtils.ts","../src/internal/constants.ts","../src/internal/fleetK8sWatchResource.ts","../src/internal/fleetK8sWatchResourceStore.ts","../src/internal/getFleetK8sAPIPath.ts","../src/internal/isHubRequest.ts","../src/internal/models.ts","../src/internal/requirements.ts","../src/internal/resourceRouteUtils.ts","../src/internal/useFleetClustersInternal.ts","../src/internal/useHubConfigurationItem.ts","../src/internal/usePoll.ts","../src/internal/useSafeFetch.ts","../src/internal/useURLPoll.ts","../src/internal/utils.ts","../src/internal/FleetResourceEventStream/EventComponent.tsx","../src/internal/FleetResourceEventStream/EventStreamList.tsx","../src/internal/FleetResourceEventStream/TogglePlay.tsx","../src/internal/FleetResourceEventStream/WithScrollContainer.tsx","../src/internal/FleetResourceEventStream/constants.ts","../src/internal/FleetResourceEventStream/utils.ts","../src/internal/hooks/useDeepCompareMemoize.ts","../src/internal/search/search-client.ts","../src/internal/search/search-sdk.ts","../src/internal/search/searchPaths.ts","../src/internal/search/searchUtils.ts","../src/types/fleet.ts","../src/types/index.ts","../src/types/search.ts"],"version":"5.9.3"}
@@ -74,4 +74,22 @@ export type FleetK8sListOptions = {
74
74
  };
75
75
  requestInit?: RequestInit;
76
76
  };
77
+ /**
78
+ * Structured data containing cluster names organized by cluster sets.
79
+ *
80
+ * Clusters without an explicit cluster set label are automatically assigned to the "default" cluster set.
81
+ * The "global" key is a special set that contains all clusters (when includeGlobal is true).
82
+ */
83
+ export type ClusterSetData = Record<string, string[]>;
84
+ /**
85
+ * Options for advanced cluster name retrieval with cluster set organization.
86
+ */
87
+ export type FleetClusterNamesOptions = {
88
+ /** Whether to return all clusters regardless of availability status. Defaults to false. */
89
+ returnAllClusters?: boolean;
90
+ /** Specific cluster set names to include. If not specified, includes all cluster sets including "default". Should not include "global" - use includeGlobal instead. */
91
+ clusterSets?: string[];
92
+ /** Whether to include a special "global" set containing all clusters. Defaults to false. */
93
+ includeGlobal?: boolean;
94
+ };
77
95
  //# sourceMappingURL=fleet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fleet.d.ts","sourceRoot":"","sources":["../../src/types/fleet.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAC9B,QAAQ,EACR,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,uCAAuC,CAAA;AAE9C,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAC/C,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAA;AAE7D,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAA;AAC3D,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,oBAAoB,IAAI;KAClE,CAAC,IAAI,MAAM,CAAC,GAAG,qBAAqB;CACtC,CAAA;AACD,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,sBAAsB,GAAG,sBAAsB,EAAE,IAAI;IAC7F,CAAC,GAAG,SAAS;IACb,OAAO;IACP,GAAG;CACJ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,sBAAsB,GAAG,sBAAsB,EAAE,CAAA;CAAE,CAAA;AACvG,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,EAAE,IAAI;IAC1F,IAAI,EAAE,CAAC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MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAErD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,2FAA2F;IAC3F,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,uKAAuK;IACvK,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,4FAA4F;IAC5F,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stolostron/multicluster-sdk",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Provides extensions and APIs that dynamic plugins can use to leverage multicluster capabilities provided by Red Hat Advanced Cluster Management.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",