debian-mirror-gitlab/app/assets/javascripts/registry/settings/store/getters.js

27 lines
881 B
JavaScript
Raw Normal View History

2020-03-13 15:44:24 +05:30
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,
2020-05-24 23:13:21 +05:30
name_regex_keep: state.settings.name_regex_keep,
2020-03-13 15:44:24 +05:30
});
export const getIsEdited = state => !isEqual(state.original, state.settings);
2020-04-22 19:07:51 +05:30
export const getIsDisabled = state => {
return !(state.original || state.enableHistoricEntries);
};