redmine_remotes 0.6.0 → 0.7.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/project_remote_issues_controller/create.rb +46 -0
- data/app/controllers/project_remote_issues_controller/index.rb +9 -0
- data/app/controllers/project_remote_issues_controller/update.rb +29 -0
- data/app/controllers/project_remote_issues_controller.rb +4 -39
- data/app/views/project_remote_issues/_issues.html.erb +21 -0
- data/app/views/project_remote_issues/index.html.erb +1 -0
- data/config/initializers/001_patches.rb +1 -0
- data/config/locales/en.yml +3 -0
- data/config/locales/pt-BR.yml +3 -0
- data/config/routes.rb +2 -0
- data/lib/redmine_remotes/patches/project.rb +24 -0
- data/lib/redmine_remotes/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b08c26b7392ab6cdf69c5e347808474375e9f98bb5102fbc199f6d91b5e22e7
|
4
|
+
data.tar.gz: d68ac09653661d303d0e7b37974fc62b4cc6678af278d2ce5eac9b9e68f16e27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c8a615c9a0e80edb67f7eb579398e042b3995a98c4b1117ae889de8713f0088e5a0ec6aeb9b318961da7ba6ff472f06c7362be2f983dcb715e044f190f6899a
|
7
|
+
data.tar.gz: 1433dfa717cddb6d7865fce5a97b613f07a501a33ef99eb473d3aef990038b8979c68abffbdda552ce3d610caa3cda07c491b295f4002e9435f1774c7e3c6b89
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ProjectRemoteIssuesController < ApplicationController
|
4
|
+
module Create
|
5
|
+
extend ::ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
before_action :find_remote_tracker, only: %i[create new]
|
9
|
+
end
|
10
|
+
|
11
|
+
def new
|
12
|
+
@add_issue = create_model_class.new(context_params)
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
@add_issue = create_model_class.new(create_params)
|
17
|
+
if @add_issue.save
|
18
|
+
flash[:notice] = "Demanda salva: \##{@add_issue.local_issue.id}"
|
19
|
+
redirect_to url_for(action: 'index', id: @project.identifier,
|
20
|
+
tracker_id: @remote_tracker.id)
|
21
|
+
else
|
22
|
+
render 'new'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def context_params
|
29
|
+
{ project_id: @project.id, remote_tracker_id: @remote_tracker.id }
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_model_class
|
33
|
+
::RedmineRemotes::Tableless::RemoteIssueFetch::Create
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_params
|
37
|
+
params.fetch(create_model_class.model_name.param_key).permit(
|
38
|
+
:issue_remote_code, :local_tracker_id
|
39
|
+
).merge(context_params)
|
40
|
+
end
|
41
|
+
|
42
|
+
def find_remote_tracker
|
43
|
+
@remote_tracker = ::RemoteTracker.find(params[:tracker_id])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ProjectRemoteIssuesController < ApplicationController
|
4
|
+
module Update
|
5
|
+
def update
|
6
|
+
update = update_model_class.new(update_params)
|
7
|
+
if update.save
|
8
|
+
update_redirect(update, "Demanda atualizada: \##{update.remote_issue.local_issue.id}")
|
9
|
+
else
|
10
|
+
update_redirect(update, "Falha ao tentar atualizar demanda: #{update.errors.messages}")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def update_model_class
|
17
|
+
::RedmineRemotes::Tableless::RemoteIssueFetch::Update
|
18
|
+
end
|
19
|
+
|
20
|
+
def update_params
|
21
|
+
{ remote_issue_id: params[:remote_issue_id] }
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_redirect(update, message)
|
25
|
+
flash[:notice] = message
|
26
|
+
redirect_to url_for(action: 'index', id: update.remote_issue.local_issue.project.identifier)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,44 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class ProjectRemoteIssuesController < ApplicationController
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def index
|
8
|
-
@trackers = ::RemoteTracker.order(profile: :asc, root_url: :asc, username: :asc)
|
9
|
-
end
|
10
|
-
|
11
|
-
def new
|
12
|
-
@add_issue = model_class.new(context_params)
|
13
|
-
end
|
14
|
-
|
15
|
-
def create
|
16
|
-
@add_issue = model_class.new(create_params)
|
17
|
-
if @add_issue.save
|
18
|
-
flash[:notice] = "Demanda salva: \##{@add_issue.local_issue.id}"
|
19
|
-
redirect_to url_for(action: 'index', id: @project.identifier, tracker_id: @remote_tracker.id)
|
20
|
-
else
|
21
|
-
render 'new'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
4
|
+
include ::ProjectRemoteIssuesController::Create
|
5
|
+
include ::ProjectRemoteIssuesController::Index
|
6
|
+
include ::ProjectRemoteIssuesController::Update
|
26
7
|
|
27
|
-
|
28
|
-
::RedmineRemotes::Tableless::RemoteIssueFetch::Create
|
29
|
-
end
|
30
|
-
|
31
|
-
def context_params
|
32
|
-
{ project_id: @project.id, remote_tracker_id: @remote_tracker.id }
|
33
|
-
end
|
34
|
-
|
35
|
-
def create_params
|
36
|
-
params.fetch(model_class.model_name.param_key).permit(
|
37
|
-
:issue_remote_code, :local_tracker_id
|
38
|
-
).merge(context_params)
|
39
|
-
end
|
40
|
-
|
41
|
-
def find_remote_tracker
|
42
|
-
@remote_tracker = ::RemoteTracker.find(params[:tracker_id])
|
43
|
-
end
|
8
|
+
before_action :find_project
|
44
9
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h3><%= t(:label_remote_issues) %></h3>
|
2
|
+
<table class="list">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th><%= t(:field_remote_tracker) %></th>
|
6
|
+
<th><%= t(:field_remote_code) %></th>
|
7
|
+
<th><%= t(:field_local_issue) %></th>
|
8
|
+
<th></th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<% @project.remote_issues.each do |ri| %>
|
13
|
+
<tr>
|
14
|
+
<td><%= ri.remote_tracker %></td>
|
15
|
+
<td><%= ri.remote_code %></td>
|
16
|
+
<td style="text-align: left"><%= link_to(ri.local_issue, issue_path(ri.local_issue)) %></td>
|
17
|
+
<td><%= link_to 'Update', update_project_remote_issue_path(@project.id, ri), method: :put %></td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</tbody>
|
21
|
+
</table>
|
data/config/locales/en.yml
CHANGED
@@ -6,7 +6,10 @@ en:
|
|
6
6
|
jira:
|
7
7
|
label: Jira
|
8
8
|
field_issue_remote_code: Remote issue's code
|
9
|
+
field_local_issue: Local issue
|
9
10
|
field_local_tracker: Local tracker
|
11
|
+
field_remote_code: Remote code
|
12
|
+
field_remote_tracker: Remote tracker
|
10
13
|
label_remote_issues: Remote issues
|
11
14
|
label_remote_trackers: Remote trackers
|
12
15
|
label_remote_issue_statuses: Remote issue statuses
|
data/config/locales/pt-BR.yml
CHANGED
@@ -6,7 +6,10 @@ pt-BR:
|
|
6
6
|
jira:
|
7
7
|
label: Jira
|
8
8
|
field_issue_remote_code: Código da demanda remota
|
9
|
+
field_local_issue: Demanda local
|
9
10
|
field_local_tracker: Tipo de tarefa local
|
11
|
+
field_remote_code: Código remoto
|
12
|
+
field_remote_tracker: Tracker remoto
|
10
13
|
label_remote_issues: Demandas remotas
|
11
14
|
label_remote_trackers: Trackers remotos
|
12
15
|
label_remote_issue_statuses: Situações de demandas remotas
|
data/config/routes.rb
CHANGED
@@ -6,6 +6,8 @@ RedmineApp::Application.routes.draw do
|
|
6
6
|
as: 'new_project_remote_issue'
|
7
7
|
post '/projects/:id/tracker/:tracker_id/new_issue', to: 'project_remote_issues#create',
|
8
8
|
as: 'create_project_remote_issue'
|
9
|
+
put '/projects/:id/remote_issue/:remote_issue_id/update', to: 'project_remote_issues#update',
|
10
|
+
as: 'update_project_remote_issue'
|
9
11
|
resources(:project_remote_issues, only: [:index])
|
10
12
|
resources(:remote_trackers) { as_routes }
|
11
13
|
resources(:remote_issues) { as_routes }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/patch'
|
4
|
+
|
5
|
+
module EacRedmineUsability
|
6
|
+
module Patches
|
7
|
+
module Project
|
8
|
+
extend ::ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
include InstanceMethods
|
12
|
+
end
|
13
|
+
|
14
|
+
module InstanceMethods
|
15
|
+
def remote_issues
|
16
|
+
::RemoteIssue.where('local_issue_id in (select id from issues where project_id = ?)', id)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
require_dependency 'project'
|
24
|
+
::EacRubyUtils.patch(::Project, ::EacRedmineUsability::Patches::Project)
|
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.7.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-
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -125,6 +125,9 @@ extensions: []
|
|
125
125
|
extra_rdoc_files: []
|
126
126
|
files:
|
127
127
|
- app/controllers/project_remote_issues_controller.rb
|
128
|
+
- app/controllers/project_remote_issues_controller/create.rb
|
129
|
+
- app/controllers/project_remote_issues_controller/index.rb
|
130
|
+
- app/controllers/project_remote_issues_controller/update.rb
|
128
131
|
- app/controllers/remote_issue_statuses_controller.rb
|
129
132
|
- app/controllers/remote_issues_controller.rb
|
130
133
|
- app/controllers/remote_trackers_controller.rb
|
@@ -144,6 +147,7 @@ files:
|
|
144
147
|
- app/models/remote_tracker.rb
|
145
148
|
- app/models/remote_tracker/jira.rb
|
146
149
|
- app/models/remote_user.rb
|
150
|
+
- app/views/project_remote_issues/_issues.html.erb
|
147
151
|
- app/views/project_remote_issues/_trackers.html.erb
|
148
152
|
- app/views/project_remote_issues/index.html.erb
|
149
153
|
- app/views/project_remote_issues/new.html.erb
|
@@ -165,6 +169,7 @@ files:
|
|
165
169
|
- lib/redmine_remotes/jira/instance.rb
|
166
170
|
- lib/redmine_remotes/patches/issue.rb
|
167
171
|
- lib/redmine_remotes/patches/issue_status.rb
|
172
|
+
- lib/redmine_remotes/patches/project.rb
|
168
173
|
- lib/redmine_remotes/patches/tracker.rb
|
169
174
|
- lib/redmine_remotes/patches/user.rb
|
170
175
|
- lib/redmine_remotes/rest_provider/http_response.rb
|