diff --git a/src/components/BulkEditActionMenu/BulkEditActionMenu.js b/src/components/BulkEditActionMenu/BulkEditActionMenu.js index 2681b3bb..46a59dd6 100644 --- a/src/components/BulkEditActionMenu/BulkEditActionMenu.js +++ b/src/components/BulkEditActionMenu/BulkEditActionMenu.js @@ -43,10 +43,7 @@ const BulkEditActionMenu = ({ const { step, currentRecordType, - capabilities, - queryRecordType, } = useSearchParams(); - const availableRecordType = capabilities || queryRecordType; const [columnSearch, setColumnSearch] = useState(''); @@ -99,7 +96,7 @@ const BulkEditActionMenu = ({ const columnsOptions = columns.map(item => ({ ...item, - label: item.ignoreTranslation ? item.label : intl.formatMessage({ id: `ui-bulk-edit.columns.${availableRecordType}.${item.label}` }), + label: item.ignoreTranslation ? item.label : intl.formatMessage({ id: `ui-bulk-edit.columns.${currentRecordType}.${item.label}` }), disabled: isLastUnselectedColumn(item.value) || !countOfRecords, })); @@ -112,7 +109,7 @@ const BulkEditActionMenu = ({ }); setVisibleColumns(changedColumns); - localStorage.setItem(`${BULK_VISIBLE_COLUMNS}_${availableRecordType}`, JSON.stringify(changedColumns)); + localStorage.setItem(`${BULK_VISIBLE_COLUMNS}_${currentRecordType}`, JSON.stringify(changedColumns)); }; const handleOnStartEdit = (approach) => { @@ -208,7 +205,6 @@ const BulkEditActionMenu = ({ }> {Boolean(columnsOptions.length) && renderColumnsFilter()} - ); }; diff --git a/src/components/BulkEditList/BulkEditList.js b/src/components/BulkEditList/BulkEditList.js index 364ad065..ed276494 100644 --- a/src/components/BulkEditList/BulkEditList.js +++ b/src/components/BulkEditList/BulkEditList.js @@ -34,6 +34,7 @@ import { useResetAppState } from '../../hooks/useResetAppState'; import BulkEditInAppLayer from './BulkEditListResult/BulkEditInAppLayer/BulkEditInAppLayer'; import { BulkEditListSidebar } from './BulkEditListSidebar/BulkEditListSidebar'; import { useSearchParams } from '../../hooks/useSearchParams'; +import { useBulkOperationDetails } from '../../hooks/api'; export const BulkEditList = () => { const history = useHistory(); @@ -62,6 +63,9 @@ export const BulkEditList = () => { criteria, initialFileName } = useSearchParams(); + + const { bulkDetails } = useBulkOperationDetails({ id: bulkOperationId, additionalQueryKeys: [step] }); + const identifierFilters = Object.values(IDENTIFIER_FILTERS).map((el) => search.getAll(el)); const queryFilters = Object.values(QUERY_FILTERS).map((el) => search.getAll(el)); const logsFilters = Object.values(LOGS_FILTERS).map((el) => search.getAll(el)); @@ -118,7 +122,12 @@ export const BulkEditList = () => { }; const isLogsTab = criteria === CRITERIA.LOGS; - const isActionMenuVisible = visibleColumns?.length && isActionMenuShown && !isLogsTab; + const isQueryTab = criteria === CRITERIA.QUERY; + const isIdentifierTab = criteria === CRITERIA.IDENTIFIER; + const isQueryTabWithPreview = isQueryTab && visibleColumns?.length && bulkDetails?.fqlQuery; + const isIdentifierTabWithPreview = isIdentifierTab && visibleColumns?.length && !bulkDetails?.fqlQuery; + + const isActionMenuVisible = (isQueryTabWithPreview || isIdentifierTabWithPreview) && isActionMenuShown && !isLogsTab; const actionMenu = () => ( isActionMenuVisible && ( diff --git a/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js b/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js index d66a0343..6b8dd8d7 100644 --- a/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js +++ b/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js @@ -94,6 +94,7 @@ export const IdentifierTab = () => { search: buildSearch({ identifier: e.target.value, step: null, + fileName: null, }, location.search), }); diff --git a/src/components/BulkEditList/BulkEditListSidebar/QueryTab/QueryTab.js b/src/components/BulkEditList/BulkEditListSidebar/QueryTab/QueryTab.js index 26ab9d8d..f77bf687 100644 --- a/src/components/BulkEditList/BulkEditListSidebar/QueryTab/QueryTab.js +++ b/src/components/BulkEditList/BulkEditListSidebar/QueryTab/QueryTab.js @@ -66,7 +66,6 @@ export const QueryTab = () => { const handleCapabilityChange = (e) => { history.replace({ - pathname: '/bulk-edit', search: buildSearch({ queryRecordType: e.target.value, }, history.location.search),