Class: Integrations::Zentao

Inherits:
Integration show all
Includes:
Gitlab::Routing, Base::IssueTracker
Defined in:
app/models/integrations/zentao.rb

Constant Summary

Constants included from Base::IssueTracker

Base::IssueTracker::REFERENCE_PATTERN_LONG_REGEXP, Base::IssueTracker::REFERENCE_PATTERN_REGEXP

Constants included from Base::Integration

Base::Integration::BASE_ATTRIBUTES, Base::Integration::BASE_CLASSES, Base::Integration::DEV_INTEGRATION_NAMES, Base::Integration::ENCRYPTED_PROPERTIES_MAX_SIZE, Base::Integration::INSTANCE_LEVEL_ONLY_INTEGRATION_NAMES, Base::Integration::INTEGRATION_NAMES, Base::Integration::PROJECT_AND_GROUP_LEVEL_ONLY_INTEGRATION_NAMES, Base::Integration::PROJECT_LEVEL_ONLY_INTEGRATION_NAMES, Base::Integration::SECTION_TYPE_CONFIGURATION, Base::Integration::SECTION_TYPE_CONNECTION, Base::Integration::SECTION_TYPE_TRIGGER, Base::Integration::SNOWPLOW_EVENT_ACTION, Base::Integration::SNOWPLOW_EVENT_LABEL, Base::Integration::UnknownType

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::MAX_RESET_PERIOD

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Routing

includes_helpers, redirect_legacy_paths, url_helpers

Methods included from Base::IssueTracker

#activate_disabled_reason, #create_cross_reference_note, #default?, #execute, #handle_properties, #issue_path, #issue_tracker_path, #issue_url, #legacy_properties_data, #new_issue_path, #reference_pattern, #support_close_issue?, #support_cross_reference?, #supports_data_fields?

Methods included from Base::Integration

#activate!, #activate_disabled_reason, #activated?, #after_build_from_integration, #api_field_names, #async_execute, #attributes, #attribution_notice, #category, #chat?, #ci?, #configurable_events, #deactivate!, #default_test_event, #description, #dup, #editable?, #event_channel_names, #event_names, #execute, #fields, #form_fields, #group_level?, #help, #inheritable?, #initialize_properties, #instance_level?, #json_fields, #manual_activation?, #operating?, #organization_id_from_parent, #parent, #project_level?, #reencrypt_properties, #reset_updated_properties, #secret_fields, #sections, #supported_events, #supports_data_fields?, #testable?, #title, #to_database_hash, #to_param, #toggle!, #updated_properties, #validate_encrypted_properties_size_limit

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Methods inherited from ApplicationRecord

===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from Organizations::Sharding

#sharding_organization

Methods included from ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Class Method Details

.descriptionObject



65
66
67
# File 'app/models/integrations/zentao.rb', line 65

def self.description
  s_("ZentaoIntegration|Use ZenTao as this project's issue tracker.")
end

.helpObject



69
70
71
72
73
74
75
# File 'app/models/integrations/zentao.rb', line 69

def self.help
  s_("ZentaoIntegration|Before you enable this integration, you must configure ZenTao. For more details, read the %{link_start}ZenTao integration documentation%{link_end}.") % {
    link_start: '<a href="%{url}" target="_blank" rel="noopener noreferrer">'
      .html_safe % { url: Rails.application.routes.url_helpers.help_page_url('user/project/integrations/zentao.md') },
    link_end: '</a>'.html_safe
  }
end

.issues_license_available?(project) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'app/models/integrations/zentao.rb', line 42

def self.issues_license_available?(project)
  project&.licensed_feature_available?(:zentao_issues_integration)
end

.supported_eventsObject



89
90
91
# File 'app/models/integrations/zentao.rb', line 89

def self.supported_events
  %w[]
end

.titleObject



61
62
63
# File 'app/models/integrations/zentao.rb', line 61

def self.title
  'ZenTao'
end

.to_paramObject



81
82
83
# File 'app/models/integrations/zentao.rb', line 81

def self.to_param
  name.demodulize.downcase
end

Instance Method Details

#avatar_urlObject



38
39
40
# File 'app/models/integrations/zentao.rb', line 38

def avatar_url
  ActionController::Base.helpers.image_path('logos/zentao.svg')
end

#client_urlObject



77
78
79
# File 'app/models/integrations/zentao.rb', line 77

def client_url
  api_url.presence || url
end

#data_fieldsObject



46
47
48
# File 'app/models/integrations/zentao.rb', line 46

def data_fields
  zentao_tracker_data || self.build_zentao_tracker_data
end

#set_default_dataObject



52
53
54
55
56
57
58
59
# File 'app/models/integrations/zentao.rb', line 52

def set_default_data
  return unless issues_tracker.present?

  return if url

  data_fields.url ||= issues_tracker['url']
  data_fields.api_url ||= issues_tracker['api_url']
end

#test(*_args) ⇒ Object



85
86
87
# File 'app/models/integrations/zentao.rb', line 85

def test(*_args)
  client.ping
end