@rh-support/troubleshoot 0.2.100 → 0.2.104
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 +0 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.js +38 -8
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +12 -5
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts +1 -0
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +52 -50
- package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
- package/lib/esm/reducers/CaseHelpers.js +1 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,sBAAsB,gBA4RrC"}
|
|
@@ -19,10 +19,10 @@ import { useCaseDispatch, useCaseSelector } from '../../../../../context/CaseCon
|
|
|
19
19
|
import { setCaseDetails, updateCaseDetails } from '../../../../../reducers/CaseReducer';
|
|
20
20
|
import { getIsClusterIdInvalid, isClusterIdEnabledForProduct } from '../../../../../utils/caseOpenshiftClusterIdUtils';
|
|
21
21
|
import { NoClusterIDReasonSelector } from '../../../../CaseManagement/NoClusterIDReasonSelector';
|
|
22
|
-
import { discoverV4ClusterIdLink, discoverV4ClusterIdLinkError, isInvalidErrorMessage, } from '../../../../CaseManagement/OpenShiftClusterId';
|
|
22
|
+
import { discoverV4ClusterIdLink, discoverV4ClusterIdLinkError, isInvalidErrorMessage, v3Tov4TransitionLink, } from '../../../../CaseManagement/OpenShiftClusterId';
|
|
23
23
|
import { fetchClusterIdDetails, OpenshiftDropdownV4 } from '../../../../CaseManagement/OpenshiftDropdownV4';
|
|
24
24
|
export function CaseOpenshiftClusterId() {
|
|
25
|
-
const { openshiftClusterID, product, version, caseNumber, openshiftClusterVersion, noClusterIdReason, noClusterIdReasonExplanation, selectedAccountDetails, } = useCaseSelector((state) => ({
|
|
25
|
+
const { openshiftClusterID, product, version, caseNumber, openshiftClusterVersion, noClusterIdReason, noClusterIdReasonExplanation, selectedAccountDetails, description, } = useCaseSelector((state) => ({
|
|
26
26
|
openshiftClusterID: state.caseDetails.openshiftClusterID,
|
|
27
27
|
product: state.caseDetails.product,
|
|
28
28
|
version: state.caseDetails.version,
|
|
@@ -31,6 +31,7 @@ export function CaseOpenshiftClusterId() {
|
|
|
31
31
|
noClusterIdReason: state.caseDetails.noClusterIdReason,
|
|
32
32
|
noClusterIdReasonExplanation: state.caseDetails.noClusterIdReasonExplanation,
|
|
33
33
|
selectedAccountDetails: state.selectedAccountDetails,
|
|
34
|
+
description: state.caseDetails.description,
|
|
34
35
|
}), isEqual);
|
|
35
36
|
const caseDispatch = useCaseDispatch();
|
|
36
37
|
const { globalMetadataState: { pcmConfig, allProducts, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
@@ -137,6 +138,24 @@ export function CaseOpenshiftClusterId() {
|
|
|
137
138
|
setDontKnowSelected(true);
|
|
138
139
|
setSelectedReason(selectedClusterId);
|
|
139
140
|
setIsClusterIdInValid(false);
|
|
141
|
+
const caseDetails = {
|
|
142
|
+
openshiftClusterID: '',
|
|
143
|
+
noClusterIdReasonExplanation: '',
|
|
144
|
+
noClusterIdReason: '',
|
|
145
|
+
openshiftClusterVersion: '',
|
|
146
|
+
};
|
|
147
|
+
yield clusterIdUpdate(caseDetails);
|
|
148
|
+
}
|
|
149
|
+
else if (selectedClusterId === 'v3-cluster') {
|
|
150
|
+
setSelectedReason('dont-have-id');
|
|
151
|
+
const caseDetails = {
|
|
152
|
+
openshiftClusterID: '',
|
|
153
|
+
noClusterIdReasonExplanation: 'v3-cluster',
|
|
154
|
+
noClusterIdReason: 'Other',
|
|
155
|
+
openshiftClusterVersion: '',
|
|
156
|
+
};
|
|
157
|
+
yield clusterIdUpdate(caseDetails);
|
|
158
|
+
setDontKnowSelected(false);
|
|
140
159
|
}
|
|
141
160
|
else {
|
|
142
161
|
const isClusterIdInvalid = getIsClusterIdInvalid(selectedClusterId);
|
|
@@ -162,13 +181,17 @@ export function CaseOpenshiftClusterId() {
|
|
|
162
181
|
setSelectedReason('');
|
|
163
182
|
}
|
|
164
183
|
});
|
|
184
|
+
const isDedicatedV3 = () => noClusterIdReason === 'Other' && noClusterIdReasonExplanation === 'v3-cluster';
|
|
185
|
+
const v3Message = () => description.match(/Cluster Name: /g) ? (React.createElement(React.Fragment, null,
|
|
186
|
+
"Your Cluster Name has been added to the description below. ",
|
|
187
|
+
v3Tov4TransitionLink())) : (React.createElement(React.Fragment, null, v3Tov4TransitionLink()));
|
|
165
188
|
const clusterIdDropdownFormInstructions = () => {
|
|
166
189
|
const errorMessage = isClusterIdInvalid
|
|
167
190
|
? isInvalidErrorMessage()
|
|
168
191
|
: isEmpty(openshiftClusterID) && isEmpty(selectedReason)
|
|
169
192
|
? discoverV4ClusterIdLinkError()
|
|
170
193
|
: null;
|
|
171
|
-
const infoMessage = discoverV4ClusterIdLink();
|
|
194
|
+
const infoMessage = isDedicatedV3() ? v3Message() : discoverV4ClusterIdLink();
|
|
172
195
|
return errorMessage ? errorMessage : infoMessage;
|
|
173
196
|
};
|
|
174
197
|
const onReasonExplanationInputBoxChanged = (explanationInput) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -205,10 +228,17 @@ export function CaseOpenshiftClusterId() {
|
|
|
205
228
|
setIsReasonUpdating(false);
|
|
206
229
|
});
|
|
207
230
|
const isInVaidNoClusterIdReason = isEmpty(noClusterIdReason) || (noClusterIdReason === 'Other' && isEmpty(noClusterIdReasonExplanation.trim()));
|
|
208
|
-
if (!showClusterId
|
|
231
|
+
if (!showClusterId) {
|
|
209
232
|
return null;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
233
|
+
}
|
|
234
|
+
else if (isOpenShiftV3) {
|
|
235
|
+
return React.createElement("div", { className: "pull-top pf-u-pb-xl" }, v3Message());
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
return (React.createElement(React.Fragment, null,
|
|
239
|
+
React.createElement(OpenshiftDropdownV4, { openshiftClusterIDState: localOpenshiftClusterIDState || selectedReason, onClusterIdStateUpdate: onClusterIdSave, isClusterIdInvalid: (isEmpty(localOpenshiftClusterIDState) && isEmpty(selectedReason)) || isClusterIdInvalid, clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: () => setLocalOpenshiftClusterIDState(''), isV4: majorVersion === '4', isDisabled: isClusterIdUpdating || isFetchingClusterDetails, noClusterIdReasonExplanation: noClusterIdReasonExplanation }),
|
|
240
|
+
noClusterIdReasonExplanation !== 'v3-cluster' &&
|
|
241
|
+
(dontKnowSelected || noClusterIdReasonExplanation || noClusterIdReason) && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: debounceFn, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer, isDisabled: isReasonUpdating || isFetchingClusterDetails })),
|
|
242
|
+
React.createElement(LoadingIndicator, { show: isClusterIdUpdating, size: "xs" })));
|
|
243
|
+
}
|
|
214
244
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenShiftClusterId.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenShiftClusterId.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,oBAAoB,mBAShC,CAAC;AAEF,eAAO,MAAM,uBAAuB,mBAInC,CAAC;AAEF,eAAO,MAAM,4BAA4B,mBAKxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,mBAIjC,CAAC;AAEF,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"OpenShiftClusterId.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenShiftClusterId.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,oBAAoB,mBAShC,CAAC;AAEF,eAAO,MAAM,uBAAuB,mBAInC,CAAC;AAEF,eAAO,MAAM,4BAA4B,mBAKxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,mBAIjC,CAAC;AAEF,wBAAgB,kBAAkB,gBAoSjC"}
|
|
@@ -148,11 +148,12 @@ export function OpenShiftClusterId() {
|
|
|
148
148
|
setClusterVersion(openshiftClusterID);
|
|
149
149
|
}
|
|
150
150
|
// when user click on back and continue button, need to show v3 text box or reasons dropdown
|
|
151
|
-
if (!isEmpty(v3ClusterName)
|
|
151
|
+
if (!isEmpty(v3ClusterName) ||
|
|
152
|
+
(noClusterIdReason === 'Other' && noClusterIdReasonExplanation === 'v3-cluster')) {
|
|
152
153
|
setV3Selected(true);
|
|
153
154
|
setSelectedReason('v3-cluster');
|
|
154
155
|
}
|
|
155
|
-
if (!isEmpty(noClusterIdReason)) {
|
|
156
|
+
else if (!isEmpty(noClusterIdReason)) {
|
|
156
157
|
setDontKnowSelected(true);
|
|
157
158
|
setSelectedReason('dont-have-id');
|
|
158
159
|
}
|
|
@@ -162,9 +163,9 @@ export function OpenShiftClusterId() {
|
|
|
162
163
|
!clusterRecommendations.data.length &&
|
|
163
164
|
fetchClusterRecommendations(clusterRecommendationsDispatch, openshiftClusterID);
|
|
164
165
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
165
|
-
}, [
|
|
166
|
+
}, [noClusterIdReason]);
|
|
166
167
|
const onClusterIdStateUpdate = (selectedCluster) => {
|
|
167
|
-
const selectedId = selectedCluster.external_cluster_id;
|
|
168
|
+
const selectedId = selectedCluster === null || selectedCluster === void 0 ? void 0 : selectedCluster.external_cluster_id;
|
|
168
169
|
if (isEmpty(selectedId))
|
|
169
170
|
return;
|
|
170
171
|
resetClusterData();
|
|
@@ -176,6 +177,12 @@ export function OpenShiftClusterId() {
|
|
|
176
177
|
if (selectedId === 'v3-cluster') {
|
|
177
178
|
setV3Selected(true);
|
|
178
179
|
setSelectedReason(selectedId);
|
|
180
|
+
setCaseDetails(caseDispatch, {
|
|
181
|
+
openshiftClusterID,
|
|
182
|
+
openshiftClusterVersion: '',
|
|
183
|
+
noClusterIdReason: 'Other',
|
|
184
|
+
noClusterIdReasonExplanation: 'v3-cluster',
|
|
185
|
+
});
|
|
179
186
|
return;
|
|
180
187
|
}
|
|
181
188
|
const isClusterInvalid = getIsClusterIdInvalid(selectedId);
|
|
@@ -214,6 +221,6 @@ export function OpenShiftClusterId() {
|
|
|
214
221
|
return (React.createElement(React.Fragment, null,
|
|
215
222
|
!isOpenShiftV3 && (React.createElement(OpenshiftDropdownV4, { openshiftClusterIDState: openshiftClusterID || selectedReason, onClusterIdStateUpdate: onClusterIdStateUpdate, isClusterIdInvalid: showValidationErrorAlert &&
|
|
216
223
|
((isEmpty(openshiftClusterID) && isEmpty(selectedReason)) || isClusterIdInvalid), clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV4: majorVersion === '4' })),
|
|
217
|
-
dontKnowSelected && !isOpenShiftV3 && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: onReasonExplanationInputBoxChanged, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer })),
|
|
224
|
+
noClusterIdReasonExplanation !== 'v3-cluster' && dontKnowSelected && !isOpenShiftV3 && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: onReasonExplanationInputBoxChanged, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer })),
|
|
218
225
|
(v3Selected || isOpenShiftV3) && (React.createElement(OpenShiftV3Inputbox, { v3ClusterName: v3ClusterName, onReasonInputBoxChanged: v3ClusterNameInputBoxChanged, isInValid: isEmpty(v3ClusterName.trim()) && showValidationErrorAlert, v3Selected: v3Selected }))));
|
|
219
226
|
}
|
|
@@ -8,6 +8,7 @@ interface IProps extends IDClassNameProps {
|
|
|
8
8
|
onClusterClear: () => void;
|
|
9
9
|
isV4: boolean;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
|
+
noClusterIdReasonExplanation?: string;
|
|
11
12
|
}
|
|
12
13
|
declare const fetchClusterIdDetails: (clusterId: string) => Promise<import("@cee-eng/hydrajs/@types/models/cloud").ICluster>;
|
|
13
14
|
declare function OpenshiftDropdownV4(props: IProps): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAgC,MAAM,sCAAsC,CAAC;AAE1G,OAAO,EAAE,gBAAgB,EAAuB,MAAM,0BAA0B,CAAC;AAYjF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iCAAiC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAgC,MAAM,sCAAsC,CAAC;AAE1G,OAAO,EAAE,gBAAgB,EAAuB,MAAM,0BAA0B,CAAC;AAYjF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iCAAiC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACzC;AAQD,QAAA,MAAM,qBAAqB,cAAqB,MAAM,qEASrD,CAAC;AAeF,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA0TzC;kBA1TQ,mBAAmB;;;AA6T5B,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -48,7 +48,7 @@ const createState = (external_cluster_id, display_name) => {
|
|
|
48
48
|
};
|
|
49
49
|
function OpenshiftDropdownV4(props) {
|
|
50
50
|
const { t } = useTranslation();
|
|
51
|
-
const OLD_API_PER_PAGE_GET_ALL =
|
|
51
|
+
const OLD_API_PER_PAGE_GET_ALL = 10000;
|
|
52
52
|
const PER_PAGE = 200;
|
|
53
53
|
const [clustersRawResponse, setClustersRawResponse] = useState([]);
|
|
54
54
|
const abortControllerRef = useRef(undefined);
|
|
@@ -58,12 +58,16 @@ function OpenshiftDropdownV4(props) {
|
|
|
58
58
|
const [inputVal, setInputVal] = useState('');
|
|
59
59
|
const [showArchivedClusters, setShowArchivedClusters] = useState(false);
|
|
60
60
|
const [isFetchingClusters, setIsFetchingClusters] = useState(false);
|
|
61
|
+
const [totalResultsNo, setTotalResultsNo] = useState(0);
|
|
61
62
|
// gets a cluster id and returns display name
|
|
62
|
-
const getDisplayNameById = (clusters, id) => {
|
|
63
|
+
const getDisplayNameById = (clusters, id, noClusterIdReasonExplanation) => {
|
|
63
64
|
if (isEmpty(id))
|
|
64
65
|
return '';
|
|
65
|
-
if (id === 'dont-have-id')
|
|
66
|
-
return
|
|
66
|
+
if (id === 'dont-have-id') {
|
|
67
|
+
return noClusterIdReasonExplanation === 'v3-cluster'
|
|
68
|
+
? t('The case is for a v3 cluster')
|
|
69
|
+
: t("I don't have my Cluster ID");
|
|
70
|
+
}
|
|
67
71
|
if (id === 'v3-cluster')
|
|
68
72
|
return t('The case is for a v3 cluster');
|
|
69
73
|
const cluster = find(clusters, (o) => o.external_cluster_id === id);
|
|
@@ -77,8 +81,9 @@ function OpenshiftDropdownV4(props) {
|
|
|
77
81
|
const onToggle = (isOpen) => setIsOpen(isOpen);
|
|
78
82
|
const onViewMoreClick = () => __awaiter(this, void 0, void 0, function* () {
|
|
79
83
|
const fetchedClusters = yield fetchAccountClusters(inputVal);
|
|
80
|
-
const clusterResponse = [...clustersRawResponse, ...fetchedClusters.items];
|
|
84
|
+
const clusterResponse = [...clustersRawResponse, ...((fetchedClusters === null || fetchedClusters === void 0 ? void 0 : fetchedClusters.items) || [])];
|
|
81
85
|
setClustersRawResponse(clusterResponse);
|
|
86
|
+
setTotalResultsNo(fetchedClusters.total);
|
|
82
87
|
setClustersSelectOptions(getClusterOptions(clusterResponse));
|
|
83
88
|
});
|
|
84
89
|
const onSelect = (event, selectedCluster) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -97,7 +102,7 @@ function OpenshiftDropdownV4(props) {
|
|
|
97
102
|
});
|
|
98
103
|
const getClusterOptions = (clusters) => {
|
|
99
104
|
const clustersResponseGrouped = groupBy(clusters, 'dns.base_domain') || [];
|
|
100
|
-
const domainNames = Object.keys(clustersResponseGrouped);
|
|
105
|
+
const domainNames = Object.keys(clustersResponseGrouped) || [];
|
|
101
106
|
// move undefined to the end of domains array
|
|
102
107
|
const undefinedIndex = domainNames.findIndex((i) => i === 'undefined');
|
|
103
108
|
if (undefinedIndex !== -1 && undefinedIndex !== domainNames.length - 1) {
|
|
@@ -110,9 +115,10 @@ function OpenshiftDropdownV4(props) {
|
|
|
110
115
|
domainNames.forEach((domain, index) => {
|
|
111
116
|
domain !== 'undefined' &&
|
|
112
117
|
clusterOptions.push(React.createElement(SelectOption, { isDisabled: true, className: "pf-u-font-weight-bold pf-u-color-400", value: createState(domain, domain), key: domain + index }));
|
|
113
|
-
clustersResponseGrouped[domain]
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
clustersResponseGrouped[domain] &&
|
|
119
|
+
clustersResponseGrouped[domain].forEach((cluster, i) => {
|
|
120
|
+
clusterOptions.push(React.createElement(SelectOption, { key: cluster.external_cluster_id, value: createState(cluster.external_cluster_id, cluster.display_name) }));
|
|
121
|
+
});
|
|
116
122
|
clusterOptions.push(React.createElement(Divider, { component: "div", key: index + domain }));
|
|
117
123
|
});
|
|
118
124
|
return [
|
|
@@ -142,50 +148,43 @@ function OpenshiftDropdownV4(props) {
|
|
|
142
148
|
let controller = new AbortController();
|
|
143
149
|
abortControllerRef.current = controller;
|
|
144
150
|
let clustersResponse;
|
|
151
|
+
let total;
|
|
145
152
|
// query language: https://github.com/yaacov/tree-search-language
|
|
146
|
-
// old api has dns info
|
|
153
|
+
// old api has dns info
|
|
147
154
|
// new api doesn't have dns info but we can exclude archived clusters
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
155
|
+
// call old api get all clusters and call new api get limitted number of clusters
|
|
156
|
+
// then add dns info to the new api response
|
|
157
|
+
const clustersResponses = yield Promise.allSettled([
|
|
158
|
+
cloud.getAccountClustersSubscription({
|
|
151
159
|
order: 'display_name asc',
|
|
152
160
|
page,
|
|
153
161
|
size: PER_PAGE,
|
|
162
|
+
search: `${showArchivedClusters ? '' : "status!='Archived' AND "} (external_cluster_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%')`,
|
|
163
|
+
fields: 'external_cluster_id,display_name,status,metrics.openshift_version',
|
|
164
|
+
}, controller.signal),
|
|
165
|
+
cloud.getAccountClusters({
|
|
166
|
+
order: 'display_name asc',
|
|
167
|
+
page: 1,
|
|
168
|
+
size: OLD_API_PER_PAGE_GET_ALL,
|
|
154
169
|
search: `external_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%' OR dns.base_domain ILIKE '%${search}%'`,
|
|
155
|
-
}, controller.signal)
|
|
156
|
-
|
|
170
|
+
}, controller.signal),
|
|
171
|
+
]);
|
|
172
|
+
if (clustersResponses[0].status === 'fulfilled' && clustersResponses[1].status === 'fulfilled') {
|
|
173
|
+
const newApi = ((_a = clustersResponses[0].value) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
174
|
+
const oldApi = ((_b = clustersResponses[1].value) === null || _b === void 0 ? void 0 : _b.items) || [];
|
|
175
|
+
clustersResponse = map(newApi, function (item) {
|
|
176
|
+
return merge(item, find(oldApi, { external_id: item.external_cluster_id }));
|
|
177
|
+
});
|
|
178
|
+
total = clustersResponses[0].value.total;
|
|
179
|
+
}
|
|
180
|
+
else if (clustersResponses[0].status === 'fulfilled' && clustersResponses[1].status === 'rejected') {
|
|
181
|
+
// old api used only for getting dns info therefore if fails still we have clusterIds
|
|
182
|
+
clustersResponse = clustersResponses[0].value.items;
|
|
183
|
+
total = clustersResponses[0].value.total;
|
|
157
184
|
}
|
|
158
185
|
else {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const clustersResponses = yield Promise.allSettled([
|
|
162
|
-
cloud.getAccountClustersSubscription({
|
|
163
|
-
order: 'display_name asc',
|
|
164
|
-
page,
|
|
165
|
-
size: PER_PAGE,
|
|
166
|
-
search: `${showArchivedClusters ? '' : "status!='Archived' AND "} (external_cluster_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%')`,
|
|
167
|
-
fields: 'external_cluster_id,display_name,status,metrics.openshift_version',
|
|
168
|
-
}, controller.signal),
|
|
169
|
-
cloud.getAccountClusters({
|
|
170
|
-
order: 'display_name asc',
|
|
171
|
-
page: 1,
|
|
172
|
-
size: OLD_API_PER_PAGE_GET_ALL,
|
|
173
|
-
search: `external_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%' OR dns.base_domain ILIKE '%${search}%'`,
|
|
174
|
-
}, controller.signal),
|
|
175
|
-
]);
|
|
176
|
-
if (clustersResponses[0].status === 'fulfilled' && clustersResponses[1].status === 'fulfilled') {
|
|
177
|
-
const newApi = ((_a = clustersResponses[0].value) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
178
|
-
const oldApi = ((_b = clustersResponses[1].value) === null || _b === void 0 ? void 0 : _b.items) || [];
|
|
179
|
-
clustersResponse = map(newApi, function (item) {
|
|
180
|
-
return merge(item, find(oldApi, { external_id: item.external_cluster_id }));
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
else if (clustersResponses[0].status === 'fulfilled' && clustersResponses[1].status === 'rejected') {
|
|
184
|
-
clustersResponse = clustersResponses[0].value.items;
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
clustersResponse = [];
|
|
188
|
-
}
|
|
186
|
+
clustersResponse = [];
|
|
187
|
+
total = 0;
|
|
189
188
|
}
|
|
190
189
|
const items = clustersResponse.map((item) => {
|
|
191
190
|
var _a, _b;
|
|
@@ -201,12 +200,13 @@ function OpenshiftDropdownV4(props) {
|
|
|
201
200
|
items,
|
|
202
201
|
totalResult: clustersResponse.length,
|
|
203
202
|
page,
|
|
203
|
+
total,
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
206
|
catch (e) {
|
|
207
207
|
// silently fails
|
|
208
208
|
setIsFetchingClusters(false);
|
|
209
|
-
return { items: [], totalResult: 0, page: 0 };
|
|
209
|
+
return { items: [], totalResult: 0, page: 0, total: 0 };
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
// need to get clusters on load
|
|
@@ -217,8 +217,9 @@ function OpenshiftDropdownV4(props) {
|
|
|
217
217
|
const fetchClusters = () => __awaiter(this, void 0, void 0, function* () {
|
|
218
218
|
const fetchedClusters = yield fetchAccountClusters(inputVal);
|
|
219
219
|
if (!isUnmounted) {
|
|
220
|
-
setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
|
|
221
220
|
setClustersRawResponse(fetchedClusters.items);
|
|
221
|
+
setTotalResultsNo(fetchedClusters.total);
|
|
222
|
+
setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
|
|
222
223
|
}
|
|
223
224
|
});
|
|
224
225
|
fetchClusters();
|
|
@@ -239,15 +240,16 @@ function OpenshiftDropdownV4(props) {
|
|
|
239
240
|
setInputVal(input);
|
|
240
241
|
props.onClusterIdStateUpdate(createState(input, input));
|
|
241
242
|
const fetchedClusters = yield fetchAccountClusters(input);
|
|
242
|
-
setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
|
|
243
243
|
setClustersRawResponse(fetchedClusters.items);
|
|
244
|
+
setTotalResultsNo(fetchedClusters.total);
|
|
245
|
+
setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
|
|
244
246
|
});
|
|
245
247
|
const getSelectedItem = () => {
|
|
246
248
|
if (!isEmpty(inputVal)) {
|
|
247
249
|
return createState(props.openshiftClusterIDState, inputVal);
|
|
248
250
|
}
|
|
249
251
|
else {
|
|
250
|
-
return createState(props.openshiftClusterIDState, getDisplayNameById(clustersRawResponse, props.openshiftClusterIDState));
|
|
252
|
+
return createState(props.openshiftClusterIDState, getDisplayNameById(clustersRawResponse, props.openshiftClusterIDState, props.noClusterIdReasonExplanation));
|
|
251
253
|
}
|
|
252
254
|
};
|
|
253
255
|
const titleId = 'case-details-cluster-nickname-selector';
|
|
@@ -259,7 +261,7 @@ function OpenshiftDropdownV4(props) {
|
|
|
259
261
|
React.createElement(CaseOpenShiftPopover, null)),
|
|
260
262
|
React.createElement("span", { id: titleId, hidden: true }, "Select a state"),
|
|
261
263
|
React.createElement(Select, Object.assign({ variant: SelectVariant.typeahead, isDisabled: props.isDisabled, typeAheadAriaLabel: t('Search by Cluster ID, alias, and domain or manually enter your Cluster ID'), onToggle: onToggle, onSelect: onSelect, onClear: onDropdownClear, selections: getSelectedItem(), isOpen: isOpen, "aria-labelledby": titleId, placeholderText: t('Search by Cluster ID, alias, and domain or manually enter your Cluster ID'), hasInlineFilter: false, onTypeaheadInputChanged: onTypeaheadInputChanged, onFilter: () => undefined, validated: validated, "aria-invalid": props.isClusterIdInvalid, "aria-describedby": "clusterID-validate-helper", required: true }, (isFetchingClusters && { loadingVariant: 'spinner' }), (!isFetchingClusters &&
|
|
262
|
-
|
|
264
|
+
clustersRawResponse.length < totalResultsNo && {
|
|
263
265
|
loadingVariant: {
|
|
264
266
|
text: 'Display additional results',
|
|
265
267
|
onClick: onViewMoreClick,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseHelpers.d.ts","sourceRoot":"","sources":["../../../src/reducers/CaseHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAW3D,OAAO,EAMH,UAAU,EAcb,MAAM,mBAA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 @@ export const isClusterIDValid = (caseState, allProducts) => {
|
|
|
118
118
|
case_details.noClusterIdReason === 'Other' &&
|
|
119
119
|
!isEmpty(case_details.noClusterIdReasonExplanation) &&
|
|
120
120
|
isEmpty(caseState.v3ClusterName);
|
|
121
|
-
const hasValidV3ClusterName = () => isEmpty(case_details.openshiftClusterID) &&
|
|
122
|
-
isEmpty(case_details.noClusterIdReason) &&
|
|
123
|
-
isEmpty(case_details.noClusterIdReasonExplanation) &&
|
|
124
|
-
!isEmpty(caseState.v3ClusterName);
|
|
121
|
+
const hasValidV3ClusterName = () => isEmpty(case_details.openshiftClusterID) && !isEmpty(caseState.v3ClusterName);
|
|
125
122
|
return productHasClusterID
|
|
126
123
|
? hasValidClusterId() || hasValidReason() || hasValidReasonExplanation() || hasValidV3ClusterName()
|
|
127
124
|
: true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.104",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@progress/kendo-react-pdf": "^3.12.0",
|
|
76
76
|
"@rh-support/api": "0.3.15",
|
|
77
77
|
"@rh-support/components": "1.1.59",
|
|
78
|
-
"@rh-support/react-context": "0.2.
|
|
78
|
+
"@rh-support/react-context": "0.2.61",
|
|
79
79
|
"@rh-support/types": "0.2.0",
|
|
80
80
|
"@rh-support/user-permissions": "0.2.47",
|
|
81
81
|
"@rh-support/utils": "0.2.36",
|
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
"not ie <= 11",
|
|
144
144
|
"not op_mini all"
|
|
145
145
|
],
|
|
146
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "f2b203085e179115277901c8d155d7c72f7f152e"
|
|
147
147
|
}
|