@rh-support/troubleshoot 0.2.104 → 0.2.107

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.
@@ -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,gBA4RrC"}
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.external_cluster_id;
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 {
@@ -153,13 +153,13 @@ export function Cep(props) {
153
153
  React.createElement(Trans, null, "Contact information"),
154
154
  "\u00A0",
155
155
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")),
156
- React.createElement(TextAreaResizable, { id: "cep-contactInformation", className: `form-control`, "aria-required": true, required: true, maxLength: 2000, name: "cep-contactInformation", value: cepDetailsLocal.contactInformation, onChange: onCepContactInformationsChange, "aria-label": "auto resizing text area example", isSpaceAllowed: false, autoResize: true }),
156
+ React.createElement(TextAreaResizable, { id: "cep-contactInformation", className: `form-control`, "aria-required": true, isRequired: true, maxLength: 2000, name: "cep-contactInformation", value: cepDetailsLocal.contactInformation, onChange: onCepContactInformationsChange, "aria-label": "auto resizing text area example", isSpaceAllowed: false, autoResize: true }),
157
157
  React.createElement("p", { className: "form-instructions" },
158
158
  React.createElement(Trans, null, "Please provide phone number, chat ID or email."))),
159
159
  React.createElement("div", { className: "form-group" },
160
160
  React.createElement("label", { htmlFor: "cep-notes" },
161
161
  React.createElement(Trans, null, "Notes")),
162
- React.createElement(TextAreaResizable, { id: "cep-notes", className: `form-control`, "aria-required": true, required: true, maxLength: 2000, name: "cep-notese", value: cepDetailsLocal.notes, onChange: onCepNotesChange, isSpaceAllowed: false, autoResize: true }),
162
+ React.createElement(TextAreaResizable, { id: "cep-notes", className: `form-control`, "aria-required": false, isRequired: false, maxLength: 2000, name: "cep-notese", value: cepDetailsLocal.notes, onChange: onCepNotesChange, isSpaceAllowed: false, autoResize: true }),
163
163
  React.createElement("p", { className: "form-instructions" },
164
164
  React.createElement(Trans, null, "Provide any pertinent information that Red Hat Support should be aware of that's not already captured in the issue statement or comments.")))))));
165
165
  }
@@ -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,gBAoSjC"}
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 === null || selectedCluster === void 0 ? void 0 : selectedCluster.external_cluster_id;
166
+ const selectedId = selectedCluster.external_id;
169
167
  if (isEmpty(selectedId))
170
168
  return;
171
169
  resetClusterData();
@@ -1,8 +1,8 @@
1
- import { IClusterSubscription } from '@cee-eng/hydrajs/@types/models/cloud';
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<IClusterSubscription>, value?: string) => void;
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<import("@cee-eng/hydrajs/@types/models/cloud").ICluster>;
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,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"}
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 { cloud } from '@cee-eng/hydrajs';
11
- import { Checkbox, Divider, Select, SelectOption, SelectVariant } from '@patternfly/react-core';
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 cloud.getAccountClusters({
27
+ const clustersResponse = yield getAccountClusters({
29
28
  order: 'display_name asc',
30
- search: `external_id ILIKE '%${clusterId}%'`,
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 = (external_cluster_id, display_name) => {
36
+ const createState = (external_id, display_name) => {
38
37
  return {
39
38
  display_name,
40
- external_cluster_id,
39
+ external_id,
41
40
  toString: () => display_name || '',
42
41
  compareTo: function (value) {
43
42
  const displayName = this.toString().toLowerCase();
@@ -48,29 +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 = 10000;
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
- const [totalResultsNo, setTotalResultsNo] = useState(0);
62
60
  // gets a cluster id and returns display name
63
- const getDisplayNameById = (clusters, id, noClusterIdReasonExplanation) => {
61
+ const getDisplayNameById = (clusters, id) => {
64
62
  if (isEmpty(id))
65
63
  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
- }
64
+ if (id === 'dont-have-id')
65
+ return t("I don't have my Cluster ID");
71
66
  if (id === 'v3-cluster')
72
67
  return t('The case is for a v3 cluster');
73
- const cluster = find(clusters, (o) => o.external_cluster_id === id);
68
+ const cluster = find(clusters, (o) => o.external_id === id);
74
69
  return isEmpty(cluster) ? id : getDisplayNameForCluster(cluster);
75
70
  };
76
71
  const onDropdownClear = () => __awaiter(this, void 0, void 0, function* () {
@@ -80,29 +75,19 @@ function OpenshiftDropdownV4(props) {
80
75
  });
81
76
  const onToggle = (isOpen) => setIsOpen(isOpen);
82
77
  const onViewMoreClick = () => __awaiter(this, void 0, void 0, function* () {
83
- const fetchedClusters = yield fetchAccountClusters(inputVal);
84
- const clusterResponse = [...clustersRawResponse, ...((fetchedClusters === null || fetchedClusters === void 0 ? void 0 : fetchedClusters.items) || [])];
78
+ const fetchedClusters = yield fetchAccountClusters();
79
+ const clusterResponse = [...clustersRawResponse, ...fetchedClusters.items];
85
80
  setClustersRawResponse(clusterResponse);
86
- setTotalResultsNo(fetchedClusters.total);
87
81
  setClustersSelectOptions(getClusterOptions(clusterResponse));
88
82
  });
89
83
  const onSelect = (event, selectedCluster) => __awaiter(this, void 0, void 0, function* () {
90
84
  setInputVal('');
91
- if (event.target.tagName !== 'BUTTON') {
92
- // checkbox is clicked
93
- setShowArchivedClusters(!showArchivedClusters);
94
- // reset
95
- props.onClusterClear();
96
- setClustersRawResponse([]);
97
- }
98
- else {
99
- props.onClusterIdStateUpdate(selectedCluster);
100
- setIsOpen(false);
101
- }
85
+ props.onClusterIdStateUpdate(selectedCluster);
86
+ setIsOpen(false);
102
87
  });
103
88
  const getClusterOptions = (clusters) => {
104
89
  const clustersResponseGrouped = groupBy(clusters, 'dns.base_domain') || [];
105
- const domainNames = Object.keys(clustersResponseGrouped) || [];
90
+ const domainNames = Object.keys(clustersResponseGrouped);
106
91
  // move undefined to the end of domains array
107
92
  const undefinedIndex = domainNames.findIndex((i) => i === 'undefined');
108
93
  if (undefinedIndex !== -1 && undefinedIndex !== domainNames.length - 1) {
@@ -115,30 +100,23 @@ function OpenshiftDropdownV4(props) {
115
100
  domainNames.forEach((domain, index) => {
116
101
  domain !== 'undefined' &&
117
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 }));
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
- });
103
+ clustersResponseGrouped[domain].forEach((cluster, i) => {
104
+ clusterOptions.push(React.createElement(SelectOption, { key: i + cluster.external_id, value: createState(cluster.external_id, cluster.display_name) }));
105
+ });
122
106
  clusterOptions.push(React.createElement(Divider, { component: "div", key: index + domain }));
123
107
  });
124
108
  return [
125
- React.createElement(SelectOption, { key: 'show-hide-archived-clusters', inputId: "check-box" },
126
- 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 })),
127
- React.createElement(Divider, { component: "div", key: 'cluster-id-options-divider-e' }),
128
- React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")) }),
109
+ ...clusterOptions,
129
110
  ...(!props.isV4
130
111
  ? [
131
112
  React.createElement(SelectOption, { key: 'v3-cluster', value: createState('v3-cluster', t('The case is for a v3 cluster')) }),
132
113
  ]
133
114
  : []),
134
- ...(clusterOptions.length !== 0 ? [React.createElement(Divider, { component: "div", key: 'cluster-id-options-divider' })] : []),
135
- ...clusterOptions,
115
+ React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")) }),
136
116
  ];
137
117
  };
138
118
  const fetchAccountClusters = (search = '') => __awaiter(this, void 0, void 0, function* () {
139
- var _a, _b;
140
119
  const page = Math.floor(clustersRawResponse.length / PER_PAGE) + 1;
141
- setIsFetchingClusters(true);
142
120
  try {
143
121
  if (abortControllerRef.current !== undefined) {
144
122
  // Cancel the previous request
@@ -147,66 +125,27 @@ function OpenshiftDropdownV4(props) {
147
125
  // recreate a new AbortController for each call
148
126
  let controller = new AbortController();
149
127
  abortControllerRef.current = controller;
150
- let clustersResponse;
151
- let total;
152
128
  // query language: https://github.com/yaacov/tree-search-language
153
- // old api has dns info
154
- // new api doesn't have dns info but we can exclude archived clusters
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({
159
- order: 'display_name asc',
160
- page,
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,
169
- search: `external_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%' OR dns.base_domain ILIKE '%${search}%'`,
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;
184
- }
185
- else {
186
- clustersResponse = [];
187
- total = 0;
188
- }
189
- const items = clustersResponse.map((item) => {
190
- var _a, _b;
191
- return ({
192
- display_name: getDisplayNameForCluster(item),
193
- external_cluster_id: item.external_cluster_id || item.external_id,
194
- 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) || '',
195
- dns: item.dns || {},
196
- });
197
- });
198
- 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
+ }));
199
140
  return {
200
141
  items,
201
- totalResult: clustersResponse.length,
202
- page,
203
- total,
142
+ totalResult: clustersResponse.total,
143
+ page: clustersResponse.page,
204
144
  };
205
145
  }
206
146
  catch (e) {
207
147
  // silently fails
208
- setIsFetchingClusters(false);
209
- return { items: [], totalResult: 0, page: 0, total: 0 };
148
+ return { items: [], totalResult: 0, page: 0 };
210
149
  }
211
150
  });
212
151
  // need to get clusters on load
@@ -215,11 +154,10 @@ function OpenshiftDropdownV4(props) {
215
154
  useEffect(() => {
216
155
  let isUnmounted = false;
217
156
  const fetchClusters = () => __awaiter(this, void 0, void 0, function* () {
218
- const fetchedClusters = yield fetchAccountClusters(inputVal);
157
+ const fetchedClusters = yield fetchAccountClusters();
219
158
  if (!isUnmounted) {
220
- setClustersRawResponse(fetchedClusters.items);
221
- setTotalResultsNo(fetchedClusters.total);
222
159
  setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
160
+ setClustersRawResponse(fetchedClusters.items);
223
161
  }
224
162
  });
225
163
  fetchClusters();
@@ -227,7 +165,7 @@ function OpenshiftDropdownV4(props) {
227
165
  isUnmounted = true;
228
166
  };
229
167
  // eslint-disable-next-line react-hooks/exhaustive-deps
230
- }, [props.isV4, showArchivedClusters]);
168
+ }, [props.isV4]);
231
169
  useEffect(() => {
232
170
  if (props.isClusterIdInvalid) {
233
171
  setValidated('error');
@@ -240,16 +178,15 @@ function OpenshiftDropdownV4(props) {
240
178
  setInputVal(input);
241
179
  props.onClusterIdStateUpdate(createState(input, input));
242
180
  const fetchedClusters = yield fetchAccountClusters(input);
243
- setClustersRawResponse(fetchedClusters.items);
244
- setTotalResultsNo(fetchedClusters.total);
245
181
  setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
182
+ setClustersRawResponse(fetchedClusters.items);
246
183
  });
247
184
  const getSelectedItem = () => {
248
185
  if (!isEmpty(inputVal)) {
249
186
  return createState(props.openshiftClusterIDState, inputVal);
250
187
  }
251
188
  else {
252
- return createState(props.openshiftClusterIDState, getDisplayNameById(clustersRawResponse, props.openshiftClusterIDState, props.noClusterIdReasonExplanation));
189
+ return createState(props.openshiftClusterIDState, getDisplayNameById(clustersRawResponse, props.openshiftClusterIDState));
253
190
  }
254
191
  };
255
192
  const titleId = 'case-details-cluster-nickname-selector';
@@ -261,7 +198,7 @@ function OpenshiftDropdownV4(props) {
261
198
  React.createElement(CaseOpenShiftPopover, null)),
262
199
  React.createElement("span", { id: titleId, hidden: true }, "Select a state"),
263
200
  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 &&
264
- clustersRawResponse.length < totalResultsNo && {
201
+ PER_PAGE <= clustersRawResponse.length && {
265
202
  loadingVariant: {
266
203
  text: 'Display additional results',
267
204
  onClick: onViewMoreClick,
@@ -13,8 +13,7 @@ export function Hostname(props) {
13
13
  setCaseDetails(caseDispatch, caseDetails);
14
14
  };
15
15
  const onHostnameChange = (e) => {
16
- var _a;
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
- export declare const getDisplayNameById: (clusters: Partial<IClusterSubscriptionExtended>[], id: string) => string;
4
- export declare const getDisplayNameForCluster: (cluster: Partial<IClusterSubscriptionExtended>) => string;
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,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAMpE,eAAO,MAAM,kBAAkB,aAAc,QAAQ,4BAA4B,CAAC,EAAE,MAAM,MAAM,WAI/F,CAAC;AAEF,eAAO,MAAM,wBAAwB,YAAa,QAAQ,4BAA4B,CAAC,WAKtF,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"}
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.external_cluster_id === id);
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
- const clusterId = (cluster === null || cluster === void 0 ? void 0 : cluster.external_cluster_id) || cluster.external_id;
15
- if (isEmpty(cluster.display_name) || cluster.display_name === clusterId)
16
- return clusterId;
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.104",
3
+ "version": "0.2.107",
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.15",
77
- "@rh-support/components": "1.1.59",
78
- "@rh-support/react-context": "0.2.61",
76
+ "@rh-support/api": "0.3.16",
77
+ "@rh-support/components": "1.1.61",
78
+ "@rh-support/react-context": "0.2.63",
79
79
  "@rh-support/types": "0.2.0",
80
- "@rh-support/user-permissions": "0.2.47",
81
- "@rh-support/utils": "0.2.36",
80
+ "@rh-support/user-permissions": "0.2.49",
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": "f2b203085e179115277901c8d155d7c72f7f152e"
146
+ "gitHead": "db6de819479468586b86d6d8a6f0fe6713baddd8"
147
147
  }