diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/google_tag_manager/index.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/pipeline_new/constants.js | 7 | ||||
-rw-r--r-- | app/assets/javascripts/projects/settings/components/shared_runners_toggle.vue | 23 | ||||
-rw-r--r-- | app/assets/javascripts/projects/settings/constants.js | 7 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 6 | ||||
-rw-r--r-- | app/models/concerns/ci/contextable.rb | 47 |
6 files changed, 32 insertions, 66 deletions
diff --git a/app/assets/javascripts/google_tag_manager/index.js b/app/assets/javascripts/google_tag_manager/index.js index 0bb4f450101..d6767001eed 100644 --- a/app/assets/javascripts/google_tag_manager/index.js +++ b/app/assets/javascripts/google_tag_manager/index.js @@ -8,14 +8,14 @@ const PRODUCT_INFO = { // eslint-disable-next-line @gitlab/require-i18n-strings name: 'Premium', id: '0002', - price: 228, + price: '228', variant: 'SaaS', }, [SKU_ULTIMATE]: { // eslint-disable-next-line @gitlab/require-i18n-strings name: 'Ultimate', id: '0001', - price: 1188, + price: '1188', variant: 'SaaS', }, }; @@ -220,8 +220,8 @@ export const trackTransaction = (transactionDetails) => { id: transactionId, affiliation: 'GitLab', option: paymentOption, - revenue, - tax, + revenue: revenue.toString(), + tax: tax.toString(), }, products: [product], }, diff --git a/app/assets/javascripts/pipeline_new/constants.js b/app/assets/javascripts/pipeline_new/constants.js index a6c9f3cb746..43f7634083b 100644 --- a/app/assets/javascripts/pipeline_new/constants.js +++ b/app/assets/javascripts/pipeline_new/constants.js @@ -1,3 +1,4 @@ +import { __ } from '~/locale'; import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants'; export const VARIABLE_TYPE = 'env_var'; @@ -7,5 +8,7 @@ export const CONFIG_VARIABLES_TIMEOUT = 5000; export const BRANCH_REF_TYPE = 'branch'; export const TAG_REF_TYPE = 'tag'; -export const CC_VALIDATION_REQUIRED_ERROR = - 'Credit card required to be on file in order to create a pipeline'; +// must match pipeline/chain/validate/after_config.rb +export const CC_VALIDATION_REQUIRED_ERROR = __( + 'Credit card required to be on file in order to create a pipeline', +); diff --git a/app/assets/javascripts/projects/settings/components/shared_runners_toggle.vue b/app/assets/javascripts/projects/settings/components/shared_runners_toggle.vue index 91d8fca0487..aa3235b1515 100644 --- a/app/assets/javascripts/projects/settings/components/shared_runners_toggle.vue +++ b/app/assets/javascripts/projects/settings/components/shared_runners_toggle.vue @@ -2,6 +2,7 @@ import { GlAlert, GlToggle, GlTooltip } from '@gitlab/ui'; import axios from '~/lib/utils/axios_utils'; import { __, s__ } from '~/locale'; +import { CC_VALIDATION_REQUIRED_ERROR } from '../constants'; const DEFAULT_ERROR_MESSAGE = __('An error occurred while updating the configuration.'); const REQUIRES_VALIDATION_TEXT = s__( @@ -47,11 +48,13 @@ export default { }; }, computed: { - showCreditCardValidation() { + ccRequiredError() { + return this.errorMessage === CC_VALIDATION_REQUIRED_ERROR && !this.ccAlertDismissed; + }, + genericError() { return ( - this.isCreditCardValidationRequired && - !this.isSharedRunnerEnabled && - !this.successfulValidation && + this.errorMessage && + this.errorMessage !== CC_VALIDATION_REQUIRED_ERROR && !this.ccAlertDismissed ); }, @@ -62,6 +65,7 @@ export default { }, toggleSharedRunners() { this.isLoading = true; + this.ccAlertDismissed = false; this.errorMessage = null; axios @@ -82,20 +86,19 @@ export default { <template> <div> <section class="gl-mt-5"> - <gl-alert v-if="errorMessage" class="gl-mb-3" variant="danger" :dismissible="false"> - {{ errorMessage }} - </gl-alert> - <cc-validation-required-alert - v-if="showCreditCardValidation" + v-if="ccRequiredError" class="gl-pb-5" :custom-message="$options.i18n.REQUIRES_VALIDATION_TEXT" @verifiedCreditCard="creditCardValidated" @dismiss="ccAlertDismissed = true" /> + <gl-alert v-if="genericError" class="gl-mb-3" variant="danger" :dismissible="false"> + {{ errorMessage }} + </gl-alert> + <gl-toggle - v-else ref="sharedRunnersToggle" :disabled="isDisabledAndUnoverridable" :is-loading="isLoading" diff --git a/app/assets/javascripts/projects/settings/constants.js b/app/assets/javascripts/projects/settings/constants.js index f5591c43dc4..9cf1afd334f 100644 --- a/app/assets/javascripts/projects/settings/constants.js +++ b/app/assets/javascripts/projects/settings/constants.js @@ -1,3 +1,5 @@ +import { __ } from '~/locale'; + export const LEVEL_TYPES = { ROLE: 'role', USER: 'user', @@ -18,3 +20,8 @@ export const ACCESS_LEVELS = { }; export const ACCESS_LEVEL_NONE = 0; + +// must match shared_runners_setting in update_service.rb +export const CC_VALIDATION_REQUIRED_ERROR = __( + 'Shared runners enabled cannot be enabled until a valid credit card is on file', +); diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 53e192dc1a1..11ea1115929 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -1286,12 +1286,6 @@ module Ci end end - def use_variables_builder_definitions? - strong_memoize(:use_variables_builder_definitions) do - ::Feature.enabled?(:ci_use_variables_builder_definitions, project, default_enabled: :yaml) - end - end - private def add_message(severity, content) diff --git a/app/models/concerns/ci/contextable.rb b/app/models/concerns/ci/contextable.rb index ed3b422251f..88b7bb89b89 100644 --- a/app/models/concerns/ci/contextable.rb +++ b/app/models/concerns/ci/contextable.rb @@ -11,26 +11,9 @@ module Ci # def scoped_variables(environment: expanded_environment_name, dependencies: true) track_duration do - variables = pipeline.variables_builder.scoped_variables(self, environment: environment, dependencies: dependencies) - - next variables if pipeline.use_variables_builder_definitions? - - variables.concat(project.predefined_variables) - variables.concat(pipeline.predefined_variables) - variables.concat(runner.predefined_variables) if runnable? && runner - variables.concat(kubernetes_variables) - variables.concat(deployment_variables(environment: environment)) - variables.concat(yaml_variables) - variables.concat(user_variables) - variables.concat(dependency_variables) if dependencies - variables.concat(secret_instance_variables) - variables.concat(secret_group_variables(environment: environment)) - variables.concat(secret_project_variables(environment: environment)) - variables.concat(trigger_request.user_variables) if trigger_request - variables.concat(pipeline.variables) - variables.concat(pipeline.pipeline_schedule.job_variables) if pipeline.pipeline_schedule - - variables + pipeline + .variables_builder + .scoped_variables(self, environment: environment, dependencies: dependencies) end end @@ -60,29 +43,5 @@ module Ci scoped_variables(environment: nil, dependencies: false) end end - - def user_variables - pipeline.variables_builder.user_variables(user) - end - - def kubernetes_variables - pipeline.variables_builder.kubernetes_variables(self) - end - - def deployment_variables(environment:) - pipeline.variables_builder.deployment_variables(job: self, environment: environment) - end - - def secret_instance_variables - pipeline.variables_builder.secret_instance_variables(ref: git_ref) - end - - def secret_group_variables(environment: expanded_environment_name) - pipeline.variables_builder.secret_group_variables(environment: environment, ref: git_ref) - end - - def secret_project_variables(environment: expanded_environment_name) - pipeline.variables_builder.secret_project_variables(environment: environment, ref: git_ref) - end end end |