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
c7008c40
Commit
c7008c40
authored
Mar 09, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed send.js in client.js - moved socket handler completly to client - created Client class
parent
0e689cb9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
52 deletions
+58
-52
debomatic-webui/index.js
debomatic-webui/index.js
+2
-26
debomatic-webui/lib/client.js
debomatic-webui/lib/client.js
+56
-26
No files found.
debomatic-webui/index.js
View file @
c7008c40
...
...
@@ -8,7 +8,7 @@ var express = require('express')
,
fs
=
require
(
'
fs
'
)
,
path
=
require
(
'
path
'
)
,
config
=
require
(
'
./lib/config.js
'
)
,
send
=
require
(
'
./lib/send
.js
'
)
,
client
=
require
(
'
./lib/client
.js
'
)
,
utils
=
require
(
'
./lib/utils.js
'
)
var
app
=
module
.
exports
=
express
.
createServer
();
...
...
@@ -40,37 +40,13 @@ app.get('/', routes.index);
app
.
get
(
config
.
routes
.
distribution
,
routes
.
distribution
)
io
.
sockets
.
on
(
'
connection
'
,
function
(
socket
)
{
send
.
distributions
(
socket
);
// send distribution packages
socket
.
on
(
'
get_distribution_packages
'
,
function
(
data
)
{
if
(
!
utils
.
check_data_distribution
(
data
))
return
send
.
distribution_packages
(
socket
,
data
);
})
socket
.
on
(
'
get_package_files_list
'
,
function
(
data
)
{
if
(
!
utils
.
check_data_package
(
data
))
return
send
.
package_files_list
(
socket
,
data
)
})
socket
.
on
(
'
get_file
'
,
function
(
data
){
if
(
!
utils
.
check_data_file
(
data
))
return
send
.
file
(
socket
,
data
)
})
client
(
socket
)
});
io
.
sockets
.
on
(
'
disconnect
'
,
function
(
socket
){
});
fs
.
watch
(
config
.
debomatic
.
path
,
{
persistent
:
true
},
function
(
event
,
fileName
)
{
send
.
distributions
(
io
.
sockets
);
});
var
server
=
app
.
listen
(
config
.
port
,
function
(){
console
.
log
(
"
Express server listening on port %d in %s mode
"
,
app
.
address
().
port
,
app
.
settings
.
env
);
});
debomatic-webui/lib/
send
.js
→
debomatic-webui/lib/
client
.js
View file @
c7008c40
...
...
@@ -97,6 +97,12 @@ function __send_file (event_name, socket, data) {
});
}
function
__send_distributions
(
event_name
,
socket
,
data
)
{
__get_files_list
(
config
.
debomatic
.
path
,
true
,
function
(
distros
){
socket
.
emit
(
event_name
,
distros
);
});
}
function
__watch_path_onsocket
(
event_name
,
socket
,
data
,
watch_path
,
updater
)
{
name
=
"
watcher-
"
+
event_name
socket
.
get
(
name
,
function
(
err
,
watcher
)
{
...
...
@@ -137,33 +143,57 @@ function __file_newcontent(event_name, socket, data) {
socket
.
emit
(
event_name
,
data
)
}
sender
=
{
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
)
}
distributions
:
function
(
socket
)
{
__get_files_list
(
config
.
debomatic
.
path
,
true
,
function
(
distros
){
socket
.
emit
(
'
distributions
'
,
distros
);
});
},
package_files_list
:
function
(
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
)
},
distribution_packages
:
function
(
socket
,
data
)
{
event_name
=
'
distribution_packages
'
distribution_path
=
path
.
join
(
config
.
debomatic
.
path
,
data
.
distribution
.
name
,
'
pool
'
)
__watch_path_onsocket
(
event_name
,
socket
,
data
,
distribution_path
,
__send_distribution_packages
)
__send_distribution_packages
(
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
)
{
event_name
=
'
distribution_packages
'
distribution_path
=
path
.
join
(
config
.
debomatic
.
path
,
data
.
distribution
.
name
,
'
pool
'
)
__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
)
{
file_path
=
utils
.
get_file_path
(
data
)
__watch_path_onsocket
(
'
file_newcontent
'
,
socket
,
data
,
file_path
,
__file_newcontent
)
__send_file
(
'
file
'
,
socket
,
data
)
}
Client
=
function
(
socket
)
{
__handler_get_distributions
(
socket
);
// send distribution packages
socket
.
on
(
'
get_distribution_packages
'
,
function
(
data
)
{
if
(
!
utils
.
check_data_distribution
(
data
))
return
__handler_get_distribution_packages
(
socket
,
data
);
})
socket
.
on
(
'
get_package_files_list
'
,
function
(
data
)
{
if
(
!
utils
.
check_data_package
(
data
))
return
__handler_get_package_files_list
(
socket
,
data
)
})
file
:
function
(
socket
,
data
)
{
file_path
=
utils
.
get_file_path
(
data
)
__watch_path_onsocket
(
'
file_newcontent
'
,
socket
,
data
,
file_path
,
__file_newcontent
)
__send_file
(
'
file
'
,
socket
,
data
)
},
socket
.
on
(
'
get_file
'
,
function
(
data
){
if
(
!
utils
.
check_data_file
(
data
))
return
__handler_get_file
(
socket
,
data
)
})
return
{
}
}
module
.
exports
=
sender
module
.
exports
=
Client
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