@rh-support/troubleshoot 0.2.105 → 0.2.107-beta.1

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.
@@ -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":"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,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,eAqTzC;kBArTQ,mBAAmB;;;AAwT5B,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,CAAC"}
@@ -10,10 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { cloud } from '@cee-eng/hydrajs';
11
11
  import { Checkbox, Divider, Select, SelectOption, SelectVariant } from '@patternfly/react-core';
12
12
  import find from 'lodash/find';
13
+ import findIndex from 'lodash/findIndex';
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';
@@ -48,8 +47,7 @@ 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
- const PER_PAGE = 200;
50
+ const PER_PAGE = 20;
53
51
  const [clustersRawResponse, setClustersRawResponse] = useState([]);
54
52
  const abortControllerRef = useRef(undefined);
55
53
  const [clustersSelectOptions, setClustersSelectOptions] = useState([]);
@@ -123,7 +121,7 @@ function OpenshiftDropdownV4(props) {
123
121
  });
124
122
  return [
125
123
  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 })),
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" })),
127
125
  React.createElement(Divider, { component: "div", key: 'cluster-id-options-divider-e' }),
128
126
  React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")) }),
129
127
  ...(!props.isV4
@@ -136,7 +134,6 @@ function OpenshiftDropdownV4(props) {
136
134
  ];
137
135
  };
138
136
  const fetchAccountClusters = (search = '') => __awaiter(this, void 0, void 0, function* () {
139
- var _a, _b;
140
137
  const page = Math.floor(clustersRawResponse.length / PER_PAGE) + 1;
141
138
  setIsFetchingClusters(true);
142
139
  try {
@@ -147,60 +144,51 @@ function OpenshiftDropdownV4(props) {
147
144
  // recreate a new AbortController for each call
148
145
  let controller = new AbortController();
149
146
  abortControllerRef.current = controller;
150
- let clustersResponse;
151
- let total;
152
147
  // 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) => {
148
+ const clustersResponse = yield cloud.getAccountClustersSubscription({
149
+ order: 'display_name asc',
150
+ page,
151
+ size: PER_PAGE,
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',
154
+ }, controller.signal);
155
+ const items = clustersResponse.items
156
+ .filter((c) => !isEmpty(c.external_cluster_id))
157
+ .map((item) => {
190
158
  var _a, _b;
191
159
  return ({
192
160
  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 || {},
161
+ external_cluster_id: item.external_cluster_id,
162
+ 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) || '',
196
163
  });
197
164
  });
165
+ try {
166
+ // old api has dns info
167
+ // new api doesn't have dns info but we can exclude archived clusters
168
+ // call old api get all clusters and call new api get limitted number of clusters
169
+ // then add dns info to the new api response
170
+ const promiseArray = clustersResponse.items.map((cluster) => cloud.getAccountClusters({
171
+ order: 'display_name asc',
172
+ search: `external_id='${cluster.external_cluster_id}' OR display_name='${cluster.external_cluster_id}'`,
173
+ }, controller.signal));
174
+ const oldApiResponse = yield Promise.allSettled(promiseArray);
175
+ oldApiResponse.forEach((response) => {
176
+ var _a, _b;
177
+ 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)) {
178
+ var index = findIndex(items, { external_cluster_id: response.value.items[0].external_id });
179
+ items[index] = Object.assign(Object.assign({}, items[index]), { dns: response.value.items[0].dns });
180
+ }
181
+ });
182
+ }
183
+ catch (e) {
184
+ // silently fails
185
+ }
198
186
  setIsFetchingClusters(false);
199
187
  return {
200
188
  items,
201
- totalResult: clustersResponse.length,
189
+ totalResult: items.length,
202
190
  page,
203
- total,
191
+ total: clustersResponse.total,
204
192
  };
205
193
  }
206
194
  catch (e) {
@@ -260,7 +248,7 @@ function OpenshiftDropdownV4(props) {
260
248
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"),
261
249
  React.createElement(CaseOpenShiftPopover, null)),
262
250
  React.createElement("span", { id: titleId, hidden: true }, "Select a state"),
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 &&
251
+ 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 &&
264
252
  clustersRawResponse.length < totalResultsNo && {
265
253
  loadingVariant: {
266
254
  text: 'Display additional results',
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.105",
3
+ "version": "0.2.107-beta.1",
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-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.47",
81
- "@rh-support/utils": "0.2.36",
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": "2b7ecbf88009c77814cd3bb6c3d608cd4add2543"
146
+ "gitHead": "e3cc0ce5728cf4aceb226e7d9f6327def34b7c06"
147
147
  }