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
Hide 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,71 +42,113 @@ function Page_History() {
...
@@ -57,71 +42,113 @@ function Page_History() {
$
(
'
table tbody
'
).
append
(
row
);
$
(
'
table tbody
'
).
append
(
row
);
}
}
// create the theme for tablesorter
function
_count_distributions
(
package_status
)
{
$
.
extend
(
$
.
tablesorter
.
themes
.
bootstrap
,
{
var
p
=
package_status
;
table
:
'
table table-condensed table-bordered table-striped
'
,
if
(
distributions_counter
.
hasOwnProperty
(
p
.
distribution
))
caption
:
'
caption
'
,
distributions_counter
[
p
.
distribution
]
++
;
header
:
'
bootstrap-header
'
,
else
distributions_counter
[
p
.
distribution
]
=
1
;
sortNone
:
'
bootstrap-icon-unsorted
'
,
}
sortAsc
:
'
glyphicon glyphicon-chevron-up
'
,
sortDesc
:
'
glyphicon glyphicon-chevron-down
'
,
function
_count_days
(
package_status
)
{
});
var
p
=
package_status
;
var
day
=
_get_short_day
(
p
.
start
);
// call the tablesorter plugin and apply the uitheme widget
if
(
days_counter
.
hasOwnProperty
(
p
.
distribution
))
{
$
(
"
table
"
).
tablesorter
({
if
(
days_counter
[
p
.
distribution
].
hasOwnProperty
(
day
))
theme
:
"
bootstrap
"
,
days_counter
[
p
.
distribution
][
day
]
++
;
widthFixed
:
true
,
else
headerTemplate
:
'
{content} {icon}
'
,
days_counter
[
p
.
distribution
][
day
]
=
1
;
widgets
:
[
"
uitheme
"
,
"
filter
"
],
}
else
{
sortList
:
[
days_counter
[
p
.
distribution
]
=
{};
[
3
,
1
]
days_counter
[
p
.
distribution
][
day
]
=
1
;
]
});
// add some fancy class to input fields
$
(
"
table input
"
).
addClass
(
'
form-control
'
);
$
(
"
table select
"
).
addClass
(
'
form-control
'
);
// build the distribution Pie graph
var
distributions_data
=
{
series
:
[],
labels
:
[]
};
var
all_distibutions
=
[];
for
(
var
distro
in
distributions_counter
)
{
if
(
distributions_counter
.
hasOwnProperty
(
distro
))
{
distributions_data
.
series
.
push
(
distributions_counter
[
distro
]);
distributions_data
.
labels
.
push
(
distro
+
"
(
"
+
distributions_counter
[
distro
]
+
"
)
"
);
all_distibutions
.
push
(
distro
);
}
}
all_days
[
day
]
=
0
;
}
}
Chartist
.
Pie
(
'
#distributions-chart
'
,
distributions_data
,
{
function
_sort_table
()
{
donut
:
true
,
// create the theme for tablesorter
donutWidth
:
15
,
$
.
extend
(
$
.
tablesorter
.
themes
.
bootstrap
,
{
});
table
:
'
table table-condensed table-bordered table-striped
'
,
caption
:
'
caption
'
,
// build the days Line graph
header
:
'
bootstrap-header
'
,
var
days_data
=
{
sortNone
:
'
bootstrap-icon-unsorted
'
,
series
:
[],
sortAsc
:
'
glyphicon glyphicon-chevron-up
'
,
labels
:
[]
sortDesc
:
'
glyphicon glyphicon-chevron-down
'
,
};
});
for
(
var
day
in
all_days
)
{
if
(
all_days
.
hasOwnProperty
(
day
))
// call the tablesorter plugin and apply the uitheme widget
days_data
.
labels
.
push
(
day
);
$
(
"
table
"
).
tablesorter
({
theme
:
"
bootstrap
"
,
widthFixed
:
true
,
headerTemplate
:
'
{content} {icon}
'
,
widgets
:
[
"
uitheme
"
,
"
filter
"
],
sortList
:
[
[
3
,
1
]
]
});
// add some fancy class to input fields
$
(
"
table input
"
).
addClass
(
'
form-control
'
);
$
(
"
table select
"
).
addClass
(
'
form-control
'
);
}
}
for
(
var
i
=
0
;
i
<
all_distibutions
.
length
;
i
++
)
{
var
info
=
[];
function
_create_graph_distributions
()
{
var
distro
=
all_distibutions
[
i
];
// build the distribution Pie graph
var
distributions_data
=
{
series
:
[],
labels
:
[]
};
for
(
var
distro
in
distributions_counter
)
{
if
(
distributions_counter
.
hasOwnProperty
(
distro
))
{
distributions_data
.
series
.
push
(
distributions_counter
[
distro
]);
distributions_data
.
labels
.
push
(
distro
+
"
(
"
+
distributions_counter
[
distro
]
+
"
)
"
);
all_distributions
.
push
(
distro
);
}
}
Chartist
.
Pie
(
'
#distributions-chart
'
,
distributions_data
,
{
donut
:
true
,
donutWidth
:
15
,
});
}
function
_create_graph_days
()
{
// build the days Line graph
var
days_data
=
{
series
:
[],
labels
:
[]
};
for
(
var
day
in
all_days
)
{
for
(
var
day
in
all_days
)
{
if
(
!
all_days
.
hasOwnProperty
(
day
))
if
(
all_days
.
hasOwnProperty
(
day
))
continue
;
days_data
.
labels
.
push
(
day
);
if
(
days_counter
[
distro
].
hasOwnProperty
(
day
))
}
info
.
push
(
days_counter
[
distro
][
day
]);
for
(
var
i
=
0
;
i
<
all_distributions
.
length
;
i
++
)
{
else
var
info
=
[];
info
.
push
(
0
);
var
distro
=
all_distributions
[
i
];
for
(
var
day
in
all_days
)
{
if
(
!
all_days
.
hasOwnProperty
(
day
))
continue
;
if
(
days_counter
[
distro
].
hasOwnProperty
(
day
))
info
.
push
(
days_counter
[
distro
][
day
]);
else
info
.
push
(
0
);
}
days_data
.
series
.
push
(
info
);
}
}
days_data
.
series
.
push
(
info
);
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
);
}
}
Chartist
.
Line
(
'
#days-chart
'
,
days_data
);
_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