columns.js 992 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { saveSettings } from './settings';
  2. export const COLUMN_ADD = 'COLUMN_ADD';
  3. export const COLUMN_REMOVE = 'COLUMN_REMOVE';
  4. export const COLUMN_MOVE = 'COLUMN_MOVE';
  5. export const COLUMN_PARAMS_CHANGE = 'COLUMN_PARAMS_CHANGE';
  6. export function addColumn(id, params) {
  7. return dispatch => {
  8. dispatch({
  9. type: COLUMN_ADD,
  10. id,
  11. params,
  12. });
  13. dispatch(saveSettings());
  14. };
  15. };
  16. export function removeColumn(uuid) {
  17. return dispatch => {
  18. dispatch({
  19. type: COLUMN_REMOVE,
  20. uuid,
  21. });
  22. dispatch(saveSettings());
  23. };
  24. };
  25. export function moveColumn(uuid, direction) {
  26. return dispatch => {
  27. dispatch({
  28. type: COLUMN_MOVE,
  29. uuid,
  30. direction,
  31. });
  32. dispatch(saveSettings());
  33. };
  34. };
  35. export function changeColumnParams(uuid, path, value) {
  36. return dispatch => {
  37. dispatch({
  38. type: COLUMN_PARAMS_CHANGE,
  39. uuid,
  40. path,
  41. value,
  42. });
  43. dispatch(saveSettings());
  44. };
  45. }