diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-08 00:08:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-08 00:08:30 +0000 |
commit | 5ae54edfa9d6200eb12f831ef56a6e80207ca281 (patch) | |
tree | eb36519353b13831095ac66bb6b7ae9c9a2537e8 /app | |
parent | a87ae2e97ee1eb3af2338e33bc3b2fb0e1ae1d42 (diff) | |
download | gitlab-ce-5ae54edfa9d6200eb12f831ef56a6e80207ca281.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
5 files changed, 69 insertions, 13 deletions
diff --git a/app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue b/app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue index 2810c9273dc..217442e6131 100644 --- a/app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue +++ b/app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue @@ -1,6 +1,8 @@ <script> import { GlTable, GlIcon, GlTooltipDirective } from '@gitlab/ui'; import { s__, __ } from '~/locale'; +import Tracking from '~/tracking'; +import { trackAlertIntergrationsViewsOptions } from '../constants'; export const i18n = { title: s__('AlertsIntegrations|Current integrations'), @@ -57,6 +59,15 @@ export default { }; }, }, + mounted() { + this.trackPageViews(); + }, + methods: { + trackPageViews() { + const { category, action } = trackAlertIntergrationsViewsOptions; + Tracking.event(category, action); + }, + }, }; </script> diff --git a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue index 7036910f85f..9a746d2baa7 100644 --- a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue +++ b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue @@ -16,7 +16,6 @@ import { import { debounce } from 'lodash'; import { s__ } from '~/locale'; import { doesHashExistInUrl } from '~/lib/utils/url_utility'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ToggleButton from '~/vue_shared/components/toggle_button.vue'; import IntegrationsList from './alerts_integrations_list.vue'; @@ -56,7 +55,6 @@ export default { directives: { 'gl-modal': GlModalDirective, }, - mixins: [glFeatureFlagsMixin()], inject: ['prometheus', 'generic', 'opsgenie'], data() { return { diff --git a/app/assets/javascripts/alerts_settings/constants.js b/app/assets/javascripts/alerts_settings/constants.js index 3dbe692e419..5025a14fdc9 100644 --- a/app/assets/javascripts/alerts_settings/constants.js +++ b/app/assets/javascripts/alerts_settings/constants.js @@ -51,3 +51,13 @@ export const targetPrometheusUrlPlaceholder = 'http://prometheus.example.com/'; export const targetOpsgenieUrlPlaceholder = 'https://app.opsgenie.com/alert/list/'; export const sectionHash = 'js-alert-management-settings'; + +/* eslint-disable @gitlab/require-i18n-strings */ + +/** + * Tracks snowplow event when user views alerts intergration list + */ +export const trackAlertIntergrationsViewsOptions = { + category: 'Alert Intergrations', + action: 'view_alert_integrations_list', +}; diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 14de8d6c6ab..93be0130e12 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -27,17 +27,10 @@ class HelpController < ApplicationController respond_to do |format| format.any(:markdown, :md, :html) do - # Note: We are purposefully NOT using `Rails.root.join` because of https://gitlab.com/gitlab-org/gitlab/-/issues/216028. - path = File.join(Rails.root, 'doc', "#{@path}.md") - - if File.exist?(path) - # Remove YAML frontmatter so that it doesn't look weird - @markdown = File.read(path).gsub(YAML_FRONT_MATTER_REGEXP, '') - - render 'show.html.haml' + if redirect_to_documentation_website? + redirect_to documentation_url else - # Force template to Haml - render 'errors/not_found.html.haml', layout: 'errors', status: :not_found + render_documentation end end @@ -76,4 +69,48 @@ class HelpController < ApplicationController params end + + def redirect_to_documentation_website? + return false unless Feature.enabled?(:help_page_documentation_redirect) + return false unless Gitlab::UrlSanitizer.valid_web?(documentation_url) + + true + end + + def documentation_url + return unless documentation_base_url + + @documentation_url ||= [ + documentation_base_url.chomp('/'), + version_segment, + 'ee', + "#{@path}.html" + ].compact.join('/') + end + + def documentation_base_url + @documentation_base_url ||= Gitlab::CurrentSettings.current_application_settings.help_page_documentation_base_url.presence + end + + def version_segment + return if Gitlab.pre_release? + + version = Gitlab.version_info + [version.major, version.minor].join('.') + end + + def render_documentation + # Note: We are purposefully NOT using `Rails.root.join` because of https://gitlab.com/gitlab-org/gitlab/-/issues/216028. + path = File.join(Rails.root, 'doc', "#{@path}.md") + + if File.exist?(path) + # Remove YAML frontmatter so that it doesn't look weird + @markdown = File.read(path).gsub(YAML_FRONT_MATTER_REGEXP, '') + + render 'show.html.haml' + else + # Force template to Haml + render 'errors/not_found.html.haml', layout: 'errors', status: :not_found + end + end end diff --git a/app/models/ci_platform_metric.rb b/app/models/ci_platform_metric.rb index 5e6e3eddce9..ac4ab391bbf 100644 --- a/app/models/ci_platform_metric.rb +++ b/app/models/ci_platform_metric.rb @@ -14,7 +14,7 @@ class CiPlatformMetric < ApplicationRecord numericality: { only_integer: true, greater_than: 0 } CI_VARIABLE_KEY = 'AUTO_DEVOPS_PLATFORM_TARGET' - ALLOWED_TARGETS = %w[ECS FARGATE].freeze + ALLOWED_TARGETS = %w[ECS FARGATE EC2].freeze def self.insert_auto_devops_platform_targets! recorded_at = Time.zone.now |