Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 12:16:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 12:16:11 +0300
commitedaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch)
tree11f143effbfeba52329fb7afbd05e6e2a3790241 /app/helpers
parentd8a5691316400a0f7ec4f83832698f1988eb27c1 (diff)
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/admin/background_migrations_helper.rb14
-rw-r--r--app/helpers/application_helper.rb13
-rw-r--r--app/helpers/application_settings_helper.rb44
-rw-r--r--app/helpers/auth_helper.rb19
-rw-r--r--app/helpers/button_helper.rb2
-rw-r--r--app/helpers/ci/jobs_helper.rb8
-rw-r--r--app/helpers/ci/pipeline_editor_helper.rb1
-rw-r--r--app/helpers/ci/runners_helper.rb11
-rw-r--r--app/helpers/commits_helper.rb18
-rw-r--r--app/helpers/custom_metrics_helper.rb2
-rw-r--r--app/helpers/environment_helper.rb2
-rw-r--r--app/helpers/environments_helper.rb2
-rw-r--r--app/helpers/groups/crm_settings_helper.rb9
-rw-r--r--app/helpers/groups_helper.rb10
-rw-r--r--app/helpers/hooks_helper.rb2
-rw-r--r--app/helpers/integrations_helper.rb17
-rw-r--r--app/helpers/issues_helper.rb19
-rw-r--r--app/helpers/learn_gitlab_helper.rb8
-rw-r--r--app/helpers/namespaces_helper.rb7
-rw-r--r--app/helpers/nav/top_nav_helper.rb15
-rw-r--r--app/helpers/nav_helper.rb4
-rw-r--r--app/helpers/notes_helper.rb2
-rw-r--r--app/helpers/packages_helper.rb28
-rw-r--r--app/helpers/page_layout_helper.rb2
-rw-r--r--app/helpers/preferences_helper.rb10
-rw-r--r--app/helpers/projects/cluster_agents_helper.rb5
-rw-r--r--app/helpers/projects/issues/service_desk_helper.rb35
-rw-r--r--app/helpers/projects_helper.rb25
-rw-r--r--app/helpers/search_helper.rb4
-rw-r--r--app/helpers/snippets_helper.rb7
-rw-r--r--app/helpers/sorting_titles_values_helper.rb4
-rw-r--r--app/helpers/ssh_keys_helper.rb10
-rw-r--r--app/helpers/tracking_helper.rb4
-rw-r--r--app/helpers/tree_helper.rb5
-rw-r--r--app/helpers/version_check_helper.rb9
-rw-r--r--app/helpers/webpack_helper.rb4
36 files changed, 192 insertions, 189 deletions
diff --git a/app/helpers/admin/background_migrations_helper.rb b/app/helpers/admin/background_migrations_helper.rb
index 698d81cc8a2..6516ea27b2c 100644
--- a/app/helpers/admin/background_migrations_helper.rb
+++ b/app/helpers/admin/background_migrations_helper.rb
@@ -2,15 +2,15 @@
module Admin
module BackgroundMigrationsHelper
- def batched_migration_status_badge_class_name(migration)
- class_names = {
- 'active' => 'badge-info',
- 'paused' => 'badge-warning',
- 'failed' => 'badge-danger',
- 'finished' => 'badge-success'
+ def batched_migration_status_badge_variant(migration)
+ variants = {
+ 'active' => :info,
+ 'paused' => :warning,
+ 'failed' => :danger,
+ 'finished' => :success
}
- class_names[migration.status]
+ variants[migration.status]
end
# The extra logic here is needed because total_tuple_count is just
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 02a87979f40..e88d1832480 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -285,6 +285,7 @@ module ApplicationHelper
class_names << 'environment-logs-page' if current_controller?(:logs)
class_names << 'with-performance-bar' if performance_bar_enabled?
class_names << system_message_class
+ class_names << marketing_header_experiment_class
class_names
end
@@ -420,6 +421,18 @@ module ApplicationHelper
def appearance
::Appearance.current
end
+
+ def marketing_header_experiment_class
+ return if current_user
+
+ experiment(:logged_out_marketing_header, actor: nil) do |e|
+ html_class = 'logged-out-marketing-header-candidate'
+ e.candidate { html_class }
+ e.try(:trial_focused) { html_class }
+ e.control {}
+ e.run
+ end
+ end
end
ApplicationHelper.prepend_mod
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index b8ee71daeee..7541247b19f 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -144,36 +144,39 @@ module ApplicationSettingsHelper
end
def external_authorization_description
- _("If enabled, access to projects will be validated on an external service"\
+ s_("ExternalAuthorization|Access to projects is validated on an external service"\
" using their classification label.")
end
def external_authorization_timeout_help_text
- _("Time in seconds GitLab will wait for a response from the external "\
- "service. When the service does not respond in time, access will be "\
- "denied.")
+ s_("ExternalAuthorization|Period GitLab waits for a response from the external "\
+ "service. If there is no response, access is denied. Default: 0.5 seconds.")
end
def external_authorization_url_help_text
- _("When leaving the URL blank, classification labels can still be "\
- "specified without disabling cross project features or performing "\
- "external authorization checks.")
+ s_("ExternalAuthorization|URL to which the projects make authorization requests. If the URL is blank, cross-project "\
+ "features are available and can still specify classification "\
+ "labels for projects.")
end
def external_authorization_client_certificate_help_text
- _("The X509 Certificate to use when mutual TLS is required to communicate "\
- "with the external authorization service. If left blank, the server "\
- "certificate is still validated when accessing over HTTPS.")
+ s_("ExternalAuthorization|Certificate used to authenticate with the external authorization service. "\
+ "If blank, the server certificate is validated when accessing over HTTPS.")
end
def external_authorization_client_key_help_text
- _("The private key to use when a client certificate is provided. This value "\
- "is encrypted at rest.")
+ s_("ExternalAuthorization|Private key of client authentication certificate. "\
+ "Encrypted when stored.")
end
def external_authorization_client_pass_help_text
- _("The passphrase required to decrypt the private key. This is optional "\
- "and the value is encrypted at rest.")
+ s_("ExternalAuthorization|Passphrase required to decrypt the private key. "\
+ "Encrypted when stored.")
+ end
+
+ def external_authorization_client_url_help_text
+ s_("ExternalAuthorization|Classification label to use when requesting authorization if no specific "\
+ " label is defined on the project.")
end
def sidekiq_job_limiter_mode_help_text
@@ -401,6 +404,12 @@ module ApplicationSettingsHelper
:rate_limiting_response_text,
:container_registry_expiration_policies_worker_capacity,
:container_registry_cleanup_tags_service_max_list_size,
+ :container_registry_import_max_tags_count,
+ :container_registry_import_max_retries,
+ :container_registry_import_start_max_retries,
+ :container_registry_import_max_step_duration,
+ :container_registry_import_target_plan,
+ :container_registry_import_created_before,
:keep_latest_artifact,
:whats_new_variant,
:user_deactivation_emails_enabled,
@@ -411,7 +420,8 @@ module ApplicationSettingsHelper
:sidekiq_job_limiter_mode,
:sidekiq_job_limiter_compression_threshold_bytes,
:sidekiq_job_limiter_limit_bytes,
- :suggest_pipeline_enabled
+ :suggest_pipeline_enabled,
+ :user_email_lookup_limit
].tap do |settings|
settings << :deactivate_dormant_users unless Gitlab.com?
end
@@ -486,6 +496,10 @@ module ApplicationSettingsHelper
def pending_user_count
User.blocked_pending_approval.count
end
+
+ def registration_features_can_be_prompted?
+ !Gitlab::CurrentSettings.usage_ping_enabled?
+ end
end
ApplicationSettingsHelper.prepend_mod_with('ApplicationSettingsHelper')
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb
index c1a74382d46..fb2fa547447 100644
--- a/app/helpers/auth_helper.rb
+++ b/app/helpers/auth_helper.rb
@@ -3,6 +3,7 @@
module AuthHelper
PROVIDERS_WITH_ICONS = %w(
atlassian_oauth2
+ auth0
authentiq
azure_activedirectory_v2
azure_oauth2
@@ -12,8 +13,10 @@ module AuthHelper
github
gitlab
google_oauth2
+ jwt
openid_connect
salesforce
+ shibboleth
twitter
).freeze
LDAP_PROVIDER = /\Aldap/.freeze
@@ -177,15 +180,13 @@ module AuthHelper
def google_tag_manager_enabled?
return false unless Gitlab.dev_env_or_com?
- has_config_key = if Feature.enabled?(:gtm_nonce, type: :ops)
- extra_config.has_key?('google_tag_manager_nonce_id') &&
- extra_config.google_tag_manager_nonce_id.present?
- else
- extra_config.has_key?('google_tag_manager_id') &&
- extra_config.google_tag_manager_id.present?
- end
-
- has_config_key && !current_user
+ if Feature.enabled?(:gtm_nonce, type: :ops)
+ extra_config.has_key?('google_tag_manager_nonce_id') &&
+ extra_config.google_tag_manager_nonce_id.present?
+ else
+ extra_config.has_key?('google_tag_manager_id') &&
+ extra_config.google_tag_manager_id.present?
+ end
end
def google_tag_manager_id
diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb
index eb30ffc0093..4ec95dc8bd7 100644
--- a/app/helpers/button_helper.rb
+++ b/app/helpers/button_helper.rb
@@ -50,7 +50,7 @@ module ButtonHelper
data: data,
type: :button,
title: title,
- aria: { label: title },
+ aria: { label: title, live: 'polite' },
itemprop: item_prop
}
diff --git a/app/helpers/ci/jobs_helper.rb b/app/helpers/ci/jobs_helper.rb
index c7f40decae8..c0dca66bac8 100644
--- a/app/helpers/ci/jobs_helper.rb
+++ b/app/helpers/ci/jobs_helper.rb
@@ -19,10 +19,12 @@ module Ci
}
end
- def bridge_data(build)
+ def bridge_data(build, project)
{
- "build_name" => build.name,
- "empty-state-illustration-path" => image_path('illustrations/job-trigger-md.svg')
+ "build_id" => build.id,
+ "empty-state-illustration-path" => image_path('illustrations/job-trigger-md.svg'),
+ "pipeline_iid" => build.pipeline.iid,
+ "project_full_path" => project.full_path
}
end
diff --git a/app/helpers/ci/pipeline_editor_helper.rb b/app/helpers/ci/pipeline_editor_helper.rb
index 9bbc326a750..bb7226da74e 100644
--- a/app/helpers/ci/pipeline_editor_helper.rb
+++ b/app/helpers/ci/pipeline_editor_helper.rb
@@ -20,6 +20,7 @@ module Ci
"empty-state-illustration-path" => image_path('illustrations/empty-state/empty-dag-md.svg'),
"initial-branch-name" => initial_branch,
"lint-help-page-path" => help_page_path('ci/lint', anchor: 'validate-basic-logic-and-syntax'),
+ "lint-unavailable-help-page-path" => help_page_path('ci/pipeline_editor/index', anchor: 'configuration-validation-currently-not-available'),
"needs-help-page-path" => help_page_path('ci/yaml/index', anchor: 'needs'),
"new-merge-request-path" => namespace_project_new_merge_request_path,
"pipeline_etag" => latest_commit ? graphql_etag_pipeline_sha_path(commit_sha) : '',
diff --git a/app/helpers/ci/runners_helper.rb b/app/helpers/ci/runners_helper.rb
index 8f219656b71..f84b42209da 100644
--- a/app/helpers/ci/runners_helper.rb
+++ b/app/helpers/ci/runners_helper.rb
@@ -24,7 +24,7 @@ module Ci
span_class = 'gl-text-gray-600'
end
when :not_connected, :never_contacted
- title = s_("Runners|New runner, has not connected yet")
+ title = s_("Runners|New runner, has not contacted yet")
icon = 'warning-solid'
when :offline
title = s_("Runners|Runner is offline, last contact was %{runner_contact} ago") % { runner_contact: time_ago_in_words(runner.contacted_at) }
@@ -65,14 +65,7 @@ module Ci
# Runner install help page is external, located at
# https://gitlab.com/gitlab-org/gitlab-runner
runner_install_help_page: 'https://docs.gitlab.com/runner/install/',
- registration_token: Gitlab::CurrentSettings.runners_registration_token,
-
- # All runner counts are returned as formatted strings
- active_runners_count: Ci::Runner.online.count.to_s,
- all_runners_count: limited_counter_with_delimiter(Ci::Runner),
- instance_runners_count: limited_counter_with_delimiter(Ci::Runner.instance_type),
- group_runners_count: limited_counter_with_delimiter(Ci::Runner.group_type),
- project_runners_count: limited_counter_with_delimiter(Ci::Runner.project_type)
+ registration_token: Gitlab::CurrentSettings.runners_registration_token
}
end
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index ee5f4bb364a..43e727ac483 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -27,10 +27,12 @@ module CommitsHelper
end
def commit_to_html(commit, ref, project)
- render 'projects/commits/commit.html',
- commit: commit,
- ref: ref,
- project: project
+ render partial: 'projects/commits/commit', formats: :html,
+ locals: {
+ commit: commit,
+ ref: ref,
+ project: project
+ }
end
# Breadcrumb links for a Project and, if applicable, a tree path
@@ -73,9 +75,7 @@ module CommitsHelper
# Returns a link formatted as a commit branch link
def commit_branch_link(url, text)
- link_to(url, class: 'badge badge-gray ref-name branch-link') do
- sprite_icon('branch', size: 12, css_class: 'fork-svg') + "#{text}"
- end
+ gl_badge_tag(text, { variant: :info, icon: 'branch' }, { href: url, class: 'gl-font-monospace gl-mb-1' })
end
# Returns the sorted alphabetically links to branches, separated by a comma
@@ -87,9 +87,7 @@ module CommitsHelper
# Returns a link formatted as a commit tag link
def commit_tag_link(url, text)
- link_to(url, class: 'badge badge-gray ref-name') do
- sprite_icon('tag', size: 12, css_class: 'gl-mr-2 vertical-align-middle') + "#{text}"
- end
+ gl_badge_tag(text, { variant: :info, icon: 'tag' }, { href: url, class: 'gl-font-monospace' })
end
# Returns the sorted links to tags, separated by a comma
diff --git a/app/helpers/custom_metrics_helper.rb b/app/helpers/custom_metrics_helper.rb
index 9fbfe377c61..5442120008a 100644
--- a/app/helpers/custom_metrics_helper.rb
+++ b/app/helpers/custom_metrics_helper.rb
@@ -5,7 +5,7 @@ module CustomMetricsHelper
{
'custom-metrics-path' => url_for([project, metric]),
'metric-persisted' => metric.persisted?.to_s,
- 'edit-project-service-path' => edit_project_service_path(project, ::Integrations::Prometheus),
+ 'edit-project-service-path' => edit_project_integration_path(project, ::Integrations::Prometheus),
'validate-query-path' => validate_query_project_prometheus_metrics_path(project),
'title' => metric.title.to_s,
'query' => metric.query.to_s,
diff --git a/app/helpers/environment_helper.rb b/app/helpers/environment_helper.rb
index f57bb600527..1f0bf46097d 100644
--- a/app/helpers/environment_helper.rb
+++ b/app/helpers/environment_helper.rb
@@ -54,6 +54,8 @@ module EnvironmentHelper
s_('Deployment|canceled')
when 'skipped'
s_('Deployment|skipped')
+ when 'blocked'
+ s_('Deployment|blocked')
end
klass = "ci-status ci-#{status.dasherize}"
diff --git a/app/helpers/environments_helper.rb b/app/helpers/environments_helper.rb
index cde45e7bc0f..1894aba7dc0 100644
--- a/app/helpers/environments_helper.rb
+++ b/app/helpers/environments_helper.rb
@@ -59,7 +59,7 @@ module EnvironmentsHelper
return {} unless project
{
- 'settings_path' => edit_project_service_path(project, 'prometheus'),
+ 'settings_path' => edit_project_integration_path(project, 'prometheus'),
'clusters_path' => project_clusters_path(project),
'dashboards_endpoint' => project_performance_monitoring_dashboards_path(project, format: :json),
'default_branch' => project.default_branch,
diff --git a/app/helpers/groups/crm_settings_helper.rb b/app/helpers/groups/crm_settings_helper.rb
new file mode 100644
index 00000000000..ab47ec40b13
--- /dev/null
+++ b/app/helpers/groups/crm_settings_helper.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module Groups
+ module CrmSettingsHelper
+ def crm_feature_flag_enabled?(group)
+ Feature.enabled?(:customer_relations, group)
+ end
+ end
+end
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index 9ba7d004d6c..7296560a450 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -134,6 +134,16 @@ module GroupsHelper
@group_projects_sort || @sort || params[:sort] || sort_value_recently_created
end
+ def verification_for_group_creation_data
+ # overridden in EE
+ {}
+ end
+
+ def require_verification_for_group_creation_enabled?
+ # overridden in EE
+ false
+ end
+
private
def group_title_link(group, hidable: false, show_avatar: false, for_dropdown: false)
diff --git a/app/helpers/hooks_helper.rb b/app/helpers/hooks_helper.rb
index c1dfd2b2cda..1e50033e0e0 100644
--- a/app/helpers/hooks_helper.rb
+++ b/app/helpers/hooks_helper.rb
@@ -39,7 +39,7 @@ module HooksHelper
def hook_log_path(hook, hook_log)
case hook
- when ProjectHook
+ when ProjectHook, ServiceHook
hook_log.present.details_path
when SystemHook
admin_hook_hook_log_path(hook, hook_log)
diff --git a/app/helpers/integrations_helper.rb b/app/helpers/integrations_helper.rb
index c5e767c6f64..230f80e20a5 100644
--- a/app/helpers/integrations_helper.rb
+++ b/app/helpers/integrations_helper.rb
@@ -29,7 +29,7 @@ module IntegrationsHelper
def scoped_integration_path(integration, project: nil, group: nil)
if project.present?
- project_service_path(project, integration)
+ project_integration_path(project, integration)
elsif group.present?
group_settings_integration_path(group, integration)
else
@@ -39,7 +39,7 @@ module IntegrationsHelper
def scoped_edit_integration_path(integration, project: nil, group: nil)
if project.present?
- edit_project_service_path(project, integration)
+ edit_project_integration_path(project, integration)
elsif group.present?
edit_group_settings_integration_path(group, integration)
else
@@ -53,7 +53,7 @@ module IntegrationsHelper
def scoped_test_integration_path(integration, project: nil, group: nil)
if project.present?
- test_project_service_path(project, integration)
+ test_project_integration_path(project, integration)
elsif group.present?
test_group_settings_integration_path(group, integration)
else
@@ -90,7 +90,9 @@ module IntegrationsHelper
cancel_path: scoped_integrations_path(project: project, group: group),
can_test: integration.testable?.to_s,
test_path: scoped_test_integration_path(integration, project: project, group: group),
- reset_path: scoped_reset_integration_path(integration, group: group)
+ reset_path: scoped_reset_integration_path(integration, group: group),
+ form_path: scoped_integration_path(integration, project: project, group: group),
+ redirect_to: request.referer
}
if integration.is_a?(Integrations::Jira)
@@ -101,8 +103,9 @@ module IntegrationsHelper
form_data
end
- def integration_overrides_data(integration)
+ def integration_overrides_data(integration, project: nil, group: nil)
{
+ edit_path: scoped_edit_integration_path(integration, project: project, group: group),
overrides_path: scoped_overrides_integration_path(integration, format: :json)
}
end
@@ -225,6 +228,10 @@ module IntegrationsHelper
name: integration.to_param
}
end
+
+ def vue_integration_form_enabled?
+ Feature.enabled?(:vue_integration_form, current_user, default_enabled: :yaml)
+ end
end
IntegrationsHelper.prepend_mod_with('IntegrationsHelper')
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index cddf740a0e6..5aa2aca37f3 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -7,7 +7,7 @@ module IssuesHelper
classes = ["issue"]
classes << "closed" if issue.closed?
classes << "today" if issue.new?
- classes << "user-can-drag" if @sort == 'relative_position'
+ classes << "gl-cursor-grab" if @sort == 'relative_position'
classes.join(' ')
end
@@ -51,7 +51,7 @@ module IssuesHelper
end
def work_item_type_icon(issue_type)
- if WorkItem::Type.base_types.include?(issue_type)
+ if WorkItems::Type.base_types.include?(issue_type)
"issue-type-#{issue_type.to_s.dasherize}"
else
'issue-type-issue'
@@ -168,21 +168,6 @@ module IssuesHelper
issue.moved_from.project.service_desk_enabled? && !issue.project.service_desk_enabled?
end
- def use_startup_call?
- request.query_parameters.empty? && @sort == 'created_date'
- end
-
- def startup_call_params
- {
- state: 'opened',
- with_labels_details: 'true',
- page: 1,
- per_page: 20,
- order_by: 'created_at',
- sort: 'desc'
- }
- end
-
def issue_header_actions_data(project, issuable, current_user)
new_issuable_params = { issue: { description: _('Related to #%{issue_id}.') % { issue_id: issuable.iid } + "\n\n" } }
if issuable.incident?
diff --git a/app/helpers/learn_gitlab_helper.rb b/app/helpers/learn_gitlab_helper.rb
index 7f8f6d77ff4..6330b8fc829 100644
--- a/app/helpers/learn_gitlab_helper.rb
+++ b/app/helpers/learn_gitlab_helper.rb
@@ -27,8 +27,12 @@ module LearnGitlabHelper
urls_to_use = nil
- experiment(:change_continuous_onboarding_link_urls) do |e|
- e.namespace = project.namespace
+ experiment(
+ :change_continuous_onboarding_link_urls,
+ namespace: project.namespace,
+ actor: current_user,
+ sticky_to: project.namespace
+ ) do |e|
e.use { urls_to_use = action_urls }
e.try { urls_to_use = new_action_urls(project) }
end
diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb
index 6acec417a75..64b58d28fc9 100644
--- a/app/helpers/namespaces_helper.rb
+++ b/app/helpers/namespaces_helper.rb
@@ -49,13 +49,6 @@ module NamespacesHelper
end
end
- def namespaces_options_with_developer_maintainer_access(options = {})
- selected = options.delete(:selected) || :current_user
- options[:groups] = current_user.manageable_groups_with_routes(include_groups_with_developer_maintainer_access: true)
-
- namespaces_options(selected, **options)
- end
-
def cascading_namespace_settings_popover_data(attribute, group, settings_path_helper)
locked_by_ancestor = group.namespace_settings.public_send("#{attribute}_locked_by_ancestor?") # rubocop:disable GitlabSecurity/PublicSend
diff --git a/app/helpers/nav/top_nav_helper.rb b/app/helpers/nav/top_nav_helper.rb
index ecef2d38e54..24102a90a3b 100644
--- a/app/helpers/nav/top_nav_helper.rb
+++ b/app/helpers/nav/top_nav_helper.rb
@@ -123,7 +123,7 @@ module Nav
if dashboard_nav_link?(:milestones)
builder.add_primary_menu_item_with_shortcut(
id: 'milestones',
- title: 'Milestones',
+ title: _('Milestones'),
href: dashboard_milestones_path,
active: active_nav_link?(controller: 'dashboard/milestones'),
icon: 'clock',
@@ -144,7 +144,7 @@ module Nav
if dashboard_nav_link?(:activity)
builder.add_primary_menu_item_with_shortcut(
id: 'activity',
- title: 'Activity',
+ title: _('Activity'),
href: activity_dashboard_path,
active: active_nav_link?(path: 'dashboard#activity'),
icon: 'history',
@@ -189,15 +189,6 @@ module Nav
end
end
# rubocop: enable Cop/UserAdmin
-
- if Gitlab::Sherlock.enabled?
- builder.add_secondary_menu_item(
- id: 'sherlock',
- title: _('Sherlock Transactions'),
- icon: 'admin',
- href: sherlock_transactions_path
- )
- end
end
def projects_menu_item_attrs
@@ -212,7 +203,7 @@ module Nav
def groups_menu_item_attrs
{
id: 'groups',
- title: 'Groups',
+ title: _('Groups'),
icon: 'group',
shortcut_class: 'dashboard-shortcuts-groups'
}
diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb
index 9a6630ec3cb..1c4d294baa7 100644
--- a/app/helpers/nav_helper.rb
+++ b/app/helpers/nav_helper.rb
@@ -46,10 +46,6 @@ module NavHelper
class_names
end
- def has_extra_nav_icons?
- Gitlab::Sherlock.enabled? || current_user.admin?
- end
-
def page_has_markdown?
current_path?('merge_requests#show') ||
current_path?('projects/merge_requests/conflicts#show') ||
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 2dadaa0be0a..1afdb7a0ab9 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -48,7 +48,7 @@ module NotesHelper
data[:note_type] = LegacyDiffNote.name
else
data[:note_type] = DiffNote.name
- data[:position] = position.to_json
+ data[:position] = Gitlab::Json.dump(position)
end
data
diff --git a/app/helpers/packages_helper.rb b/app/helpers/packages_helper.rb
index 66f80e7eeb8..402a363349f 100644
--- a/app/helpers/packages_helper.rb
+++ b/app/helpers/packages_helper.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
module PackagesHelper
+ include ::API::Helpers::RelatedResourcesHelpers
+
def package_sort_path(options = {})
"#{request.path}?#{options.to_param}"
end
@@ -53,30 +55,4 @@ module PackagesHelper
project.container_expiration_policy.nil? &&
project.container_repositories.exists?
end
-
- def package_details_data(project, package)
- {
- package_id: package.id,
- can_delete: can?(current_user, :destroy_package, project).to_s,
- svg_path: image_path('illustrations/no-packages.svg'),
- npm_path: package_registry_instance_url(:npm),
- npm_project_path: package_registry_project_url(project.id, :npm),
- npm_help_path: help_page_path('user/packages/npm_registry/index'),
- maven_path: package_registry_project_url(project.id, :maven),
- maven_help_path: help_page_path('user/packages/maven_repository/index'),
- conan_path: package_registry_project_url(project.id, :conan),
- conan_help_path: help_page_path('user/packages/conan_repository/index'),
- nuget_path: nuget_package_registry_url(project.id),
- nuget_help_path: help_page_path('user/packages/nuget_repository/index'),
- pypi_path: pypi_registry_url(project.id),
- pypi_setup_path: package_registry_project_url(project.id, :pypi),
- pypi_help_path: help_page_path('user/packages/pypi_repository/index'),
- composer_path: composer_registry_url(project&.group&.id),
- composer_help_path: help_page_path('user/packages/composer_repository/index'),
- project_name: project.name,
- project_list_url: project_packages_path(project),
- group_list_url: project.group ? group_packages_path(project.group) : '',
- composer_config_repository_name: composer_config_repository_name(project.group&.id)
- }
- end
end
diff --git a/app/helpers/page_layout_helper.rb b/app/helpers/page_layout_helper.rb
index 2729951d685..fb74a52fcda 100644
--- a/app/helpers/page_layout_helper.rb
+++ b/app/helpers/page_layout_helper.rb
@@ -125,7 +125,7 @@ module PageLayoutHelper
end
def fluid_layout
- current_user && current_user.layout == "fluid"
+ @force_fluid_layout == true || (current_user && current_user.layout == "fluid")
end
def blank_container(enabled = false)
diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb
index 76f2ee0981b..17450e5b26b 100644
--- a/app/helpers/preferences_helper.rb
+++ b/app/helpers/preferences_helper.rb
@@ -4,8 +4,8 @@
module PreferencesHelper
def layout_choices
[
- ['Fixed', :fixed],
- ['Fluid', :fluid]
+ [s_('Layout|Fixed'), :fixed],
+ [s_('Layout|Fluid'), :fluid]
]
end
@@ -40,9 +40,9 @@ module PreferencesHelper
def project_view_choices
[
- ['Files and Readme (default)', :files],
- ['Activity', :activity],
- ['Readme', :readme]
+ [s_('ProjectView|Files and Readme (default)'), :files],
+ [s_('ProjectView|Activity'), :activity],
+ [s_('ProjectView|Readme'), :readme]
]
end
diff --git a/app/helpers/projects/cluster_agents_helper.rb b/app/helpers/projects/cluster_agents_helper.rb
index aeeab250c7a..e3027759d65 100644
--- a/app/helpers/projects/cluster_agents_helper.rb
+++ b/app/helpers/projects/cluster_agents_helper.rb
@@ -3,9 +3,10 @@
module Projects::ClusterAgentsHelper
def js_cluster_agent_details_data(agent_name, project)
{
+ activity_empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg'),
agent_name: agent_name,
- project_path: project.full_path,
- activity_empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg')
+ empty_state_svg_path: image_path('illustrations/operations-dashboard_empty.svg'),
+ project_path: project.full_path
}
end
end
diff --git a/app/helpers/projects/issues/service_desk_helper.rb b/app/helpers/projects/issues/service_desk_helper.rb
deleted file mode 100644
index 0f87e5ed837..00000000000
--- a/app/helpers/projects/issues/service_desk_helper.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-module Projects::Issues::ServiceDeskHelper
- def service_desk_meta(project)
- empty_state_meta = {
- is_service_desk_supported: Gitlab::ServiceDesk.supported?,
- is_service_desk_enabled: project.service_desk_enabled?,
- can_edit_project_settings: can?(current_user, :admin_project, project)
- }
-
- if Gitlab::ServiceDesk.supported?
- empty_state_meta.merge(supported_meta(project))
- else
- empty_state_meta.merge(unsupported_meta(project))
- end
- end
-
- private
-
- def supported_meta(project)
- {
- service_desk_address: project.service_desk_address,
- service_desk_help_page: help_page_path('user/project/service_desk'),
- edit_project_page: edit_project_path(project),
- svg_path: image_path('illustrations/service_desk_empty.svg')
- }
- end
-
- def unsupported_meta(project)
- {
- incoming_email_help_page: help_page_path('administration/incoming_email', anchor: 'set-it-up'),
- svg_path: image_path('illustrations/service-desk-setup.svg')
- }
- end
-end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 827d2cb7164..084c962d34c 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -660,6 +660,31 @@ module ProjectsHelper
project.unlink_forks_upon_visibility_decrease_enabled? && project.visibility_level > Gitlab::VisibilityLevel::PRIVATE && project.forks_count > 0
end
+ def confirm_reduce_visibility_message(project)
+ strong_start = "<strong>".html_safe
+ strong_end = "</strong>".html_safe
+ message = _("You're about to reduce the visibility of the project %{strong_start}%{project_name}%{strong_end}.")
+
+ if project.group
+ message = _("You're about to reduce the visibility of the project %{strong_start}%{project_name}%{strong_end} in %{strong_start}%{group_name}%{strong_end}.")
+ end
+
+ html_escape(message) % { strong_start: strong_start, strong_end: strong_end, project_name: project.name, group_name: project.group ? project.group.name : nil }
+ end
+
+ def visibility_confirm_modal_data(project, target_form_id = nil)
+ {
+ target_form_id: target_form_id,
+ button_testid: 'reduce-project-visibility-button',
+ confirm_button_text: _('Reduce project visibility'),
+ confirm_danger_message: confirm_reduce_visibility_message(project),
+ phrase: project.full_path,
+ additional_information: _('Note: current forks will keep their visibility level.'),
+ html_confirmation_message: true.to_s,
+ show_visibility_confirm_modal: show_visibility_confirm_modal?(project).to_s
+ }
+ end
+
def build_project_breadcrumb_link(project)
project_name = simple_sanitize(project.name)
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index aedb7df9e4f..6efede8d565 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -141,7 +141,7 @@ module SearchHelper
}
},
{
- title: _('Last updated'),
+ title: _('Updated date'),
sortable: true,
sortParam: {
asc: 'updated_asc',
@@ -336,7 +336,7 @@ module SearchHelper
link_to search_path(search_params) do
concat label
concat ' '
- concat content_tag(:span, count, class: ['badge badge-pill gl-badge badge-muted sm', badge_class], data: badge_data)
+ concat gl_badge_tag(count, { size: :sm }, { class: badge_class, data: badge_data })
end
end
end
diff --git a/app/helpers/snippets_helper.rb b/app/helpers/snippets_helper.rb
index e9ef9146529..ca90d1e13c1 100644
--- a/app/helpers/snippets_helper.rb
+++ b/app/helpers/snippets_helper.rb
@@ -26,11 +26,8 @@ module SnippetsHelper
return unless attrs = snippet_badge_attributes(snippet)
icon_name, text = attrs
- tag.span(class: %w[badge badge-gray]) do
- concat(sprite_icon(icon_name, size: 14, css_class: 'gl-vertical-align-middle'))
- concat(' ')
- concat(text)
- end
+
+ gl_badge_tag(text, icon: icon_name)
end
def snippet_badge_attributes(snippet)
diff --git a/app/helpers/sorting_titles_values_helper.rb b/app/helpers/sorting_titles_values_helper.rb
index 75ba6e8a153..4dfa7689110 100644
--- a/app/helpers/sorting_titles_values_helper.rb
+++ b/app/helpers/sorting_titles_values_helper.rb
@@ -59,7 +59,7 @@ module SortingTitlesValuesHelper
end
def sort_title_latest_activity
- s_('SortOptions|Last updated')
+ _('Updated date')
end
def sort_title_milestone
@@ -127,7 +127,7 @@ module SortingTitlesValuesHelper
end
def sort_title_recently_updated
- s_('SortOptions|Last updated')
+ _('Updated date')
end
def sort_title_start_date_later
diff --git a/app/helpers/ssh_keys_helper.rb b/app/helpers/ssh_keys_helper.rb
index f5a9bea482b..17a9fd6146d 100644
--- a/app/helpers/ssh_keys_helper.rb
+++ b/app/helpers/ssh_keys_helper.rb
@@ -18,4 +18,14 @@ module SshKeysHelper
container: 'body'
}
end
+
+ def ssh_key_allowed_algorithms
+ allowed_algorithms = Gitlab::CurrentSettings.allowed_key_types.flat_map do |ssh_key_type_name|
+ Gitlab::SSHPublicKey.supported_algorithms_for_name(ssh_key_type_name)
+ end
+
+ quoted_allowed_algorithms = allowed_algorithms.map { |name| "'#{name}'" }
+
+ Gitlab::Utils.to_exclusive_sentence(quoted_allowed_algorithms)
+ end
end
diff --git a/app/helpers/tracking_helper.rb b/app/helpers/tracking_helper.rb
index 3f53bd535b2..1beb88548c5 100644
--- a/app/helpers/tracking_helper.rb
+++ b/app/helpers/tracking_helper.rb
@@ -13,6 +13,10 @@ module TrackingHelper
}
end
+ def tracking_attrs_data(label, action, property)
+ tracking_attrs(label, action, property).fetch(:data, {})
+ end
+
private
def tracking_enabled?
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index d089b540282..4437f309a9c 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -191,7 +191,10 @@ module TreeHelper
web_ide_url: web_ide_url,
edit_url: edit_url(options),
- gitpod_url: gitpod_url
+
+ gitpod_url: gitpod_url,
+ user_preferences_gitpod_path: profile_preferences_path(anchor: 'user_gitpod_enabled'),
+ user_profile_enable_gitpod_path: profile_path(user: { gitpod_enabled: true })
}
end
diff --git a/app/helpers/version_check_helper.rb b/app/helpers/version_check_helper.rb
index 7875b9e4a28..48548ae9e6a 100644
--- a/app/helpers/version_check_helper.rb
+++ b/app/helpers/version_check_helper.rb
@@ -1,12 +1,11 @@
# frozen_string_literal: true
module VersionCheckHelper
- def version_status_badge
- return unless Rails.env.production?
- return unless Gitlab::CurrentSettings.version_check_enabled
- return if User.single_user&.requires_usage_stats_consent?
+ def show_version_check?
+ return false unless Gitlab::CurrentSettings.version_check_enabled
+ return false if User.single_user&.requires_usage_stats_consent?
- image_tag VersionCheck.image_url, class: 'js-version-status-badge'
+ current_user&.can_read_all_resources?
end
def link_to_version
diff --git a/app/helpers/webpack_helper.rb b/app/helpers/webpack_helper.rb
index 0d27e07f172..64900714327 100644
--- a/app/helpers/webpack_helper.rb
+++ b/app/helpers/webpack_helper.rb
@@ -25,6 +25,10 @@ module WebpackHelper
else
preload_link_tag(path, options)
end
+ rescue Gitlab::Webpack::Manifest::AssetMissingError
+ # In development/test, incremental compilation may be enabled, meaning not
+ # all chunks may be available/split out
+ raise unless Gitlab.dev_or_test_env?
end
def webpack_controller_bundle_tags