@rh-support/troubleshoot 0.2.106 → 0.2.107-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,sBAAsB,gBAqRrC"}
1
+ {"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,sBAAsB,gBA4RrC"}
@@ -55,7 +55,9 @@ export function CaseOpenshiftClusterId() {
55
55
  if (!openshiftClusterID || getIsClusterIdInvalid(openshiftClusterID))
56
56
  return;
57
57
  let openshiftClusterVersion;
58
- if (clusterDetails && clusterDetails.external_id === openshiftClusterID && clusterDetails.openshift_version) {
58
+ if (clusterDetails &&
59
+ clusterDetails.external_cluster_id === openshiftClusterID &&
60
+ clusterDetails.openshift_version) {
59
61
  openshiftClusterVersion = clusterDetails.openshift_version;
60
62
  }
61
63
  else {
@@ -128,7 +130,7 @@ export function CaseOpenshiftClusterId() {
128
130
  }
129
131
  });
130
132
  const onClusterIdSave = (selectedCluster) => __awaiter(this, void 0, void 0, function* () {
131
- const selectedClusterId = selectedCluster === null || selectedCluster === void 0 ? void 0 : selectedCluster.external_id;
133
+ const selectedClusterId = selectedCluster === null || selectedCluster === void 0 ? void 0 : selectedCluster.external_cluster_id;
132
134
  if (isEmpty(selectedClusterId))
133
135
  return;
134
136
  setLocalOpenshiftClusterIDState(selectedClusterId);
@@ -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,gBA6RjC"}
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"}
@@ -96,7 +96,9 @@ export function OpenShiftClusterId() {
96
96
  if (!openshiftClusterID || getIsClusterIdInvalid(openshiftClusterID))
97
97
  return;
98
98
  let openshiftClusterVersion;
99
- if (clusterDetails && clusterDetails.external_id === openshiftClusterID && clusterDetails.openshift_version) {
99
+ if (clusterDetails &&
100
+ clusterDetails.external_cluster_id === openshiftClusterID &&
101
+ clusterDetails.openshift_version) {
100
102
  openshiftClusterVersion = clusterDetails.openshift_version;
101
103
  }
102
104
  else {
@@ -163,7 +165,7 @@ export function OpenShiftClusterId() {
163
165
  // eslint-disable-next-line react-hooks/exhaustive-deps
164
166
  }, [noClusterIdReason]);
165
167
  const onClusterIdStateUpdate = (selectedCluster) => {
166
- const selectedId = selectedCluster.external_id;
168
+ const selectedId = selectedCluster === null || selectedCluster === void 0 ? void 0 : selectedCluster.external_cluster_id;
167
169
  if (isEmpty(selectedId))
168
170
  return;
169
171
  resetClusterData();
@@ -1,8 +1,8 @@
1
- import { ICluster } from '@rh-support/api';
1
+ import { IClusterSubscription } from '@cee-eng/hydrajs/@types/models/cloud';
2
2
  import { IDClassNameProps } from '@rh-support/types/shared';
3
3
  interface IProps extends IDClassNameProps {
4
4
  openshiftClusterIDState: string;
5
- onClusterIdStateUpdate: (cluster: Partial<ICluster>, value?: string) => void;
5
+ onClusterIdStateUpdate: (cluster: Partial<IClusterSubscription>, 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<ICluster>;
13
+ declare const fetchClusterIdDetails: (clusterId: string) => Promise<import("@cee-eng/hydrajs/@types/models/cloud").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,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"}
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;AAWjF,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,eAkTzC;kBAlTQ,mBAAmB;;;AAqT5B,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,CAAC"}
@@ -7,10 +7,10 @@ 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 { Divider, Select, SelectOption, SelectVariant } from '@patternfly/react-core';
11
- import { getAccountClusters } from '@rh-support/api';
12
- import { useFetch } from '@rh-support/components';
10
+ import { cloud } from '@cee-eng/hydrajs';
11
+ import { Checkbox, Divider, Select, SelectOption, SelectVariant } from '@patternfly/react-core';
13
12
  import find from 'lodash/find';
13
+ import findIndex from 'lodash/findIndex';
14
14
  import groupBy from 'lodash/groupBy';
15
15
  import isEmpty from 'lodash/isEmpty';
16
16
  import React, { useEffect, useRef, useState } from 'react';
@@ -24,19 +24,19 @@ const defaultProps = {
24
24
  };
25
25
  const fetchClusterIdDetails = (clusterId) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  try {
27
- const clustersResponse = yield getAccountClusters({
27
+ const clustersResponse = yield cloud.getAccountClusters({
28
28
  order: 'display_name asc',
29
- search: `external_id ILIKE '%${clusterId}%'`,
29
+ search: `external_id ILIKE '%${clusterId}%'`,
30
30
  });
31
31
  const clusterDetails = (clustersResponse.items || []).find((item) => item.external_id === clusterId);
32
32
  return clusterDetails;
33
33
  }
34
34
  catch (e) { }
35
35
  });
36
- const createState = (external_id, display_name) => {
36
+ const createState = (external_cluster_id, display_name) => {
37
37
  return {
38
38
  display_name,
39
- external_id,
39
+ external_cluster_id,
40
40
  toString: () => display_name || '',
41
41
  compareTo: function (value) {
42
42
  const displayName = this.toString().toLowerCase();
@@ -47,25 +47,28 @@ const createState = (external_id, display_name) => {
47
47
  };
48
48
  function OpenshiftDropdownV4(props) {
49
49
  const { t } = useTranslation();
50
- const PER_PAGE = 200;
51
- const { request: getAccountClustersRequest, isFetching: isFetchingClusters } = useFetch(getAccountClusters, {
52
- propgateErrors: true,
53
- });
50
+ const PER_PAGE = 20;
54
51
  const [clustersRawResponse, setClustersRawResponse] = useState([]);
55
52
  const abortControllerRef = useRef(undefined);
56
53
  const [clustersSelectOptions, setClustersSelectOptions] = useState([]);
57
54
  const [isOpen, setIsOpen] = useState(false);
58
55
  const [validated, setValidated] = useState('default');
59
56
  const [inputVal, setInputVal] = useState('');
57
+ const [showArchivedClusters, setShowArchivedClusters] = useState(false);
58
+ const [isFetchingClusters, setIsFetchingClusters] = useState(false);
59
+ const [totalResultsNo, setTotalResultsNo] = useState(0);
60
60
  // gets a cluster id and returns display name
61
- const getDisplayNameById = (clusters, id) => {
61
+ const getDisplayNameById = (clusters, id, noClusterIdReasonExplanation) => {
62
62
  if (isEmpty(id))
63
63
  return '';
64
- if (id === 'dont-have-id')
65
- return t("I don't have my Cluster ID");
64
+ if (id === 'dont-have-id') {
65
+ return noClusterIdReasonExplanation === 'v3-cluster'
66
+ ? t('The case is for a v3 cluster')
67
+ : t("I don't have my Cluster ID");
68
+ }
66
69
  if (id === 'v3-cluster')
67
70
  return t('The case is for a v3 cluster');
68
- const cluster = find(clusters, (o) => o.external_id === id);
71
+ const cluster = find(clusters, (o) => o.external_cluster_id === id);
69
72
  return isEmpty(cluster) ? id : getDisplayNameForCluster(cluster);
70
73
  };
71
74
  const onDropdownClear = () => __awaiter(this, void 0, void 0, function* () {
@@ -75,19 +78,29 @@ function OpenshiftDropdownV4(props) {
75
78
  });
76
79
  const onToggle = (isOpen) => setIsOpen(isOpen);
77
80
  const onViewMoreClick = () => __awaiter(this, void 0, void 0, function* () {
78
- const fetchedClusters = yield fetchAccountClusters();
79
- const clusterResponse = [...clustersRawResponse, ...fetchedClusters.items];
81
+ const fetchedClusters = yield fetchAccountClusters(inputVal);
82
+ const clusterResponse = [...clustersRawResponse, ...((fetchedClusters === null || fetchedClusters === void 0 ? void 0 : fetchedClusters.items) || [])];
80
83
  setClustersRawResponse(clusterResponse);
84
+ setTotalResultsNo(fetchedClusters.total);
81
85
  setClustersSelectOptions(getClusterOptions(clusterResponse));
82
86
  });
83
87
  const onSelect = (event, selectedCluster) => __awaiter(this, void 0, void 0, function* () {
84
88
  setInputVal('');
85
- props.onClusterIdStateUpdate(selectedCluster);
86
- setIsOpen(false);
89
+ if (event.target.tagName !== 'BUTTON') {
90
+ // checkbox is clicked
91
+ setShowArchivedClusters(!showArchivedClusters);
92
+ // reset
93
+ props.onClusterClear();
94
+ setClustersRawResponse([]);
95
+ }
96
+ else {
97
+ props.onClusterIdStateUpdate(selectedCluster);
98
+ setIsOpen(false);
99
+ }
87
100
  });
88
101
  const getClusterOptions = (clusters) => {
89
102
  const clustersResponseGrouped = groupBy(clusters, 'dns.base_domain') || [];
90
- const domainNames = Object.keys(clustersResponseGrouped);
103
+ const domainNames = Object.keys(clustersResponseGrouped) || [];
91
104
  // move undefined to the end of domains array
92
105
  const undefinedIndex = domainNames.findIndex((i) => i === 'undefined');
93
106
  if (undefinedIndex !== -1 && undefinedIndex !== domainNames.length - 1) {
@@ -100,23 +113,29 @@ function OpenshiftDropdownV4(props) {
100
113
  domainNames.forEach((domain, index) => {
101
114
  domain !== 'undefined' &&
102
115
  clusterOptions.push(React.createElement(SelectOption, { isDisabled: true, className: "pf-u-font-weight-bold pf-u-color-400", value: createState(domain, domain), key: domain + index }));
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
- });
116
+ clustersResponseGrouped[domain] &&
117
+ clustersResponseGrouped[domain].forEach((cluster, i) => {
118
+ clusterOptions.push(React.createElement(SelectOption, { key: cluster.external_cluster_id, value: createState(cluster.external_cluster_id, cluster.display_name) }));
119
+ });
106
120
  clusterOptions.push(React.createElement(Divider, { component: "div", key: index + domain }));
107
121
  });
108
122
  return [
109
- ...clusterOptions,
123
+ React.createElement(SelectOption, { key: 'show-hide-archived-clusters', inputId: "check-box" },
124
+ 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, className: "archived-clusters-checkbox" })),
125
+ React.createElement(Divider, { component: "div", key: 'cluster-id-options-divider-e' }),
126
+ React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")) }),
110
127
  ...(!props.isV4
111
128
  ? [
112
129
  React.createElement(SelectOption, { key: 'v3-cluster', value: createState('v3-cluster', t('The case is for a v3 cluster')) }),
113
130
  ]
114
131
  : []),
115
- React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")) }),
132
+ ...(clusterOptions.length !== 0 ? [React.createElement(Divider, { component: "div", key: 'cluster-id-options-divider' })] : []),
133
+ ...clusterOptions,
116
134
  ];
117
135
  };
118
136
  const fetchAccountClusters = (search = '') => __awaiter(this, void 0, void 0, function* () {
119
137
  const page = Math.floor(clustersRawResponse.length / PER_PAGE) + 1;
138
+ setIsFetchingClusters(true);
120
139
  try {
121
140
  if (abortControllerRef.current !== undefined) {
122
141
  // Cancel the previous request
@@ -126,26 +145,54 @@ function OpenshiftDropdownV4(props) {
126
145
  let controller = new AbortController();
127
146
  abortControllerRef.current = controller;
128
147
  // query language: https://github.com/yaacov/tree-search-language
129
- const clustersResponse = yield getAccountClustersRequest({
148
+ const clustersResponse = yield cloud.getAccountClustersSubscription({
130
149
  order: 'display_name asc',
131
150
  page,
132
151
  size: PER_PAGE,
133
- search: `external_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%' OR dns.base_domain ILIKE '%${search}%'`,
152
+ search: `${showArchivedClusters ? '' : "status!='Archived'"} ${search && !showArchivedClusters ? 'AND' : ''} ${search ? `(external_cluster_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%')` : ''}`,
153
+ fields: 'external_cluster_id,display_name,status,metrics.openshift_version',
134
154
  }, 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
- }));
155
+ const items = clustersResponse.items.map((item) => {
156
+ var _a, _b;
157
+ return ({
158
+ display_name: getDisplayNameForCluster(item),
159
+ external_cluster_id: item.external_cluster_id,
160
+ 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) || '',
161
+ });
162
+ });
163
+ try {
164
+ // old api has dns info
165
+ // new api doesn't have dns info but we can exclude archived clusters
166
+ // call old api get all clusters and call new api get limitted number of clusters
167
+ // then add dns info to the new api response
168
+ const promiseArray = clustersResponse.items.map((cluster) => cloud.getAccountClusters({
169
+ order: 'display_name asc',
170
+ search: `external_id='${cluster.external_cluster_id}' OR display_name='${cluster.external_cluster_id}'`,
171
+ }, controller.signal));
172
+ const oldApiResponse = yield Promise.allSettled(promiseArray);
173
+ oldApiResponse.forEach((response) => {
174
+ var _a, _b;
175
+ if (response.status === 'fulfilled' && ((_b = (_a = response.value) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b[0].dns)) {
176
+ var index = findIndex(items, { external_cluster_id: response.value.items[0].external_id });
177
+ items[index] = Object.assign(Object.assign({}, items[index]), { dns: response.value.items[0].dns });
178
+ }
179
+ });
180
+ }
181
+ catch (e) {
182
+ // silently fails
183
+ }
184
+ setIsFetchingClusters(false);
140
185
  return {
141
186
  items,
142
- totalResult: clustersResponse.total,
143
- page: clustersResponse.page,
187
+ totalResult: items.length,
188
+ page,
189
+ total: clustersResponse.total,
144
190
  };
145
191
  }
146
192
  catch (e) {
147
193
  // silently fails
148
- return { items: [], totalResult: 0, page: 0 };
194
+ setIsFetchingClusters(false);
195
+ return { items: [], totalResult: 0, page: 0, total: 0 };
149
196
  }
150
197
  });
151
198
  // need to get clusters on load
@@ -154,10 +201,11 @@ function OpenshiftDropdownV4(props) {
154
201
  useEffect(() => {
155
202
  let isUnmounted = false;
156
203
  const fetchClusters = () => __awaiter(this, void 0, void 0, function* () {
157
- const fetchedClusters = yield fetchAccountClusters();
204
+ const fetchedClusters = yield fetchAccountClusters(inputVal);
158
205
  if (!isUnmounted) {
159
- setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
160
206
  setClustersRawResponse(fetchedClusters.items);
207
+ setTotalResultsNo(fetchedClusters.total);
208
+ setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
161
209
  }
162
210
  });
163
211
  fetchClusters();
@@ -165,7 +213,7 @@ function OpenshiftDropdownV4(props) {
165
213
  isUnmounted = true;
166
214
  };
167
215
  // eslint-disable-next-line react-hooks/exhaustive-deps
168
- }, [props.isV4]);
216
+ }, [props.isV4, showArchivedClusters]);
169
217
  useEffect(() => {
170
218
  if (props.isClusterIdInvalid) {
171
219
  setValidated('error');
@@ -178,15 +226,16 @@ function OpenshiftDropdownV4(props) {
178
226
  setInputVal(input);
179
227
  props.onClusterIdStateUpdate(createState(input, input));
180
228
  const fetchedClusters = yield fetchAccountClusters(input);
181
- setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
182
229
  setClustersRawResponse(fetchedClusters.items);
230
+ setTotalResultsNo(fetchedClusters.total);
231
+ setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
183
232
  });
184
233
  const getSelectedItem = () => {
185
234
  if (!isEmpty(inputVal)) {
186
235
  return createState(props.openshiftClusterIDState, inputVal);
187
236
  }
188
237
  else {
189
- return createState(props.openshiftClusterIDState, getDisplayNameById(clustersRawResponse, props.openshiftClusterIDState));
238
+ return createState(props.openshiftClusterIDState, getDisplayNameById(clustersRawResponse, props.openshiftClusterIDState, props.noClusterIdReasonExplanation));
190
239
  }
191
240
  };
192
241
  const titleId = 'case-details-cluster-nickname-selector';
@@ -197,8 +246,8 @@ function OpenshiftDropdownV4(props) {
197
246
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"),
198
247
  React.createElement(CaseOpenShiftPopover, null)),
199
248
  React.createElement("span", { id: titleId, hidden: true }, "Select a state"),
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 &&
201
- PER_PAGE <= clustersRawResponse.length && {
249
+ React.createElement(Select, Object.assign({ variant: SelectVariant.typeahead, isDisabled: props.isDisabled, typeAheadAriaLabel: t('Search by Cluster ID and alias 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 and alias 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 &&
250
+ clustersRawResponse.length < totalResultsNo && {
202
251
  loadingVariant: {
203
252
  text: 'Display additional results',
204
253
  onClick: onViewMoreClick,
@@ -31,6 +31,10 @@ button,
31
31
  font-size: 14px;
32
32
  }
33
33
 
34
+ .archived-clusters-checkbox {
35
+ grid-gap: 0px;
36
+ }
37
+
34
38
  .case-details-tabs .case-details-tabs-content {
35
39
  background-color: #f0f0f0;
36
40
  margin-left: -1.8rem;
@@ -1,7 +1,7 @@
1
+ import { IClusterSubscriptionExtended } from '@cee-eng/hydrajs/@types/models/cloud';
1
2
  import { ISEProduct } from '@cee-eng/hydrajs/@types/models/product';
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;
3
+ export declare const getDisplayNameById: (clusters: Partial<IClusterSubscriptionExtended>[], id: string) => string;
4
+ export declare const getDisplayNameForCluster: (cluster: Partial<IClusterSubscriptionExtended>) => 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,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"}
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"}
@@ -5,15 +5,16 @@ 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_id === id);
8
+ const cluster = find(clusters, (o) => o.external_cluster_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
- if (isEmpty(cluster.display_name) || cluster.display_name === cluster.external_id)
15
- return `${cluster.external_id}`;
16
- return `${cluster.external_id} <${cluster.display_name}>`;
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}>`;
17
18
  };
18
19
  export const invalidGuidHelperText = 'Please enter a valid Cluster ID (For example: d3aa88e2-c754-41e0-8ba6-4198a34aa0a2)';
19
20
  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.106",
3
+ "version": "0.2.107-beta.0",
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.16",
77
- "@rh-support/components": "1.1.60",
78
- "@rh-support/react-context": "0.2.62",
76
+ "@rh-support/api": "0.3.16-beta.0",
77
+ "@rh-support/components": "1.1.61-beta.0",
78
+ "@rh-support/react-context": "0.2.63-beta.0",
79
79
  "@rh-support/types": "0.2.0",
80
- "@rh-support/user-permissions": "0.2.48",
81
- "@rh-support/utils": "0.2.37",
80
+ "@rh-support/user-permissions": "0.2.49-beta.0",
81
+ "@rh-support/utils": "0.2.37-beta.0",
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": "16a9ab39fc63d39d0816ee2ef890c2f0ff2282e4"
146
+ "gitHead": "66b9e765df2035e24ee6ae3ee02289ca5a4eed09"
147
147
  }