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
dc527ee3
Commit
dc527ee3
authored
Sep 07, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move time functions to Utils
parent
81fe9292
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
25 deletions
+30
-25
debomatic-webui/public/javascripts/page_distribution.js
debomatic-webui/public/javascripts/page_distribution.js
+5
-23
debomatic-webui/public/javascripts/page_history.js
debomatic-webui/public/javascripts/page_history.js
+3
-2
debomatic-webui/public/javascripts/utils.js
debomatic-webui/public/javascripts/utils.js
+22
-0
No files found.
debomatic-webui/public/javascripts/page_distribution.js
View file @
dc527ee3
...
...
@@ -355,24 +355,6 @@ function Page_Distrubion(socket) {
return
;
}
function
_get_two_digits
(
num
)
{
return
(
"
0
"
+
num
).
slice
(
-
2
);
}
function
_get_time
(
timestamp
)
{
var
date
=
new
Date
(
timestamp
*
1000
);
var
locale
=
navigator
.
language
||
'
en-US
'
;
var
options
=
{
weekday
:
"
long
"
,
year
:
"
numeric
"
,
month
:
"
long
"
,
day
:
"
numeric
"
,
};
var
result
=
date
.
toLocaleDateString
(
locale
,
options
);
result
+=
'
<b>
'
+
_get_two_digits
(
date
.
getHours
())
+
'
:
'
+
_get_two_digits
(
date
.
getMinutes
())
+
'
</b>
'
;
return
result
;
}
if
(
socket_data
.
hasOwnProperty
(
'
files
'
))
{
var
s_files
=
socket_data
.
files
;
for
(
var
file
in
s_files
)
{
...
...
@@ -390,15 +372,15 @@ function Page_Distrubion(socket) {
if
(
socket_data
.
uploader
)
info
+=
"
Uploaded by
"
+
socket_data
.
uploader
+
'
-
'
;
info
+=
"
Build started
"
+
_get_time
(
socket_data
.
start
);
info
+=
"
Build started
"
+
Utils
.
format_time
(
socket_data
.
start
,
true
);
if
(
socket_data
.
end
)
{
info
+=
'
- finished
'
+
_get_time
(
socket_data
.
end
);
info
+=
'
- finished
'
+
Utils
.
format_time
(
socket_data
.
end
,
true
);
info
+=
'
- elapsed time: <b>
'
;
var
elapsed
=
new
Date
((
socket_data
.
end
-
socket_data
.
start
)
*
1000
);
info
+=
_get
_two_digits
(
elapsed
.
getUTCHours
())
+
'
:
'
;
info
+=
_get
_two_digits
(
elapsed
.
getUTCMinutes
())
+
'
:
'
;
info
+=
_get
_two_digits
(
elapsed
.
getUTCSeconds
());
info
+=
Utils
.
num
_two_digits
(
elapsed
.
getUTCHours
())
+
'
:
'
;
info
+=
Utils
.
num
_two_digits
(
elapsed
.
getUTCMinutes
())
+
'
:
'
;
info
+=
Utils
.
num
_two_digits
(
elapsed
.
getUTCSeconds
());
}
$
(
"
#package_info
"
).
html
(
info
);
...
...
debomatic-webui/public/javascripts/page_history.js
View file @
dc527ee3
...
...
@@ -7,14 +7,15 @@
/* global dom_history: false */
function
Page_History
()
{
// init table
for
(
var
i
=
0
;
i
<
dom_history
.
length
;
i
++
)
{
var
p
=
dom_history
[
i
];
var
row
=
'
<tr>
'
;
row
+=
'
<td>
'
+
p
.
distribution
+
'
</td>
'
;
row
+=
'
<td>
'
+
p
.
package
+
'
</td>
'
;
row
+=
'
<td>
'
+
p
.
uploader
+
'
</td>
'
;
row
+=
'
<td>
'
+
p
.
start
+
'
</td>
'
;
row
+=
'
<td>
'
+
p
.
end
+
'
</td>
'
;
row
+=
'
<td>
'
+
Utils
.
format_time
(
p
.
start
)
+
'
</td>
'
;
row
+=
'
<td>
'
+
Utils
.
format_time
(
p
.
end
)
+
'
</td>
'
;
row
+=
'
<td>
'
+
p
.
status
+
'
</td>
'
;
row
+=
'
</tr>
'
;
$
(
'
.table tbody
'
).
append
(
row
);
...
...
debomatic-webui/public/javascripts/utils.js
View file @
dc527ee3
...
...
@@ -105,5 +105,27 @@ var Utils = {
"
/
"
:
"
/
"
}[
s
];
});
},
// returns a two digits num
num_two_digits
:
function
(
num
)
{
return
(
"
0
"
+
num
).
slice
(
-
2
);
},
// format time from a timestamp
format_time
:
function
(
timestamp
,
time_in_bold
)
{
var
date
=
new
Date
(
timestamp
*
1000
);
var
locale
=
navigator
.
language
||
'
en-US
'
;
var
options
=
{
weekday
:
"
long
"
,
year
:
"
numeric
"
,
month
:
"
long
"
,
day
:
"
numeric
"
,
};
var
result_date
=
date
.
toLocaleDateString
(
locale
,
options
);
var
result_time
=
Utils
.
num_two_digits
(
date
.
getHours
())
+
'
:
'
+
Utils
.
num_two_digits
(
date
.
getMinutes
());
if
(
time_in_bold
)
result_time
=
'
<b>
'
+
result_time
+
'
</b>
'
;
return
result_date
+
'
'
+
result_time
;
}
};
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