Sha256: 083d827c0c1cce063f3b80e2da4f1ba6362b66b7fcf18e723e210f347672932c
Contents?: true
Size: 1.66 KB
Versions: 2
Compression:
Stored size: 1.66 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' };
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman-tasks-1.1.0 | webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js |
foreman-tasks-1.0.1 | webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js |