Class: Integrations::Zentao

Inherits:
BaseIssueTracker show all
Includes:
Gitlab::Routing
Defined in:
app/models/integrations/zentao.rb

Constant Summary

Constants inherited from Integration

Integration::BASE_CLASSES, Integration::DEV_INTEGRATION_NAMES, Integration::INTEGRATION_NAMES, Integration::PROJECT_SPECIFIC_INTEGRATION_NAMES, Integration::SECTION_TYPE_CONFIGURATION, Integration::SECTION_TYPE_CONNECTION, Integration::SECTION_TYPE_TRIGGER, Integration::SNOWPLOW_EVENT_ACTION, Integration::SNOWPLOW_EVENT_LABEL, Integration::UnknownType

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Instance Attribute Summary

Attributes included from Importable

#imported, #importing

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Routing

includes_helpers, redirect_legacy_paths, url_helpers

Methods inherited from BaseIssueTracker

#activate_disabled_reason, base_reference_pattern, #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 inherited from Integration

#activate_disabled_reason, #activated?, #api_field_names, #async_execute, #attributes, available_integration_names, available_integration_types, boolean_accessor, build_from_integration, #category, #chat?, #ci?, #configurable_events, create_from_active_default_integrations, default_integration, #default_test_event, default_test_event, dev_integration_names, #dup, #editable?, #event_channel_names, event_description, event_names, #event_names, #execute, field, #fields, fields, find_or_initialize_all_non_project_specific, find_or_initialize_non_project_specific_integration, #form_fields, #group_level?, #inheritable?, inherited_descendants_from_self_or_ancestors_from, #initialize_properties, instance_exists_for?, #instance_level?, integration_name_to_model, integration_name_to_type, integration_names, #json_fields, #operating?, #parent, #project_level?, project_specific_integration_names, prop_accessor, #properties=, #reencrypt_properties, #reset_updated_properties, #secret_fields, #sections, #show_active_box?, #supported_events, #supports_data_fields?, #testable?, #to_database_hash, #to_param, #updated_properties

Methods included from Gitlab::Utils::Override

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

Methods included from ResetSecretFields

#exposing_secrets_fields

Methods included from Loggable

#build_message, #log_error, #log_exception, #log_info, #logger

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, 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 SensitiveSerializableHash

#serializable_hash

Class Method Details

.issues_license_available?(project) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.supported_eventsObject



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

def self.supported_events
  %w[]
end

.to_paramObject



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

def self.to_param
  name.demodulize.downcase
end

Instance Method Details

#avatar_urlObject



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

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

#client_urlObject



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

def client_url
  api_url.presence || url
end

#data_fieldsObject



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

def data_fields
  zentao_tracker_data || self.build_zentao_tracker_data
end

#descriptionObject



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

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

#helpObject



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

def 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: help_page_url('user/project/integrations/zentao') },
    link_end: '</a>'.html_safe
  }
end

#set_default_dataObject



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

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



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

def test(*_args)
  client.ping
end

#titleObject



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

def title
  'ZenTao'
end