@rh-support/manage 0.2.7 → 0.2.11

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.
@@ -13,6 +13,7 @@ interface IProps {
13
13
  errorVariant?: AlertVariant;
14
14
  isError: boolean;
15
15
  pagination?: boolean;
16
+ keepPageNumberOnDataChange?: boolean;
16
17
  actions?: IActions;
17
18
  areActionsDisabled?: IAreActionsDisabled;
18
19
  actionResolver?: IActionsResolver;
@@ -1 +1 @@
1
- {"version":3,"file":"ManageTable.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageTable/ManageTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGH,YAAY,EAQf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,SAAS,EAAmC,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,MAAM;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAGrB,cAAc,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IAEjB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,cAAc,CAAC,EAAE,gBAAgB,CAAC;CACrC;AA0BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eA0CxC"}
1
+ {"version":3,"file":"ManageTable.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageTable/ManageTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGH,YAAY,EAQf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,SAAS,EAAmC,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,MAAM;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAGrB,cAAc,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IAEjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,cAAc,CAAC,EAAE,gBAAgB,CAAC;CACrC;AA0BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eA4CxC"}
@@ -32,12 +32,12 @@ const noResultFoundRow = [
32
32
  },
33
33
  ];
34
34
  export function ManageTable(props) {
35
- const { ariaLabel, errorComponent, errorTitle, errorVariant, isError, isFetching, sortInfo, actions, areActionsDisabled, actionResolver } = props, tableProps = __rest(props, ["ariaLabel", "errorComponent", "errorTitle", "errorVariant", "isError", "isFetching", "sortInfo", "actions", "areActionsDisabled", "actionResolver"]);
35
+ const { ariaLabel, errorComponent, errorTitle, errorVariant, isError, isFetching, sortInfo, actions, keepPageNumberOnDataChange, areActionsDisabled, actionResolver } = props, tableProps = __rest(props, ["ariaLabel", "errorComponent", "errorTitle", "errorVariant", "isError", "isFetching", "sortInfo", "actions", "keepPageNumberOnDataChange", "areActionsDisabled", "actionResolver"]);
36
36
  return (React.createElement("div", { className: "table-wrapper" },
37
37
  isError && (React.createElement(React.Fragment, null,
38
38
  React.createElement(Alert, { variant: errorVariant, title: errorTitle, actionClose: React.createElement(AlertActionCloseButton, null) }, errorComponent))),
39
39
  React.createElement(Table, Object.assign({}, tableProps),
40
- React.createElement(PFTable, { sortInfo: sortInfo, "aria-label": ariaLabel, pagination: true, emptyStateRow: noResultFoundRow, actions: actions, areActionsDisabled: areActionsDisabled, actionResolver: actionResolver, isLoading: isFetching }),
40
+ React.createElement(PFTable, { sortInfo: sortInfo, "aria-label": ariaLabel, pagination: true, emptyStateRow: noResultFoundRow, actions: actions, areActionsDisabled: areActionsDisabled, actionResolver: actionResolver, isLoading: isFetching, keepPageNumberOnDataChange: keepPageNumberOnDataChange }),
41
41
  tableProps.data.length > 0 && (React.createElement("footer", null,
42
42
  React.createElement(TablePagination, { variant: PaginationVariant.bottom }))))));
43
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationEmailsModal.d.ts","sourceRoot":"","sources":["../../../../src/components/NotificationEmails/NotificationEmailsModal.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzE,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,yBAAyB,EAAE,GAAG,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB,EAAE,OAAO,CAAC;IACnC,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,UAAW,MAAM,gBA0LpD,CAAC"}
1
+ {"version":3,"file":"NotificationEmailsModal.d.ts","sourceRoot":"","sources":["../../../../src/components/NotificationEmails/NotificationEmailsModal.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzE,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,yBAAyB,EAAE,GAAG,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB,EAAE,OAAO,CAAC;IACnC,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,UAAW,MAAM,gBA2LpD,CAAC"}
@@ -103,7 +103,7 @@ export const NotificationEmailsModal = (props) => {
103
103
  React.createElement(Form, null,
104
104
  React.createElement(FormGroup, { label: t('Email address'), isRequired: true, fieldId: "email-notification-first-emailaddress", validated: isValidEmail && !isEmailDuplicate ? ValidatedOptions.default : ValidatedOptions.error, helperTextInvalid: !isValidEmail ? t('Invalid email') : isEmailDuplicate ? t('Duplicate Email') : '', className: "pf-u-mb-md" },
105
105
  React.createElement(TextInput, { value: email, className: `form-control${!isValidEmail && isEmailDuplicate ? ' form-invalid' : ''}`, isRequired: true, type: "text", onChange: onEmailChange, "aria-label": t('Email address'), placeholder: t('Email address'), maxLength: 254, validated: isValidEmail && !isEmailDuplicate ? ValidatedOptions.default : ValidatedOptions.error, isDisabled: !props.isAddingNotificationEmail })),
106
- React.createElement(FormGroup, { label: t('First name'), isRequired: true, fieldId: "email-notification-first-name", validated: isValidFirstName ? ValidatedOptions.default : ValidatedOptions.error },
106
+ React.createElement(FormGroup, { label: t('First name'), isRequired: true, fieldId: "email-notification-first-name", validated: isValidFirstName ? ValidatedOptions.default : ValidatedOptions.error, helperTextInvalid: t('First name cannot be empty') },
107
107
  React.createElement(TextInput, { value: firstName, className: "form-control", isRequired: true, type: "text", onChange: onFirstNameChange, "aria-label": t('First Name'), placeholder: t('First Name'), maxLength: 254, validated: isValidFirstName ? ValidatedOptions.default : ValidatedOptions.error })),
108
108
  React.createElement(FormGroup, { label: t('Last name'), fieldId: "email-notification-last-name" },
109
109
  React.createElement(TextInput, { value: lastName, className: "form-control", type: "text", onChange: onLastNameChange, "aria-label": t('Last Name'), placeholder: t('Last Name'), maxLength: 254 })))));
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NotificationEmails/index.tsx"],"names":[],"mappings":"AAkBA,wBAAgB,kBAAkB,gBAwNjC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NotificationEmails/index.tsx"],"names":[],"mappings":"AAkBA,wBAAgB,kBAAkB,gBAmOjC"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { customEmail } from '@cee-eng/hydrajs';
11
- import { AlertVariant, Button, ButtonVariant } from '@patternfly/react-core';
11
+ import { AlertVariant, Button, ButtonVariant, SearchInput } from '@patternfly/react-core';
12
12
  import { Input, ToastNotification, useConfirmation } from '@rh-support/components';
13
13
  import { fetchAccountCustomEmails, setAccountCustomEmails, useGlobalDispatchContext, useGlobalStateContext, } from '@rh-support/react-context';
14
14
  import isEmpty from 'lodash/isEmpty';
@@ -32,15 +32,20 @@ export function NotificationEmails() {
32
32
  });
33
33
  const [emailToAdd, setEmailToAdd] = useState('');
34
34
  const [isAddButtonDisabled, setIsAddButtonDisabled] = useState(true);
35
+ const [keepPageNumberOnDataChange, setKeepPageNumberOnDataChange] = useState(undefined);
35
36
  useEffect(() => {
36
37
  fetchAccountCustomEmails(dispatch, loggedInUserJwtToken.account_number);
37
38
  }, [dispatch, loggedInUserJwtToken]);
38
- const onSearchChange = (str) => setSearchString(str);
39
+ const onSearchChange = (str) => {
40
+ setSearchString(str);
41
+ setKeepPageNumberOnDataChange(false);
42
+ };
39
43
  const editEmail = (notificationEmail) => {
40
44
  setSelectedEmailNotification(notificationEmail);
41
45
  setIsEditModalOpen(true);
42
46
  };
43
47
  const onModalClose = () => {
48
+ setIsAddingNotificationEmail(false);
44
49
  setIsEditModalOpen(false);
45
50
  setSelectedEmailNotification({ firstName: '', lastName: '', email: '' });
46
51
  };
@@ -63,6 +68,7 @@ export function NotificationEmails() {
63
68
  React.createElement(Trans, null, "Are you sure you want to remove this notification email?"))),
64
69
  });
65
70
  yield customEmail.deleteCustomEmailFromAccount(loggedInUserJwtToken.account_number, email);
71
+ setKeepPageNumberOnDataChange(true);
66
72
  const newAccountCustomEmails = accountCustomEmails.data.filter((a) => a.emailAddress !== email);
67
73
  setAccountCustomEmails(dispatch, newAccountCustomEmails);
68
74
  ToastNotification.addSuccessMessage(t('Notification email has been successfully removed'));
@@ -72,8 +78,9 @@ export function NotificationEmails() {
72
78
  !isEmpty(e) && ToastNotification.addDangerMessage(t('Notification email account failed to update'));
73
79
  }
74
80
  });
75
- const onUpdate = (email, firstName, lastName) => __awaiter(this, void 0, void 0, function* () {
81
+ const onUpdate = (email, firstName, lastName) => {
76
82
  setIsEditModalOpen(false);
83
+ setKeepPageNumberOnDataChange(true);
77
84
  const updatedAccountCustomEmail = accountCustomEmails.data.map((emailNotification) => {
78
85
  if (emailNotification.emailAddress === selectedEmailNotification.email) {
79
86
  emailNotification.firstName = firstName;
@@ -83,11 +90,12 @@ export function NotificationEmails() {
83
90
  return emailNotification;
84
91
  });
85
92
  setAccountCustomEmails(dispatch, updatedAccountCustomEmail);
86
- });
87
- const onAdd = (emailAddress, firstName, lastName) => __awaiter(this, void 0, void 0, function* () {
93
+ };
94
+ const onAdd = (emailAddress, firstName, lastName) => {
88
95
  setIsAddingNotificationEmail(false);
89
96
  setIsEditModalOpen(false);
90
97
  setEmailToAdd('');
98
+ setKeepPageNumberOnDataChange(false);
91
99
  setAccountCustomEmails(dispatch, [
92
100
  ...accountCustomEmails.data,
93
101
  {
@@ -100,7 +108,7 @@ export function NotificationEmails() {
100
108
  notifyOfNewCases: false,
101
109
  },
102
110
  ]);
103
- });
111
+ };
104
112
  const columns = [
105
113
  {
106
114
  accessor: (notificationEmail) => notificationEmail.firstName,
@@ -160,7 +168,7 @@ export function NotificationEmails() {
160
168
  React.createElement(Trans, null, "Add")))),
161
169
  React.createElement("div", { className: "toolbar-right" },
162
170
  React.createElement("label", { htmlFor: "search-notification-emails-selector" }, "Filter by"),
163
- React.createElement(Input, { id: "search-notification-emails-selector", placeholder: t('Search for an existing email'), ariaLabel: t('Notification emails search input'), onChange: onSearchChange }))),
164
- React.createElement(ManageTable, { ariaLabel: t('Table to manage Notification emails'), columns: columns, data: emailLists || [], sortInfo: { column: 'first-name', direction: 'asc' }, errorVariant: AlertVariant.warning, isFetching: accountCustomEmails.isFetching, isError: accountCustomEmails.isError, errorTitle: t('Notification emails error'), errorComponent: React.createElement(Trans, null, "Could not get notification emails"), actionResolver: emailLists && emailLists.length !== 0 ? actionResolver : null }),
171
+ React.createElement(SearchInput, { className: "pf-u-flex-grow-1 pf-c-search-input pf-u-background-color-100", id: "search-notification-emails-selector", placeholder: t('Search for an existing email'), value: searchString, onChange: onSearchChange, onClear: () => onSearchChange(''), "aria-label": t('Search for an existing email') }))),
172
+ React.createElement(ManageTable, { ariaLabel: t('Table to manage Notification emails'), columns: columns, data: emailLists || [], sortInfo: { column: 'first-name', direction: 'asc' }, errorVariant: AlertVariant.warning, isFetching: accountCustomEmails.isFetching, isError: accountCustomEmails.isError, errorTitle: t('Notification emails error'), errorComponent: React.createElement(Trans, null, "Could not get notification emails"), actionResolver: emailLists && emailLists.length !== 0 ? actionResolver : null, keepPageNumberOnDataChange: keepPageNumberOnDataChange }),
165
173
  React.createElement(NotificationEmailsModal, { isOpen: isEditModalOpen, onClose: onModalClose, selectedEmailNotification: selectedEmailNotification, onUpdate: onUpdate, onAdd: onAdd, accountNumber: loggedInUserJwtToken.account_number, isAddingNotificationEmail: isAddingNotificationEmail, emailsList: (accountCustomEmails.data || []).map((e) => e.emailAddress) })));
166
174
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentSingleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,EAGH,oBAAoB,EAQvB,MAAM,wCAAwC,CAAC;AAGhD,UAAU,MAAM;IACZ,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,CAAC,EAAE,MAAM,CAAC;CACb;AAaD,eAAO,MAAM,oBAAoB,kDAAmD,MAAM,gBAkXzF,CAAC"}
1
+ {"version":3,"file":"TopContentSingleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,EAGH,oBAAoB,EAOvB,MAAM,wCAAwC,CAAC;AAGhD,UAAU,MAAM;IACZ,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,CAAC,EAAE,MAAM,CAAC;CACb;AAaD,eAAO,MAAM,oBAAoB,kDAAmD,MAAM,gBAwXzF,CAAC"}
@@ -19,7 +19,7 @@ import React, { useEffect, useState } from 'react';
19
19
  import { Trans, useTranslation } from 'react-i18next';
20
20
  import { useTopContentContext, useTopContentDispatchContext } from '../../../../context/TopContentProvider';
21
21
  import { getTopContentUrl } from '../../../../reducers/TopContentHelpers';
22
- import { ContentMode, deleteTopContent, removeTopContent, resetChangeInCategory, saveAddedNewSectionContents, saveAddToTopContent, saveChangeInCategoryContent, setIsAddingCategory, } from '../../../../reducers/TopContentReducer';
22
+ import { ContentMode, deleteTopContent, removeTopContent, saveAddedNewSectionContents, saveAddToTopContent, saveChangeInCategoryContent, setIsAddingCategory, } from '../../../../reducers/TopContentReducer';
23
23
  import { AddNewCategoryDropDown } from './AddNewCategoryDropDown';
24
24
  function formatDuplicateWarning(arr) {
25
25
  if (arr.length === 0 || arr.length === 1)
@@ -40,7 +40,7 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
40
40
  };
41
41
  const content = category.content && category.content[i];
42
42
  const { t } = useTranslation();
43
- const { topContentEditState, isCatOnlyForMajorVersion, selectedProduct, selectedVersion, isCreatingNewSet, topContentResponse, contentUrls, } = useTopContentContext();
43
+ const { topContentEditState, isCatOnlyForMajorVersion, selectedProduct, selectedVersion, contentUrls } = useTopContentContext();
44
44
  const topContentDispatch = useTopContentDispatchContext();
45
45
  const [localContentUrl, setLocalContentUrl] = useState(content.contentUrl);
46
46
  const [localContentTitle, setLocalContentTitle] = useState(content.contentTitle);
@@ -49,6 +49,7 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
49
49
  const [contentUrlIsValid, setContentUrlIsValid] = useState(true);
50
50
  const [showDuplicateError, setShowDuplicateError] = useState(false);
51
51
  const [duplicatUrlErrorArray, setDuplicatUrlErrorArray] = useState([]);
52
+ const [isSaving, setIsSaving] = useState(false);
52
53
  const onContentTitleChange = (contentTitle, event) => {
53
54
  const contentTitleIsValid = event.target.validity.valid;
54
55
  setContentTitleIsValid(contentTitleIsValid);
@@ -150,17 +151,22 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
150
151
  const onSaveAddContentToCategory = () => __awaiter(void 0, void 0, void 0, function* () {
151
152
  try {
152
153
  const newContent = Object.assign(Object.assign({}, content), { contentTitle: localContentTitle, contentUrl: localContentUrl });
154
+ setIsSaving(true);
153
155
  yield saveAddToTopContent(topContentDispatch, topContentEditState, category.id, category.categoryId, newContent, i);
154
156
  ToastNotification.addSuccessMessage(t('Content added successfully'));
155
157
  }
156
158
  catch (error) {
157
159
  ToastNotification.addDangerMessage(t('There was an error adding content'));
158
160
  }
161
+ finally {
162
+ setIsSaving(false);
163
+ }
159
164
  return;
160
165
  });
161
166
  const onSaveUpdateContent = () => __awaiter(void 0, void 0, void 0, function* () {
162
167
  try {
163
168
  const updatedContent = Object.assign(Object.assign({}, content), { contentTitle: localContentTitle, contentUrl: localContentUrl });
169
+ setIsSaving(true);
164
170
  yield saveChangeInCategoryContent(topContentDispatch, topContentEditState, category.categoryId, updatedContent, i);
165
171
  editToggle();
166
172
  ToastNotification.addSuccessMessage(t('Content updated successfully'));
@@ -168,10 +174,14 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
168
174
  catch (error) {
169
175
  ToastNotification.addDangerMessage(t('There was an error updating content'));
170
176
  }
177
+ finally {
178
+ setIsSaving(false);
179
+ }
171
180
  });
172
181
  const onSaveCreateNewCategory = () => __awaiter(void 0, void 0, void 0, function* () {
173
182
  try {
174
183
  const newContent = Object.assign(Object.assign({}, content), { contentTitle: localContentTitle, contentUrl: localContentUrl });
184
+ setIsSaving(true);
175
185
  yield saveAddedNewSectionContents(topContentDispatch, topContentEditState, newCategory, selectedProduct, selectedVersion, isCatOnlyForMajorVersion, newContent);
176
186
  ToastNotification.addSuccessMessage(t('Category created successfully'));
177
187
  setIsAddingCategory(topContentDispatch, false);
@@ -179,8 +189,11 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
179
189
  catch (error) {
180
190
  ToastNotification.addDangerMessage(t('There was an error creating category'));
181
191
  }
192
+ finally {
193
+ setIsSaving(false);
194
+ }
182
195
  });
183
- const onSave = () => __awaiter(void 0, void 0, void 0, function* () {
196
+ const onSave = () => {
184
197
  if (content.mode === ContentMode.NEW_SECTION_CONTENT) {
185
198
  // create new category
186
199
  onSaveCreateNewCategory();
@@ -193,7 +206,7 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
193
206
  //update content
194
207
  onSaveUpdateContent();
195
208
  }
196
- });
209
+ };
197
210
  const onSubmit = (e) => e.preventDefault();
198
211
  const onAddedNewCategoryChange = (category) => {
199
212
  setNewCategory(category);
@@ -202,9 +215,6 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
202
215
  if (content.mode === ContentMode.ADD || content.mode === ContentMode.NEW_SECTION_CONTENT) {
203
216
  removeTopContent(topContentDispatch, topContentEditState, category.id, i);
204
217
  }
205
- // when we create new set, we create an empty category.
206
- // when user click on cancel need to reset to original catagory list
207
- isCreatingNewSet && resetChangeInCategory(topContentDispatch, topContentResponse);
208
218
  // reset values to initial props values
209
219
  setLocalContentTitle(content.contentTitle);
210
220
  setLocalContentUrl(content.contentUrl);
@@ -213,6 +223,7 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
213
223
  setDuplicatUrlErrorArray([]);
214
224
  setShowDuplicateError(false);
215
225
  setContentUrlIsValid(true);
226
+ setIsAddingCategory(topContentDispatch, false);
216
227
  };
217
228
  useEffect(() => {
218
229
  if (isArrangingContent)
@@ -254,7 +265,7 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
254
265
  "."))),
255
266
  React.createElement("span", { className: "pf-c-accordion__expanded-content-footer" },
256
267
  React.createElement("span", null,
257
- React.createElement(Button, { variant: "primary", onClick: onSave, isDisabled: isSaveButtonDisabled },
268
+ React.createElement(Button, { variant: "primary", onClick: onSave, isDisabled: isSaveButtonDisabled || isSaving, isLoading: isSaving },
258
269
  React.createElement(Trans, null, "Save")),
259
270
  ' ',
260
271
  React.createElement(Button, { variant: "tertiary", onClick: onCancel, "data-tracking-id": "cancel-button-top-content" },
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentProductVersionSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/TopContentManagement/TopContentProductVersionSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;AAOrE,UAAU,MAAO,SAAQ,gBAAgB;IACrC,eAAe,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAC3D,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;CACrB;AA8BD,iBAAS,gCAAgC,CAAC,KAAK,EAAE,MAAM,eAoHtD;kBApHQ,gCAAgC;;;AAuHzC,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
1
+ {"version":3,"file":"TopContentProductVersionSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/TopContentManagement/TopContentProductVersionSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;AASrE,UAAU,MAAO,SAAQ,gBAAgB;IACrC,eAAe,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAC3D,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;CACrB;AAgCD,iBAAS,gCAAgC,CAAC,KAAK,EAAE,MAAM,eAwHtD;kBAxHQ,gCAAgC;;;AA2HzC,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
@@ -2,35 +2,37 @@ import { products as productsApi } from '@cee-eng/hydrajs';
2
2
  import { Dropdown, useFetch } from '@rh-support/components';
3
3
  import { getUniqueSortedVersions, getVersion, toOption, toOptions } from '@rh-support/utils';
4
4
  import isEmpty from 'lodash/isEmpty';
5
- import uniq from 'lodash/uniq';
6
5
  import React, { useEffect, useState } from 'react';
7
6
  import { useTranslation } from 'react-i18next';
7
+ import { useTopContentDispatchContext } from '../../context/TopContentProvider';
8
+ import { setIsAddingCategory } from '../../reducers/TopContentReducer';
8
9
  const defaultProps = {
9
10
  htmlForId: '',
10
11
  className: '',
11
12
  id: '',
12
13
  };
13
14
  function postVersionsProcessor(versionItems) {
14
- versionItems.items = getUniqueSortedVersions(versionItems.items);
15
+ versionItems.items = getProcessedVersions(getUniqueSortedVersions(versionItems.items));
15
16
  return versionItems;
16
17
  }
17
18
  // for each major version, we add major.x version
18
19
  function getProcessedVersions(arr) {
19
20
  if (!arr)
20
21
  return [];
21
- var majorsArray = [];
22
- var i = 0;
22
+ let majorsArray = [];
23
+ let i = 0;
23
24
  while (i < arr.length) {
24
25
  const major = getVersion(arr[i]).major;
25
- if (parseInt(major) && !majorsArray.includes(major)) {
26
+ if (Number(major) && !majorsArray.includes(major)) {
26
27
  majorsArray.push(major);
27
28
  arr.splice(i, 0, major + '.x');
29
+ i = i + 2;
28
30
  }
29
31
  else {
30
32
  i++;
31
33
  }
32
34
  }
33
- return uniq(arr);
35
+ return arr;
34
36
  }
35
37
  function TopContentProductVersionSelector(props) {
36
38
  const { t } = useTranslation();
@@ -42,6 +44,7 @@ function TopContentProductVersionSelector(props) {
42
44
  const [isVersionInValid, setIsVersionInValid] = useState(false);
43
45
  const [isProductBlured, setIsProductBlured] = useState(false);
44
46
  const [isVersionBlured, setIsVersionBlured] = useState(false);
47
+ const topContentDispatch = useTopContentDispatchContext();
45
48
  /**
46
49
  * Fetch products on load
47
50
  */
@@ -53,18 +56,20 @@ function TopContentProductVersionSelector(props) {
53
56
  * Auto select the version if its the only one in the response
54
57
  */
55
58
  useEffect(() => {
56
- const versionsLocal = uniq(versions === null || versions === void 0 ? void 0 : versions.items);
59
+ const versionsLocal = (versions === null || versions === void 0 ? void 0 : versions.items) || [];
57
60
  if (versionsLocal.length === 1 && props.selectedVersion !== versions.items[0]) {
58
61
  props.onVersionChange(versions.items[0]);
59
62
  }
60
63
  // eslint-disable-next-line react-hooks/exhaustive-deps
61
64
  }, [versions]);
62
65
  const onProductChange = (option) => {
66
+ setIsAddingCategory(topContentDispatch, false);
63
67
  props.onProductChange(option.value);
64
68
  validateProduct(option);
65
69
  isProductValid(option) && getProductVersions(option.value.name);
66
70
  };
67
71
  const onVersionChange = (option) => {
72
+ setIsAddingCategory(topContentDispatch, false);
68
73
  props.onVersionChange(option.value);
69
74
  validateVersion(option);
70
75
  };
@@ -98,7 +103,7 @@ function TopContentProductVersionSelector(props) {
98
103
  React.createElement(Dropdown, { className: `tc-product-dropdown`, placeholder: t('Select a product'), list: products ? toOptions(products, { labelKey: 'name' }) : [], title: `Select a product`, selectedItem: toOption(props.selectedProduct, { labelKey: 'name' }), isInValid: isProductInValid, onChange: onProductChange, onOuterClick: onProductOuterClick, searchable: true, isLoadingList: isLoadingProducts, onClearSelection: onProductClear, id: "tc-product-dropdown-selector", "data-tracking-id": "tc-product-dropdown-selector" })),
99
104
  React.createElement("div", { className: "toolbar-right" },
100
105
  React.createElement("label", { htmlFor: "version-selector-dropdown-toggle" }, "Version"),
101
- React.createElement(Dropdown, { selectedItem: toOption(props.selectedVersion), list: props.selectedProduct ? toOptions(getProcessedVersions(versions === null || versions === void 0 ? void 0 : versions.items)) : [], id: "version-selector-dropdown", placeholder: t('Select a version'), isLoadingList: isLoadingVersions, title: `Versions for ${props.selectedProduct.name}`, disabled: isEmpty(versions === null || versions === void 0 ? void 0 : versions.items), isInValid: isVersionInValid, onChange: onVersionChange, onOuterClick: onVersionOuterClick, "data-tracking-id": "version-dropdown-selector" }))));
106
+ React.createElement(Dropdown, { selectedItem: toOption(props.selectedVersion), list: props.selectedProduct ? toOptions(versions === null || versions === void 0 ? void 0 : versions.items) : [], id: "version-selector-dropdown", placeholder: t('Select a version'), isLoadingList: isLoadingVersions, title: `Versions for ${props.selectedProduct.name}`, disabled: isEmpty(versions === null || versions === void 0 ? void 0 : versions.items), isInValid: isVersionInValid, onChange: onVersionChange, onOuterClick: onVersionOuterClick, "data-tracking-id": "version-dropdown-selector" }))));
102
107
  }
103
108
  TopContentProductVersionSelector.defaultProps = defaultProps;
104
109
  export { TopContentProductVersionSelector };
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/TopContentReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EACH,WAAW,EAEX,mBAAmB,EACnB,eAAe,EAGlB,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMxE,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACrD,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,oBAAoB,EAAE,CAAC;CACnC;AAED;;;;;;;EAOE;AACF,UAAU,YAAY;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,OAAO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B,MAAM,mBA+BrB,CAAC;AAGF,eAAO,MAAM,iBAAiB,wBAA+B,oBAAoB,EAAE,oGAiBlF,CAAC;AAEF,eAAO,MAAM,eAAe,aAAoB,6BAA6B,mBAwB5E,CAAC;AAEF,eAAO,MAAM,sBAAsB,aAAc,6BAA6B,uBAAuB,OAAO,SAK3G,CAAC"}
@@ -51,7 +51,7 @@ export const TopContentReducer = (pState, action) => {
51
51
  return Object.assign(Object.assign({}, pState), { isCatOnlyForMajorVersion: action.payload.isCatOnlyForMajorVersion, topContentEditState: action.payload.topContentEditState, isCreatingNewSet: action.payload.isCreatingNewSet });
52
52
  }
53
53
  case TopContentReducerConstants.changeTopContentStateOnSave: {
54
- return Object.assign(Object.assign({}, pState), { topContentEditState: [...action.payload.topContentEditState], topContentResponse: action.payload.topContentResponse, contentUrls: action.payload.contentUrls });
54
+ return Object.assign(Object.assign({}, pState), { topContentEditState: action.payload.topContentEditState, topContentResponse: action.payload.topContentResponse, contentUrls: action.payload.contentUrls });
55
55
  }
56
56
  case TopContentReducerConstants.changeTopContentStateOnCatsArrangementSave: {
57
57
  return Object.assign(Object.assign({}, pState), { topContentEditState: [...action.payload.topContentEditState], topContentResponse: action.payload.topContentResponse });
@@ -239,13 +239,15 @@ export const deleteTopContent = (dispatch, topContentEditState, categoryId, topC
239
239
  cat.content = cat.content.filter((item) => item.topContentId !== topContentId);
240
240
  }
241
241
  });
242
+ // if content length equal zero after delete, remove catagory
243
+ const topContent = topContentEditState.filter((cat) => cat.content.length !== 0);
242
244
  // update both current state and original get state on app load
243
245
  dispatch({
244
246
  type: TopContentReducerConstants.changeTopContentStateOnSave,
245
247
  payload: {
246
- topContentEditState,
247
- topContentResponse: getApiResourceObject(topContentEditState),
248
- contentUrls: getContentUrls(topContentEditState),
248
+ topContentEditState: topContent,
249
+ topContentResponse: getApiResourceObject(topContent),
250
+ contentUrls: getContentUrls(topContent),
249
251
  },
250
252
  });
251
253
  }
@@ -219,11 +219,6 @@
219
219
  .top-content-manage-wrapper {
220
220
  border: 1px solid #ccc;
221
221
  border-top: none;
222
-
223
- .pf-c-spinner {
224
- margin: 0 auto;
225
- padding: 3rem;
226
- }
227
222
  }
228
223
  }
229
224
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "0.2.7",
3
+ "version": "0.2.11",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "homepage": "",
@@ -97,9 +97,9 @@
97
97
  "@patternfly/react-core": "4.128.2",
98
98
  "@patternfly/react-table": "4.26.7",
99
99
  "@rh-support/api": "0.3.3",
100
- "@rh-support/components": "1.1.6",
101
- "@rh-support/configs": "0.2.0",
102
- "@rh-support/react-context": "0.2.7",
100
+ "@rh-support/components": "1.1.9",
101
+ "@rh-support/configs": "0.2.1",
102
+ "@rh-support/react-context": "0.2.10",
103
103
  "@rh-support/types": "0.2.0",
104
104
  "@rh-support/user-permissions": "0.2.5",
105
105
  "@rh-support/utils": "0.2.5",
@@ -113,5 +113,5 @@
113
113
  "react-i18next": ">=10.11.0",
114
114
  "react-router-dom": ">=5.1.2"
115
115
  },
116
- "gitHead": "3dff1672e22e8df3181b7aaa053faaddc36bacf1"
116
+ "gitHead": "27553f3c53998d0f3657c7e2f04b2eacdcda00c2"
117
117
  }