@rh-support/troubleshoot 0.2.104 → 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.
@@ -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);
@@ -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":"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,eAkTzC;kBAlTQ,mBAAmB;;;AAqT5B,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,49 @@ 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.map((item) => {
190
156
  var _a, _b;
191
157
  return ({
192
158
  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 || {},
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) || '',
196
161
  });
197
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
+ }
198
184
  setIsFetchingClusters(false);
199
185
  return {
200
186
  items,
201
- totalResult: clustersResponse.length,
187
+ totalResult: items.length,
202
188
  page,
203
- total,
189
+ total: clustersResponse.total,
204
190
  };
205
191
  }
206
192
  catch (e) {
@@ -260,7 +246,7 @@ function OpenshiftDropdownV4(props) {
260
246
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"),
261
247
  React.createElement(CaseOpenShiftPopover, null)),
262
248
  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 &&
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 &&
264
250
  clustersRawResponse.length < totalResultsNo && {
265
251
  loadingVariant: {
266
252
  text: 'Display additional results',
@@ -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);
@@ -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.104",
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.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": "f2b203085e179115277901c8d155d7c72f7f152e"
146
+ "gitHead": "66b9e765df2035e24ee6ae3ee02289ca5a4eed09"
147
147
  }