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
33d2dda1
Commit
33d2dda1
authored
Mar 09, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean code with handlers .. use just one for generic cases
parent
9e0e02c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
28 deletions
+16
-28
debomatic-webui/lib/client.js
debomatic-webui/lib/client.js
+16
-28
No files found.
debomatic-webui/lib/client.js
View file @
33d2dda1
...
@@ -137,54 +137,42 @@ function __watch_path_onsocket(event_name, socket, data, watch_path, updater) {
...
@@ -137,54 +137,42 @@ function __watch_path_onsocket(event_name, socket, data, watch_path, updater) {
})
})
}
}
function
__file_newcontent
(
event_name
,
socket
,
data
)
{
if
(
!
utils
.
check_data_file
(
data
))
return
data
.
file
.
content
=
null
socket
.
emit
(
event_name
,
data
)
}
function
__handler_get_distributions
(
socket
,
data
)
{
event_name
=
'
distributions
'
__watch_path_onsocket
(
event_name
,
socket
,
data
,
config
.
debomatic
.
path
,
__send_distributions
)
__send_distributions
(
event_name
,
socket
,
data
)
}
function
__handler_get_package_files_list
(
socket
,
data
)
{
event_name
=
'
package_files_list
'
package_path
=
utils
.
get_package_path
(
data
)
__watch_path_onsocket
(
event_name
,
socket
,
data
,
package_path
,
__send_package_files_list
)
__send_package_files_list
(
event_name
,
socket
,
data
)
}
function
__handler_get_distribution_packages
(
socket
,
data
)
{
function
__generic_handler
(
event_name
,
socket
,
data
,
watch_path
,
callback
)
{
event_name
=
'
distribution_packages
'
__watch_path_onsocket
(
event_name
,
socket
,
data
,
config
.
debomatic
.
path
,
callback
)
distribution_path
=
path
.
join
(
config
.
debomatic
.
path
,
data
.
distribution
.
name
,
'
pool
'
)
callback
(
event_name
,
socket
,
data
)
__watch_path_onsocket
(
event_name
,
socket
,
data
,
distribution_path
,
__send_distribution_packages
)
__send_distribution_packages
(
event_name
,
socket
,
data
)
}
}
function
__handler_get_file
(
socket
,
data
)
{
function
__handler_get_file
(
socket
,
data
)
{
file_path
=
utils
.
get_file_path
(
data
)
file_path
=
utils
.
get_file_path
(
data
)
__watch_path_onsocket
(
'
file_newcontent
'
,
socket
,
data
,
file_path
,
__file_newcontent
)
__watch_path_onsocket
(
'
file_newcontent
'
,
socket
,
data
,
file_path
,
__
handler_
file_newcontent
)
__send_file
(
'
file
'
,
socket
,
data
)
__send_file
(
'
file
'
,
socket
,
data
)
}
}
function
__handler_file_newcontent
(
event_name
,
socket
,
data
)
{
if
(
!
utils
.
check_data_file
(
data
))
return
data
.
file
.
content
=
null
socket
.
emit
(
event_name
,
data
)
}
Client
=
function
(
socket
)
{
Client
=
function
(
socket
)
{
__
handler_get_distributions
(
socket
);
__
generic_handler
(
'
distributions
'
,
socket
,
null
,
config
.
debomatic
.
path
,
__send_distributions
)
// send distribution packages
socket
.
on
(
'
get_distribution_packages
'
,
function
(
data
)
{
socket
.
on
(
'
get_distribution_packages
'
,
function
(
data
)
{
if
(
!
utils
.
check_data_distribution
(
data
))
if
(
!
utils
.
check_data_distribution
(
data
))
return
return
__handler_get_distribution_packages
(
socket
,
data
);
distribution_path
=
path
.
join
(
config
.
debomatic
.
path
,
data
.
distribution
.
name
,
'
pool
'
)
__generic_handler
(
'
distribution_packages
'
,
socket
,
data
,
distribution_path
,
__send_distribution_packages
)
})
})
socket
.
on
(
'
get_package_files_list
'
,
function
(
data
)
{
socket
.
on
(
'
get_package_files_list
'
,
function
(
data
)
{
if
(
!
utils
.
check_data_package
(
data
))
if
(
!
utils
.
check_data_package
(
data
))
return
return
__handler_get_package_files_list
(
socket
,
data
)
package_path
=
utils
.
get_package_path
(
data
)
__generic_handler
(
'
package_files_list
'
,
socket
,
data
,
package_path
,
__send_package_files_list
)
})
})
socket
.
on
(
'
get_file
'
,
function
(
data
){
socket
.
on
(
'
get_file
'
,
function
(
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