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
89690de7
Commit
89690de7
authored
Mar 08, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement tail send/receive on new file content
parent
28a72f8b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
9 deletions
+39
-9
debomatic-webui/app.js
debomatic-webui/app.js
+21
-6
debomatic-webui/package.json
debomatic-webui/package.json
+1
-1
debomatic-webui/send.js
debomatic-webui/send.js
+4
-0
debomatic-webui/views/layout.ejs
debomatic-webui/views/layout.ejs
+13
-2
No files found.
debomatic-webui/app.js
View file @
89690de7
...
...
@@ -10,6 +10,7 @@ var express = require('express')
,
fs
=
require
(
'
fs
'
)
,
path
=
require
(
'
path
'
)
,
utils
=
require
(
'
./utils.js
'
)
,
Tail
=
require
(
'
tail
'
).
Tail
var
app
=
module
.
exports
=
express
.
createServer
();
...
...
@@ -39,16 +40,28 @@ var io = require('socket.io').listen(app);
// Routes
app
.
get
(
'
/
'
,
routes
.
index
);
function
watch_
dir
(
event_name
,
socket
,
data
,
watch_path
,
updater
)
{
function
watch_
path_onsocket
(
event_name
,
socket
,
data
,
watch_path
,
updater
)
{
name
=
"
watcher-
"
+
event_name
socket
.
get
(
name
,
function
(
err
,
watcher
)
{
if
(
watcher
)
watcher
.
close
()
try
{
fs
.
stat
(
watch_path
,
function
(
err
,
stats
)
{
watcher
=
null
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
)
{}
})
...
...
@@ -62,7 +75,7 @@ io.sockets.on('connection', function(socket) {
if
(
!
utils
.
check_data_distribution
(
data
))
return
distribution_path
=
path
.
join
(
config
.
debomatic_path
,
data
.
distribution
.
name
,
'
pool
'
)
watch_
dir
(
'
get_distribution_packages
'
,
socket
,
data
,
distribution_path
,
send
.
distribution_packages
)
watch_
path_onsocket
(
'
get_distribution_packages
'
,
socket
,
data
,
distribution_path
,
send
.
distribution_packages
)
send
.
distribution_packages
(
socket
,
data
);
})
...
...
@@ -70,7 +83,7 @@ io.sockets.on('connection', function(socket) {
if
(
!
utils
.
check_data_package
(
data
))
return
package_path
=
utils
.
get_package_path
(
data
)
watch_
dir
(
'
get_package_file_list
'
,
socket
,
data
,
package_path
,
send
.
package_file_list
)
watch_
path_onsocket
(
'
get_package_file_list
'
,
socket
,
data
,
package_path
,
send
.
package_file_list
)
send
.
package_file_list
(
socket
,
data
)
})
...
...
@@ -78,6 +91,8 @@ io.sockets.on('connection', function(socket) {
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/package.json
View file @
89690de7
...
...
@@ -8,6 +8,6 @@
,
"ejs"
:
">= 0.0.1"
,
"socket.io"
:
"*"
,
"node-fs"
:
"*"
,
"
node-
tail"
:
"*"
,
"tail"
:
"*"
}
}
debomatic-webui/send.js
View file @
89690de7
...
...
@@ -111,6 +111,10 @@ debomatic_sender = {
file
:
function
(
socket
,
data
)
{
__send_file
(
socket
,
data
)
},
file_newcontent
:
function
(
socket
,
data
)
{
socket
.
emit
(
'
file_newcontent
'
,
data
);
}
}
...
...
debomatic-webui/views/layout.ejs
View file @
89690de7
...
...
@@ -21,7 +21,8 @@
socket
.
emit
(
"
get_package_file_list
"
,
data
)
}
if
(
info
.
length
>=
4
)
{
data
.
file
=
info
[
3
]
data
.
file
=
{}
data
.
file
.
name
=
info
[
3
]
socket
.
emit
(
"
get_file
"
,
data
)
}
}
...
...
@@ -50,6 +51,15 @@
})
})
socket
.
on
(
'
file
'
,
function
(
data
)
{
$
(
"
#file
"
).
html
(
data
.
file
.
content
)
})
socket
.
on
(
'
file_newcontent
'
,
function
(
data
)
{
new_html
=
$
(
"
#file
"
).
html
()
+
data
.
file
.
new_content
$
(
"
#file
"
).
html
(
new_html
)
})
socket
.
on
(
'
error
'
,
function
()
{
console
.
error
(
arguments
)
});
$
(
window
).
on
(
'
hashchange
'
,
function
()
{
...
...
@@ -66,6 +76,7 @@
<ul
id=
"distributions"
></ul>
<ul
id=
"packages"
></ul>
<ul
id=
"files"
></ul>
<pre
id=
"file"
></pre>
<
%
-
body
%
>
</body>
</html>
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