debian-mirror-gitlab/app/assets/javascripts/registry/settings/store/getters.js
2020-03-13 15:44:24 +05:30

21 lines
727 B
JavaScript

import { isEqual } from 'lodash';
import { findDefaultOption } from '../../shared/utils';
export const getCadence = state =>
state.settings.cadence || findDefaultOption(state.formOptions.cadence);
export const getKeepN = state =>
state.settings.keep_n || findDefaultOption(state.formOptions.keepN);
export const getOlderThan = state =>
state.settings.older_than || findDefaultOption(state.formOptions.olderThan);
export const getSettings = (state, getters) => ({
enabled: state.settings.enabled,
cadence: getters.getCadence,
older_than: getters.getOlderThan,
keep_n: getters.getKeepN,
name_regex: state.settings.name_regex,
});
export const getIsEdited = state => !isEqual(state.original, state.settings);