debian-mirror-gitlab/app/assets/javascripts/environments/stores/helpers.js
2021-03-08 18:12:59 +05:30

22 lines
773 B
JavaScript

/**
* @param {Object} environment
* @returns {Object}
*/
export const setDeployBoard = (oldEnvironmentState, environment) => {
let parsedEnvironment = environment;
if (environment.size === 1 && environment.rollout_status) {
parsedEnvironment = {
...environment,
hasDeployBoard: true,
isDeployBoardVisible:
oldEnvironmentState.isDeployBoardVisible === false
? oldEnvironmentState.isDeployBoardVisible
: true,
deployBoardData:
environment.rollout_status.status === 'found' ? environment.rollout_status : {},
isLoadingDeployBoard: environment.rollout_status.status === 'loading',
isEmptyDeployBoard: environment.rollout_status.status === 'not_found',
};
}
return parsedEnvironment;
};