Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
redmine_v2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
redmine_v2
Commits
3f6dbd83
Commit
3f6dbd83
authored
Nov 09, 2023
by
Tấn Trần Thanh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change logic ajax
parent
e4270585
Pipeline
#1573
canceled with stages
in 0 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
30 deletions
+18
-30
plugins/workflow_report/app/controllers/workflow_report_controller.rb
+1
-3
plugins/workflow_report/app/views/workflow_report/build_table.js.erb
+7
-0
plugins/workflow_report/app/views/workflow_report/index.html.slim
+3
-3
plugins/workflow_report/assets/javascripts/application.js
+7
-24
No files found.
plugins/workflow_report/app/controllers/workflow_report_controller.rb
View file @
3f6dbd83
...
...
@@ -17,9 +17,7 @@ class WorkflowReportController < ApplicationController
result
=
fetch_data
(
project_ids
,
params
[
:year
].
to_i
,
params
[
:month
].
to_i
,
column_number:
thead
.
size
)
respond_to
do
|
format
|
format
.
html
do
render
partial:
'table_workflow_report'
,
layout:
false
,
locals:
{
result:
result
,
thead:
thead
}
end
format
.
js
{
render
'build_table'
,
locals:
{
result:
result
,
thead:
thead
}
}
end
end
...
...
plugins/workflow_report/app/views/workflow_report/build_table.js.erb
0 → 100644
View file @
3f6dbd83
$("#data_workflow").html("
<%=
escape_javascript
(
render
partial:
'table_workflow_report'
,
locals:
{
result:
result
,
thead:
thead
}
)
%>
")
<%
if
result
.
present?
%>
$('button.export-button').removeClass('d-none')
<%
else
%>
$('button.export-button').addClass('d-none')
<%
end
%>
\ No newline at end of file
plugins/workflow_report/app/views/workflow_report/index.html.slim
View file @
3f6dbd83
...
...
@@ -4,13 +4,13 @@
fieldset
.box.tabular
legend
|
EXPORT WORKFLOW
=
form_tag
do
=
form_tag
workflow_report_export_path
,
method: :get
,
remote:
true
,
id:
'export-form'
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"
}
...
...
plugins/workflow_report/assets/javascripts/application.js
View file @
3f6dbd83
window
.
addEventListener
(
'load'
,
function
()
{
$
(
'#export'
).
click
(
function
(
event
)
{
event
.
preventDefault
()
$
(
'#export-form'
).
submit
(
function
()
{
const
month
=
$
(
'#month'
).
val
()
const
year
=
$
(
'#year'
).
val
()
const
team
=
$
(
'#team'
).
val
()
if
(
year
===
''
||
month
===
''
||
team
===
''
)
{
if
(
month
===
''
||
year
===
''
||
team
===
''
)
{
alert
(
'Please complete all the necessary fields.'
)
}
else
{
$
.
ajax
({
url
:
'workflow_report/export'
,
type
:
'GET'
,
data
:
{
month
:
month
,
year
:
year
,
team
:
team
},
success
:
function
(
response
)
{
$
(
'#data_workflow'
).
html
(
response
)
if
(
$
(
'#data_workflow'
).
has
(
'table'
).
length
>
0
&&
$
(
'button.export-button'
).
hasClass
(
"d-none"
))
{
$
(
'button.export-button'
).
removeClass
(
'd-none'
)
}
else
{
$
(
'button.export-button'
).
addClass
(
'd-none'
)
return
false
}
},
error
:
function
(
error
)
{
console
.
log
(
error
)
},
})
}
})
return
true
});
const
download
=
function
(
data
)
{
const
blob
=
new
Blob
([
data
],
{
type
:
'text/csv'
})
...
...
@@ -39,9 +23,8 @@ window.addEventListener('load', function () {
}
$
(
".export-button"
).
on
(
"click"
,
function
()
{
exportToCSV
();
});
exportToCSV
()
})
function
exportToCSV
()
{
const
table
=
$
(
"table"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment