Source

maintenance-mode/maintenance-mode-actions.js

import popupActions from './maintenace-mode-popup-actions';

const DISABLE = 'maintenanceMode/DISABLE';
const ENABLE = 'maintenanceMode/ENABLE';
const UPDATE = 'maintenanceMode/UPDATE';
const STAGE = 'maintenanceMode/STAGE';
const TOGGLE = 'maintenanceMode/TOGGLE';
const CHANGE_PRISTINE_STATE = 'maintenanceMode/CHANGE_PRISTINE_STATE';

/**
 * Provides a possibility to work with maintenance mode.
 * It is used in the case when you want to restart XL Deploy and don't allow to spawn new tasks by users and only
 * drain existed ones.
 *
 * @module maintenanceMode
 */
export default {
    CHANGE_PRISTINE_STATE,
    /**
     * Changes the pristinity state of maintenance modal dialog.
     * Visually it is represented by asterisk on the title of modal dialog.
     * If pristinity is false and user clicks on "Cancel", first confirmation will be asked before changes be lost.
     *
     * @param {boolean} pristine - the new pristinity value
     * @property {string} type - CHANGE_PRISTINE_STATE
     */
    changePristineState: (pristine) => ({
        pristine,
        type: CHANGE_PRISTINE_STATE
    }),
    DISABLE,
    /**
     * Disables the usage of custom text. And disallows the user to change text in the modal dialog.
     *
     * @property {string} type - DISABLE
     */
    disable: () => ({type: DISABLE}),
    ENABLE,
    /**
     * Enables the usage of custom text. And allows the user to change text in the modal dialog.
     *
     * @property {string} type - ENABLE
     */
    enable: () => ({type: ENABLE}),
    popup: popupActions,
    STAGE,
    /**
     * Stages all user input. It means that it saves in redux store but not persisted to database.
     *
     * @param {String} htmlValue - provided custom input in html representation.
     * @property {string} type - STAGE
     */
    stage: (htmlValue) => ({
        htmlValue,
        type: STAGE
    }),
    TOGGLE,
    /**
     * Enables/disables the maintenance mode.
     * If its enables users can't anymore to create new deployments.
     * Exception is only for admin user.
     *
     * @property {string} type - TOGGLE
     */
    toggle: () => ({type: TOGGLE}),
    UPDATE,
    /**
     * Updates current custom text with new staged one.
     * That means if you want to provide you custom text, first you need to {stage} it and then {update}.
     *
     * @property {string} type - UPDATE
     */
    update: () => ({type: UPDATE})
};