@openshift-assisted/ui-lib 2.42.1 → 2.42.2

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.
Files changed (34) hide show
  1. package/build/@types/common/components/operators/operatorSpecs.d.ts +10 -3
  2. package/build/@types/common/components/operators/operatorSpecs.d.ts.map +1 -1
  3. package/build/@types/common/components/operators/test.d.ts +50 -0
  4. package/build/@types/common/components/operators/test.d.ts.map +1 -0
  5. package/build/@types/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.d.ts.map +1 -1
  6. package/build/@types/ocm/components/clusterConfiguration/operators/OperatorCheckbox.d.ts +2 -1
  7. package/build/@types/ocm/components/clusterConfiguration/operators/OperatorCheckbox.d.ts.map +1 -1
  8. package/build/@types/ocm/components/clusterWizard/OperatorsBundle.d.ts +2 -1
  9. package/build/@types/ocm/components/clusterWizard/OperatorsBundle.d.ts.map +1 -1
  10. package/build/@types/ocm/components/clusterWizard/OperatorsSelect.d.ts +2 -1
  11. package/build/@types/ocm/components/clusterWizard/OperatorsSelect.d.ts.map +1 -1
  12. package/build/@types/ocm/components/clusterWizard/OperatorsStep.d.ts.map +1 -1
  13. package/build/cjs/common/components/operators/operatorSpecs.js +111 -139
  14. package/build/cjs/common/components/operators/operatorSpecs.js.map +1 -1
  15. package/build/cjs/common/components/operators/test.js +323 -0
  16. package/build/cjs/common/components/operators/test.js.map +1 -0
  17. package/build/cjs/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.js +13 -4
  18. package/build/cjs/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.js.map +1 -1
  19. package/build/cjs/ocm/components/clusterConfiguration/operators/OperatorCheckbox.js +3 -3
  20. package/build/cjs/ocm/components/clusterConfiguration/operators/OperatorCheckbox.js.map +1 -1
  21. package/build/cjs/ocm/components/clusterWizard/OperatorsBundle.js +8 -8
  22. package/build/cjs/ocm/components/clusterWizard/OperatorsBundle.js.map +1 -1
  23. package/build/cjs/ocm/components/clusterWizard/OperatorsSelect.js +33 -14
  24. package/build/cjs/ocm/components/clusterWizard/OperatorsSelect.js.map +1 -1
  25. package/build/cjs/ocm/components/clusterWizard/OperatorsStep.js +13 -3
  26. package/build/cjs/ocm/components/clusterWizard/OperatorsStep.js.map +1 -1
  27. package/lib/common/components/operators/operatorSpecs.tsx +123 -160
  28. package/lib/common/components/operators/test.tsx +469 -0
  29. package/lib/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.tsx +21 -9
  30. package/lib/ocm/components/clusterConfiguration/operators/OperatorCheckbox.tsx +5 -2
  31. package/lib/ocm/components/clusterWizard/OperatorsBundle.tsx +15 -7
  32. package/lib/ocm/components/clusterWizard/OperatorsSelect.tsx +58 -37
  33. package/lib/ocm/components/clusterWizard/OperatorsStep.tsx +30 -3
  34. package/package.json +3 -3
@@ -24,10 +24,12 @@ const OperatorsSelect = ({
24
24
  cluster,
25
25
  bundles,
26
26
  preflightRequirements,
27
+ searchTerm,
27
28
  }: {
28
29
  cluster: Cluster;
29
30
  bundles: Bundle[];
30
31
  preflightRequirements: PreflightHardwareRequirements | undefined;
32
+ searchTerm?: string;
31
33
  }) => {
32
34
  const [isLoading, setIsLoading] = useStateSafely(true);
33
35
  const { addAlert } = useAlerts();
@@ -64,50 +66,69 @@ const OperatorsSelect = ({
64
66
  });
65
67
  }, [isSingleClusterFeatureEnabled, supportedOperators]);
66
68
 
67
- if (isLoading) {
68
- return <LoadingState />;
69
- }
70
-
71
69
  const selectedOperators = values.selectedOperators.filter(
72
70
  (opKey) => operators.includes(opKey) && !!opSpecs[opKey],
73
71
  );
74
72
 
73
+ if (isLoading) {
74
+ return <LoadingState />;
75
+ }
76
+ let foundAtLeastOneOperator = false;
75
77
  return (
76
- <ExpandableSection
77
- toggleText={`Single Operators (${operators.length} | ${selectedOperators.length} selected)`}
78
- onToggle={() => setIsExpanded(!isExpanded)}
79
- isExpanded={isExpanded}
80
- data-testid="single-operators-section"
81
- >
82
- <Stack hasGutter data-testid={'operators-form'}>
83
- {Object.entries(byCategory).map(([categoryName, specs]) => {
84
- const categoryOperators = specs.filter((spec) => operators.includes(spec.operatorKey));
85
- if (categoryOperators.length === 0) {
86
- return null;
87
- }
78
+ <>
79
+ <ExpandableSection
80
+ toggleText={`Single Operators (${operators.length} | ${selectedOperators.length} selected)`}
81
+ onToggle={() => setIsExpanded(!isExpanded)}
82
+ isExpanded={isExpanded}
83
+ data-testid="single-operators-section"
84
+ >
85
+ <Stack hasGutter data-testid={'operators-form'}>
86
+ {Object.entries(byCategory).map(([categoryName, specs]) => {
87
+ let categoryOperators = specs.filter((spec) => operators.includes(spec.operatorKey));
88
+ // Filter by searchTerm
89
+ if (searchTerm?.trim()) {
90
+ const term = searchTerm.trim().toLowerCase();
91
+ categoryOperators = categoryOperators.filter((spec) => {
92
+ const op = opSpecs[spec.operatorKey];
93
+ const title = op?.title?.toLowerCase() || '';
94
+ const description = op?.descriptionText?.toLowerCase() || '';
95
+ return title.includes(term) || description.includes(term);
96
+ });
97
+ }
98
+ if (categoryOperators.length === 0) {
99
+ return null;
100
+ }
101
+ foundAtLeastOneOperator = true;
102
+ if (!!searchTerm?.trim() && !isExpanded) {
103
+ //if we found some results expand operators section
104
+ setIsExpanded(true);
105
+ }
88
106
 
89
- return (
90
- <React.Fragment key={categoryName}>
91
- <StackItem>
92
- <strong>{categoryName}</strong>
93
- </StackItem>
94
- {categoryOperators.map((spec) => (
95
- <StackItem key={spec.operatorKey}>
96
- <OperatorCheckbox
97
- bundles={bundles}
98
- operatorId={spec.operatorKey}
99
- cluster={cluster}
100
- openshiftVersion={cluster.openshiftVersion}
101
- preflightRequirements={preflightRequirements}
102
- {...spec}
103
- />
107
+ return (
108
+ <React.Fragment key={categoryName}>
109
+ <StackItem>
110
+ <strong>{categoryName}</strong>
104
111
  </StackItem>
105
- ))}
106
- </React.Fragment>
107
- );
108
- })}
109
- </Stack>
110
- </ExpandableSection>
112
+ {categoryOperators.map((spec) => (
113
+ <StackItem key={spec.operatorKey}>
114
+ <OperatorCheckbox
115
+ bundles={bundles}
116
+ operatorId={spec.operatorKey}
117
+ cluster={cluster}
118
+ openshiftVersion={cluster.openshiftVersion}
119
+ preflightRequirements={preflightRequirements}
120
+ searchTerm={searchTerm}
121
+ {...spec}
122
+ />
123
+ </StackItem>
124
+ ))}
125
+ </React.Fragment>
126
+ );
127
+ })}
128
+ </Stack>
129
+ </ExpandableSection>
130
+ {!foundAtLeastOneOperator && !!searchTerm?.trim() && <StackItem>No results found</StackItem>}
131
+ </>
111
132
  );
112
133
  };
113
134
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Stack, StackItem } from '@patternfly/react-core';
2
+ import { Flex, FlexItem, SearchInput, Stack, StackItem } from '@patternfly/react-core';
3
3
  import { Bundle } from '@openshift-assisted/types/assisted-installer-service';
4
4
  import {
5
5
  ClusterOperatorProps,
@@ -19,6 +19,7 @@ export const OperatorsStep = ({ cluster }: ClusterOperatorProps) => {
19
19
  const [bundlesLoading, setBundlesLoading] = React.useState(true);
20
20
  const [bundles, setBundles] = React.useState<Bundle[]>([]);
21
21
  const { preflightRequirements, isLoading } = useClusterPreflightRequirements(cluster.id);
22
+ const [searchTerm, setSearchTerm] = React.useState('');
22
23
  React.useEffect(() => {
23
24
  const fetchBundles = async () => {
24
25
  try {
@@ -39,6 +40,12 @@ export const OperatorsStep = ({ cluster }: ClusterOperatorProps) => {
39
40
  void fetchBundles();
40
41
  }, [addAlert]);
41
42
 
43
+ const filteredBundles = bundles.filter(
44
+ (bundle) =>
45
+ bundle.title?.toLowerCase().includes(searchTerm.toLowerCase()) ||
46
+ bundle.description?.toLowerCase().includes(searchTerm.toLowerCase()),
47
+ );
48
+
42
49
  if (isLoading || bundlesLoading) {
43
50
  return <LoadingState />;
44
51
  }
@@ -46,16 +53,36 @@ export const OperatorsStep = ({ cluster }: ClusterOperatorProps) => {
46
53
  return (
47
54
  <Stack hasGutter data-testid={'operators-page'}>
48
55
  <StackItem>
49
- <ClusterWizardStepHeader>Operators</ClusterWizardStepHeader>
56
+ <Flex
57
+ justifyContent={{ default: 'justifyContentSpaceBetween' }}
58
+ alignItems={{ default: 'alignItemsCenter' }}
59
+ >
60
+ <FlexItem>
61
+ <ClusterWizardStepHeader>Operators</ClusterWizardStepHeader>
62
+ </FlexItem>
63
+ <FlexItem style={{ minWidth: '300px' }}>
64
+ <SearchInput
65
+ placeholder={'Find bundles or operators'}
66
+ value={searchTerm}
67
+ onChange={(_e, value) => setSearchTerm(value)}
68
+ onClear={() => setSearchTerm('')}
69
+ />
70
+ </FlexItem>
71
+ </Flex>
50
72
  </StackItem>
51
73
  <StackItem>
52
- <OperatorsBundle bundles={bundles} preflightRequirements={preflightRequirements} />
74
+ <OperatorsBundle
75
+ bundles={filteredBundles}
76
+ preflightRequirements={preflightRequirements}
77
+ searchTerm={searchTerm}
78
+ />
53
79
  </StackItem>
54
80
  <StackItem>
55
81
  <OperatorsSelect
56
82
  bundles={bundles}
57
83
  cluster={cluster}
58
84
  preflightRequirements={preflightRequirements}
85
+ searchTerm={searchTerm}
59
86
  />
60
87
  </StackItem>
61
88
  </Stack>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
- "@openshift-assisted/locales": "2.42.1",
4
- "@openshift-assisted/types": "2.42.1",
3
+ "@openshift-assisted/locales": "2.42.2",
4
+ "@openshift-assisted/types": "2.42.2",
5
5
  "@openshift-console/dynamic-plugin-sdk": "0.0.3",
6
6
  "@patternfly/patternfly": "5.2.0",
7
7
  "@patternfly/react-code-editor": "5.2.0",
@@ -140,5 +140,5 @@
140
140
  ]
141
141
  }
142
142
  },
143
- "version": "2.42.1"
143
+ "version": "2.42.2"
144
144
  }