import React from 'react'; import PropTypes from 'prop-types'; import URI from 'urijs'; import { getURIsearch } from 'foremanReact/common/urlHelpers'; import { Spinner, Button, Icon } from 'patternfly-react'; import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout'; import { translate as __ } from 'foremanReact/common/I18n'; import { getURIQuery } from 'foremanReact/common/helpers'; import ExportButton from 'foremanReact/routes/common/PageLayout/components/ExportButton/ExportButton'; import { STATUS } from 'foremanReact/constants'; import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks'; import TasksDashboard from '../TasksDashboard'; import TasksTable from './TasksTable'; import { getCSVurl, updateURlQuery } from './TasksTableHelpers'; import ConfirmModal from './Components/ConfirmModal/'; import { TASKS_SEARCH_PROPS, CANCEL_SELECTED_MODAL, RESUME_SELECTED_MODAL, FORCE_UNLOCK_SELECTED_MODAL, CONFIRM_MODAL, } from './TasksTableConstants'; import { ActionSelectButton } from './Components/ActionSelectButton'; import './TasksTablePage.scss'; import { SelectAllAlert } from './Components/SelectAllAlert'; const TasksTablePage = ({ getBreadcrumbs, history, createHeader, selectAllRows, showSelectAll, modalID, openModalAction, ...props }) => { const url = history.location.pathname + history.location.search; const uriQuery = getURIQuery(url); const onSearch = search => { const uri = new URI(url); if (uri.search(true).search === search && uri.search(true).page === '1') { props.getTableItems(uri); } else { const newUriQuery = { search, page: 1, }; updateURlQuery(newUriQuery, history); } }; const { setModalOpen, setModalClosed } = useForemanModal({ id: CONFIRM_MODAL, }); const openModal = id => openModalAction(id, setModalOpen); return (