diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 15:09:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 15:09:21 +0000 |
commit | c36152ff8c41fad2f413f253eb7ac5c927e47c56 (patch) | |
tree | bbf300da207de3e8bbf272d44111ceedb18f5833 /app/assets/javascripts/ci_variable_list/store | |
parent | 286fe61013674fe2d245ffc8d2233baf09923e70 (diff) | |
download | gitlab-ce-c36152ff8c41fad2f413f253eb7ac5c927e47c56.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/ci_variable_list/store')
3 files changed, 19 insertions, 21 deletions
diff --git a/app/assets/javascripts/ci_variable_list/store/mutations.js b/app/assets/javascripts/ci_variable_list/store/mutations.js index 74e2bcfa2db..c75eb4a91fd 100644 --- a/app/assets/javascripts/ci_variable_list/store/mutations.js +++ b/app/assets/javascripts/ci_variable_list/store/mutations.js @@ -1,5 +1,5 @@ import * as types from './mutation_types'; -import { __ } from '~/locale'; +import { displayText } from '../constants'; export default { [types.REQUEST_VARIABLES](state) { @@ -61,7 +61,7 @@ export default { [types.RECEIVE_ENVIRONMENTS_SUCCESS](state, environments) { state.isLoading = false; state.environments = environments; - state.environments.unshift(__('All environments')); + state.environments.unshift(displayText.allEnvironmentsText); }, [types.VARIABLE_BEING_EDITED](state, variable) { @@ -70,12 +70,12 @@ export default { [types.CLEAR_MODAL](state) { state.variable = { - variable_type: __('Variable'), + variable_type: displayText.variableText, key: '', secret_value: '', protected: false, masked: false, - environment_scope: __('All environments'), + environment_scope: displayText.allEnvironmentsText, }; }, diff --git a/app/assets/javascripts/ci_variable_list/store/state.js b/app/assets/javascripts/ci_variable_list/store/state.js index c5e0bbfdbf4..5166321d6a7 100644 --- a/app/assets/javascripts/ci_variable_list/store/state.js +++ b/app/assets/javascripts/ci_variable_list/store/state.js @@ -1,4 +1,4 @@ -import { __ } from '~/locale'; +import { displayText } from '../constants'; export default () => ({ endpoint: null, @@ -8,17 +8,17 @@ export default () => ({ isLoading: false, isDeleting: false, variable: { - variable_type: __('Variable'), + variable_type: displayText.variableText, key: '', secret_value: '', protected: false, masked: false, - environment_scope: __('All environments'), + environment_scope: displayText.allEnvironmentsText, }, variables: null, valuesHidden: true, error: null, environments: [], - typeOptions: [__('Variable'), __('File')], + typeOptions: [displayText.variableText, displayText.fileText], variableBeingEdited: null, }); diff --git a/app/assets/javascripts/ci_variable_list/store/utils.js b/app/assets/javascripts/ci_variable_list/store/utils.js index 0b9932d9bb5..3cd8c85024b 100644 --- a/app/assets/javascripts/ci_variable_list/store/utils.js +++ b/app/assets/javascripts/ci_variable_list/store/utils.js @@ -1,23 +1,22 @@ -import { __ } from '~/locale'; import { cloneDeep } from 'lodash'; +import { displayText, types } from '../constants'; -const variableType = 'env_var'; -const fileType = 'file'; - -const variableTypeHandler = type => (type === 'Variable' ? variableType : fileType); +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 === variableType) { - variableCopy.variable_type = __('Variable'); + if (variableCopy.variable_type === types.variableType) { + variableCopy.variable_type = displayText.variableText; } else { - variableCopy.variable_type = __('File'); + variableCopy.variable_type = displayText.fileText; } + variableCopy.secret_value = variableCopy.value; - if (variableCopy.environment_scope === '*') { - variableCopy.environment_scope = __('All environments'); + if (variableCopy.environment_scope === types.allEnvironmentsType) { + variableCopy.environment_scope = displayText.allEnvironmentsText; } variablesToDisplay.push(variableCopy); }); @@ -29,9 +28,8 @@ export const prepareDataForApi = (variable, destroy = false) => { variableCopy.protected = variableCopy.protected.toString(); variableCopy.masked = variableCopy.masked.toString(); variableCopy.variable_type = variableTypeHandler(variableCopy.variable_type); - - if (variableCopy.environment_scope === __('All environments')) { - variableCopy.environment_scope = __('*'); + if (variableCopy.environment_scope === displayText.allEnvironmentsText) { + variableCopy.environment_scope = types.allEnvironmentsType; } if (destroy) { |