@rh-support/troubleshoot 0.2.102 → 0.2.106
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/CaseAlternateId.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseHostname.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.js +2 -4
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.js +1 -1
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +2 -4
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts +3 -3
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +36 -100
- package/lib/esm/components/ImproveCase/Hostname.js +1 -2
- package/lib/esm/utils/caseOpenshiftClusterIdUtils.d.ts +3 -3
- package/lib/esm/utils/caseOpenshiftClusterIdUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseOpenshiftClusterIdUtils.js +4 -5
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ function CaseAlternateId(props) {
|
|
|
53
53
|
const updateAlternateId = () => __awaiter(this, void 0, void 0, function* () {
|
|
54
54
|
try {
|
|
55
55
|
setIsUpdating(true);
|
|
56
|
-
const caseDetails = { alternateId: alternateIdState };
|
|
56
|
+
const caseDetails = { alternateId: alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.trim() };
|
|
57
57
|
yield updateCaseDetails(caseDispatch, caseNumber, caseDetails);
|
|
58
58
|
ToastNotification.addSuccessMessage(t(`Alternate case ID has been successfully updated`));
|
|
59
59
|
setIsUpdating(false);
|
|
@@ -64,7 +64,7 @@ function CaseHostname(props) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
const onSave = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const caseDetails = { hostname: hostnameState };
|
|
67
|
+
const caseDetails = { hostname: hostnameState === null || hostnameState === void 0 ? void 0 : hostnameState.trim() };
|
|
68
68
|
try {
|
|
69
69
|
yield onHostnameUpdate(caseDetails);
|
|
70
70
|
setLocalHostnameChange(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,sBAAsB,gBAqRrC"}
|
|
@@ -55,9 +55,7 @@ export function CaseOpenshiftClusterId() {
|
|
|
55
55
|
if (!openshiftClusterID || getIsClusterIdInvalid(openshiftClusterID))
|
|
56
56
|
return;
|
|
57
57
|
let openshiftClusterVersion;
|
|
58
|
-
if (clusterDetails &&
|
|
59
|
-
clusterDetails.external_cluster_id === openshiftClusterID &&
|
|
60
|
-
clusterDetails.openshift_version) {
|
|
58
|
+
if (clusterDetails && clusterDetails.external_id === openshiftClusterID && clusterDetails.openshift_version) {
|
|
61
59
|
openshiftClusterVersion = clusterDetails.openshift_version;
|
|
62
60
|
}
|
|
63
61
|
else {
|
|
@@ -130,7 +128,7 @@ export function CaseOpenshiftClusterId() {
|
|
|
130
128
|
}
|
|
131
129
|
});
|
|
132
130
|
const onClusterIdSave = (selectedCluster) => __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
const selectedClusterId = selectedCluster === null || selectedCluster === void 0 ? void 0 : selectedCluster.
|
|
131
|
+
const selectedClusterId = selectedCluster === null || selectedCluster === void 0 ? void 0 : selectedCluster.external_id;
|
|
134
132
|
if (isEmpty(selectedClusterId))
|
|
135
133
|
return;
|
|
136
134
|
setLocalOpenshiftClusterIDState(selectedClusterId);
|
|
@@ -67,7 +67,7 @@ function Summary(props) {
|
|
|
67
67
|
});
|
|
68
68
|
const onSave = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
69
69
|
setHasLargeSummary(false);
|
|
70
|
-
const caseDetails = { summary: summaryState };
|
|
70
|
+
const caseDetails = { summary: summaryState === null || summaryState === void 0 ? void 0 : summaryState.trim() };
|
|
71
71
|
if (caseNumber) {
|
|
72
72
|
// edit/view case
|
|
73
73
|
try {
|
|
@@ -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,gBA6RjC"}
|
|
@@ -96,9 +96,7 @@ export function OpenShiftClusterId() {
|
|
|
96
96
|
if (!openshiftClusterID || getIsClusterIdInvalid(openshiftClusterID))
|
|
97
97
|
return;
|
|
98
98
|
let openshiftClusterVersion;
|
|
99
|
-
if (clusterDetails &&
|
|
100
|
-
clusterDetails.external_cluster_id === openshiftClusterID &&
|
|
101
|
-
clusterDetails.openshift_version) {
|
|
99
|
+
if (clusterDetails && clusterDetails.external_id === openshiftClusterID && clusterDetails.openshift_version) {
|
|
102
100
|
openshiftClusterVersion = clusterDetails.openshift_version;
|
|
103
101
|
}
|
|
104
102
|
else {
|
|
@@ -165,7 +163,7 @@ export function OpenShiftClusterId() {
|
|
|
165
163
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
164
|
}, [noClusterIdReason]);
|
|
167
165
|
const onClusterIdStateUpdate = (selectedCluster) => {
|
|
168
|
-
const selectedId = selectedCluster
|
|
166
|
+
const selectedId = selectedCluster.external_id;
|
|
169
167
|
if (isEmpty(selectedId))
|
|
170
168
|
return;
|
|
171
169
|
resetClusterData();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICluster } from '@rh-support/api';
|
|
2
2
|
import { IDClassNameProps } from '@rh-support/types/shared';
|
|
3
3
|
interface IProps extends IDClassNameProps {
|
|
4
4
|
openshiftClusterIDState: string;
|
|
5
|
-
onClusterIdStateUpdate: (cluster: Partial<
|
|
5
|
+
onClusterIdStateUpdate: (cluster: Partial<ICluster>, value?: string) => void;
|
|
6
6
|
isClusterIdInvalid: boolean;
|
|
7
7
|
clusterIdDropdownFormInstructions?: JSX.Element;
|
|
8
8
|
onClusterClear: () => void;
|
|
@@ -10,7 +10,7 @@ interface IProps extends IDClassNameProps {
|
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
noClusterIdReasonExplanation?: string;
|
|
12
12
|
}
|
|
13
|
-
declare const fetchClusterIdDetails: (clusterId: string) => Promise<
|
|
13
|
+
declare const fetchClusterIdDetails: (clusterId: string) => Promise<ICluster>;
|
|
14
14
|
declare function OpenshiftDropdownV4(props: IProps): JSX.Element;
|
|
15
15
|
declare namespace OpenshiftDropdownV4 {
|
|
16
16
|
var defaultProps: {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,QAAQ,EAAqB,MAAM,iBAAiB,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAuB,MAAM,0BAA0B,CAAC;AAUjF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7E,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;AAcD,QAAA,MAAM,qBAAqB,cAAqB,MAAM,sBASrD,CAAC;AAeF,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA6OzC;kBA7OQ,mBAAmB;;;AAgP5B,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -7,13 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { Divider, Select, SelectOption, SelectVariant } from '@patternfly/react-core';
|
|
11
|
+
import { getAccountClusters } from '@rh-support/api';
|
|
12
|
+
import { useFetch } from '@rh-support/components';
|
|
12
13
|
import find from 'lodash/find';
|
|
13
14
|
import groupBy from 'lodash/groupBy';
|
|
14
15
|
import isEmpty from 'lodash/isEmpty';
|
|
15
|
-
import map from 'lodash/map';
|
|
16
|
-
import merge from 'lodash/merge';
|
|
17
16
|
import React, { useEffect, useRef, useState } from 'react';
|
|
18
17
|
import { Trans, useTranslation } from 'react-i18next';
|
|
19
18
|
import { getDisplayNameForCluster } from '../../utils/caseOpenshiftClusterIdUtils';
|
|
@@ -25,19 +24,19 @@ const defaultProps = {
|
|
|
25
24
|
};
|
|
26
25
|
const fetchClusterIdDetails = (clusterId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
26
|
try {
|
|
28
|
-
const clustersResponse = yield
|
|
27
|
+
const clustersResponse = yield getAccountClusters({
|
|
29
28
|
order: 'display_name asc',
|
|
30
|
-
search: `external_id ILIKE
|
|
29
|
+
search: `external_id ILIKE '%${clusterId}%'`,
|
|
31
30
|
});
|
|
32
31
|
const clusterDetails = (clustersResponse.items || []).find((item) => item.external_id === clusterId);
|
|
33
32
|
return clusterDetails;
|
|
34
33
|
}
|
|
35
34
|
catch (e) { }
|
|
36
35
|
});
|
|
37
|
-
const createState = (
|
|
36
|
+
const createState = (external_id, display_name) => {
|
|
38
37
|
return {
|
|
39
38
|
display_name,
|
|
40
|
-
|
|
39
|
+
external_id,
|
|
41
40
|
toString: () => display_name || '',
|
|
42
41
|
compareTo: function (value) {
|
|
43
42
|
const displayName = this.toString().toLowerCase();
|
|
@@ -48,28 +47,25 @@ const createState = (external_cluster_id, display_name) => {
|
|
|
48
47
|
};
|
|
49
48
|
function OpenshiftDropdownV4(props) {
|
|
50
49
|
const { t } = useTranslation();
|
|
51
|
-
const OLD_API_PER_PAGE_GET_ALL = 5000;
|
|
52
50
|
const PER_PAGE = 200;
|
|
51
|
+
const { request: getAccountClustersRequest, isFetching: isFetchingClusters } = useFetch(getAccountClusters, {
|
|
52
|
+
propgateErrors: true,
|
|
53
|
+
});
|
|
53
54
|
const [clustersRawResponse, setClustersRawResponse] = useState([]);
|
|
54
55
|
const abortControllerRef = useRef(undefined);
|
|
55
56
|
const [clustersSelectOptions, setClustersSelectOptions] = useState([]);
|
|
56
57
|
const [isOpen, setIsOpen] = useState(false);
|
|
57
58
|
const [validated, setValidated] = useState('default');
|
|
58
59
|
const [inputVal, setInputVal] = useState('');
|
|
59
|
-
const [showArchivedClusters, setShowArchivedClusters] = useState(false);
|
|
60
|
-
const [isFetchingClusters, setIsFetchingClusters] = useState(false);
|
|
61
60
|
// gets a cluster id and returns display name
|
|
62
|
-
const getDisplayNameById = (clusters, id
|
|
61
|
+
const getDisplayNameById = (clusters, id) => {
|
|
63
62
|
if (isEmpty(id))
|
|
64
63
|
return '';
|
|
65
|
-
if (id === 'dont-have-id')
|
|
66
|
-
return
|
|
67
|
-
? t('The case is for a v3 cluster')
|
|
68
|
-
: t("I don't have my Cluster ID");
|
|
69
|
-
}
|
|
64
|
+
if (id === 'dont-have-id')
|
|
65
|
+
return t("I don't have my Cluster ID");
|
|
70
66
|
if (id === 'v3-cluster')
|
|
71
67
|
return t('The case is for a v3 cluster');
|
|
72
|
-
const cluster = find(clusters, (o) => o.
|
|
68
|
+
const cluster = find(clusters, (o) => o.external_id === id);
|
|
73
69
|
return isEmpty(cluster) ? id : getDisplayNameForCluster(cluster);
|
|
74
70
|
};
|
|
75
71
|
const onDropdownClear = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -79,24 +75,15 @@ function OpenshiftDropdownV4(props) {
|
|
|
79
75
|
});
|
|
80
76
|
const onToggle = (isOpen) => setIsOpen(isOpen);
|
|
81
77
|
const onViewMoreClick = () => __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
const fetchedClusters = yield fetchAccountClusters(
|
|
78
|
+
const fetchedClusters = yield fetchAccountClusters();
|
|
83
79
|
const clusterResponse = [...clustersRawResponse, ...fetchedClusters.items];
|
|
84
80
|
setClustersRawResponse(clusterResponse);
|
|
85
81
|
setClustersSelectOptions(getClusterOptions(clusterResponse));
|
|
86
82
|
});
|
|
87
83
|
const onSelect = (event, selectedCluster) => __awaiter(this, void 0, void 0, function* () {
|
|
88
84
|
setInputVal('');
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
setShowArchivedClusters(!showArchivedClusters);
|
|
92
|
-
// reset
|
|
93
|
-
props.onClusterClear();
|
|
94
|
-
setClustersRawResponse([]);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
props.onClusterIdStateUpdate(selectedCluster);
|
|
98
|
-
setIsOpen(false);
|
|
99
|
-
}
|
|
85
|
+
props.onClusterIdStateUpdate(selectedCluster);
|
|
86
|
+
setIsOpen(false);
|
|
100
87
|
});
|
|
101
88
|
const getClusterOptions = (clusters) => {
|
|
102
89
|
const clustersResponseGrouped = groupBy(clusters, 'dns.base_domain') || [];
|
|
@@ -114,28 +101,22 @@ function OpenshiftDropdownV4(props) {
|
|
|
114
101
|
domain !== 'undefined' &&
|
|
115
102
|
clusterOptions.push(React.createElement(SelectOption, { isDisabled: true, className: "pf-u-font-weight-bold pf-u-color-400", value: createState(domain, domain), key: domain + index }));
|
|
116
103
|
clustersResponseGrouped[domain].forEach((cluster, i) => {
|
|
117
|
-
clusterOptions.push(React.createElement(SelectOption, { key: cluster.
|
|
104
|
+
clusterOptions.push(React.createElement(SelectOption, { key: i + cluster.external_id, value: createState(cluster.external_id, cluster.display_name) }));
|
|
118
105
|
});
|
|
119
106
|
clusterOptions.push(React.createElement(Divider, { component: "div", key: index + domain }));
|
|
120
107
|
});
|
|
121
108
|
return [
|
|
122
|
-
|
|
123
|
-
React.createElement(Checkbox, { label: t('Show archived clusters'), key: "show-archived-clusters", "aria-label": t('Show archived clusters'), id: "show-archived-clusters", "data-tracking-id": "show-hide-archived-clusters", isChecked: showArchivedClusters })),
|
|
124
|
-
React.createElement(Divider, { component: "div", key: 'cluster-id-options-divider-e' }),
|
|
125
|
-
React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")) }),
|
|
109
|
+
...clusterOptions,
|
|
126
110
|
...(!props.isV4
|
|
127
111
|
? [
|
|
128
112
|
React.createElement(SelectOption, { key: 'v3-cluster', value: createState('v3-cluster', t('The case is for a v3 cluster')) }),
|
|
129
113
|
]
|
|
130
114
|
: []),
|
|
131
|
-
|
|
132
|
-
...clusterOptions,
|
|
115
|
+
React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")) }),
|
|
133
116
|
];
|
|
134
117
|
};
|
|
135
118
|
const fetchAccountClusters = (search = '') => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
var _a, _b;
|
|
137
119
|
const page = Math.floor(clustersRawResponse.length / PER_PAGE) + 1;
|
|
138
|
-
setIsFetchingClusters(true);
|
|
139
120
|
try {
|
|
140
121
|
if (abortControllerRef.current !== undefined) {
|
|
141
122
|
// Cancel the previous request
|
|
@@ -144,71 +125,26 @@ function OpenshiftDropdownV4(props) {
|
|
|
144
125
|
// recreate a new AbortController for each call
|
|
145
126
|
let controller = new AbortController();
|
|
146
127
|
abortControllerRef.current = controller;
|
|
147
|
-
let clustersResponse;
|
|
148
128
|
// query language: https://github.com/yaacov/tree-search-language
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
// call old api get all clusters and call new api get limitted number of clusters
|
|
163
|
-
// then add dns info to the new api response
|
|
164
|
-
const clustersResponses = yield Promise.allSettled([
|
|
165
|
-
cloud.getAccountClustersSubscription({
|
|
166
|
-
order: 'display_name asc',
|
|
167
|
-
page,
|
|
168
|
-
size: PER_PAGE,
|
|
169
|
-
search: `${showArchivedClusters ? '' : "status!='Archived' AND "} (external_cluster_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%')`,
|
|
170
|
-
fields: 'external_cluster_id,display_name,status,metrics.openshift_version',
|
|
171
|
-
}, controller.signal),
|
|
172
|
-
cloud.getAccountClusters({
|
|
173
|
-
order: 'display_name asc',
|
|
174
|
-
page: 1,
|
|
175
|
-
size: OLD_API_PER_PAGE_GET_ALL,
|
|
176
|
-
search: `external_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%' OR dns.base_domain ILIKE '%${search}%'`,
|
|
177
|
-
}, controller.signal),
|
|
178
|
-
]);
|
|
179
|
-
if (clustersResponses[0].status === 'fulfilled' && clustersResponses[1].status === 'fulfilled') {
|
|
180
|
-
const newApi = ((_a = clustersResponses[0].value) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
181
|
-
const oldApi = ((_b = clustersResponses[1].value) === null || _b === void 0 ? void 0 : _b.items) || [];
|
|
182
|
-
clustersResponse = map(newApi, function (item) {
|
|
183
|
-
return merge(item, find(oldApi, { external_id: item.external_cluster_id }));
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
else if (clustersResponses[0].status === 'fulfilled' && clustersResponses[1].status === 'rejected') {
|
|
187
|
-
clustersResponse = clustersResponses[0].value.items;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
clustersResponse = [];
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
const items = clustersResponse.map((item) => {
|
|
194
|
-
var _a, _b;
|
|
195
|
-
return ({
|
|
196
|
-
display_name: getDisplayNameForCluster(item),
|
|
197
|
-
external_cluster_id: item.external_cluster_id || item.external_id,
|
|
198
|
-
openshift_version: item.openshift_version || ((_b = (_a = item === null || item === void 0 ? void 0 : item.metrics) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.openshift_version) || '',
|
|
199
|
-
dns: item.dns || {},
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
setIsFetchingClusters(false);
|
|
129
|
+
const clustersResponse = yield getAccountClustersRequest({
|
|
130
|
+
order: 'display_name asc',
|
|
131
|
+
page,
|
|
132
|
+
size: PER_PAGE,
|
|
133
|
+
search: `external_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%' OR dns.base_domain ILIKE '%${search}%'`,
|
|
134
|
+
}, controller.signal);
|
|
135
|
+
const items = clustersResponse.items.map((item) => ({
|
|
136
|
+
display_name: getDisplayNameForCluster(item),
|
|
137
|
+
external_id: item.external_id,
|
|
138
|
+
dns: item.dns,
|
|
139
|
+
}));
|
|
203
140
|
return {
|
|
204
141
|
items,
|
|
205
|
-
totalResult: clustersResponse.
|
|
206
|
-
page,
|
|
142
|
+
totalResult: clustersResponse.total,
|
|
143
|
+
page: clustersResponse.page,
|
|
207
144
|
};
|
|
208
145
|
}
|
|
209
146
|
catch (e) {
|
|
210
147
|
// silently fails
|
|
211
|
-
setIsFetchingClusters(false);
|
|
212
148
|
return { items: [], totalResult: 0, page: 0 };
|
|
213
149
|
}
|
|
214
150
|
});
|
|
@@ -218,7 +154,7 @@ function OpenshiftDropdownV4(props) {
|
|
|
218
154
|
useEffect(() => {
|
|
219
155
|
let isUnmounted = false;
|
|
220
156
|
const fetchClusters = () => __awaiter(this, void 0, void 0, function* () {
|
|
221
|
-
const fetchedClusters = yield fetchAccountClusters(
|
|
157
|
+
const fetchedClusters = yield fetchAccountClusters();
|
|
222
158
|
if (!isUnmounted) {
|
|
223
159
|
setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
|
|
224
160
|
setClustersRawResponse(fetchedClusters.items);
|
|
@@ -229,7 +165,7 @@ function OpenshiftDropdownV4(props) {
|
|
|
229
165
|
isUnmounted = true;
|
|
230
166
|
};
|
|
231
167
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
232
|
-
}, [props.isV4
|
|
168
|
+
}, [props.isV4]);
|
|
233
169
|
useEffect(() => {
|
|
234
170
|
if (props.isClusterIdInvalid) {
|
|
235
171
|
setValidated('error');
|
|
@@ -250,7 +186,7 @@ function OpenshiftDropdownV4(props) {
|
|
|
250
186
|
return createState(props.openshiftClusterIDState, inputVal);
|
|
251
187
|
}
|
|
252
188
|
else {
|
|
253
|
-
return createState(props.openshiftClusterIDState, getDisplayNameById(clustersRawResponse, props.openshiftClusterIDState
|
|
189
|
+
return createState(props.openshiftClusterIDState, getDisplayNameById(clustersRawResponse, props.openshiftClusterIDState));
|
|
254
190
|
}
|
|
255
191
|
};
|
|
256
192
|
const titleId = 'case-details-cluster-nickname-selector';
|
|
@@ -13,8 +13,7 @@ export function Hostname(props) {
|
|
|
13
13
|
setCaseDetails(caseDispatch, caseDetails);
|
|
14
14
|
};
|
|
15
15
|
const onHostnameChange = (e) => {
|
|
16
|
-
|
|
17
|
-
onCaseDetailsChange({ hostname: (_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim() });
|
|
16
|
+
onCaseDetailsChange({ hostname: e.target.value });
|
|
18
17
|
};
|
|
19
18
|
if (!canUseHostName) {
|
|
20
19
|
return React.createElement(React.Fragment, null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IClusterSubscriptionExtended } from '@cee-eng/hydrajs/@types/models/cloud';
|
|
2
1
|
import { ISEProduct } from '@cee-eng/hydrajs/@types/models/product';
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
2
|
+
import { ICluster } from '@rh-support/api';
|
|
3
|
+
export declare const getDisplayNameById: (clusters: Partial<ICluster>[], id: string) => string;
|
|
4
|
+
export declare const getDisplayNameForCluster: (cluster: Partial<ICluster>) => string;
|
|
5
5
|
export declare const invalidGuidHelperText = "Please enter a valid Cluster ID (For example: d3aa88e2-c754-41e0-8ba6-4198a34aa0a2)";
|
|
6
6
|
export declare const isClusterIdEnabledForProduct: (selectedProduct: string, allProducts: Partial<ISEProduct>[]) => boolean;
|
|
7
7
|
export declare const isOpenShiftV3Product: (product: string, pcmConfig: any) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseOpenshiftClusterIdUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseOpenshiftClusterIdUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"caseOpenshiftClusterIdUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseOpenshiftClusterIdUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAM3C,eAAO,MAAM,kBAAkB,aAAc,QAAQ,QAAQ,CAAC,EAAE,MAAM,MAAM,WAI3E,CAAC;AAEF,eAAO,MAAM,wBAAwB,YAAa,QAAQ,QAAQ,CAAC,WAIlE,CAAC;AAEF,eAAO,MAAM,qBAAqB,wFACuD,CAAC;AAE1F,eAAO,MAAM,4BAA4B,oBAAqB,MAAM,eAAe,QAAQ,UAAU,CAAC,EAAE,YAIvG,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,MAAM,4BAenD,CAAC;AAEF,eAAO,MAAM,qBAAqB,sCACkC,CAAC"}
|
|
@@ -5,16 +5,15 @@ import isEmpty from 'lodash/isEmpty';
|
|
|
5
5
|
export const getDisplayNameById = (clusters, id) => {
|
|
6
6
|
if (isEmpty(id))
|
|
7
7
|
return '';
|
|
8
|
-
const cluster = find(clusters, (o) => o.
|
|
8
|
+
const cluster = find(clusters, (o) => o.external_id === id);
|
|
9
9
|
return isEmpty(cluster) ? `${id}` : cluster.display_name;
|
|
10
10
|
};
|
|
11
11
|
export const getDisplayNameForCluster = (cluster) => {
|
|
12
12
|
if (isEmpty(cluster))
|
|
13
13
|
return '';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return `${clusterId} <${cluster.display_name}>`;
|
|
14
|
+
if (isEmpty(cluster.display_name) || cluster.display_name === cluster.external_id)
|
|
15
|
+
return `${cluster.external_id}`;
|
|
16
|
+
return `${cluster.external_id} <${cluster.display_name}>`;
|
|
18
17
|
};
|
|
19
18
|
export const invalidGuidHelperText = 'Please enter a valid Cluster ID (For example: d3aa88e2-c754-41e0-8ba6-4198a34aa0a2)';
|
|
20
19
|
export const isClusterIdEnabledForProduct = (selectedProduct, allProducts) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.106",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
"@patternfly/react-core": "4.202.16",
|
|
74
74
|
"@progress/kendo-drawing": "^1.6.0",
|
|
75
75
|
"@progress/kendo-react-pdf": "^3.12.0",
|
|
76
|
-
"@rh-support/api": "0.3.
|
|
77
|
-
"@rh-support/components": "1.1.
|
|
78
|
-
"@rh-support/react-context": "0.2.
|
|
76
|
+
"@rh-support/api": "0.3.16",
|
|
77
|
+
"@rh-support/components": "1.1.60",
|
|
78
|
+
"@rh-support/react-context": "0.2.62",
|
|
79
79
|
"@rh-support/types": "0.2.0",
|
|
80
|
-
"@rh-support/user-permissions": "0.2.
|
|
81
|
-
"@rh-support/utils": "0.2.
|
|
80
|
+
"@rh-support/user-permissions": "0.2.48",
|
|
81
|
+
"@rh-support/utils": "0.2.37",
|
|
82
82
|
"@types/react-redux": "^7.1.12",
|
|
83
83
|
"@types/redux": "^3.6.0",
|
|
84
84
|
"@webcomponents/webcomponentsjs": "^2.2.10",
|
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
"not ie <= 11",
|
|
144
144
|
"not op_mini all"
|
|
145
145
|
],
|
|
146
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "16a9ab39fc63d39d0816ee2ef890c2f0ff2282e4"
|
|
147
147
|
}
|