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

100% Statements 12/12
100% Branches 0/0
100% Functions 5/5
100% Lines 12/12

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 29        2x 2x           2x 2x     2x 1x 1x     2x 1x     2x 1x 1x    
import { setUrlParams, queryToObject, visitUrl } from '~/lib/utils/url_utility';
import { parseAuditEventSearchQuery, createAuditEventSearchQuery } from '../utils';
import * as types from './mutation_types';
 
export const initializeAuditEvents = ({ commit }) => {
  commit(
    types.INITIALIZE_AUDIT_EVENTS,
    parseAuditEventSearchQuery(queryToObject(window.location.search, { legacySpacesDecode: true })),
  );
};
 
export const searchForAuditEvents = ({ state }) => {
  visitUrl(setUrlParams(createAuditEventSearchQuery(state)));
};
 
export const setDateRange = ({ commit, dispatch }, { startDate, endDate }) => {
  commit(types.SET_DATE_RANGE, { startDate, endDate });
  dispatch('searchForAuditEvents');
};
 
export const setFilterValue = ({ commit }, filterValue) => {
  commit(types.SET_FILTER_VALUE, filterValue);
};
 
export const setSortBy = ({ commit, dispatch }, sortBy) => {
  commit(types.SET_SORT_BY, sortBy);
  dispatch('searchForAuditEvents');
};