Sha256: 8f2a0da428a201ee0b74a273bbf39490e0caa07a683caf47755862ecb334c2d6
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
import { selectForemanTasks } from '../../../../ForemanTasksSelectors'; import { selectTasksTableQuery, selectResults, selectSelectedRows, selectItemCount, selectAllRowsSelected, } from '../../TasksTableSelectors'; import { RESUME_MODAL, CANCEL_MODAL } from '../../TasksTableConstants'; import { FORCE_UNLOCK_MODAL } from '../../../TaskActions/TaskActionsConstants'; export const selectCofirmModal = state => selectForemanTasks(state).confirmModal || {}; export const selectActionType = state => selectCofirmModal(state).actionType; export const selectActionText = state => selectCofirmModal(state).actionText; export const selectActionState = state => selectCofirmModal(state).actionState; export const selectClicked = state => selectTasksTableQuery(state).clicked || {}; export const selectSelectedTasks = state => { const selectedIDs = selectResults(state).filter(item => selectSelectedRows(state).includes(item.id) ); return selectedIDs.map(item => ({ name: item.action, id: item.id, isCancellable: item.availableActions.cancellable, isResumable: item.availableActions.resumable, })); }; export const selectSelectedRowsLen = state => { if ( [CANCEL_MODAL, RESUME_MODAL, FORCE_UNLOCK_MODAL].includes( selectActionType(state) ) ) { return 1; } if (selectAllRowsSelected(state)) { return selectItemCount(state); } return selectSelectedRows(state).length; };
Version data entries
3 entries across 3 versions & 1 rubygems