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
d2b90430
Commit
d2b90430
authored
Sep 08, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code refactoried and structured
parent
480fdb12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
78 deletions
+105
-78
debomatic-webui/public/javascripts/page_history.js
debomatic-webui/public/javascripts/page_history.js
+105
-78
No files found.
debomatic-webui/public/javascripts/page_history.js
View file @
d2b90430
...
@@ -10,6 +10,7 @@ function Page_History() {
...
@@ -10,6 +10,7 @@ function Page_History() {
var
distributions_counter
=
{};
var
distributions_counter
=
{};
var
days_counter
=
{};
var
days_counter
=
{};
var
all_distributions
=
[];
var
all_days
=
{};
var
all_days
=
{};
function
_get_short_day
(
timestamp
)
{
function
_get_short_day
(
timestamp
)
{
...
@@ -22,24 +23,8 @@ function Page_History() {
...
@@ -22,24 +23,8 @@ function Page_History() {
return
date
.
toLocaleDateString
(
locale
,
options
);
return
date
.
toLocaleDateString
(
locale
,
options
);
}
}
// init table and some objects
function
_add_row
(
package_status
)
{
for
(
var
i
=
0
;
i
<
dom_history
.
length
;
i
++
)
{
var
p
=
package_status
;
var
p
=
dom_history
[
i
];
var
day
=
_get_short_day
(
p
.
start
);
// count total packages by distributions
if
(
distributions_counter
.
hasOwnProperty
(
p
.
distribution
))
distributions_counter
[
p
.
distribution
]
++
;
else
distributions_counter
[
p
.
distribution
]
=
1
;
if
(
days_counter
.
hasOwnProperty
(
p
.
distribution
))
{
if
(
days_counter
[
p
.
distribution
].
hasOwnProperty
(
day
))
days_counter
[
p
.
distribution
][
day
]
++
;
else
days_counter
[
p
.
distribution
][
day
]
=
1
;
}
else
{
days_counter
[
p
.
distribution
]
=
{};
days_counter
[
p
.
distribution
][
day
]
=
1
;
}
all_days
[
day
]
=
0
;
var
info
=
Utils
.
get_status_icon_and_class
(
p
);
var
info
=
Utils
.
get_status_icon_and_class
(
p
);
var
label
=
info
.
label
||
'
building
'
;
var
label
=
info
.
label
||
'
building
'
;
var
distribution_url
=
Utils
.
get_url_to_package
({
var
distribution_url
=
Utils
.
get_url_to_package
({
...
@@ -57,6 +42,29 @@ function Page_History() {
...
@@ -57,6 +42,29 @@ function Page_History() {
$
(
'
table tbody
'
).
append
(
row
);
$
(
'
table tbody
'
).
append
(
row
);
}
}
function
_count_distributions
(
package_status
)
{
var
p
=
package_status
;
if
(
distributions_counter
.
hasOwnProperty
(
p
.
distribution
))
distributions_counter
[
p
.
distribution
]
++
;
else
distributions_counter
[
p
.
distribution
]
=
1
;
}
function
_count_days
(
package_status
)
{
var
p
=
package_status
;
var
day
=
_get_short_day
(
p
.
start
);
if
(
days_counter
.
hasOwnProperty
(
p
.
distribution
))
{
if
(
days_counter
[
p
.
distribution
].
hasOwnProperty
(
day
))
days_counter
[
p
.
distribution
][
day
]
++
;
else
days_counter
[
p
.
distribution
][
day
]
=
1
;
}
else
{
days_counter
[
p
.
distribution
]
=
{};
days_counter
[
p
.
distribution
][
day
]
=
1
;
}
all_days
[
day
]
=
0
;
}
function
_sort_table
()
{
// create the theme for tablesorter
// create the theme for tablesorter
$
.
extend
(
$
.
tablesorter
.
themes
.
bootstrap
,
{
$
.
extend
(
$
.
tablesorter
.
themes
.
bootstrap
,
{
table
:
'
table table-condensed table-bordered table-striped
'
,
table
:
'
table table-condensed table-bordered table-striped
'
,
...
@@ -82,17 +90,19 @@ function Page_History() {
...
@@ -82,17 +90,19 @@ function Page_History() {
$
(
"
table input
"
).
addClass
(
'
form-control
'
);
$
(
"
table input
"
).
addClass
(
'
form-control
'
);
$
(
"
table select
"
).
addClass
(
'
form-control
'
);
$
(
"
table select
"
).
addClass
(
'
form-control
'
);
}
function
_create_graph_distributions
()
{
// build the distribution Pie graph
// build the distribution Pie graph
var
distributions_data
=
{
var
distributions_data
=
{
series
:
[],
series
:
[],
labels
:
[]
labels
:
[]
};
};
var
all_distibutions
=
[];
for
(
var
distro
in
distributions_counter
)
{
for
(
var
distro
in
distributions_counter
)
{
if
(
distributions_counter
.
hasOwnProperty
(
distro
))
{
if
(
distributions_counter
.
hasOwnProperty
(
distro
))
{
distributions_data
.
series
.
push
(
distributions_counter
[
distro
]);
distributions_data
.
series
.
push
(
distributions_counter
[
distro
]);
distributions_data
.
labels
.
push
(
distro
+
"
(
"
+
distributions_counter
[
distro
]
+
"
)
"
);
distributions_data
.
labels
.
push
(
distro
+
"
(
"
+
distributions_counter
[
distro
]
+
"
)
"
);
all_dist
ibutions
.
push
(
distro
);
all_distr
ibutions
.
push
(
distro
);
}
}
}
}
...
@@ -100,7 +110,9 @@ function Page_History() {
...
@@ -100,7 +110,9 @@ function Page_History() {
donut
:
true
,
donut
:
true
,
donutWidth
:
15
,
donutWidth
:
15
,
});
});
}
function
_create_graph_days
()
{
// build the days Line graph
// build the days Line graph
var
days_data
=
{
var
days_data
=
{
series
:
[],
series
:
[],
...
@@ -110,9 +122,9 @@ function Page_History() {
...
@@ -110,9 +122,9 @@ function Page_History() {
if
(
all_days
.
hasOwnProperty
(
day
))
if
(
all_days
.
hasOwnProperty
(
day
))
days_data
.
labels
.
push
(
day
);
days_data
.
labels
.
push
(
day
);
}
}
for
(
var
i
=
0
;
i
<
all_dist
ibutions
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
all_distr
ibutions
.
length
;
i
++
)
{
var
info
=
[];
var
info
=
[];
var
distro
=
all_dist
ibutions
[
i
];
var
distro
=
all_distr
ibutions
[
i
];
for
(
var
day
in
all_days
)
{
for
(
var
day
in
all_days
)
{
if
(
!
all_days
.
hasOwnProperty
(
day
))
if
(
!
all_days
.
hasOwnProperty
(
day
))
continue
;
continue
;
...
@@ -124,4 +136,19 @@ function Page_History() {
...
@@ -124,4 +136,19 @@ function Page_History() {
days_data
.
series
.
push
(
info
);
days_data
.
series
.
push
(
info
);
}
}
Chartist
.
Line
(
'
#days-chart
'
,
days_data
);
Chartist
.
Line
(
'
#days-chart
'
,
days_data
);
}
// init table and some objects
for
(
var
i
=
0
;
i
<
dom_history
.
length
;
i
++
)
{
var
p
=
dom_history
[
i
];
_add_row
(
p
);
// count stats
_count_distributions
(
p
);
_count_days
(
p
);
}
_sort_table
();
_create_graph_distributions
();
_create_graph_days
();
}
}
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