Class: Projects::Security::ConfigurationPresenter

Inherits:
Gitlab::View::Presenter::Delegated show all
Includes:
AutoDevopsHelper, Security::LatestPipelineInformation
Defined in:
app/presenters/projects/security/configuration_presenter.rb

Instance Method Summary collapse

Methods included from AutoDevopsHelper

#auto_devops_settings_path, #badge_for_auto_devops_scope, #show_auto_devops_callout?

Methods inherited from Gitlab::View::Presenter::Delegated

#initialize

Methods included from Gitlab::Utils::DelegatorOverride

#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!

Methods included from Gitlab::View::Presenter::Base

#__subject__, #can?, #declarative_policy_delegate, #is_a?, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?

Methods included from Gitlab::Routing

add_helpers, includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::View::Presenter::Delegated

Instance Method Details

#to_hObject


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/presenters/projects/security/configuration_presenter.rb', line 11

def to_h
  {
    auto_devops_enabled: auto_devops_source?,
    auto_devops_help_page_path: help_page_path('topics/autodevops/index'),
    auto_devops_path: auto_devops_settings_path(project),
    can_enable_auto_devops: can_enable_auto_devops?,
    features: features,
    help_page_path: help_page_path('user/application_security/index'),
    latest_pipeline_path: latest_pipeline_path,
    # TODO: gitlab_ci_present will incorrectly report `false` if the CI/CD configuration file name
    # has been customized and a file with the given custom name exists in the repo. This edge case
    # will be addressed in https://gitlab.com/gitlab-org/gitlab/-/issues/342465
    gitlab_ci_present: project.repository.gitlab_ci_yml.present?,
    gitlab_ci_history_path: gitlab_ci_history_path,
    auto_fix_enabled: autofix_enabled,
    can_toggle_auto_fix_settings: can_toggle_autofix,
    auto_fix_user_path: auto_fix_user_path
  }
end

#to_html_data_attributeObject


31
32
33
34
35
36
37
# File 'app/presenters/projects/security/configuration_presenter.rb', line 31

def to_html_data_attribute
  data = to_h
  data[:features] = data[:features].to_json
  data[:auto_fix_enabled] = data[:auto_fix_enabled].to_json

  data
end