diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/assets/javascripts/deploy_freeze/store/mutations.js | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/assets/javascripts/deploy_freeze/store/mutations.js')
-rw-r--r-- | app/assets/javascripts/deploy_freeze/store/mutations.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/app/assets/javascripts/deploy_freeze/store/mutations.js b/app/assets/javascripts/deploy_freeze/store/mutations.js new file mode 100644 index 00000000000..89ce1dc5428 --- /dev/null +++ b/app/assets/javascripts/deploy_freeze/store/mutations.js @@ -0,0 +1,54 @@ +import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; +import * as types from './mutation_types'; + +const formatTimezoneName = (freezePeriod, timezoneList) => + convertObjectPropsToCamelCase({ + ...freezePeriod, + cron_timezone: timezoneList.find(tz => tz.identifier === freezePeriod.cron_timezone)?.name, + }); + +export default { + [types.REQUEST_FREEZE_PERIODS](state) { + state.isLoading = true; + }, + + [types.RECEIVE_FREEZE_PERIODS_SUCCESS](state, freezePeriods) { + state.isLoading = false; + state.freezePeriods = freezePeriods.map(freezePeriod => + formatTimezoneName(freezePeriod, state.timezoneData), + ); + }, + + [types.REQUEST_ADD_FREEZE_PERIOD](state) { + state.isLoading = true; + }, + + [types.RECEIVE_ADD_FREEZE_PERIOD_SUCCESS](state) { + state.isLoading = false; + }, + + [types.RECEIVE_ADD_FREEZE_PERIOD_ERROR](state, error) { + state.isLoading = false; + state.error = error; + }, + + [types.SET_SELECTED_TIMEZONE](state, timezone) { + state.selectedTimezone = timezone.formattedTimezone; + state.selectedTimezoneIdentifier = timezone.identifier; + }, + + [types.SET_FREEZE_START_CRON](state, freezeStartCron) { + state.freezeStartCron = freezeStartCron; + }, + + [types.SET_FREEZE_END_CRON](state, freezeEndCron) { + state.freezeEndCron = freezeEndCron; + }, + + [types.RESET_MODAL](state) { + state.freezeStartCron = ''; + state.freezeEndCron = ''; + state.selectedTimezone = ''; + state.selectedTimezoneIdentifier = ''; + }, +}; |