redmine_remotes 0.15.3 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18d9615ff3b718437d968bdc9c3483e185936efa5f9ba0bd6d936bd2c6732e34
4
- data.tar.gz: 97d71e8ba3e72b4154775ed48e3ab6604133059dda380cc36cb6838dedc4af19
3
+ metadata.gz: f974e7b689f90b6250957c0a0356f22fa78fbd9e84705a18abbd5667df745da0
4
+ data.tar.gz: eb073a99fd7ee11795b341d132f943e820f78103928baa66983ccbebef2531a2
5
5
  SHA512:
6
- metadata.gz: f4de283cfde98c0739a7d335cd531a79350bbffb22d70acfcbf26b600c3e519796f719a670e7de39e7ab0114bce829537833f748d7e56df657e4069e3ae465b0
7
- data.tar.gz: 67c0236c893e01723aedd350f33b1c79d733da22514b2060a5c407a6abc58835360d857878461ad1df2bc72501cda2fff5dce91da5d5cdcec1dfabc4a8a0ede1
6
+ metadata.gz: 74953344c1a68f1ce612e808341767fbdc0a4e359f145d55273cd29c7b5160da9b2fc149dc4bb1b536a1ea96d0a2ef95a0e690f4c6f0f20019a143414ee01f7c
7
+ data.tar.gz: cd80adf88f456deedeb3a440626877fa7e5c50bc9d84b8a9311531459e5ad731e9e69422b7b169c306e1630eca4f97a90a126233725dbce9446738b4d751d5b1
@@ -8,9 +8,22 @@ class RemoteIssueStatusesController < ApplicationController
8
8
  layout 'nonproject_modules'
9
9
  require_permission PERMISSIONS
10
10
 
11
+ SEARCH_COLUMNS = %i[remote_name local_issue_status local_tracker remote_tracker].freeze
12
+ before_action :localize_options
13
+
11
14
  active_scaffold :remote_issue_status do |conf|
12
- %i[remote_tracker local_tracker local_issue_status].each do |column|
15
+ conf.actions.swap :search, :field_search
16
+ SEARCH_COLUMNS.each do |column|
13
17
  conf.columns[column].form_ui = :select
14
18
  end
19
+ conf.field_search.columns = SEARCH_COLUMNS
20
+ end
21
+
22
+ private
23
+
24
+ def localize_options
25
+ active_scaffold_config.columns[:remote_name].options = {
26
+ options: ::RemoteIssueStatus.remote_name_options
27
+ }
15
28
  end
16
29
  end
@@ -13,4 +13,10 @@ class RemoteIssueStatus < ActiveRecord::Base
13
13
  validates :remote_tracker, presence: true
14
14
  validates :local_tracker, presence: true
15
15
  validates :local_issue_status, presence: true
16
+
17
+ class << self
18
+ def remote_name_options
19
+ all.pluck(:remote_name).map { |v| [v.upcase, v] }
20
+ end
21
+ end
16
22
  end
@@ -19,7 +19,8 @@ class RemoteTracker < ActiveRecord::Base
19
19
  dependent: :destroy
20
20
  has_many :remote_users, class_name: 'RemoteUser', inverse_of: :remote_tracker,
21
21
  dependent: :restrict_with_error
22
- belongs_to :default_local_user, class_name: 'User', inverse_of: :remote_trackers_as_default
22
+ belongs_to :default_local_user, class_name: 'User', inverse_of: :remote_trackers_as_default,
23
+ foreign_key: :default_local_user_id
23
24
 
24
25
  validates :profile, presence: true, inclusion: { in: lists.profile.values }
25
26
  validates :root_url, presence: true, uniqueness: { scope: [:username] }, url: true
@@ -6,7 +6,7 @@ class RemoteUser < ActiveRecord::Base
6
6
  downcase_columns :remote_login
7
7
 
8
8
  belongs_to :remote_tracker, class_name: 'RemoteTracker', inverse_of: :remote_users
9
- belongs_to :local_user, class_name: 'User', inverse_of: :remote_users
9
+ belongs_to :local_user, class_name: 'User', inverse_of: :remote_users, foreign_key: :local_user_id
10
10
 
11
11
  validates :remote_login, presence: true, uniqueness: { scope: [:remote_tracker] }
12
12
  validates :local_user, presence: true
@@ -1,4 +1,9 @@
1
1
  en:
2
+ activerecord:
3
+ models:
4
+ remote_issue_status:
5
+ one: Remote issue status
6
+ other: Remote issue statuses
2
7
  eac_ruby_utils:
3
8
  listable:
4
9
  remote_tracker:
@@ -13,8 +18,10 @@ en:
13
18
  label: Alternative "description" field
14
19
  field_issue_remote_code: Remote issue's code
15
20
  field_local_issue: Local issue
21
+ field_local_issue_status: Local issue status
16
22
  field_local_tracker: Local tracker
17
23
  field_remote_code: Remote code
24
+ field_remote_name: Local issue status's name
18
25
  field_remote_tracker: Remote tracker
19
26
  label_remote_issues: Remote issues
20
27
  label_remote_trackers: Remote trackers
@@ -1,4 +1,9 @@
1
1
  pt-BR:
2
+ activerecord:
3
+ models:
4
+ remote_issue_status:
5
+ one: Situação de demanda remota
6
+ other: Situações de demandas remotas
2
7
  eac_ruby_utils:
3
8
  listable:
4
9
  remote_tracker:
@@ -13,8 +18,10 @@ pt-BR:
13
18
  label: Campo "descrição" alternativo
14
19
  field_issue_remote_code: Código da demanda remota
15
20
  field_local_issue: Demanda local
16
- field_local_tracker: Tipo de tarefa local
21
+ field_local_issue_status: Situação de demanda local
22
+ field_local_tracker: Tipo de demanda local
17
23
  field_remote_code: Código remoto
24
+ field_remote_name: Nome da situação de demanda remota
18
25
  field_remote_tracker: Tracker remoto
19
26
  label_remote_issues: Demandas remotas
20
27
  label_remote_trackers: Trackers remotos
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateRemoteTrackers < ActiveRecord::Migration
3
+ class CreateRemoteTrackers < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  create_table :remote_trackers do |t| # rubocop:disable Rails/CreateTableWithTimestamps
6
8
  t.string :profile
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateRemoteUsers < ActiveRecord::Migration
3
+ class CreateRemoteUsers < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  create_table :remote_users do |t| # rubocop:disable Rails/CreateTableWithTimestamps
6
8
  t.references :remote_tracker, index: true
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateRemoteIssueStatuses < ActiveRecord::Migration
3
+ class CreateRemoteIssueStatuses < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  create_table :remote_issue_statuses do |t| # rubocop:disable Rails/CreateTableWithTimestamps
6
8
  t.references :remote_tracker, index: true
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class RenameIssueStatusIdToLocalIssueStatusIdInRemoteIssueStatuses < ActiveRecord::Migration
3
+ class RenameIssueStatusIdToLocalIssueStatusIdInRemoteIssueStatuses < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  rename_column :remote_issue_statuses, :issue_status_id, :local_issue_status_id
6
8
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateRemoteIssues < ActiveRecord::Migration
3
+ class CreateRemoteIssues < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  create_table :remote_issues do |t| # rubocop:disable Rails/CreateTableWithTimestamps
6
8
  t.references :remote_tracker, index: true
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddDefaultLocalUserIdToRemoteTrackers < ActiveRecord::Migration
3
+ class AddDefaultLocalUserIdToRemoteTrackers < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  add_reference :remote_trackers, :default_local_user, index: true
6
8
 
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateRemoteTrackerSettings < ActiveRecord::Migration
3
+ class CreateRemoteTrackerSettings < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  create_table :remote_tracker_settings do |t|
6
8
  t.references :remote_tracker, index: true
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddTimestampsToRedmineTrackers < ActiveRecord::Migration
3
+ class AddTimestampsToRedmineTrackers < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  class RemoteTracker < ::ActiveRecord::Base; end
5
7
 
6
8
  def change
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddTimestampsToRemoteIssues < ActiveRecord::Migration
3
+ class AddTimestampsToRemoteIssues < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  class RemoteIssue < ::ActiveRecord::Base; end
5
7
 
6
8
  def change
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddTimestampsToRemoteUsers < ActiveRecord::Migration
3
+ class AddTimestampsToRemoteUsers < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  class RemoteUser < ::ActiveRecord::Base; end
5
7
 
6
8
  def change
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddOutdatedAtToRemoteIssues < ActiveRecord::Migration
3
+ class AddOutdatedAtToRemoteIssues < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  add_column :remote_issues, :outdated_at, :datetime
6
8
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddFetchedAtToRemoteIssues < ActiveRecord::Migration
3
+ class AddFetchedAtToRemoteIssues < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  add_column :remote_issues, :fetched_at, :timestamp
6
8
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddFetchedAtToRemoteTrackers < ActiveRecord::Migration
3
+ class AddFetchedAtToRemoteTrackers < (
4
+ ::Rails.version < '5.1' ? ::ActiveRecord::Migration : ::ActiveRecord::Migration[4.2]
5
+ )
4
6
  def change
5
7
  add_column :remote_trackers, :fetched_at, :datetime
6
8
  end
@@ -6,11 +6,16 @@ module RedmineRemotes
6
6
  module Esosti
7
7
  module Entities
8
8
  class Issue < ::Avmtrf1::Esosti::Entities::Issue
9
+ DEFAULT_TYPE_FOR_URL_PREFIX = '_unmapped_'
9
10
  EXTRA_DESCRIPTION_BEFORE = { reported_by: 'Relatado por', affected_person: 'Pessoa afetada',
10
11
  type_description: 'Tipo de solicitação' }.freeze
12
+ TYPES_FOR_URL = {
13
+ 'INCIDENTE' => 'ms_incident',
14
+ 'SS' => 'ms_sr'
15
+ }.freeze
11
16
 
12
17
  def human_view_url
13
- instance.issue_human_view_url(uid)
18
+ instance.issue_human_view_url(type_for_url, uid)
14
19
  end
15
20
 
16
21
  def author_login
@@ -63,6 +68,14 @@ module RedmineRemotes
63
68
  description.gsub(/\s+/, ' ')
64
69
  end
65
70
 
71
+ def type_for_url
72
+ TYPES_FOR_URL[type_class] || "#{DEFAULT_TYPE_FOR_URL_PREFIX}#{type_class}"
73
+ end
74
+
75
+ def type_class
76
+ attributes.fetch('CLASS')
77
+ end
78
+
66
79
  def type_description
67
80
  attributes.fetch('DESCRIPTION')
68
81
  end
@@ -17,8 +17,8 @@ module RedmineRemotes
17
17
  end
18
18
  end
19
19
 
20
- def issue_human_view_url(ticket_uid)
21
- "#{root_url}/itsm/ui/?event=loadapp&value=ms_sr&uniqueid=#{ticket_uid}"
20
+ def issue_human_view_url(ticket_type, ticket_uid)
21
+ "#{root_url}/itsm/ui/?event=loadapp&value=#{ticket_type}&uniqueid=#{ticket_uid}"
22
22
  end
23
23
 
24
24
  def fetch_issues_changed(start_time, _end_time)
@@ -7,10 +7,10 @@ module EacRedmineUsability
7
7
 
8
8
  included do
9
9
  has_many :remote_users, class_name: 'RemoteUser', inverse_of: :local_user,
10
- dependent: :destroy
10
+ dependent: :destroy, foreign_key: :local_user_id
11
11
  has_many :remote_trackers_as_default,
12
12
  class_name: 'RemoteTracker', inverse_of: :default_local_user,
13
- dependent: :restrict_with_error
13
+ dependent: :restrict_with_error, foreign_key: :default_local_user_id
14
14
  end
15
15
  end
16
16
  end
@@ -3,7 +3,7 @@
3
3
  module RedmineRemotes
4
4
  SLUG = 'redmine_remotes'
5
5
  NAME = 'Redmine Remotes'
6
- VERSION = '0.15.3'
6
+ VERSION = '0.16.0'
7
7
  AUTHOR = 'Eduardo Henrique Bogoni'
8
8
  SUMMARY = 'Integração do Redmine com trackers diversos.'
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_remotes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Henrique Bogoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-07 00:00:00.000000000 Z
11
+ date: 2022-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers