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
697053ac
Commit
697053ac
authored
Mar 10, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored Page_Description code
parent
9a31568d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
100 deletions
+108
-100
debomatic-webui/public/javascripts/main.js
debomatic-webui/public/javascripts/main.js
+1
-38
debomatic-webui/public/javascripts/page_distribution.js
debomatic-webui/public/javascripts/page_distribution.js
+107
-62
No files found.
debomatic-webui/public/javascripts/main.js
View file @
697053ac
...
...
@@ -19,42 +19,5 @@ socket.on('status-update', function(data) {
})
if
(
window
.
location
.
pathname
==
PATHS
.
distribution
)
{
function
__check_hash_makes_sense
()
{
if
(
!
window
.
location
.
hash
)
window
.
location
.
pathname
=
'
/
'
info
=
window
.
location
.
hash
.
split
(
'
/
'
)
if
(
info
.
length
==
2
)
window
.
location
.
hash
=
info
[
0
]
}
var
old_data
=
Utils
.
from_hash_to_data
()
socket
.
on
(
'
distribution_packages
'
,
function
(
data
){
Page_Distrubion
.
packages
.
set
(
data
)
})
socket
.
on
(
'
package_files_list
'
,
function
(
data
){
Page_Distrubion
.
files
.
set
(
data
)
})
socket
.
on
(
'
file
'
,
function
(
data
)
{
Page_Distrubion
.
file
.
set
(
data
)
})
socket
.
on
(
'
file_newcontent
'
,
function
(
data
)
{
Page_Distrubion
.
file
.
append
(
data
)
})
$
(
window
).
on
(
'
hashchange
'
,
function
()
{
__check_hash_makes_sense
()
data
=
Utils
.
from_hash_to_data
()
Page_Distrubion
.
update
(
data
,
old_data
)
old_data
=
data
});
$
(
window
).
on
(
'
load
'
,
function
(){
__check_hash_makes_sense
()
Page_Distrubion
.
update
(
old_data
)
});
new
Page_Distrubion
().
init
(
socket
)
}
debomatic-webui/public/javascripts/page_distribution.js
View file @
697053ac
var
Page_Distrubion
=
{
function
Page_Distrubion
()
{
var
socket
var
data
=
Utils
.
from_hash_to_data
()
title
:
{
function
__check_hash_makes_sense
()
{
if
(
!
window
.
location
.
hash
)
window
.
location
.
pathname
=
'
/
'
info
=
window
.
location
.
hash
.
split
(
'
/
'
)
if
(
info
.
length
==
2
)
window
.
location
.
hash
=
info
[
0
]
}
var
title
=
{
set
:
function
(
data
)
{
if
(
!
data
)
data
=
Utils
.
from_hash_to_data
()
...
...
@@ -23,9 +34,9 @@ var Page_Distrubion = {
clean
:
function
()
{
$
(
'
#title
'
).
html
(
''
)
}
}
,
}
packages
:
{
var
packages
=
{
set
:
function
(
data
)
{
$
(
'
#packages ul
'
).
html
(
''
)
tmp
=
data
...
...
@@ -34,7 +45,7 @@ var Page_Distrubion = {
tmp
.
package
=
p
$
(
'
#packages ul
'
).
append
(
'
<li id="package-
'
+
p
.
orig_name
+
'
"><a href="
'
+
Utils
.
from_data_to_hash
(
tmp
)
+
'
">
'
+
p
.
name
+
'
<span>
'
+
p
.
version
+
'
</span></a></li>
'
)
})
Page_Distrubion
.
select
(
data
)
select
(
data
)
},
clean
:
function
()
{
...
...
@@ -50,7 +61,7 @@ var Page_Distrubion = {
}
},
select
:
function
(
data
)
{
Page_Distrubion
.
packages
.
unselect
()
packages
.
unselect
()
if
(
!
data
)
data
=
Utils
.
from_hash_to_data
()
if
(
Utils
.
check_data_package
(
data
))
{
...
...
@@ -60,24 +71,24 @@ var Page_Distrubion = {
unselect
:
function
()
{
$
(
'
#packages li
'
).
removeClass
(
'
active
'
)
}
}
,
}
files
:
{
var
files
=
{
set
:
function
(
data
)
{
Page_Distrubion
.
files
.
clean
()
files
.
clean
()
tmp
=
data
if
(
data
.
package
.
files
&&
data
.
package
.
files
.
length
>
0
)
{
selected_file
=
Utils
.
check_data_file
(
data
)
data
.
package
.
files
.
forEach
(
function
(
f
){
tmp
.
file
=
f
file
=
$
(
'
<li id="file-
'
+
f
.
orig_name
+
'
"><a title="
'
+
f
.
orig_name
+
'
" href="
'
+
Utils
.
from_data_to_hash
(
tmp
)
+
'
">
'
+
f
.
name
+
'
</a></li>
'
)
file
.
on
(
"
click
"
,
function
(){
Page_Distrubion
.
files
.
select
(
this
)
current_
file
=
$
(
'
<li id="file-
'
+
f
.
orig_name
+
'
"><a title="
'
+
f
.
orig_name
+
'
" href="
'
+
Utils
.
from_data_to_hash
(
tmp
)
+
'
">
'
+
f
.
name
+
'
</a></li>
'
)
current_
file
.
on
(
"
click
"
,
function
(){
files
.
select
(
this
)
})
$
(
'
#logs ul
'
).
append
(
file
)
})
$
(
'
#logs
'
).
show
()
Page_Distrubion
.
select
()
select
()
}
if
(
data
.
package
.
debs
&&
data
.
package
.
debs
.
length
>
0
)
{
...
...
@@ -115,7 +126,7 @@ var Page_Distrubion = {
}
},
select
:
function
(
data
)
{
Page_Distrubion
.
files
.
unselect
()
files
.
unselect
()
if
(
!
data
)
data
=
Utils
.
from_hash_to_data
()
if
(
Utils
.
check_data_file
(
data
))
{
...
...
@@ -125,13 +136,13 @@ var Page_Distrubion = {
unselect
:
function
()
{
$
(
'
#logs li
'
).
removeClass
(
'
active
'
);
}
}
,
}
file
:
{
var
file
=
{
set
:
function
(
data
)
{
$
(
"
#file pre
"
).
html
(
data
.
file
.
content
)
$
(
"
#file
"
).
show
()
Page_Distrubion
.
select
()
select
()
},
clean
:
function
()
{
$
(
'
#file pre
'
).
html
(
''
)
...
...
@@ -156,9 +167,9 @@ var Page_Distrubion = {
socket
.
emit
(
"
get_file
"
,
new_data
)
}
}
}
,
}
breadcrumb
:
{
var
breadcrumb
=
{
update
:
function
(
hash
)
{
if
(
!
hash
)
hash
=
window
.
location
.
hash
...
...
@@ -176,10 +187,10 @@ var Page_Distrubion = {
}
$
(
'
.breadcrumb
'
).
html
(
new_html
)
}
}
,
}
// stiky sidebar
sticky
:
function
()
{
var
sticky
=
function
()
{
// $(window).off("scroll")
// // back on top
//// $("html, body").animate({scrollTop: 0}, 0);
...
...
@@ -190,40 +201,40 @@ var Page_Distrubion = {
// else
// $("#sticky").stop().removeClass('fixed');
// })
}
,
}
select
:
function
(
data
)
{
Page_Distrubion
.
unselect
()
var
select
=
function
(
data
)
{
unselect
()
if
(
!
data
)
data
=
Utils
.
from_hash_to_data
()
if
(
Utils
.
check_data_distribution
(
data
))
{
$
(
"
#distributions li[id='distribution-
"
+
data
.
distribution
.
name
+
"
']
"
).
addClass
(
'
active
'
)
}
Page_Distrubion
.
packages
.
select
(
data
)
Page_Distrubion
.
files
.
select
(
data
)
}
,
packages
.
select
(
data
)
files
.
select
(
data
)
}
unselect
:
function
()
{
var
unselect
=
function
()
{
$
(
'
#distributions li
'
).
removeClass
(
'
active
'
)
Page_Distrubion
.
files
.
unselect
()
Page_Distrubion
.
packages
.
unselect
()
}
,
files
.
unselect
()
packages
.
unselect
()
}
clean
:
function
()
{
Page_Distrubion
.
title
.
clean
()
Page_Distrubion
.
packages
.
clean
()
Page_Distrubion
.
files
.
clean
()
Page_Distrubion
.
file
.
clean
()
Page_Distrubion
.
unselect
()
Page_Distrubion
.
breadcrumb
.
update
()
}
,
var
clean
=
function
()
{
title
.
clean
()
packages
.
clean
()
files
.
clean
()
file
.
clean
()
unselect
()
breadcrumb
.
update
()
}
update
:
function
(
data
,
old_data
)
{
var
update
=
function
(
data
,
old_data
)
{
if
(
!
old_data
)
{
if
(
!
data
)
Page_Distrubion
.
populate
()
populate
()
else
Page_Distrubion
.
populate
(
data
)
populate
(
data
)
return
;
}
else
{
...
...
@@ -231,17 +242,17 @@ var Page_Distrubion = {
!
Utils
.
check_data_distribution
(
data
)
||
data
.
distribution
.
name
!=
old_data
.
distribution
.
name
)
{
Page_Distrubion
.
clean
()
Page_Distrubion
.
populate
(
data
)
clean
()
populate
(
data
)
}
else
if
(
!
Utils
.
check_data_package
(
old_data
)
||
!
Utils
.
check_data_package
(
data
)
||
data
.
package
.
orig_name
!=
old_data
.
package
.
orig_name
)
{
Page_Distrubion
.
file
.
clean
()
Page_Distrubion
.
files
.
clean
()
Page_Distrubion
.
files
.
get
(
data
)
file
.
clean
()
files
.
clean
()
files
.
get
(
data
)
if
(
Utils
.
check_data_package
(
data
))
{
// I will always get dataestamp from package
window
.
location
.
hash
+=
'
/datestamp
'
...
...
@@ -253,25 +264,59 @@ var Page_Distrubion = {
data
.
file
.
name
!=
old_data
.
file
.
name
)
{
Page_Distrubion
.
file
.
get
()
file
.
get
()
}
Page_Distrubion
.
title
.
set
(
data
)
Page_Distrubion
.
breadcrumb
.
update
()
Page_Distrubion
.
select
(
data
)
Page_Distrubion
.
sticky
()
title
.
set
(
data
)
breadcrumb
.
update
()
select
(
data
)
sticky
()
}
}
,
}
populate
:
function
(
data
)
{
Page_Distrubion
.
clean
()
var
populate
=
function
(
data
)
{
clean
()
if
(
!
data
)
data
=
Utils
.
from_hash_to_data
()
Page_Distrubion
.
packages
.
get
(
data
)
Page_Distrubion
.
files
.
get
(
data
)
Page_Distrubion
.
file
.
get
(
data
)
Page_Distrubion
.
select
(
data
)
Page_Distrubion
.
breadcrumb
.
update
()
Page_Distrubion
.
title
.
set
(
data
)
Page_Distrubion
.
sticky
()
packages
.
get
(
data
)
files
.
get
(
data
)
file
.
get
(
data
)
select
(
data
)
breadcrumb
.
update
()
title
.
set
(
data
)
sticky
()
}
this
.
init
=
function
(
mysocket
)
{
socket
=
mysocket
socket
.
on
(
'
distribution_packages
'
,
function
(
data
){
packages
.
set
(
data
)
})
socket
.
on
(
'
package_files_list
'
,
function
(
data
){
files
.
set
(
data
)
})
socket
.
on
(
'
file
'
,
function
(
data
)
{
file
.
set
(
data
)
})
socket
.
on
(
'
file_newcontent
'
,
function
(
data
)
{
file
.
append
(
data
)
})
$
(
window
).
on
(
'
hashchange
'
,
function
()
{
__check_hash_makes_sense
()
new_data
=
Utils
.
from_hash_to_data
()
update
(
new_data
,
data
)
data
=
new_data
});
$
(
window
).
on
(
'
load
'
,
function
(){
__check_hash_makes_sense
()
populate
(
data
)
});
}
}
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