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
8a6307f0
Commit
8a6307f0
authored
Mar 09, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved watcher to send lib and renamed event package_file_list in package_files_list
parent
ab0a52af
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
58 deletions
+60
-58
debomatic-webui/index.js
debomatic-webui/index.js
+2
-42
debomatic-webui/lib/send.js
debomatic-webui/lib/send.js
+56
-14
debomatic-webui/public/javascripts/main.js
debomatic-webui/public/javascripts/main.js
+1
-1
debomatic-webui/public/javascripts/page_distribution.js
debomatic-webui/public/javascripts/page_distribution.js
+1
-1
No files found.
debomatic-webui/index.js
View file @
8a6307f0
...
...
@@ -7,7 +7,6 @@ var express = require('express')
,
routes
=
require
(
'
./routes
'
)
,
fs
=
require
(
'
fs
'
)
,
path
=
require
(
'
path
'
)
,
Tail
=
require
(
'
tail
'
).
Tail
,
config
=
require
(
'
./lib/config.js
'
)
,
send
=
require
(
'
./lib/send.js
'
)
,
utils
=
require
(
'
./lib/utils.js
'
)
...
...
@@ -40,39 +39,6 @@ var io = require('socket.io').listen(app);
app
.
get
(
'
/
'
,
routes
.
index
);
app
.
get
(
'
/distribution
'
,
routes
.
distribution
)
function
watch_path_onsocket
(
event_name
,
socket
,
data
,
watch_path
,
updater
)
{
name
=
"
watcher-
"
+
event_name
socket
.
get
(
name
,
function
(
err
,
watcher
)
{
if
(
watcher
)
{
try
{
watcher
.
unwatch
()
}
catch
(
errorWatchingDirectory
)
{
watcher
.
close
()
}
}
try
{
fs
.
stat
(
watch_path
,
function
(
err
,
stats
)
{
if
(
err
)
return
if
(
stats
.
isDirectory
())
{
watcher
=
fs
.
watch
(
watch_path
,
{
persistent
:
true
},
function
(
event
,
fileName
)
{
if
(
event
==
'
rename
'
)
updater
(
socket
,
data
)
})
}
else
{
watcher
=
new
Tail
(
watch_path
)
watcher
.
on
(
'
line
'
,
function
(
new_content
)
{
data
.
file
.
new_content
=
new_content
+
'
\n
'
updater
(
socket
,
data
)
})
}
socket
.
set
(
name
,
watcher
)
})
}
catch
(
err_watch
)
{}
})
}
io
.
sockets
.
on
(
'
connection
'
,
function
(
socket
)
{
send
.
distributions
(
socket
);
...
...
@@ -80,25 +46,19 @@ io.sockets.on('connection', function(socket) {
socket
.
on
(
'
get_distribution_packages
'
,
function
(
data
)
{
if
(
!
utils
.
check_data_distribution
(
data
))
return
distribution_path
=
path
.
join
(
config
.
debomatic
.
path
,
data
.
distribution
.
name
,
'
pool
'
)
watch_path_onsocket
(
'
get_distribution_packages
'
,
socket
,
data
,
distribution_path
,
send
.
distribution_packages
)
send
.
distribution_packages
(
socket
,
data
);
})
socket
.
on
(
'
get_package_file_list
'
,
function
(
data
)
{
socket
.
on
(
'
get_package_file
s
_list
'
,
function
(
data
)
{
if
(
!
utils
.
check_data_package
(
data
))
return
package_path
=
utils
.
get_package_path
(
data
)
watch_path_onsocket
(
'
get_package_file_list
'
,
socket
,
data
,
package_path
,
send
.
package_file_list
)
send
.
package_file_list
(
socket
,
data
)
send
.
package_files_list
(
socket
,
data
)
})
socket
.
on
(
'
get_file
'
,
function
(
data
){
if
(
!
utils
.
check_data_file
(
data
))
return
file_path
=
utils
.
get_file_path
(
data
)
watch_path_onsocket
(
'
get_file
'
,
socket
,
data
,
file_path
,
send
.
file_newcontent
)
send
.
file
(
socket
,
data
)
})
});
...
...
debomatic-webui/lib/send.js
View file @
8a6307f0
var
fs
=
require
(
'
fs
'
)
,
path
=
require
(
'
path
'
)
,
Tail
=
require
(
'
tail
'
).
Tail
,
config
=
require
(
'
./config.js
'
)
,
utils
=
require
(
'
./utils.js
'
)
...
...
@@ -57,13 +58,13 @@ function __get_files_list_from_package(data, callback) {
});
}
function
__send_package_files_list
(
socket
,
data
)
{
function
__send_package_files_list
(
event_name
,
socket
,
data
)
{
__get_files_list_from_package
(
data
,
function
(
new_data
){
socket
.
emit
(
'
package_file_list
'
,
new_data
)
socket
.
emit
(
event_name
,
new_data
)
});
}
function
__send_distribution_packages
(
socket
,
data
)
{
function
__send_distribution_packages
(
event_name
,
socket
,
data
)
{
distro_path
=
utils
.
get_distribution_pool_path
(
data
)
__get_files_list
(
distro_path
,
true
,
function
(
packages
)
{
data
.
distribution
.
packages
=
[]
...
...
@@ -80,20 +81,57 @@ function __send_distribution_packages (socket, data) {
}
data
.
distribution
.
packages
.
push
(
pack
)
});
socket
.
emit
(
"
distribution_packages
"
,
data
)
socket
.
emit
(
event_name
,
data
)
});
}
function
__send_file
(
socket
,
data
)
{
function
__send_file
(
event_name
,
socket
,
data
)
{
file_path
=
utils
.
get_file_path
(
data
)
fs
.
readFile
(
file_path
,
'
utf8
'
,
function
(
err
,
content
)
{
if
(
err
)
return
;
data
.
file
.
orig_name
=
file_path
.
split
(
'
/
'
).
pop
()
data
.
file
.
content
=
content
socket
.
emit
(
'
file
'
,
data
)
socket
.
emit
(
event_name
,
data
)
});
}
function
__watch_path_onsocket
(
event_name
,
socket
,
data
,
watch_path
,
updater
)
{
name
=
"
watcher-
"
+
event_name
socket
.
get
(
name
,
function
(
err
,
watcher
)
{
if
(
watcher
)
{
try
{
watcher
.
unwatch
()
}
catch
(
errorWatchingDirectory
)
{
watcher
.
close
()
}
}
try
{
fs
.
stat
(
watch_path
,
function
(
err
,
stats
)
{
if
(
err
)
return
if
(
stats
.
isDirectory
())
{
watcher
=
fs
.
watch
(
watch_path
,
{
persistent
:
true
},
function
(
event
,
fileName
)
{
if
(
event
==
'
rename
'
)
updater
(
event_name
,
socket
,
data
)
})
}
else
{
watcher
=
new
Tail
(
watch_path
)
watcher
.
on
(
'
line
'
,
function
(
new_content
)
{
data
.
file
.
new_content
=
new_content
+
'
\n
'
updater
(
event_name
,
socket
,
data
)
})
}
socket
.
set
(
name
,
watcher
)
})
}
catch
(
err_watch
)
{}
})
}
function
__file_newcontent
(
event_name
,
socket
,
data
)
{
socket
.
emit
(
event_name
,
data
)
}
sender
=
{
distributions
:
function
(
socket
)
{
...
...
@@ -102,21 +140,25 @@ sender = {
});
},
package_file_list
:
function
(
socket
,
data
)
{
__send_package_files_list
(
socket
,
data
)
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
)
{
__send_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
)
},
file
:
function
(
socket
,
data
)
{
__send_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
)
},
file_newcontent
:
function
(
socket
,
data
)
{
socket
.
emit
(
'
file_newcontent
'
,
data
);
}
}
module
.
exports
=
sender
debomatic-webui/public/javascripts/main.js
View file @
8a6307f0
...
...
@@ -16,7 +16,7 @@ if (window.location.pathname == '/distribution') {
Page_Distrubion
.
packages
.
set
(
data
)
})
socket
.
on
(
'
package_file_list
'
,
function
(
data
){
socket
.
on
(
'
package_file
s
_list
'
,
function
(
data
){
Page_Distrubion
.
files
.
set
(
data
)
})
...
...
debomatic-webui/public/javascripts/page_distribution.js
View file @
8a6307f0
...
...
@@ -87,7 +87,7 @@ var Page_Distrubion = {
if
(
!
data
)
data
=
Utils
.
from_hash_to_data
()
if
(
Utils
.
check_data_package
(
data
))
socket
.
emit
(
"
get_package_file_list
"
,
data
)
socket
.
emit
(
"
get_package_file
s
_list
"
,
data
)
},
select
:
function
(
file
)
{
$
(
"
#logs li
"
).
removeClass
(
'
active
'
)
...
...
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