@rh-support/troubleshoot 0.2.105 → 0.2.106-beta.2

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":"ManagedAccountsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/ManagedAccountsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAGhF,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAM7G,UAAU,MAAO,SAAQ,gBAAgB;IACrC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,mBAAmB,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACxE,sBAAsB,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC,KAAK,IAAI,CAAC;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,iBAAS,uBAAuB,CAAC,KAAK,EAAE,MAAM,eAyD7C;kBAzDQ,uBAAuB;;;AA2DhC,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"ManagedAccountsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/ManagedAccountsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAGhF,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAM7G,UAAU,MAAO,SAAQ,gBAAgB;IACrC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,mBAAmB,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACxE,sBAAsB,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC,KAAK,IAAI,CAAC;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,iBAAS,uBAAuB,CAAC,KAAK,EAAE,MAAM,eA4D7C;kBA5DQ,uBAAuB;;;AA8DhC,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
@@ -24,7 +24,10 @@ function ManagedAccountsDropdown(props) {
24
24
  };
25
25
  setSelectedItem(toOption(item, { labelKey: getLabelForAccountOption }));
26
26
  }, [props.managedAccounts.data, props.selectedAccountNumber]);
27
- const managedAccountsOptions = props.managedAccounts.data.map((account) => (Object.assign({ actionItem: (React.createElement(React.Fragment, null, account.subscriptionAbuse && (React.createElement("span", { className: "form-instructions form-invalid pf-u-text-nowrap pf-u-pr-sm" },
27
+ // Only accounts that have granted access permission to partner should be listed
28
+ const managedAccountsOptions = props.managedAccounts.data
29
+ .filter((account) => account.partnerCaseAccess === 'All')
30
+ .map((account) => (Object.assign({ actionItem: (React.createElement(React.Fragment, null, account.subscriptionAbuse && (React.createElement("span", { className: "form-instructions form-invalid pf-u-text-nowrap pf-u-pr-sm" },
28
31
  ' ',
29
32
  React.createElement(InfoCircleIcon, null),
30
33
  " ",
@@ -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,eAwTzC;kBAxTQ,mBAAmB;;;AA2T5B,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([]);
@@ -77,10 +75,15 @@ function OpenshiftDropdownV4(props) {
77
75
  setIsOpen(false);
78
76
  setInputVal('');
79
77
  props.onClusterClear();
78
+ const fetchedClusters = yield fetchAccountClusters();
79
+ setClustersRawResponse(fetchedClusters.items);
80
+ setTotalResultsNo(fetchedClusters.total);
81
+ setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
80
82
  });
81
83
  const onToggle = (isOpen) => setIsOpen(isOpen);
82
84
  const onViewMoreClick = () => __awaiter(this, void 0, void 0, function* () {
83
- const fetchedClusters = yield fetchAccountClusters(inputVal);
85
+ const page = Math.floor(clustersRawResponse.length / PER_PAGE) + 1;
86
+ const fetchedClusters = yield fetchAccountClusters(inputVal, page);
84
87
  const clusterResponse = [...clustersRawResponse, ...((fetchedClusters === null || fetchedClusters === void 0 ? void 0 : fetchedClusters.items) || [])];
85
88
  setClustersRawResponse(clusterResponse);
86
89
  setTotalResultsNo(fetchedClusters.total);
@@ -123,7 +126,7 @@ function OpenshiftDropdownV4(props) {
123
126
  });
124
127
  return [
125
128
  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 })),
129
+ 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
130
  React.createElement(Divider, { component: "div", key: 'cluster-id-options-divider-e' }),
128
131
  React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")) }),
129
132
  ...(!props.isV4
@@ -135,9 +138,7 @@ function OpenshiftDropdownV4(props) {
135
138
  ...clusterOptions,
136
139
  ];
137
140
  };
138
- const fetchAccountClusters = (search = '') => __awaiter(this, void 0, void 0, function* () {
139
- var _a, _b;
140
- const page = Math.floor(clustersRawResponse.length / PER_PAGE) + 1;
141
+ const fetchAccountClusters = (search = '', page = 0) => __awaiter(this, void 0, void 0, function* () {
141
142
  setIsFetchingClusters(true);
142
143
  try {
143
144
  if (abortControllerRef.current !== undefined) {
@@ -147,60 +148,51 @@ function OpenshiftDropdownV4(props) {
147
148
  // recreate a new AbortController for each call
148
149
  let controller = new AbortController();
149
150
  abortControllerRef.current = controller;
150
- let clustersResponse;
151
- let total;
152
151
  // 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) => {
152
+ const clustersResponse = yield cloud.getAccountClustersSubscription({
153
+ order: 'display_name asc',
154
+ page,
155
+ size: PER_PAGE,
156
+ search: `${showArchivedClusters ? '' : "status!='Archived'"} ${search && !showArchivedClusters ? 'AND' : ''} ${search ? `(external_cluster_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%')` : ''}`,
157
+ fields: 'external_cluster_id,display_name,status,metrics.openshift_version',
158
+ }, controller.signal);
159
+ const items = clustersResponse.items
160
+ .filter((c) => !isEmpty(c.external_cluster_id))
161
+ .map((item) => {
190
162
  var _a, _b;
191
163
  return ({
192
164
  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 || {},
165
+ external_cluster_id: item.external_cluster_id,
166
+ 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
167
  });
197
168
  });
169
+ try {
170
+ // old api has dns info
171
+ // new api doesn't have dns info but we can exclude archived clusters
172
+ // call old api get all clusters and call new api get limitted number of clusters
173
+ // then add dns info to the new api response
174
+ const promiseArray = clustersResponse.items.map((cluster) => cloud.getAccountClusters({
175
+ order: 'display_name asc',
176
+ search: `external_id='${cluster.external_cluster_id}' OR display_name='${cluster.external_cluster_id}'`,
177
+ }, controller.signal));
178
+ const oldApiResponse = yield Promise.allSettled(promiseArray);
179
+ oldApiResponse.forEach((response) => {
180
+ var _a, _b;
181
+ 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)) {
182
+ var index = findIndex(items, { external_cluster_id: response.value.items[0].external_id });
183
+ items[index] = Object.assign(Object.assign({}, items[index]), { dns: response.value.items[0].dns });
184
+ }
185
+ });
186
+ }
187
+ catch (e) {
188
+ // silently fails
189
+ }
198
190
  setIsFetchingClusters(false);
199
191
  return {
200
192
  items,
201
- totalResult: clustersResponse.length,
193
+ totalResult: items.length,
202
194
  page,
203
- total,
195
+ total: clustersResponse.total,
204
196
  };
205
197
  }
206
198
  catch (e) {
@@ -260,7 +252,7 @@ function OpenshiftDropdownV4(props) {
260
252
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"),
261
253
  React.createElement(CaseOpenShiftPopover, null)),
262
254
  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 &&
255
+ 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
256
  clustersRawResponse.length < totalResultsNo && {
265
257
  loadingVariant: {
266
258
  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.106-beta.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,7 +26,7 @@
26
26
  "lib/**/*"
27
27
  ],
28
28
  "peerDependencies": {
29
- "@cee-eng/hydrajs": "4.9.1",
29
+ "@cee-eng/hydrajs": "4.10.0",
30
30
  "@cee-eng/ui-toolkit": "1.1.6",
31
31
  "@patternfly/patternfly": "4.185.1",
32
32
  "@patternfly/pfe-accordion": "1.12.3",
@@ -63,7 +63,7 @@
63
63
  "react-virtualized": "^9.21.2"
64
64
  },
65
65
  "dependencies": {
66
- "@cee-eng/hydrajs": "4.9.1",
66
+ "@cee-eng/hydrajs": "4.10.0",
67
67
  "@cee-eng/ui-toolkit": "1.1.6",
68
68
  "@patternfly/patternfly": "4.185.1",
69
69
  "@patternfly/pfe-accordion": "1.12.3",
@@ -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.2",
77
+ "@rh-support/components": "1.1.60-beta.2",
78
+ "@rh-support/react-context": "0.2.62-beta.2",
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.48-beta.2",
81
+ "@rh-support/utils": "0.2.37-beta.2",
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": "3698a59c19b70dd7c9722faa83c7d8aaf55e483c"
147
147
  }