All files / ee/app/assets/javascripts/dependencies/store actions.js

100% Statements 19/19
100% Branches 2/2
100% Functions 10/10
100% Lines 16/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28    6x   6x 14x   6x 1x   6x 1x   6x 3x   6x 1x   6x 1x   6x 4x 1x      
import * as types from './mutation_types';
 
export const addListType = ({ commit }, payload) => commit(types.ADD_LIST_TYPE, payload);
 
export const dispatchForNamespaces = ({ state, dispatch }, action, payload) =>
  Promise.all(state.listTypes.map(({ namespace }) => dispatch(`${namespace}/${action}`, payload)));
 
export const setDependenciesEndpoint = (handle, endpoint) =>
  dispatchForNamespaces(handle, 'setDependenciesEndpoint', endpoint);
 
export const setExportDependenciesEndpoint = (handle, payload) =>
  dispatchForNamespaces(handle, 'setExportDependenciesEndpoint', payload);
 
export const setNamespaceType = (handle, payload) =>
  dispatchForNamespaces(handle, 'setNamespaceType', payload);
 
export const setPageInfo = (handle, payload) =>
  dispatchForNamespaces(handle, 'setPageInfo', payload);
 
export const setSortField = (handle, payload) =>
  dispatchForNamespaces(handle, 'setSortField', payload);
 
export const setCurrentList = ({ state, commit }, payload) => {
  if (state.listTypes.map(({ namespace }) => namespace).includes(payload)) {
    commit(types.SET_CURRENT_LIST, payload);
  }
};