Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
debomatic-webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
debomatic-webui-admins
debomatic-webui
Commits
4727c50e
Commit
4727c50e
authored
Sep 12, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add download button to history - exports current view as csv file
parent
598fe509
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
3 deletions
+57
-3
debomatic-webui/public/javascripts/page_history.js
debomatic-webui/public/javascripts/page_history.js
+48
-1
debomatic-webui/public/stylesheets/style.css
debomatic-webui/public/stylesheets/style.css
+8
-2
debomatic-webui/views/history.ejs
debomatic-webui/views/history.ejs
+1
-0
No files found.
debomatic-webui/public/javascripts/page_history.js
View file @
4727c50e
...
@@ -37,7 +37,7 @@ function Page_History() {
...
@@ -37,7 +37,7 @@ function Page_History() {
var
distribution_url
=
Utils
.
get_url_to_package
({
var
distribution_url
=
Utils
.
get_url_to_package
({
'
distribution
'
:
p
.
distribution
'
distribution
'
:
p
.
distribution
});
});
var
row
=
'
<tr id="
'
+
_get_id
(
package_status
)
+
'
">
'
;
var
row
=
'
<tr
class="package"
id="
'
+
_get_id
(
package_status
)
+
'
">
'
;
var
package_url
=
Utils
.
get_url_to_package
(
p
);
var
package_url
=
Utils
.
get_url_to_package
(
p
);
row
+=
'
<td><a href="
'
+
distribution_url
+
'
">
'
+
p
.
distribution
+
'
</a></td>
'
;
row
+=
'
<td><a href="
'
+
distribution_url
+
'
">
'
+
p
.
distribution
+
'
</a></td>
'
;
row
+=
'
<td><a href="
'
+
package_url
+
'
">
'
+
p
.
package
+
'
</td>
'
;
row
+=
'
<td><a href="
'
+
package_url
+
'
">
'
+
p
.
package
+
'
</td>
'
;
...
@@ -143,6 +143,49 @@ function Page_History() {
...
@@ -143,6 +143,49 @@ function Page_History() {
Chartist
.
Line
(
'
#days-chart
'
,
days_data
);
Chartist
.
Line
(
'
#days-chart
'
,
days_data
);
}
}
function
_exportTableToCSV
(
$table
,
filename
)
{
// code from http://jsfiddle.net/terryyounghk/KPEGU/
var
$rows
=
$table
.
find
(
'
tr.package:visible:has(td)
'
),
// Temporary delimiter characters unlikely to be typed by keyboard
// This is to avoid accidentally splitting the actual contents
tmpColDelim
=
String
.
fromCharCode
(
11
),
// vertical tab character
tmpRowDelim
=
String
.
fromCharCode
(
0
),
// null character
// actual delimiter characters for CSV format
colDelim
=
'
","
'
,
rowDelim
=
'
"
\r\n
"
'
,
// Grab text from table into CSV formatted string
csv
=
'
"
'
+
$rows
.
map
(
function
(
i
,
row
)
{
var
$row
=
$
(
row
),
$cols
=
$row
.
find
(
'
td
'
);
return
$cols
.
map
(
function
(
j
,
col
)
{
var
$col
=
$
(
col
),
text
=
$col
.
text
();
return
text
.
replace
(
'
"
'
,
'
""
'
);
// escape double quotes
}).
get
().
join
(
tmpColDelim
);
}).
get
().
join
(
tmpRowDelim
)
.
split
(
tmpRowDelim
).
join
(
rowDelim
)
.
split
(
tmpColDelim
).
join
(
colDelim
)
+
'
"
'
,
// Data URI
csvData
=
'
data:application/csv;charset=utf-8,
'
+
encodeURIComponent
(
csv
);
$
(
this
)
.
attr
({
'
download
'
:
filename
,
'
href
'
:
csvData
,
'
target
'
:
'
_blank
'
});
}
this
.
start
=
function
(
socket
)
{
this
.
start
=
function
(
socket
)
{
socket
.
on
(
config
.
events
.
broadcast
.
status_update
,
function
(
socket_data
)
{
socket
.
on
(
config
.
events
.
broadcast
.
status_update
,
function
(
socket_data
)
{
// TODO - implements _update_table
// TODO - implements _update_table
...
@@ -162,4 +205,8 @@ function Page_History() {
...
@@ -162,4 +205,8 @@ function Page_History() {
_sort_table
();
_sort_table
();
_create_graph_distributions
();
_create_graph_distributions
();
_create_graph_days
();
_create_graph_days
();
$
(
'
#download
'
).
on
(
'
click
'
,
function
()
{
_exportTableToCSV
.
apply
(
this
,
[
$
(
'
#history
'
),
'
history.csv
'
]);
});
}
}
debomatic-webui/public/stylesheets/style.css
View file @
4727c50e
...
@@ -258,6 +258,8 @@ footer .info {
...
@@ -258,6 +258,8 @@ footer .info {
cursor
:
pointer
;
cursor
:
pointer
;
}
}
/* History page */
.ct-chart
{
.ct-chart
{
height
:
180px
;
height
:
180px
;
width
:
50%
;
width
:
50%
;
...
@@ -265,13 +267,17 @@ footer .info {
...
@@ -265,13 +267,17 @@ footer .info {
margin-bottom
:
30px
;
margin-bottom
:
30px
;
}
}
.ct-chart
.ct-label
{
font-size
:
0.85em
;
}
#distributions-chart
.ct-chart
{
#distributions-chart
.ct-chart
{
height
:
200px
;
height
:
200px
;
margin-top
:
-20px
;
margin-top
:
-20px
;
}
}
.ct-chart
.ct-label
{
#history
{
font-size
:
0.85em
;
margin-top
:
15px
;
}
}
/* add more colors to graphs */
/* add more colors to graphs */
...
...
debomatic-webui/views/history.ejs
View file @
4727c50e
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<div id="days-chart" class="ct-chart"></div>
<div id="days-chart" class="ct-chart"></div>
<div id="distributions-chart" class="ct-chart"></div>
<div id="distributions-chart" class="ct-chart"></div>
</div>
</div>
<a id="download" class="btn btn-primary btn-lg">Download current view</a>
<table id="history" class="tablesorter">
<table id="history" class="tablesorter">
<thead>
<thead>
<tr>
<tr>
...
...
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