@bigbinary/neeto-tags-frontend 0.0.39 → 0.0.41
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 +35 -9
- package/dist/index.js.map +1 -1
- package/dist/main.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3648,6 +3648,17 @@ var renderColumnData = function renderColumnData(columns, handleEdit, handleDele
|
|
|
3648
3648
|
}
|
|
3649
3649
|
}]);
|
|
3650
3650
|
};
|
|
3651
|
+
var getCurrentTagType = function getCurrentTagType() {
|
|
3652
|
+
var tagTypes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3653
|
+
var searchParams = new URLSearchParams(window.location.search);
|
|
3654
|
+
var tagLabel = searchParams.get("view");
|
|
3655
|
+
var requiredTagType = tagTypes.find(function (tagType) {
|
|
3656
|
+
var _tagType$label;
|
|
3657
|
+
|
|
3658
|
+
return (tagType === null || tagType === void 0 ? void 0 : (_tagType$label = tagType.label) === null || _tagType$label === void 0 ? void 0 : _tagType$label.toLowerCase()) === tagLabel;
|
|
3659
|
+
});
|
|
3660
|
+
return requiredTagType || tagTypes[0];
|
|
3661
|
+
};
|
|
3651
3662
|
|
|
3652
3663
|
function useDebounce(value, delay) {
|
|
3653
3664
|
var _useState = useState(value),
|
|
@@ -6823,7 +6834,8 @@ var fetch = function fetch(_ref) {
|
|
|
6823
6834
|
params: {
|
|
6824
6835
|
search_term: searchTerm,
|
|
6825
6836
|
limit: limit,
|
|
6826
|
-
page_no: pageNo
|
|
6837
|
+
page_no: pageNo,
|
|
6838
|
+
term: searchTerm
|
|
6827
6839
|
}
|
|
6828
6840
|
});
|
|
6829
6841
|
};
|
|
@@ -6874,7 +6886,8 @@ var useFetchTags = function useFetchTags(params) {
|
|
|
6874
6886
|
staleTime: STALE_TIME,
|
|
6875
6887
|
select: function select(response) {
|
|
6876
6888
|
return response.data || response;
|
|
6877
|
-
}
|
|
6889
|
+
},
|
|
6890
|
+
keepPreviousData: true
|
|
6878
6891
|
}, options));
|
|
6879
6892
|
};
|
|
6880
6893
|
|
|
@@ -7225,7 +7238,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
7225
7238
|
|
|
7226
7239
|
var _useFetchTags = useFetchTags({
|
|
7227
7240
|
url: tagType.url,
|
|
7228
|
-
searchTerm: debouncedSearchTerm,
|
|
7241
|
+
searchTerm: debouncedSearchTerm.trim(),
|
|
7229
7242
|
limit: DEFAULT_PAGE_SIZE,
|
|
7230
7243
|
pageNo: pageIndex
|
|
7231
7244
|
}),
|
|
@@ -7300,6 +7313,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
7300
7313
|
title: "".concat(tagType.label, " ").concat(t("title").toLocaleLowerCase()),
|
|
7301
7314
|
menuBarToggle: displayMenu ? handleMenuToggle : null,
|
|
7302
7315
|
searchProps: {
|
|
7316
|
+
"data-cy": "neeto-tags-search-text-input-field",
|
|
7303
7317
|
value: searchTerm,
|
|
7304
7318
|
onChange: function onChange(_ref3) {
|
|
7305
7319
|
var value = _ref3.target.value;
|
|
@@ -7311,6 +7325,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
7311
7325
|
})
|
|
7312
7326
|
},
|
|
7313
7327
|
actionBlock: /*#__PURE__*/React.createElement(React.Fragment, null, tagsMergable && /*#__PURE__*/React.createElement(Button, {
|
|
7328
|
+
"data-cy": "neeto-tags-merge-tags-button",
|
|
7314
7329
|
style: "secondary",
|
|
7315
7330
|
label: t("merge.mergeTags"),
|
|
7316
7331
|
onClick: function onClick() {
|
|
@@ -7345,8 +7360,9 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
7345
7360
|
className: "w-full flex-grow"
|
|
7346
7361
|
}, /*#__PURE__*/React.createElement(SubHeader, {
|
|
7347
7362
|
leftActionBlock: /*#__PURE__*/React.createElement(Typography, {
|
|
7363
|
+
className: "neeto-ui-gray-800 font-semibold",
|
|
7348
7364
|
component: "h4",
|
|
7349
|
-
|
|
7365
|
+
"data-cy": "neeto-tags-filtered-tags-count-text"
|
|
7350
7366
|
}, t("tagsWithCount", {
|
|
7351
7367
|
count: data === null || data === void 0 ? void 0 : data.totalCount,
|
|
7352
7368
|
type: (_tagType$label = tagType.label) === null || _tagType$label === void 0 ? void 0 : _tagType$label.toLowerCase()
|
|
@@ -7406,7 +7422,8 @@ var List = function List(_ref) {
|
|
|
7406
7422
|
onSelect = _ref.onSelect,
|
|
7407
7423
|
selectedCounterTagId = _ref.selectedCounterTagId,
|
|
7408
7424
|
selectedTagId = _ref.selectedTagId,
|
|
7409
|
-
type = _ref.type
|
|
7425
|
+
type = _ref.type,
|
|
7426
|
+
isSource = _ref.isSource;
|
|
7410
7427
|
|
|
7411
7428
|
var _useTranslation = useTranslation(),
|
|
7412
7429
|
t = _useTranslation.t;
|
|
@@ -7421,6 +7438,7 @@ var List = function List(_ref) {
|
|
|
7421
7438
|
searchTerm = _useState4[0],
|
|
7422
7439
|
setSearchTerm = _useState4[1];
|
|
7423
7440
|
|
|
7441
|
+
var listType = isSource ? "source" : "destination";
|
|
7424
7442
|
useEffect(function () {
|
|
7425
7443
|
var filteredTags = tagList.filter(function (_ref2) {
|
|
7426
7444
|
var name = _ref2.name;
|
|
@@ -7433,6 +7451,7 @@ var List = function List(_ref) {
|
|
|
7433
7451
|
}, /*#__PURE__*/React.createElement("div", {
|
|
7434
7452
|
className: "tags-merge__title"
|
|
7435
7453
|
}, /*#__PURE__*/React.createElement("h4", null, type)), /*#__PURE__*/React.createElement(Input$1, {
|
|
7454
|
+
"data-cy": "neeto-tags-merge-".concat(listType, "-search-text-input-field"),
|
|
7436
7455
|
value: searchTerm,
|
|
7437
7456
|
onChange: function onChange(e) {
|
|
7438
7457
|
return setSearchTerm(e.target.value);
|
|
@@ -7441,7 +7460,8 @@ var List = function List(_ref) {
|
|
|
7441
7460
|
where: t("tag").toLocaleLowerCase()
|
|
7442
7461
|
})
|
|
7443
7462
|
}), /*#__PURE__*/React.createElement("div", {
|
|
7444
|
-
className: "tags-merge__items"
|
|
7463
|
+
className: "tags-merge__items",
|
|
7464
|
+
"data-cy": "neeto-tags-merge-".concat(listType, "-tags-list")
|
|
7445
7465
|
}, tags.map(function (tag) {
|
|
7446
7466
|
return /*#__PURE__*/React.createElement("div", {
|
|
7447
7467
|
className: classnames("tags-merge__item", {
|
|
@@ -7552,11 +7572,13 @@ var MergeAlert = function MergeAlert(_ref) {
|
|
|
7552
7572
|
}))), /*#__PURE__*/React.createElement(Modal.Footer, {
|
|
7553
7573
|
className: "space-x-2"
|
|
7554
7574
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
7575
|
+
"data-cy": "neeto-tags-merge-proceed-button",
|
|
7555
7576
|
label: t("proceed"),
|
|
7556
7577
|
onClick: handleSubmit,
|
|
7557
7578
|
loading: isSubmitting,
|
|
7558
7579
|
disabled: isSubmitting
|
|
7559
7580
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
7581
|
+
"data-cy": "neeto-tags-merge-cancel-button",
|
|
7560
7582
|
style: "text",
|
|
7561
7583
|
label: t("cancel"),
|
|
7562
7584
|
onClick: function onClick() {
|
|
@@ -7649,6 +7671,7 @@ var Merge = function Merge(_ref) {
|
|
|
7649
7671
|
title: t("merge.mergeTags"),
|
|
7650
7672
|
menuBarToggle: displayMenu ? handleMenuToggle : null,
|
|
7651
7673
|
actionBlock: /*#__PURE__*/React.createElement(Button, {
|
|
7674
|
+
"data-cy": "neeto-tags-merge-button",
|
|
7652
7675
|
disabled: !(sourceTag !== null && sourceTag !== void 0 && sourceTag.id && destinationTag !== null && destinationTag !== void 0 && destinationTag.id),
|
|
7653
7676
|
onClick: function onClick() {
|
|
7654
7677
|
setIsModalOpen(true);
|
|
@@ -7660,6 +7683,7 @@ var Merge = function Merge(_ref) {
|
|
|
7660
7683
|
title: t("noTagsFound"),
|
|
7661
7684
|
kbArticleUrl: kbArticleUrl,
|
|
7662
7685
|
actionBlock: /*#__PURE__*/React.createElement(Button, {
|
|
7686
|
+
"data-cy": "neeto-tags-go-back-button",
|
|
7663
7687
|
size: "small",
|
|
7664
7688
|
onClick: function onClick() {
|
|
7665
7689
|
return history.push(tagsPath);
|
|
@@ -7677,7 +7701,8 @@ var Merge = function Merge(_ref) {
|
|
|
7677
7701
|
selectedTagId: sourceTag === null || sourceTag === void 0 ? void 0 : sourceTag.id,
|
|
7678
7702
|
type: t("select", {
|
|
7679
7703
|
what: t("merge.sourceTag").toLocaleLowerCase()
|
|
7680
|
-
})
|
|
7704
|
+
}),
|
|
7705
|
+
isSource: true
|
|
7681
7706
|
}), /*#__PURE__*/React.createElement(List, {
|
|
7682
7707
|
tagList: data === null || data === void 0 ? void 0 : data.tags,
|
|
7683
7708
|
onSelect: setDestinationTag,
|
|
@@ -7685,7 +7710,8 @@ var Merge = function Merge(_ref) {
|
|
|
7685
7710
|
selectedTagId: destinationTag === null || destinationTag === void 0 ? void 0 : destinationTag.id,
|
|
7686
7711
|
type: t("select", {
|
|
7687
7712
|
what: t("merge.destinationTag").toLocaleLowerCase()
|
|
7688
|
-
})
|
|
7713
|
+
}),
|
|
7714
|
+
isSource: false
|
|
7689
7715
|
})))), /*#__PURE__*/React.createElement(MergeAlert, {
|
|
7690
7716
|
showModal: isModalOpen,
|
|
7691
7717
|
setShowModal: setIsModalOpen,
|
|
@@ -7778,7 +7804,7 @@ var Tags = function Tags(_ref) {
|
|
|
7778
7804
|
_config$displayMenu = config.displayMenu,
|
|
7779
7805
|
displayMenu = _config$displayMenu === void 0 ? true : _config$displayMenu;
|
|
7780
7806
|
|
|
7781
|
-
var _useState = useState(tagTypes
|
|
7807
|
+
var _useState = useState(getCurrentTagType(tagTypes)),
|
|
7782
7808
|
_useState2 = _slicedToArray(_useState, 2),
|
|
7783
7809
|
tagType = _useState2[0],
|
|
7784
7810
|
setTagType = _useState2[1];
|