diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-16 21:11:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-16 21:11:26 +0300 |
commit | 8fa0c53e26c947ac647b8067fde3e9673b77b1a6 (patch) | |
tree | da32e7224125973e9e87d3856fb7e672ff41c8b1 /app/assets/javascripts/ci_variable_list/store/utils.js | |
parent | 0552020767452da44de2bf5424096f2cb2ea6bf5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/ci_variable_list/store/utils.js')
-rw-r--r-- | app/assets/javascripts/ci_variable_list/store/utils.js | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/app/assets/javascripts/ci_variable_list/store/utils.js b/app/assets/javascripts/ci_variable_list/store/utils.js deleted file mode 100644 index f46a671ae7b..00000000000 --- a/app/assets/javascripts/ci_variable_list/store/utils.js +++ /dev/null @@ -1,45 +0,0 @@ -import { cloneDeep } from 'lodash'; -import { displayText, types, allEnvironments } from '../constants'; - -const variableTypeHandler = (type) => - type === displayText.variableText ? types.variableType : types.fileType; - -export const prepareDataForDisplay = (variables) => { - const variablesToDisplay = []; - variables.forEach((variable) => { - const variableCopy = variable; - if (variableCopy.variable_type === types.variableType) { - variableCopy.variable_type = displayText.variableText; - } else { - variableCopy.variable_type = displayText.fileText; - } - variableCopy.secret_value = variableCopy.value; - - if (variableCopy.environment_scope === allEnvironments.type) { - variableCopy.environment_scope = displayText.allEnvironmentsText; - } - variableCopy.protected_variable = variableCopy.protected; - variablesToDisplay.push(variableCopy); - }); - return variablesToDisplay; -}; - -export const prepareDataForApi = (variable, destroy = false) => { - const variableCopy = cloneDeep(variable); - variableCopy.protected = variableCopy.protected_variable.toString(); - delete variableCopy.protected_variable; - variableCopy.masked = variableCopy.masked.toString(); - variableCopy.variable_type = variableTypeHandler(variableCopy.variable_type); - if (variableCopy.environment_scope === displayText.allEnvironmentsText) { - variableCopy.environment_scope = allEnvironments.type; - } - - if (destroy) { - // eslint-disable-next-line - variableCopy._destroy = destroy; - } - - return variableCopy; -}; - -export const prepareEnvironments = (environments) => environments.map((e) => e.name); |