redmine_remotes 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/remote_tracker_settings_controller.rb +27 -0
- data/app/models/redmine_remotes/tableless/remote_issue_fetch/base/_local_issue.rb +5 -0
- data/app/models/remote_tracker/jira.rb +1 -1
- data/app/models/remote_tracker.rb +7 -0
- data/app/models/remote_tracker_setting.rb +13 -0
- data/config/initializers/nonproject_modules.rb +1 -0
- data/config/locales/en.yml +5 -0
- data/config/locales/pt-BR.yml +5 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20200504183142_create_remote_tracker_settings.rb +14 -0
- data/db/migrate/20200505153200_add_timestamps_to_redmine_trackers.rb +18 -0
- data/db/migrate/20200505160938_add_timestamps_to_remote_issues.rb +18 -0
- data/db/migrate/20200505161002_add_timestamps_to_remote_users.rb +18 -0
- data/lib/redmine_remotes/jira/entities/issue.rb +4 -0
- data/lib/redmine_remotes/jira/instance.rb +8 -0
- data/lib/redmine_remotes/rest_provider/instance.rb +7 -0
- data/lib/redmine_remotes/version.rb +1 -1
- metadata +8 -3
- data/app/models/redmine_remotes/tableless/remote_issue_fetch/update/_provider_issue.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5f35dbfa9b3937fe817de6c4b40ee9d2478f8cf109a4972dcf23013af7aaf38
|
4
|
+
data.tar.gz: a9351636d9086cb45149db0221ec92dc74ac7d9860e8b98720be6544b799c31e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0019b818f02217850e974d6ae9095f887349db3bf732965038abbc51438e5f00b6c622e844748bdccb87c074cddbddfff2b94e501610c16af8b8afb8a44ba8d
|
7
|
+
data.tar.gz: cf17dc61038a50092c9e4158303d9678ef57a3a2b561d2c38b4a7a568e006e4384e58cd70e92b3e10363941cc921ec07a2ab28a831cd78b15ce75545c2fac887
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RemoteTrackerSettingsController < ApplicationController
|
4
|
+
READ_PERMISSION = 'remote_tracker.read'
|
5
|
+
WRITE_PERMISSION = 'remote_tracker.write'
|
6
|
+
PERMISSIONS = READ_PERMISSION
|
7
|
+
|
8
|
+
before_action :localize_options
|
9
|
+
layout 'nonproject_modules'
|
10
|
+
require_permission PERMISSIONS
|
11
|
+
|
12
|
+
active_scaffold :remote_tracker_setting do |conf|
|
13
|
+
conf.columns[:name].form_ui = :select
|
14
|
+
conf.columns[:remote_tracker].form_ui = :select
|
15
|
+
%w[create update].each do |action|
|
16
|
+
conf.send(action).columns = %w[remote_tracker name value]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def localize_options
|
23
|
+
active_scaffold_config.columns[:name].options = {
|
24
|
+
options: ::RemoteTrackerSetting.lists.name.options
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
@@ -9,6 +9,7 @@ module RedmineRemotes
|
|
9
9
|
def local_issue_provider_attributes
|
10
10
|
{
|
11
11
|
subject: local_issue_subject, author: local_issue_author, status: local_issue_status,
|
12
|
+
description: local_issue_description,
|
12
13
|
created_on: provider_issue.created_on, updated_on: provider_issue.updated_on
|
13
14
|
}
|
14
15
|
end
|
@@ -41,6 +42,10 @@ module RedmineRemotes
|
|
41
42
|
def local_issue_status_from_local_tracker
|
42
43
|
local_tracker.default_status
|
43
44
|
end
|
45
|
+
|
46
|
+
def local_issue_description
|
47
|
+
provider_issue.description
|
48
|
+
end
|
44
49
|
end
|
45
50
|
end
|
46
51
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
3
4
|
require 'eac_ruby_utils/listable'
|
4
5
|
require 'validate_url'
|
5
6
|
|
@@ -9,6 +10,8 @@ class RemoteTracker < ActiveRecord::Base
|
|
9
10
|
|
10
11
|
has_many :issues, class_name: 'RemoteIssue', inverse_of: :remote_tracker,
|
11
12
|
dependent: :restrict_with_error
|
13
|
+
has_many :settings, class_name: 'RemoteTrackerSetting', inverse_of: :remote_tracker,
|
14
|
+
dependent: :destroy
|
12
15
|
|
13
16
|
lists.add_string :profile, :jira
|
14
17
|
|
@@ -33,4 +36,8 @@ class RemoteTracker < ActiveRecord::Base
|
|
33
36
|
|
34
37
|
send("#{profile}_find_remote_issue", issue_id)
|
35
38
|
end
|
39
|
+
|
40
|
+
def setting_value(name)
|
41
|
+
::RemoteTrackerSetting.where(remote_tracker: self, name: name).first.if_present(&:value)
|
42
|
+
end
|
36
43
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/listable'
|
4
|
+
|
5
|
+
class RemoteTrackerSetting < ActiveRecord::Base
|
6
|
+
include ::EacRubyUtils::Listable
|
7
|
+
lists.add_string :name, :field_description
|
8
|
+
|
9
|
+
belongs_to :remote_tracker, class_name: 'RemoteTracker', inverse_of: :settings
|
10
|
+
|
11
|
+
validates :name, presence: true, inclusion: { in: lists.name.values }
|
12
|
+
validates :value, presence: true
|
13
|
+
end
|
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
Redmine::MenuManager.map ::RedmineRemotes::SLUG.to_sym do |menu|
|
25
25
|
menu.push_controller(:remote_trackers)
|
26
|
+
menu.push_controller(:remote_tracker_settings)
|
26
27
|
menu.push_controller(:remote_issues)
|
27
28
|
menu.push_controller(:remote_issue_statuses)
|
28
29
|
menu.push_controller(:remote_users)
|
data/config/locales/en.yml
CHANGED
@@ -5,6 +5,10 @@ en:
|
|
5
5
|
profile:
|
6
6
|
jira:
|
7
7
|
label: Jira
|
8
|
+
remote_tracker_setting:
|
9
|
+
name:
|
10
|
+
field_description:
|
11
|
+
label: Alternative "description" field
|
8
12
|
field_issue_remote_code: Remote issue's code
|
9
13
|
field_local_issue: Local issue
|
10
14
|
field_local_tracker: Local tracker
|
@@ -12,6 +16,7 @@ en:
|
|
12
16
|
field_remote_tracker: Remote tracker
|
13
17
|
label_remote_issues: Remote issues
|
14
18
|
label_remote_trackers: Remote trackers
|
19
|
+
label_remote_tracker_settings: Remote trackers / Settings
|
15
20
|
label_remote_issue_statuses: Remote issue statuses
|
16
21
|
label_remote_users: Remote users
|
17
22
|
label_remotes: Remotes
|
data/config/locales/pt-BR.yml
CHANGED
@@ -5,6 +5,10 @@ pt-BR:
|
|
5
5
|
profile:
|
6
6
|
jira:
|
7
7
|
label: Jira
|
8
|
+
remote_tracker_setting:
|
9
|
+
name:
|
10
|
+
field_description:
|
11
|
+
label: Campo "descrição" alternativo
|
8
12
|
field_issue_remote_code: Código da demanda remota
|
9
13
|
field_local_issue: Demanda local
|
10
14
|
field_local_tracker: Tipo de tarefa local
|
@@ -12,6 +16,7 @@ pt-BR:
|
|
12
16
|
field_remote_tracker: Tracker remoto
|
13
17
|
label_remote_issues: Demandas remotas
|
14
18
|
label_remote_trackers: Trackers remotos
|
19
|
+
label_remote_tracker_settings: Trackers remotos / Configurações
|
15
20
|
label_remote_issue_statuses: Situações de demandas remotas
|
16
21
|
label_remote_users: Usuários remotos
|
17
22
|
label_remotes: Remotos
|
data/config/routes.rb
CHANGED
@@ -10,6 +10,7 @@ RedmineApp::Application.routes.draw do
|
|
10
10
|
as: 'update_project_remote_issue'
|
11
11
|
resources(:project_remote_issues, only: [:index])
|
12
12
|
resources(:remote_trackers) { as_routes }
|
13
|
+
resources(:remote_tracker_settings) { as_routes }
|
13
14
|
resources(:remote_issues) { as_routes }
|
14
15
|
resources(:remote_issue_statuses) { as_routes }
|
15
16
|
resources(:remote_users) { as_routes }
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateRemoteTrackerSettings < ActiveRecord::Migration
|
4
|
+
def change
|
5
|
+
create_table :remote_tracker_settings do |t|
|
6
|
+
t.references :remote_tracker, index: true
|
7
|
+
t.string :name
|
8
|
+
t.string :value
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
add_foreign_key :remote_tracker_settings, :remote_trackers, column: :remote_tracker_id
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddTimestampsToRedmineTrackers < ActiveRecord::Migration
|
4
|
+
class RemoteTracker < ::ActiveRecord::Base; end
|
5
|
+
|
6
|
+
def change
|
7
|
+
add_timestamps :remote_trackers, null: true
|
8
|
+
reversible do |dir|
|
9
|
+
dir.up do
|
10
|
+
now = ::Time.zone.now
|
11
|
+
RemoteTracker.update_all(created_at: now, updated_at: now) # rubocop:disable Rails/SkipsModelValidations
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
change_column_null :remote_trackers, :created_at, false
|
16
|
+
change_column_null :remote_trackers, :updated_at, false
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddTimestampsToRemoteIssues < ActiveRecord::Migration
|
4
|
+
class RemoteIssue < ::ActiveRecord::Base; end
|
5
|
+
|
6
|
+
def change
|
7
|
+
add_timestamps :remote_issues, null: true
|
8
|
+
reversible do |dir|
|
9
|
+
dir.up do
|
10
|
+
now = ::Time.zone.now
|
11
|
+
RemoteIssue.update_all(created_at: now, updated_at: now) # rubocop:disable Rails/SkipsModelValidations
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
change_column_null :remote_issues, :created_at, false
|
16
|
+
change_column_null :remote_issues, :updated_at, false
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddTimestampsToRemoteUsers < ActiveRecord::Migration
|
4
|
+
class RemoteUser < ::ActiveRecord::Base; end
|
5
|
+
|
6
|
+
def change
|
7
|
+
add_timestamps :remote_users, null: true
|
8
|
+
reversible do |dir|
|
9
|
+
dir.up do
|
10
|
+
now = ::Time.zone.now
|
11
|
+
RemoteUser.update_all(created_at: now, updated_at: now) # rubocop:disable Rails/SkipsModelValidations
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
change_column_null :remote_users, :created_at, false
|
16
|
+
change_column_null :remote_users, :updated_at, false
|
17
|
+
end
|
18
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
3
5
|
module RedmineRemotes
|
4
6
|
module Jira
|
5
7
|
class Instance < ::RedmineRemotes::RestProvider::Instance
|
6
8
|
ISSUE_ID_PATTERN = /\A([a-z][a-z0-9]+)\-(\d+)\z/i.freeze
|
9
|
+
DEFAULT_DESCRIPTION_FIELD = 'description'
|
7
10
|
|
8
11
|
class << self
|
9
12
|
def parse_issue_id(global_issue_id)
|
@@ -18,6 +21,11 @@ module RedmineRemotes
|
|
18
21
|
"#{root_url}/rest/api/latest#{service_url_suffix}"
|
19
22
|
end
|
20
23
|
|
24
|
+
def description_field
|
25
|
+
remote_tracker.setting_value(::RemoteTrackerSetting::NAME_FIELD_DESCRIPTION)
|
26
|
+
.if_present(DEFAULT_DESCRIPTION_FIELD)
|
27
|
+
end
|
28
|
+
|
21
29
|
def issue_get_url_suffix(provider_issue_id)
|
22
30
|
"/issue/#{provider_issue_id}"
|
23
31
|
end
|
@@ -11,6 +11,13 @@ module RedmineRemotes
|
|
11
11
|
# * self.build_service_url(service_url_suffix)
|
12
12
|
# * self.issue_get_url_suffix(provider_issue_id)
|
13
13
|
class Instance < ::Avmtrf1::RestProvider::Instance
|
14
|
+
attr_reader :remote_tracker
|
15
|
+
|
16
|
+
def initialize(remote_tracker, root_url, username, password)
|
17
|
+
@remote_tracker = remote_tracker
|
18
|
+
super(root_url, username, password)
|
19
|
+
end
|
20
|
+
|
14
21
|
def request(service_url_suffix)
|
15
22
|
JSON.parse(super(service_url_suffix).body_or_raise)
|
16
23
|
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.
|
4
|
+
version: 0.8.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: 2020-05-
|
11
|
+
date: 2020-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- app/controllers/project_remote_issues_controller/update.rb
|
131
131
|
- app/controllers/remote_issue_statuses_controller.rb
|
132
132
|
- app/controllers/remote_issues_controller.rb
|
133
|
+
- app/controllers/remote_tracker_settings_controller.rb
|
133
134
|
- app/controllers/remote_trackers_controller.rb
|
134
135
|
- app/controllers/remote_users_controller.rb
|
135
136
|
- app/models/redmine_remotes/tableless/remote_issue_fetch/base.rb
|
@@ -140,12 +141,12 @@ files:
|
|
140
141
|
- app/models/redmine_remotes/tableless/remote_issue_fetch/create/_remote_issue.rb
|
141
142
|
- app/models/redmine_remotes/tableless/remote_issue_fetch/update.rb
|
142
143
|
- app/models/redmine_remotes/tableless/remote_issue_fetch/update/_local_issue.rb
|
143
|
-
- app/models/redmine_remotes/tableless/remote_issue_fetch/update/_provider_issue.rb
|
144
144
|
- app/models/redmine_remotes/tableless/remote_issue_fetch/update/_remote_issue.rb
|
145
145
|
- app/models/remote_issue.rb
|
146
146
|
- app/models/remote_issue_status.rb
|
147
147
|
- app/models/remote_tracker.rb
|
148
148
|
- app/models/remote_tracker/jira.rb
|
149
|
+
- app/models/remote_tracker_setting.rb
|
149
150
|
- app/models/remote_user.rb
|
150
151
|
- app/views/project_remote_issues/_issues.html.erb
|
151
152
|
- app/views/project_remote_issues/_trackers.html.erb
|
@@ -163,6 +164,10 @@ files:
|
|
163
164
|
- db/migrate/20190911165556_rename_issue_status_id_to_local_issue_status_id_in_remote_issue_statuses.rb
|
164
165
|
- db/migrate/20190912000000_create_remote_issues.rb
|
165
166
|
- db/migrate/20190913195930_add_default_local_user_id_to_remote_trackers.rb
|
167
|
+
- db/migrate/20200504183142_create_remote_tracker_settings.rb
|
168
|
+
- db/migrate/20200505153200_add_timestamps_to_redmine_trackers.rb
|
169
|
+
- db/migrate/20200505160938_add_timestamps_to_remote_issues.rb
|
170
|
+
- db/migrate/20200505161002_add_timestamps_to_remote_users.rb
|
166
171
|
- init.rb
|
167
172
|
- lib/redmine_remotes.rb
|
168
173
|
- lib/redmine_remotes/jira/entities/issue.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RedmineRemotes
|
4
|
-
module Tableless
|
5
|
-
module RemoteIssueFetch
|
6
|
-
class Update < ::RedmineRemotes::Tableless::RemoteIssueFetch::Base
|
7
|
-
private
|
8
|
-
|
9
|
-
def provider_issue_uncached
|
10
|
-
remote_issue.remote_tracker.find_remote_issue(remote_issue.remote_code)
|
11
|
-
rescue ::RedmineRemotes::RestProvider::HttpResponse => e
|
12
|
-
errors.add(:remote_issue_id,
|
13
|
-
"Requisição a \"#{e.url}\" retornou com status #{e.status}")
|
14
|
-
puts "====> #{e.body}"
|
15
|
-
nil
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|