@bigbinary/neeto-tags-frontend 0.0.38 → 0.0.40

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.
package/dist/index.js CHANGED
@@ -6823,7 +6823,8 @@ var fetch = function fetch(_ref) {
6823
6823
  params: {
6824
6824
  search_term: searchTerm,
6825
6825
  limit: limit,
6826
- page_no: pageNo
6826
+ page_no: pageNo,
6827
+ term: searchTerm
6827
6828
  }
6828
6829
  });
6829
6830
  };
@@ -6874,7 +6875,8 @@ var useFetchTags = function useFetchTags(params) {
6874
6875
  staleTime: STALE_TIME,
6875
6876
  select: function select(response) {
6876
6877
  return response.data || response;
6877
- }
6878
+ },
6879
+ keepPreviousData: true
6878
6880
  }, options));
6879
6881
  };
6880
6882
 
@@ -7225,7 +7227,7 @@ var Dashboard = function Dashboard(_ref) {
7225
7227
 
7226
7228
  var _useFetchTags = useFetchTags({
7227
7229
  url: tagType.url,
7228
- searchTerm: debouncedSearchTerm,
7230
+ searchTerm: debouncedSearchTerm.trim(),
7229
7231
  limit: DEFAULT_PAGE_SIZE,
7230
7232
  pageNo: pageIndex
7231
7233
  }),
@@ -7259,14 +7261,16 @@ var Dashboard = function Dashboard(_ref) {
7259
7261
  };
7260
7262
 
7261
7263
  var _useDeleteTag = useDeleteTag(),
7262
- mutate = _useDeleteTag.mutate;
7264
+ mutate = _useDeleteTag.mutate,
7265
+ isDeletingTag = _useDeleteTag.isLoading;
7263
7266
 
7264
7267
  var handleConfirmDelete = function handleConfirmDelete() {
7265
7268
  var payload = {
7266
7269
  url: tagType.url,
7267
7270
  id: selectedTag === null || selectedTag === void 0 ? void 0 : selectedTag.id
7268
7271
  };
7269
- mutate(payload, {
7272
+ var isNotDeleting = !isDeletingTag && isDeleteAlertOpen;
7273
+ isNotDeleting && mutate(payload, {
7270
7274
  onSuccess: function onSuccess() {
7271
7275
  var _data$tags, _deleteTags$onSuccess;
7272
7276
 
@@ -7298,6 +7302,7 @@ var Dashboard = function Dashboard(_ref) {
7298
7302
  title: "".concat(tagType.label, " ").concat(t("title").toLocaleLowerCase()),
7299
7303
  menuBarToggle: displayMenu ? handleMenuToggle : null,
7300
7304
  searchProps: {
7305
+ "data-cy": "neeto-tags-search-text-input-field",
7301
7306
  value: searchTerm,
7302
7307
  onChange: function onChange(_ref3) {
7303
7308
  var value = _ref3.target.value;
@@ -7309,6 +7314,7 @@ var Dashboard = function Dashboard(_ref) {
7309
7314
  })
7310
7315
  },
7311
7316
  actionBlock: /*#__PURE__*/React.createElement(React.Fragment, null, tagsMergable && /*#__PURE__*/React.createElement(Button, {
7317
+ "data-cy": "neeto-tags-merge-tags-button",
7312
7318
  style: "secondary",
7313
7319
  label: t("merge.mergeTags"),
7314
7320
  onClick: function onClick() {
@@ -7343,8 +7349,9 @@ var Dashboard = function Dashboard(_ref) {
7343
7349
  className: "w-full flex-grow"
7344
7350
  }, /*#__PURE__*/React.createElement(SubHeader, {
7345
7351
  leftActionBlock: /*#__PURE__*/React.createElement(Typography, {
7352
+ className: "neeto-ui-gray-800 font-semibold",
7346
7353
  component: "h4",
7347
- className: "neeto-ui-gray-800 font-semibold"
7354
+ "data-cy": "neeto-tags-filtered-tags-count-text"
7348
7355
  }, t("tagsWithCount", {
7349
7356
  count: data === null || data === void 0 ? void 0 : data.totalCount,
7350
7357
  type: (_tagType$label = tagType.label) === null || _tagType$label === void 0 ? void 0 : _tagType$label.toLowerCase()
@@ -7359,7 +7366,7 @@ var Dashboard = function Dashboard(_ref) {
7359
7366
  currentPageNumber: pageIndex,
7360
7367
  handlePageChange: setPageIndex,
7361
7368
  totalCount: data === null || data === void 0 ? void 0 : data.totalCount,
7362
- allowRowClick: onTagRowClick,
7369
+ allowRowClick: !!onTagRowClick,
7363
7370
  onRowClick: function onRowClick(event, record, rowIndex) {
7364
7371
  return onTagRowClick({
7365
7372
  event: event,
@@ -7386,6 +7393,7 @@ var Dashboard = function Dashboard(_ref) {
7386
7393
  updateTags: updateTags
7387
7394
  }), /*#__PURE__*/React.createElement(Alert, {
7388
7395
  isOpen: isDeleteAlertOpen,
7396
+ isSubmitting: isDeletingTag,
7389
7397
  title: t("deleteTag"),
7390
7398
  message: /*#__PURE__*/React.createElement(React.Fragment, null, t("deleteItem", {
7391
7399
  type: t("tag").toLocaleLowerCase()
@@ -7403,7 +7411,8 @@ var List = function List(_ref) {
7403
7411
  onSelect = _ref.onSelect,
7404
7412
  selectedCounterTagId = _ref.selectedCounterTagId,
7405
7413
  selectedTagId = _ref.selectedTagId,
7406
- type = _ref.type;
7414
+ type = _ref.type,
7415
+ isSource = _ref.isSource;
7407
7416
 
7408
7417
  var _useTranslation = useTranslation(),
7409
7418
  t = _useTranslation.t;
@@ -7418,6 +7427,7 @@ var List = function List(_ref) {
7418
7427
  searchTerm = _useState4[0],
7419
7428
  setSearchTerm = _useState4[1];
7420
7429
 
7430
+ var listType = isSource ? "source" : "destination";
7421
7431
  useEffect(function () {
7422
7432
  var filteredTags = tagList.filter(function (_ref2) {
7423
7433
  var name = _ref2.name;
@@ -7430,6 +7440,7 @@ var List = function List(_ref) {
7430
7440
  }, /*#__PURE__*/React.createElement("div", {
7431
7441
  className: "tags-merge__title"
7432
7442
  }, /*#__PURE__*/React.createElement("h4", null, type)), /*#__PURE__*/React.createElement(Input$1, {
7443
+ "data-cy": "neeto-tags-merge-".concat(listType, "-search-text-input-field"),
7433
7444
  value: searchTerm,
7434
7445
  onChange: function onChange(e) {
7435
7446
  return setSearchTerm(e.target.value);
@@ -7438,7 +7449,8 @@ var List = function List(_ref) {
7438
7449
  where: t("tag").toLocaleLowerCase()
7439
7450
  })
7440
7451
  }), /*#__PURE__*/React.createElement("div", {
7441
- className: "tags-merge__items"
7452
+ className: "tags-merge__items",
7453
+ "data-cy": "neeto-tags-merge-".concat(listType, "-tags-list")
7442
7454
  }, tags.map(function (tag) {
7443
7455
  return /*#__PURE__*/React.createElement("div", {
7444
7456
  className: classnames("tags-merge__item", {
@@ -7549,11 +7561,13 @@ var MergeAlert = function MergeAlert(_ref) {
7549
7561
  }))), /*#__PURE__*/React.createElement(Modal.Footer, {
7550
7562
  className: "space-x-2"
7551
7563
  }, /*#__PURE__*/React.createElement(Button, {
7564
+ "data-cy": "neeto-tags-merge-proceed-button",
7552
7565
  label: t("proceed"),
7553
7566
  onClick: handleSubmit,
7554
7567
  loading: isSubmitting,
7555
7568
  disabled: isSubmitting
7556
7569
  }), /*#__PURE__*/React.createElement(Button, {
7570
+ "data-cy": "neeto-tags-merge-cancel-button",
7557
7571
  style: "text",
7558
7572
  label: t("cancel"),
7559
7573
  onClick: function onClick() {
@@ -7646,6 +7660,7 @@ var Merge = function Merge(_ref) {
7646
7660
  title: t("merge.mergeTags"),
7647
7661
  menuBarToggle: displayMenu ? handleMenuToggle : null,
7648
7662
  actionBlock: /*#__PURE__*/React.createElement(Button, {
7663
+ "data-cy": "neeto-tags-merge-button",
7649
7664
  disabled: !(sourceTag !== null && sourceTag !== void 0 && sourceTag.id && destinationTag !== null && destinationTag !== void 0 && destinationTag.id),
7650
7665
  onClick: function onClick() {
7651
7666
  setIsModalOpen(true);
@@ -7657,6 +7672,7 @@ var Merge = function Merge(_ref) {
7657
7672
  title: t("noTagsFound"),
7658
7673
  kbArticleUrl: kbArticleUrl,
7659
7674
  actionBlock: /*#__PURE__*/React.createElement(Button, {
7675
+ "data-cy": "neeto-tags-go-back-button",
7660
7676
  size: "small",
7661
7677
  onClick: function onClick() {
7662
7678
  return history.push(tagsPath);
@@ -7674,7 +7690,8 @@ var Merge = function Merge(_ref) {
7674
7690
  selectedTagId: sourceTag === null || sourceTag === void 0 ? void 0 : sourceTag.id,
7675
7691
  type: t("select", {
7676
7692
  what: t("merge.sourceTag").toLocaleLowerCase()
7677
- })
7693
+ }),
7694
+ isSource: true
7678
7695
  }), /*#__PURE__*/React.createElement(List, {
7679
7696
  tagList: data === null || data === void 0 ? void 0 : data.tags,
7680
7697
  onSelect: setDestinationTag,
@@ -7682,7 +7699,8 @@ var Merge = function Merge(_ref) {
7682
7699
  selectedTagId: destinationTag === null || destinationTag === void 0 ? void 0 : destinationTag.id,
7683
7700
  type: t("select", {
7684
7701
  what: t("merge.destinationTag").toLocaleLowerCase()
7685
- })
7702
+ }),
7703
+ isSource: false
7686
7704
  })))), /*#__PURE__*/React.createElement(MergeAlert, {
7687
7705
  showModal: isModalOpen,
7688
7706
  setShowModal: setIsModalOpen,