Class: ConfluenceService

Inherits:
Service show all
Includes:
ActionView::Helpers::UrlHelper
Defined in:
app/models/project_services/confluence_service.rb

Constant Summary collapse

VALID_SCHEME_MATCH =
%r{\Ahttps?\Z}.freeze
VALID_HOST_MATCH =
%r{\A.+\.atlassian\.net\Z}.freeze
VALID_PATH_MATCH =
%r{\A/wiki(/|\Z)}.freeze

Constants inherited from Service

Service::DEV_SERVICE_NAMES, Service::PROJECT_SPECIFIC_SERVICE_NAMES, Service::SERVICE_NAMES

Instance Attribute Summary

Attributes included from Importable

#imported, #importing

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Service

#activated?, #api_field_names, #async_execute, available_services_names, available_services_types, boolean_accessor, build_from_integration, #category, #configurable_event_actions, #configurable_events, create_from_active_default_integrations, default_integration, #default_test_event, default_test_event, dev_services_names, #editable?, #event_channel_names, event_description, #event_field, #event_names, event_names, #execute, #external_issue_tracker?, #external_wiki?, find_or_create_templates, find_or_initialize_all_non_project_specific, find_or_initialize_non_project_specific_integration, #global_fields, #help, inherited_descendants_from_self_or_ancestors_from, #initialize_properties, instance_exists_for?, #json_fields, #operating?, project_specific_services_names, prop_accessor, #reset_updated_properties, services_names, #show_active_box?, supported_event_actions, #supported_events, #supports_data_fields?, #test, #to_data_fields_hash, #to_param, #to_service_hash, #updated_properties

Methods included from ProjectServicesLoggable

#build_message, #log_error, #log_info, #logger

Methods inherited from ApplicationRecord

at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, where_exists, with_fast_statement_timeout, without_order

Class Method Details

.supported_eventsObject


21
22
23
# File 'app/models/project_services/confluence_service.rb', line 21

def self.supported_events
  %w()
end

.to_paramObject


17
18
19
# File 'app/models/project_services/confluence_service.rb', line 17

def self.to_param
  'confluence'
end

Instance Method Details

#can_test?Boolean

Returns:

  • (Boolean)

60
61
62
# File 'app/models/project_services/confluence_service.rb', line 60

def can_test?
  false
end

#descriptionObject


29
30
31
# File 'app/models/project_services/confluence_service.rb', line 29

def description
  s_('ConfluenceService|Connect a Confluence Cloud Workspace to GitLab')
end

#detailed_descriptionObject


33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/models/project_services/confluence_service.rb', line 33

def detailed_description
  return unless project.wiki_enabled?

  if activated?
    wiki_url = project.wiki.web_url

    s_(
      'ConfluenceService|Your GitLab Wiki can be accessed here: %{wiki_link}. To re-enable your GitLab Wiki, disable this integration' %
      { wiki_link: link_to(wiki_url, wiki_url) }
    ).html_safe
  else
    s_('ConfluenceService|Enabling the Confluence Workspace will disable the default GitLab Wiki. Your GitLab Wiki data will be saved and you can always re-enable it later by turning off this integration').html_safe
  end
end

#fieldsObject


48
49
50
51
52
53
54
55
56
57
58
# File 'app/models/project_services/confluence_service.rb', line 48

def fields
  [
    {
      type: 'text',
      name: 'confluence_url',
      title: 'Confluence Cloud Workspace URL',
      placeholder: s_('ConfluenceService|The URL of the Confluence Workspace'),
      required: true
    }
  ]
end

#titleObject


25
26
27
# File 'app/models/project_services/confluence_service.rb', line 25

def title
  s_('ConfluenceService|Confluence Workspace')
end