Sha256: 85d9970171f0be95ab3fc7f78a21f500dab3ddacdc2f392924a8c1b68615f556
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
import { createSelector } from 'reselect'; import { translate as __ } from 'foremanReact/common/I18n'; import { selectForemanTasks } from '../../ForemanTasksSelectors'; import { getDuration } from './TasksTableHelpers'; export const selectTasksTable = state => selectForemanTasks(state).tasksTable || {}; export const selectTasksTableContent = state => selectTasksTable(state).tasksTableContent || {}; export const selectTasksTableQuery = state => selectTasksTable(state).tasksTableQuery || {}; export const selectPagitation = state => selectTasksTableQuery(state).pagination || {}; export const selectItemCount = state => selectTasksTableQuery(state).itemCount || 0; export const selectActionName = state => selectTasksTableQuery(state).actionName || ''; export const selectSelectedRows = state => selectTasksTableQuery(state).selectedRows || []; export const selectClicked = state => selectTasksTableQuery(state).clicked || {}; export const selectResults = createSelector( selectTasksTableContent, ({ results }) => results.map(result => ({ ...result, action: result.action || (result.label ? result.label.replace(/::/g, ' ') : result.id), username: result.username || '', state: result.state + (result.frozen ? ` ${__('Disabled')}` : ''), duration: getDuration(result.started_at, result.ended_at), availableActions: result.available_actions, })) ); export const selectStatus = state => selectTasksTableContent(state).status; export const selectError = state => selectTasksTableContent(state).error; export const selectSort = state => selectTasksTableQuery(state).sort || { by: 'started_at', order: 'DESC' }; export const selectAllRowsSelected = state => selectTasksTableQuery(state).allRowsSelected; export const selectShowSelectAll = state => selectTasksTableQuery(state).showSelectAll;
Version data entries
3 entries across 3 versions & 1 rubygems