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
62a8495e
Commit
62a8495e
authored
Nov 06, 2023
by
Tấn Trần Thanh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
done for search month, year, team and export data to csv
parent
0dc84db9
Pipeline
#1565
failed with stages
in 0 seconds
Changes
9
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
220 additions
and
11 deletions
+220
-11
plugins/workflow_report/app/controllers/workflow_report_controller.rb
+0
-0
plugins/workflow_report/app/views/workflow_report/_data_report.json.erb
+6
-0
plugins/workflow_report/app/views/workflow_report/_table_workflow_report.html.slim
+35
-0
plugins/workflow_report/app/views/workflow_report/index.html.slim
+11
-9
plugins/workflow_report/assets/javascripts/application.js
+71
-0
plugins/workflow_report/assets/stylesheets/style.css
+49
-2
plugins/workflow_report/config/routes.rb
+2
-0
plugins/workflow_report/config/settings.yml
+44
-0
plugins/workflow_report/init.rb
+2
-0
No files found.
plugins/workflow_report/app/controllers/workflow_report_controller.rb
View file @
62a8495e
This diff is collapsed.
Click to expand it.
plugins/workflow_report/app/views/workflow_report/_data_report.json.erb
0 → 100644
View file @
62a8495e
<%
json_array
=
[]
%>
<%
result
[
0
].
each_with_index
do
|
item
,
index
|
%>
<%
json_array
<<
{
"root_id"
=>
item
[
0
]
}
%>
<%
end
%>
<%=
json_array
.
to_json
%>
plugins/workflow_report/app/views/workflow_report/_table_workflow_report.html.slim
0 → 100644
View file @
62a8495e
-
if
result
[
0
].
size
>
0
table
[
border
=
"1"
]
tr
.header_table--visible
th
.green
[
colspan
=
"8"
]
Task
information
th
.blue
[
colspan
=
"6"
]
Overall
th
.purple
[
colspan
=
"7"
]
Estimation
detail
*
final
version
th
.gray
[
colspan
=
"7"
]
Actual
time
detail
th
.yellow
[
colspan
=
"4"
]
Bugs
th
.pink
[
colspan
=
"8"
]
Github
tr
.header_table--visible
-
thead
.
each_with_index
do
|
head
,
index
|
-
if
(
0
..
7
).
include?
(
index
)
th
.green
=
head
-
elsif
(
8
..
10
).
include?
(
index
)
th
.red
=
head
-
elsif
(
11
..
13
).
include?
(
index
)
th
.blue
=
head
-
elsif
(
14
..
20
).
include?
(
index
)
th
.purple
=
head
-
elsif
(
21
..
27
).
include?
(
index
)
th
.gray
=
head
-
elsif
(
28
..
31
).
include?
(
index
)
th
.yellow
=
head
-
else
th
.pink
=
head
-
result
[
0
].
each_with_index
do
|
_root_id
,
index
|
tr
-
(
0
..
(
thead
.
length
-
1
)).
each
do
|
i
|
-
if
i
==
0
td
.sidebar_visible
=
result
[
0
][
index
]
-
else
td
=
result
[
i
][
index
]
-
else
h1
There
is
no
data
for
the
'workflow
report'
table
.
\ No newline at end of file
plugins/workflow_report/app/views/workflow_report/index.html.slim
View file @
62a8495e
=
stylesheet_link_tag
'style'
,
plugin:
'workflow_report'
=
stylesheet_link_tag
'style'
,
plugin:
'workflow_report'
=
javascript_include_tag
(
:application
,
:plugin
=>
'workflow_report'
)
.table-container
fieldset
.box.tabular
table
[
border
=
"1"
]
legend
tr
|
EXPORT WORKFLOW
-
@thead
.
each
do
|
head
|
=
form_tag
do
th
=
head
=
select_tag
:month
,
options_for_select
(
1
..
12
,
Time
.
now
.
month
),{
prompt:
"Select month"
}
-
@result
[
0
].
each_with_index
do
|
_root_id
,
index
|
=
select_tag
:year
,
options_for_select
((
Time
.
now
.
year
-
5
)
..
(
Time
.
now
.
year
+
1
),
Time
.
now
.
year
),{
prompt:
"Select year"
}
tr
=
select_tag
:team
,
options_for_select
(
@team_options
),
{
prompt:
"Select team"
}
-
(
0
..
(
@thead
.
length
-
1
)).
each
do
|
i
|
=
submit_tag
'export'
,
id:
'export'
td
=
@result
[
i
][
index
]
button
.export-button
Download
.CSV
#data_workflow
plugins/workflow_report/assets/javascripts/application.js
0 → 100644
View file @
62a8495e
window
.
addEventListener
(
'load'
,
function
()
{
$
(
'#export'
).
click
(
function
(
event
)
{
event
.
preventDefault
()
const
month
=
$
(
'#month'
).
val
()
const
year
=
$
(
'#year'
).
val
()
const
team
=
$
(
'#team'
).
val
()
if
(
year
===
''
||
month
===
''
||
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
)
},
error
:
function
(
error
)
{
console
.
log
(
error
)
},
})
}
})
const
download
=
function
(
data
)
{
const
blob
=
new
Blob
([
data
],
{
type
:
'text/csv'
});
const
url
=
window
.
URL
.
createObjectURL
(
blob
)
const
a
=
document
.
createElement
(
'a'
)
a
.
setAttribute
(
'href'
,
url
)
a
.
setAttribute
(
'download'
,
"download.csv"
);
a
.
click
()
}
$
(
".export-button"
).
on
(
"click"
,
function
()
{
exportToCSV
();
});
function
exportToCSV
()
{
const
table
=
$
(
"table"
);
const
rows
=
table
.
find
(
"tr"
);
let
csv
=
[];
rows
.
each
(
function
(
index
)
{
const
cols
=
$
(
this
).
find
(
"td, th"
);
let
rowText
=
[];
let
currentColspan
=
1
;
cols
.
each
(
function
()
{
const
text_report
=
$
(
this
).
text
();
if
(
$
(
this
).
attr
(
"colspan"
))
{
currentColspan
=
parseInt
(
$
(
this
).
attr
(
"colspan"
),
10
);
}
if
(
currentColspan
>
1
)
{
for
(
let
i
=
0
;
i
<
currentColspan
;
i
++
)
{
i
===
0
?
rowText
.
push
(
text_report
)
:
rowText
.
push
(
''
)
}
}
else
{
text_report
.
includes
(
','
)
?
rowText
.
push
(
`"
${
text_report
}
"`
)
:
rowText
.
push
(
text_report
);
}
currentColspan
=
Math
.
max
(
1
,
currentColspan
-
1
);
});
csv
.
push
(
rowText
.
join
(
","
));
});
const
csvContent
=
csv
.
join
(
"
\
n"
);
download
(
csvContent
);
}
});
plugins/workflow_report/assets/stylesheets/style.css
View file @
62a8495e
.table-container
{
#data_workflow
{
overflow-x
:
auto
;
overflow
:
auto
;
height
:
100vh
;
}
}
table
{
table
{
display
:
inline-block
;
table-layout
:
fixed
;
table-layout
:
fixed
;
border-collapse
:
collapse
;
border-collapse
:
collapse
;
}
}
.header_table--visible
{
position
:
sticky
;
top
:
0
;
z-index
:
2
;
}
.sidebar_visible
{
position
:
sticky
;
background
:
#dacbcb
;
left
:
0
;
z-index
:
1
;
}
.green
{
background-color
:
#92ce92
;
}
.red
{
background-color
:
#e38585
;
}
.blue
{
background-color
:
#b2b2f0
;
}
.purple
{
background-color
:
#f7adf7
;
}
.gray
{
background-color
:
#e6e4e4
;
}
.yellow
{
background-color
:
#eaeab0
;
}
.pink
{
background-color
:
pink
;
}
#date_from
,
#date_to
,
#team
,
#export
{
margin-right
:
24px
;
}
\ No newline at end of file
plugins/workflow_report/config/routes.rb
View file @
62a8495e
...
@@ -2,3 +2,5 @@
...
@@ -2,3 +2,5 @@
# See: http://guides.rubyonrails.org/routing.html
# See: http://guides.rubyonrails.org/routing.html
get
'workflow_report'
,
to:
'workflow_report#index'
get
'workflow_report'
,
to:
'workflow_report#index'
get
'workflow_report/export'
,
to:
'workflow_report#export'
get
'/download_csv'
,
to:
'workflow_report#export_csv'
plugins/workflow_report/config/settings.yml
0 → 100644
View file @
62a8495e
github_token
:
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
teams
:
-
Kyujin
:
-
9
-
142
-
88
-
Sumai
:
-
17
-
29
-
31
-
131
-
140
-
Kuruma
:
-
139
-
138
-
94
-
90
-
93
-
120
-
128
-
147
-
121
-
116
-
LS
:
-
134
-
PS
:
-
145
-
141
-
144
-
151
-
Sanko
:
-
91
-
149
-
CORDA
:
-
92
-
112
-
APW-Travelist-Air
:
-
133
-
APW-Travelist-Hotel
:
-
148
-
APW-Voyager
:
-
146
-
APW-SUB
:
-
137
plugins/workflow_report/init.rb
View file @
62a8495e
...
@@ -11,5 +11,7 @@ Redmine::Plugin.register :workflow_report do
...
@@ -11,5 +11,7 @@ Redmine::Plugin.register :workflow_report do
version
'0.0.1'
version
'0.0.1'
url
'http://example.com/path/to/plugin'
url
'http://example.com/path/to/plugin'
author_url
'http://example.com/about'
author_url
'http://example.com/about'
configfile
=
File
.
join
(
File
.
dirname
(
__FILE__
),
'config'
,
'settings.yml'
)
$workflow_report_config
=
YAML
::
load_file
(
configfile
)
menu
:top_menu
,
:workflow_report
,
{
controller:
'workflow_report'
,
action:
'index'
},
caption:
'Workflow Report'
menu
:top_menu
,
:workflow_report
,
{
controller:
'workflow_report'
,
action:
'index'
},
caption:
'Workflow Report'
end
end
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