webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js in foreman-tasks-0.17.1 vs webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js in foreman-tasks-0.17.2
- old
+ new
@@ -4,15 +4,17 @@
headerFormatterWithProps,
cellFormatter,
} from 'foremanReact/components/common/table';
import { translate as __ } from 'foremanReact/common/I18n';
import {
- dateCellFormmatter,
- actionCellFormatter,
+ selectionHeaderCellFormatter,
+ selectionCellFormatter,
actionNameCellFormatter,
durationCellFormmatter,
-} from './TaskTableFormmatters';
+ actionCellFormatter,
+ dateCellFormmatter,
+} from './formatters';
const headFormat = [headerFormatterWithProps];
const cellFormat = [cellFormatter];
/**
@@ -23,19 +25,35 @@
* @param {String} order in what order to sort a column. If none then set it to undefined/null.
* Otherwise, 'ASC' for ascending and 'DESC' for descending
* @param {function} cancelTask A function to run when the cancel cell is clicked
* @return {Array}
*/
-const createTasksTableSchema = (setSort, by, order, taskActions) => {
+
+const createTasksTableSchema = (
+ setSort,
+ by,
+ order,
+ taskActions,
+ selectionController
+) => {
const sortController = {
apply: setSort,
property: by,
order,
};
return [
column(
+ 'select',
+ 'Select all rows',
+ [label => selectionHeaderCellFormatter(selectionController, label)],
+ [
+ (value, additionalData) =>
+ selectionCellFormatter(selectionController, additionalData),
+ ]
+ ),
+ column(
'action',
__('Action'),
headFormat,
[actionNameCellFormatter('foreman_tasks/tasks')],
{ className: 'col-md-4' }
@@ -51,10 +69,10 @@
]),
sortableColumn('duration', __('Duration'), 3, sortController, [
durationCellFormmatter,
]),
column(
- 'available_actions',
+ 'availableActions',
__('Operation'),
headFormat,
[actionCellFormatter(taskActions)],
{
className: 'col-md-1',