Class: Search::ProjectSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/search/project_settings.rb

Overview

Generates a list of all available setting sections of a project. This list is used by the command palette’s search functionality.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ ProjectSettings

Returns a new instance of ProjectSettings.



11
12
13
# File 'lib/search/project_settings.rb', line 11

def initialize(project)
  @project = project
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



9
10
11
# File 'lib/search/project_settings.rb', line 9

def project
  @project
end

Instance Method Details

#allObject



15
16
17
18
19
20
21
22
# File 'lib/search/project_settings.rb', line 15

def all
  general_settings.concat(
    repository_settings,
    merge_request_settings,
    ci_cd_settings,
    monitor_settings
  )
end

#ci_cd_settingsObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/search/project_settings.rb', line 57

def ci_cd_settings
  [
    { text: _("General pipelines"),
      href: project_settings_ci_cd_path(project, anchor: 'js-general-pipeline-settings') },
    { text: _("Auto DevOps"), href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings') },
    { text: _("Runners"), href: project_settings_ci_cd_path(project, anchor: 'js-runners-settings') },
    { text: _("Artifacts"),     href: project_settings_ci_cd_path(project, anchor: 'js-artifacts-settings') },
    { text: _("Variables"),     href: project_settings_ci_cd_path(project, anchor: 'js-cicd-variables-settings') },
    { text: _("Pipeline trigger tokens"),
      href: project_settings_ci_cd_path(project, anchor: 'js-pipeline-triggers') },
    { text: _("Deploy freezes"),
      href: project_settings_ci_cd_path(project, anchor: 'js-deploy-freeze-settings') },
    { text: _("Job token permissions"), href: project_settings_ci_cd_path(project, anchor: 'js-token-access') },
    { text: _("Secure files"),
      href: project_settings_ci_cd_path(project, anchor: 'js-secure-files') }
  ]
end

#general_settingsObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/search/project_settings.rb', line 24

def general_settings
  [
    { text: _("Naming, description, topics"), href: edit_project_path(project, anchor: 'js-general-settings') },
    { text: _("Visibility, project features, permissions"),
      href: edit_project_path(project, anchor: 'js-shared-permissions') },
    { text: _("Badges"), href: edit_project_path(project, anchor: 'js-badges-settings') },
    { text: _("Service Desk"), href: edit_project_path(project, anchor: 'js-service-desk') },
    { text: _("Advanced"), href: edit_project_path(project, anchor: 'js-project-advanced-settings') }
  ]
end

#merge_request_settingsObject



50
51
52
53
54
55
# File 'lib/search/project_settings.rb', line 50

def merge_request_settings
  [
    { text: _("Merge requests"),
      href: project_settings_merge_requests_path(project, anchor: 'js-merge-request-settings') }
  ]
end

#monitor_settingsObject



75
76
77
78
79
80
81
82
83
84
# File 'lib/search/project_settings.rb', line 75

def monitor_settings
  [
    { text: _("Error tracking"),
      href: project_settings_operations_path(project, anchor: 'js-error-tracking-settings') },
    { text: _("Alerts"),
      href: project_settings_operations_path(project, anchor: 'js-alert-management-settings') },
    { text: _("Incidents"),
      href: project_settings_operations_path(project, anchor: 'incident-management-settings') }
  ]
end

#repository_settingsObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/search/project_settings.rb', line 35

def repository_settings
  [
    { text: _("Branch defaults"),
      href: project_settings_repository_path(project, anchor: 'branch-defaults-settings') },
    { text: _("Branch rules"), href: project_settings_repository_path(project, anchor: 'branch-rules') },
    { text: _("Mirroring repositories"),
      href: project_settings_repository_path(project, anchor: 'js-push-remote-settings') },
    { text: s_('DeployTokens|Deploy tokens'),
      href: project_settings_repository_path(project, anchor: 'js-deploy-tokens') },
    { text: _("Deploy keys"),
      href: project_settings_repository_path(project, anchor: 'js-deploy-keys-settings') },
    { text: _("Repository cleanup"), href: project_settings_repository_path(project, anchor: 'cleanup') }
  ]
end