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
c0c918ec
Commit
c0c918ec
authored
Jun 04, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jslint client code
parent
08e14f2f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
912 additions
and
926 deletions
+912
-926
debomatic-webui/public/javascripts/debug.js
debomatic-webui/public/javascripts/debug.js
+21
-20
debomatic-webui/public/javascripts/main.js
debomatic-webui/public/javascripts/main.js
+20
-19
debomatic-webui/public/javascripts/page_distribution.js
debomatic-webui/public/javascripts/page_distribution.js
+563
-577
debomatic-webui/public/javascripts/page_generic.js
debomatic-webui/public/javascripts/page_generic.js
+168
-171
debomatic-webui/public/javascripts/preferences.js
debomatic-webui/public/javascripts/preferences.js
+52
-50
debomatic-webui/public/javascripts/utils.js
debomatic-webui/public/javascripts/utils.js
+88
-89
No files found.
debomatic-webui/public/javascripts/debug.js
View file @
c0c918ec
"
use strict
"
;
/*
General information about debugging:
...
...
@@ -10,18 +11,18 @@
3 - socket emit data
4 - socket received data
*/
var
debug
=
function
()
{
if
(
arguments
.
length
<
2
)
{
return
}
var
level
=
arguments
[
0
]
arguments
[
0
]
=
"
debug [
"
+
level
+
"
]:
"
if
(
level
<=
config
.
preferences
.
debug
)
{
if
(
console
.
debug
)
console
.
debug
.
apply
(
console
,
arguments
)
else
console
.
log
.
apply
(
console
,
arguments
)
}
var
debug
=
function
()
{
if
(
arguments
.
length
<
2
)
{
return
;
}
var
level
=
arguments
[
0
];
arguments
[
0
]
=
"
debug [
"
+
level
+
"
]:
"
;
if
(
level
<=
config
.
preferences
.
debug
)
{
if
(
console
.
debug
)
console
.
debug
.
apply
(
console
,
arguments
);
else
console
.
log
.
apply
(
console
,
arguments
);
}
}
/*
...
...
@@ -30,11 +31,11 @@ var debug = function() {
usage: debug_socket("emit"|"received", event_name, data)
*/
var
debug_socket
=
function
()
{
if
(
arguments
.
length
!=
3
)
return
var
level
=
3
;
if
(
arguments
[
0
]
==
"
received
"
)
level
=
4
debug
(
level
,
"
socket
"
,
arguments
[
0
],
"
event:
"
,
arguments
[
1
],
"
data:
"
,
arguments
[
2
])
}
\ No newline at end of file
var
debug_socket
=
function
()
{
if
(
arguments
.
length
!=
3
)
return
;
var
level
=
3
;
if
(
arguments
[
0
]
==
"
received
"
)
level
=
4
;
debug
(
level
,
"
socket
"
,
arguments
[
0
],
"
event:
"
,
arguments
[
1
],
"
data:
"
,
arguments
[
2
]);
}
debomatic-webui/public/javascripts/main.js
View file @
c0c918ec
// main client javascript
'
use strict
'
;
var
preferences
=
new
Preferences
()
var
preferences
=
new
Preferences
()
;
var
page_generic
=
new
Page_Generic
()
var
page_generic
=
new
Page_Generic
()
;
if
(
window
.
location
.
pathname
==
config
.
paths
.
preferences
)
{
preferences
.
initPage
()
preferences
.
initPage
();
}
if
(
window
.
location
.
pathname
==
'
/
'
)
{
// convert email addresses in the right format
var
emails
=
$
(
"
.email
"
)
$
.
each
(
emails
,
function
()
{
var
subject
=
''
if
(
$
(
this
).
attr
(
'
subject
'
))
{
subject
=
'
?subject=
'
+
$
(
this
).
attr
(
'
subject
'
)
}
var
real_email
=
$
(
this
).
attr
(
'
address
'
).
replace
(
'
AT
'
,
'
@
'
).
replace
(
'
DOT
'
,
'
.
'
).
replace
(
/ /g
,
''
)
var
label
=
real_email
if
(
config
.
debomatic
.
admin
.
name
&&
config
.
debomatic
.
admin
.
name
!=
'
Your Name
'
)
label
=
config
.
debomatic
.
admin
.
name
real_email
=
'
<a href="mailto:
'
+
real_email
+
subject
+
'
">
'
+
label
+
'
</a>
'
$
(
this
).
html
(
real_email
)
})
// convert email addresses in the right format
var
emails
=
$
(
'
.email
'
);
$
.
each
(
emails
,
function
()
{
var
subject
=
''
;
if
(
$
(
this
).
attr
(
'
subject
'
))
{
subject
=
'
?subject=
'
+
$
(
this
).
attr
(
'
subject
'
);
}
var
real_email
=
$
(
this
).
attr
(
'
address
'
).
replace
(
'
AT
'
,
'
@
'
).
replace
(
'
DOT
'
,
'
.
'
).
replace
(
/ /g
,
''
);
var
label
=
real_email
;
if
(
config
.
debomatic
.
admin
.
name
&&
config
.
debomatic
.
admin
.
name
!=
'
Your Name
'
);
label
=
config
.
debomatic
.
admin
.
name
;
real_email
=
'
<a href="mailto:
'
+
real_email
+
subject
+
'
">
'
+
label
+
'
</a>
'
;
$
(
this
).
html
(
real_email
);
})
}
var
socket
=
io
.
connect
(
'
/
'
);
page_generic
.
start
(
socket
)
page_generic
.
start
(
socket
)
;
if
(
window
.
location
.
pathname
==
config
.
paths
.
distribution
)
{
new
Page_Distrubion
(
socket
).
start
()
new
Page_Distrubion
(
socket
).
start
();
}
debomatic-webui/public/javascripts/page_distribution.js
View file @
c0c918ec
This diff is collapsed.
Click to expand it.
debomatic-webui/public/javascripts/page_generic.js
View file @
c0c918ec
This diff is collapsed.
Click to expand it.
debomatic-webui/public/javascripts/preferences.js
View file @
c0c918ec
'
use strict
'
;
function
Preferences
()
{
// update config.preferences according with user choices
var
load
=
function
()
{
for
(
key
in
config
.
preferences
)
{
if
((
value
=
localStorage
.
getItem
(
key
)))
{
debug
(
2
,
'
loading preference
'
,
key
,
value
)
config
.
preferences
[
key
]
=
JSON
.
parse
(
value
)
}
}
}
// set prefence
var
set
=
function
(
key
,
value
)
{
if
(
config
.
preferences
.
hasOwnProperty
(
key
))
{
debug
(
1
,
'
setting preference
'
,
key
,
value
)
localStorage
.
setItem
(
key
,
value
)
config
.
preferences
[
key
]
=
JSON
.
parse
(
value
)
}
}
// init prefence page
this
.
initPage
=
function
()
{
page_generic
.
set_window_title
(
"
Preferences
"
)
// set view according with config.preferences
for
(
key
in
config
.
preferences
)
{
var
element
=
$
(
"
#preferences #
"
+
key
)
if
(
element
.
attr
(
'
type
'
)
==
"
checkbox
"
)
{
element
.
prop
(
'
checked
'
,
config
.
preferences
[
key
])
}
else
{
element
.
val
(
config
.
preferences
[
key
])
}
}
// on input change, set prefence
$
(
"
#preferences input, #preferences select
"
).
change
(
function
()
{
var
key
=
$
(
this
).
attr
(
'
id
'
)
var
value
=
$
(
this
).
val
()
if
(
$
(
this
).
attr
(
'
type
'
)
==
'
checkbox
'
)
value
=
$
(
this
).
is
(
'
:checked
'
)
set
(
key
,
value
)
// give to user an immediate feedback changing preferences
page_generic
.
preferences
()
})
}
load
()
}
\ No newline at end of file
// update config.preferences according with user choices
var
load
=
function
()
{
for
(
var
key
in
config
.
preferences
)
{
var
value
=
localStorage
.
getItem
(
key
);
if
(
value
)
{
debug
(
2
,
'
loading preference
'
,
key
,
value
);
config
.
preferences
[
key
]
=
JSON
.
parse
(
value
);
}
}
};
// set prefence
var
set
=
function
(
key
,
value
)
{
if
(
config
.
preferences
.
hasOwnProperty
(
key
))
{
debug
(
1
,
'
setting preference
'
,
key
,
value
);
localStorage
.
setItem
(
key
,
value
);
config
.
preferences
[
key
]
=
JSON
.
parse
(
value
);
}
};
// init prefence page
this
.
initPage
=
function
()
{
page_generic
.
set_window_title
(
'
Preferences
'
);
// set view according with config.preferences
for
(
var
key
in
config
.
preferences
)
{
var
element
=
$
(
'
#preferences #
'
+
key
);
if
(
element
.
attr
(
'
type
'
)
==
'
checkbox
'
)
{
element
.
prop
(
'
checked
'
,
config
.
preferences
[
key
]);
}
else
{
element
.
val
(
config
.
preferences
[
key
]);
}
}
// on input change, set prefence
$
(
'
#preferences input, #preferences select
'
).
change
(
function
()
{
var
key
=
$
(
this
).
attr
(
'
id
'
);
var
value
=
$
(
this
).
val
();
if
(
$
(
this
).
attr
(
'
type
'
)
==
'
checkbox
'
)
value
=
$
(
this
).
is
(
'
:checked
'
);
set
(
key
,
value
);
// give to user an immediate feedback changing preferences
page_generic
.
preferences
();
});
};
load
();
}
debomatic-webui/public/javascripts/utils.js
View file @
c0c918ec
'
use strict
'
;
var
Utils
=
{
from_hash_to_view
:
function
(
hash
)
{
if
(
!
hash
)
hash
=
window
.
location
.
hash
hash
=
hash
.
replace
(
'
#
'
,
''
)
info
=
hash
.
split
(
'
/
'
);
var
view
=
{}
view
.
distribution
=
{}
view
.
packages
=
{}
view
.
package
=
{}
view
.
file
=
{}
from_hash_to_view
:
function
(
hash
)
{
if
(
!
hash
)
hash
=
window
.
location
.
hash
;
hash
=
hash
.
replace
(
'
#
'
,
''
);
var
info
=
hash
.
split
(
'
/
'
);
var
view
=
{};
view
.
distribution
=
{};
view
.
packages
=
{};
view
.
package
=
{};
view
.
file
=
{};
if
(
info
.
length
>=
1
)
{
view
.
distribution
.
name
=
info
[
0
];
}
if
(
info
.
length
>=
3
){
view
.
package
.
name
=
info
[
1
];
view
.
package
.
version
=
info
[
2
];
view
.
package
.
orig_name
=
view
.
package
.
name
+
'
_
'
+
view
.
package
.
version
}
if
(
info
.
length
>=
4
)
{
view
.
file
.
name
=
info
[
3
]
view
.
file
.
orig_name
=
view
.
package
.
orig_name
+
'
.
'
+
view
.
file
.
name
}
return
view
},
from_view_to_hash
:
function
(
view
)
{
hash
=
"
#
"
if
(
Utils
.
check_view_distribution
(
view
))
{
hash
=
hash
+
view
.
distribution
.
name
if
(
Utils
.
check_view_package
(
view
))
{
hash
=
hash
+
'
/
'
+
view
.
package
.
name
+
"
/
"
+
view
.
package
.
version
if
(
Utils
.
check_view_file
(
view
))
hash
=
hash
+
'
/
'
+
view
.
file
.
name
}
}
return
hash
},
check_view_distribution
:
function
(
view
)
{
return
view
&&
view
.
distribution
&&
view
.
distribution
.
name
},
check_view_package
:
function
(
view
)
{
return
Utils
.
check_view_distribution
(
view
)
&&
view
.
package
&&
view
.
package
.
name
&&
view
.
package
.
version
&&
view
.
package
.
orig_name
},
check_view_file
:
function
(
view
)
{
return
Utils
.
check_view_package
(
view
)
&&
view
.
file
&&
view
.
file
.
name
},
if
(
info
.
length
>=
1
)
{
view
.
distribution
.
name
=
info
[
0
];
}
if
(
info
.
length
>=
3
)
{
view
.
package
.
name
=
info
[
1
];
view
.
package
.
version
=
info
[
2
];
view
.
package
.
orig_name
=
view
.
package
.
name
+
'
_
'
+
view
.
package
.
version
;
}
if
(
info
.
length
>=
4
)
{
view
.
file
.
name
=
info
[
3
];
view
.
file
.
orig_name
=
view
.
package
.
orig_name
+
'
.
'
+
view
.
file
.
name
;
}
return
view
;
},
get_status_icon_and_class
:
function
(
status_data
)
{
var
_c
=
config
.
status
.
className
var
_i
=
config
.
status
.
icons
var
_s
=
status_data
var
className
=
null
var
icon
=
null
if
(
_s
.
hasOwnProperty
(
'
success
'
))
{
if
(
_s
.
success
==
true
)
{
className
=
_c
.
success
icon
=
_i
.
success
}
else
{
className
=
_c
.
fail
icon
=
_i
.
fail
}
}
else
{
className
=
_c
[
_s
.
status
]
icon
=
_i
[
_s
.
status
]
}
from_view_to_hash
:
function
(
view
)
{
var
hash
=
'
#
'
;
if
(
Utils
.
check_view_distribution
(
view
))
{
hash
=
hash
+
view
.
distribution
.
name
;
if
(
Utils
.
check_view_package
(
view
))
{
hash
=
hash
+
'
/
'
+
view
.
package
.
name
+
'
/
'
+
view
.
package
.
version
;
if
(
Utils
.
check_view_file
(
view
))
hash
=
hash
+
'
/
'
+
view
.
file
.
name
;
}
}
return
hash
;
},
// do not change color if update or create and successed
if
(
_s
.
success
==
true
&&
_s
.
status
!=
config
.
status
.
build
)
{
className
=
_c
[
_s
.
status
]
}
check_view_distribution
:
function
(
view
)
{
return
view
&&
view
.
distribution
&&
view
.
distribution
.
name
;
},
return
{
className
:
className
,
icon
:
icon
}
},
check_view_package
:
function
(
view
)
{
return
Utils
.
check_view_distribution
(
view
)
&&
view
.
package
&&
view
.
package
.
name
&&
view
.
package
.
version
&&
view
.
package
.
orig_name
;
},
check_view_file
:
function
(
view
)
{
return
Utils
.
check_view_package
(
view
)
&&
view
.
file
&&
view
.
file
.
name
;
},
get_status_icon_and_class
:
function
(
status_data
)
{
var
_c
=
config
.
status
.
className
;
var
_i
=
config
.
status
.
icons
;
var
_s
=
status_data
;
var
className
=
null
;
var
icon
=
null
;
if
(
_s
.
hasOwnProperty
(
'
success
'
))
{
if
(
_s
.
success
===
true
)
{
className
=
_c
.
success
;
icon
=
_i
.
success
;
}
else
{
className
=
_c
.
fail
;
icon
=
_i
.
fail
;
}
}
else
{
className
=
_c
[
_s
.
status
];
icon
=
_i
[
_s
.
status
];
}
get_status_icon_html
:
function
(
status_data
)
{
info
=
Utils
.
get_status_icon_and_class
(
status_data
)
return
'
<span class="icon glyphicon glyphicon-
'
+
info
.
icon
+
'
"></span>
'
},
// do not change color if update or create and successed
if
(
_s
.
success
===
true
&&
_s
.
status
!=
config
.
status
.
build
)
{
className
=
_c
[
_s
.
status
];
}
// clone an object via JSON
clone
:
function
(
object
)
{
return
JSON
.
parse
(
JSON
.
stringify
(
object
));
}
}
return
{
className
:
className
,
icon
:
icon
};
},
get_status_icon_html
:
function
(
status_data
)
{
var
info
=
Utils
.
get_status_icon_and_class
(
status_data
);
return
'
<span class="icon glyphicon glyphicon-
'
+
info
.
icon
+
'
"></span>
'
;
},
// clone an object via JSON
clone
:
function
(
object
)
{
return
JSON
.
parse
(
JSON
.
stringify
(
object
));
}
};
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