diff --git a/web/src/js/components/FlowTable/FlowTableHead.jsx b/web/src/js/components/FlowTable/FlowTableHead.jsx
index 6deee808e..2cd32524a 100644
--- a/web/src/js/components/FlowTable/FlowTableHead.jsx
+++ b/web/src/js/components/FlowTable/FlowTableHead.jsx
@@ -3,7 +3,7 @@ import { connect } from 'react-redux'
import classnames from 'classnames'
import columns from './FlowColumns'
-import { updateSorter } from '../../ducks/views/main'
+import { updateSort } from '../../ducks/views/main'
FlowTableHead.propTypes = {
onSort: PropTypes.func.isRequired,
@@ -11,7 +11,7 @@ FlowTableHead.propTypes = {
sortColumn: React.PropTypes.string,
}
-function FlowTableHead({ sortColumn, sortDesc, onSort }) {
+function FlowTableHead({ sortColumn, sortDesc, updateSort }) {
const sortType = sortDesc ? 'sort-desc' : 'sort-asc'
return (
@@ -19,7 +19,7 @@ function FlowTableHead({ sortColumn, sortDesc, onSort }) {
{columns.map(Column => (
onSort(Column.name, Column.name !== sortColumn ? false : !sortDesc)}>
+ onClick={() => updateSort(Column.name, Column.name !== sortColumn ? false : !sortDesc)}>
{Column.headerName}
|
))}
@@ -29,10 +29,10 @@ function FlowTableHead({ sortColumn, sortDesc, onSort }) {
export default connect(
state => ({
- sortDesc: state.flows.views.main.sorter.desc,
- sortColumn: state.flows.views.main.sorter.column,
+ sortDesc: state.flows.views.main.sort.desc,
+ sortColumn: state.flows.views.main.sort.column,
}),
{
- onSort: updateSorter,
+ updateSort
}
)(FlowTableHead)
diff --git a/web/src/js/ducks/utils/view.js b/web/src/js/ducks/utils/view.js
index 87f9bd2a1..2296e4540 100755
--- a/web/src/js/ducks/utils/view.js
+++ b/web/src/js/ducks/utils/view.js
@@ -1,7 +1,7 @@
import _ from 'lodash'
export const UPDATE_FILTER = 'VIEW_UPDATE_FILTER'
-export const UPDATE_SORTER = 'VIEW_UPDATE_SORTER'
+export const UPDATE_SORT = 'VIEW_UPDATE_SORT'
export const ADD = 'VIEW_ADD'
export const UPDATE = 'VIEW_UPDATE'
export const REMOVE = 'VIEW_REMOVE'
@@ -16,7 +16,7 @@ export default function reduce(state = defaultState, action) {
switch (action.type) {
case UPDATE_FILTER: {
- const data = action.list.data.filter(action.filter).sort(action.sorter)
+ const data = action.list.data.filter(action.filter).sort(action.sort)
return {
...state,
data,
@@ -24,8 +24,8 @@ export default function reduce(state = defaultState, action) {
}
}
- case UPDATE_SORTER: {
- const data = [...state.data].sort(action.sorter)
+ case UPDATE_SORT: {
+ const data = [...state.data].sort(action.sort)
return {
...state,
data,
@@ -39,7 +39,7 @@ export default function reduce(state = defaultState, action) {
}
return {
...state,
- ...sortedInsert(state, action.item, action.sorter),
+ ...sortedInsert(state, action.item, action.sort),
}
case REMOVE:
@@ -64,12 +64,12 @@ export default function reduce(state = defaultState, action) {
}
return {
...nextState,
- ...sortedInsert(nextState, action.item, action.sorter)
+ ...sortedInsert(nextState, action.item, action.sort)
}
}
case RECEIVE: {
- const data = action.list.data.filter(action.filter).sort(action.sorter)
+ const data = action.list.data.filter(action.filter).sort(action.sort)
return {
...state,
data,
@@ -82,32 +82,32 @@ export default function reduce(state = defaultState, action) {
}
}
-export function updateFilter(list, filter = defaultFilter, sorter = defaultSorter) {
- return { type: UPDATE_FILTER, list, filter, sorter }
+export function updateFilter(list, filter = defaultFilter, sort = defaultSort) {
+ return { type: UPDATE_FILTER, list, filter, sort }
}
-export function updateSorter(sorter = defaultSorter) {
- return { type: UPDATE_SORTER, sorter }
+export function updateSort(sort = defaultSort) {
+ return { type: UPDATE_SORT, sort }
}
-export function add(item, filter = defaultFilter, sorter = defaultSorter) {
- return { type: ADD, item, filter, sorter }
+export function add(item, filter = defaultFilter, sort = defaultSort) {
+ return { type: ADD, item, filter, sort }
}
-export function update(id, item, filter = defaultFilter, sorter = defaultSorter) {
- return { type: UPDATE, id, item, filter, sorter }
+export function update(id, item, filter = defaultFilter, sort = defaultSort) {
+ return { type: UPDATE, id, item, filter, sort }
}
export function remove(id) {
return { type: REMOVE, id }
}
-export function receive(list, filter = defaultFilter, sorter = defaultSorter) {
- return { type: RECEIVE, list, filter, sorter }
+export function receive(list, filter = defaultFilter, sort = defaultSort) {
+ return { type: RECEIVE, list, filter, sort }
}
-function sortedInsert(state, item, sorter) {
- const index = sortedIndex(state.data, item, sorter)
+function sortedInsert(state, item, sort) {
+ const index = sortedIndex(state.data, item, sort)
const data = [...state.data]
const indexOf = { ...state.indexOf }
@@ -132,13 +132,13 @@ function sortedRemove(state, id) {
return { data, indexOf }
}
-function sortedIndex(list, item, sorter) {
+function sortedIndex(list, item, sort) {
let low = 0
let high = list.length
while (low < high) {
const middle = (low + high) >>> 1
- if (sorter(item, list[middle]) >= 0) {
+ if (sort(item, list[middle]) >= 0) {
low = middle + 1
} else {
high = middle
@@ -152,6 +152,6 @@ function defaultFilter() {
return true
}
-function defaultSorter(a, b) {
+function defaultSort(a, b) {
return 0
}
diff --git a/web/src/js/ducks/views/main.js b/web/src/js/ducks/views/main.js
index 778dffa1d..f4968de4b 100755
--- a/web/src/js/ducks/views/main.js
+++ b/web/src/js/ducks/views/main.js
@@ -4,7 +4,7 @@ import reduceView, * as viewActions from '../utils/view'
import * as viewsActions from '../views'
export const UPDATE_FILTER = 'FLOW_VIEWS_MAIN_UPDATE_FILTER'
-export const UPDATE_SORTER = 'FLOW_VIEWS_MAIN_UPDATE_SORTER'
+export const UPDATE_SORT = 'FLOW_VIEWS_MAIN_UPDATE_SORT'
export const UPDATE_HIGHLIGHT = 'FLOW_VIEWS_MAIN_UPDATE_HIGHLIGHT'
export const SELECT = 'FLOW_VIEWS_MAIN_SELECT'
@@ -33,7 +33,7 @@ const defaultState = {
highlight: null,
selected: [],
filter: null,
- sorter: { column: null, desc: false },
+ sort: { column: null, desc: false },
view: undefined,
}
@@ -61,20 +61,20 @@ export default function reduce(state = defaultState, action) {
viewActions.updateFilter(
action.list,
makeFilter(action.filter),
- makeSorter(state.sorter)
+ makeSort(state.sort)
)
),
}
- case UPDATE_SORTER:
- const sorter = { column: action.column, desc: action.desc }
+ case UPDATE_SORT:
+ const sort = { column: action.column, desc: action.desc }
return {
...state,
- sorter,
+ sort,
view: reduceView(
state.view,
- viewActions.updateSorter(
- makeSorter(sorter)
+ viewActions.updateSort(
+ makeSort(sort)
)
),
}
@@ -87,7 +87,7 @@ export default function reduce(state = defaultState, action) {
viewActions.add(
action.item,
makeFilter(state.filter),
- makeSorter(state.sorter)
+ makeSort(state.sort)
)
),
}
@@ -101,7 +101,7 @@ export default function reduce(state = defaultState, action) {
action.id,
action.item,
makeFilter(state.filter),
- makeSorter(state.sorter)
+ makeSort(state.sort)
)
),
}
@@ -125,7 +125,7 @@ export default function reduce(state = defaultState, action) {
viewActions.receive(
action.list,
makeFilter(state.filter),
- makeSorter(state.sorter)
+ makeSort(state.sort)
)
),
}
@@ -157,8 +157,8 @@ export function updateHighlight(highlight) {
/**
* @public
*/
-export function updateSorter(column, desc) {
- return { type: UPDATE_SORTER, column, desc }
+export function updateSort(column, desc) {
+ return { type: UPDATE_SORT, column, desc }
}
/**
@@ -183,7 +183,7 @@ function makeFilter(filter) {
/**
* @private
*/
-function makeSorter({ column, desc }) {
+function makeSort({ column, desc }) {
const sortKeyFun = sortKeyFuns[column]
if (!sortKeyFun) {
return