Commit e8650e1f by Tấn Trần Thanh

permission, gemfile.lock for github_api

parent e8a1223a
Pipeline #1570 failed with stages
in 0 seconds
GEM
specs:
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
faraday (1.0.1)
multipart-post (>= 1.2, < 3)
github_api (0.19.0)
addressable (~> 2.4)
descendants_tracker (~> 0.0.4)
faraday (>= 0.8, < 2)
hashie (~> 3.5, >= 3.5.2)
oauth2 (~> 1.0)
hashie (3.6.0)
jwt (2.3.0)
multi_json (1.13.0)
multi_xml (0.6.0)
multipart-post (2.3.0)
oauth2 (1.4.11)
faraday (>= 0.17.3, < 3.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 4)
public_suffix (3.0.1)
rack (1.6.8)
thread_safe (0.3.6)
PLATFORMS
ruby
DEPENDENCIES
github_api (~> 0.19.0)
BUNDLED WITH
1.17.3
require 'csv' require 'csv'
class WorkflowReportController < ApplicationController class WorkflowReportController < ApplicationController
before_action :authorize_global
before_action :require_xhr_request, only: :export
def index def index
@team_options = $workflow_report_config['teams'].map { |team| team.keys() } @team_options = $workflow_report_config['teams'].map { |team| team.keys() }
end end
def export def export
thead = ['root_id', 'project', 'subject', 'target_version', ' created_on ', ' closed_on ', ' due_date ', ' status ', ' Estimated_hours (*final version) ', 'Actual time', 'Diff', 'Estimated_hours (*Initial version)', thead = ['root_id', 'project', 'subject', 'target_version', ' created_on ', 'closed_on ', 'due_date ', ' status ', 'Estimated_hours (*final version) ', 'Actual time', 'Diff', 'Estimated_hours (*Initial version)',
'Number of estimation changes', 'Note of estimation changes', '1. Requirement', '2. Design', '3. Coding', '4. Testing', '5. Bug fixing', '6. Release', 'Others', '1. Requirement', '2. Design', '3. Coding', 'Number of estimation changes', 'Note of estimation changes', '1. Requirement', '2. Design', '3. Coding', '4. Testing', '5. Bug fixing', '6. Release', 'Others', '1. Requirement', '2. Design', '3. Coding',
'4. Testing', '5. Bug fixing', '6. Release', 'Others', 'testcases', 'vn STG bug', 'Jp STG bug', 'Production', 'Issue', 'Issue comment', 'PR comment', 'Review comment', 'Commits', 'File changed', 'Addtion', 'Deletetion'] '4. Testing', '5. Bug fixing', '6. Release', 'Others', 'testcases', 'vn STG bug', 'Jp STG bug', 'Production', 'Issue', 'Issue comment', 'PR comment', 'Review comment', 'Commits', 'File changed', 'Addtion', 'Deletetion']
team = params[:team] team = params[:team]
...@@ -239,4 +241,8 @@ class WorkflowReportController < ApplicationController ...@@ -239,4 +241,8 @@ class WorkflowReportController < ApplicationController
end end
name.strip name.strip
end end
def require_xhr_request
head :unprocessable_entity unless request.xhr?
end
end end
...@@ -5,8 +5,14 @@ fieldset.box.tabular ...@@ -5,8 +5,14 @@ fieldset.box.tabular
legend legend
| EXPORT WORKFLOW | EXPORT WORKFLOW
= form_tag do = form_tag do
p
= label :month, 'Month'
= select_tag :month ,options_for_select(1..12, Time.now.month),{ prompt: "Select month" } = select_tag :month ,options_for_select(1..12, Time.now.month),{ prompt: "Select month" }
p
= label :year, 'Year'
= select_tag :year ,options_for_select((Time.now.year - 5)..(Time.now.year + 1), Time.now.year),{ prompt: "Select year" } = select_tag :year ,options_for_select((Time.now.year - 5)..(Time.now.year + 1), Time.now.year),{ prompt: "Select year" }
p
= label :team, 'Team'
= select_tag :team, options_for_select(@team_options), { prompt: "Select team" } = select_tag :team, options_for_select(@team_options), { prompt: "Select team" }
= submit_tag 'export', id: 'export' = submit_tag 'export', id: 'export'
button.export-button.d-none Download .CSV button.export-button.d-none Download .CSV
......
...@@ -54,10 +54,6 @@ table { ...@@ -54,10 +54,6 @@ table {
background-color: pink; background-color: pink;
} }
#year, #month, #team, #export {
margin: 8px 24px 0 0;
}
button.export-button { button.export-button {
margin-bottom: 35px; margin-bottom: 35px;
} }
......
...@@ -3,4 +3,3 @@ ...@@ -3,4 +3,3 @@
get 'workflow_report', to: 'workflow_report#index' get 'workflow_report', to: 'workflow_report#index'
get 'workflow_report/export', to: 'workflow_report#export' get 'workflow_report/export', to: 'workflow_report#export'
get '/download_csv', to: 'workflow_report#export_csv'
...@@ -13,5 +13,21 @@ Redmine::Plugin.register :workflow_report do ...@@ -13,5 +13,21 @@ Redmine::Plugin.register :workflow_report do
author_url 'http://example.com/about' author_url 'http://example.com/about'
configfile = File.join(File.dirname(__FILE__), 'config', 'settings.yml') configfile = File.join(File.dirname(__FILE__), 'config', 'settings.yml')
$workflow_report_config = YAML::load_file(configfile) $workflow_report_config = YAML::load_file(configfile)
menu :top_menu, :workflow_report, { controller: 'workflow_report', action: 'index' }, caption: 'Workflow Report'
end end
Redmine::MenuManager.map :top_menu do |menu|
menu.push(:workflow_report, { controller: 'workflow_report', action: 'index' },
caption: 'Workflow Report',
if: proc { User.current.allowed_to_globally?(:view_workflow_report) })
end
ActionDispatch::Reloader.to_prepare do
Redmine::AccessControl.map do |map|
map.project_module :workflow_report do |pmap|
pmap.permission(:view_workflow_report, {
workflow_report: [:index, :export],
}, read: true)
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment