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
d9d2976c
Commit
d9d2976c
authored
Jul 10, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get and set package info instead of datestamp
parent
2281919d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
32 deletions
+102
-32
debomatic-webui/lib/client.js
debomatic-webui/lib/client.js
+32
-0
debomatic-webui/lib/config.js
debomatic-webui/lib/config.js
+1
-0
debomatic-webui/public/javascripts/page_distribution.js
debomatic-webui/public/javascripts/page_distribution.js
+59
-22
debomatic-webui/public/stylesheets/style.css
debomatic-webui/public/stylesheets/style.css
+9
-9
debomatic-webui/views/distribution.ejs
debomatic-webui/views/distribution.ejs
+1
-1
No files found.
debomatic-webui/lib/client.js
View file @
d9d2976c
...
@@ -42,6 +42,26 @@ function __send_package_files_list(event_name, socket, data) {
...
@@ -42,6 +42,26 @@ function __send_package_files_list(event_name, socket, data) {
});
});
}
}
function
__read_package_status
(
data
,
cb
)
{
var
package_path
=
utils
.
get_package_path
(
data
);
var
package_json
=
path
.
join
(
package_path
,
data
.
package
.
orig_name
+
'
.json
'
);
fs
.
readFile
(
package_json
,
{
encoding
:
'
utf8
'
},
function
(
err
,
content
)
{
if
(
err
)
{
utils
.
errors_handler
(
'
Client:__read_package_status:
'
,
err
);
return
;
}
try
{
content
=
JSON
.
parse
(
content
);
}
catch
(
parse_err
)
{
utils
.
errors_handler
(
'
Client:__read_package_status:parse_err:
'
,
parse_err
);
return
;
}
cb
(
content
);
});
}
function
__send_package_status
(
socket
,
data
,
package_data
)
{
function
__send_package_status
(
socket
,
data
,
package_data
)
{
var
event_name
=
config
.
events
.
client
.
distribution_packages_status
;
var
event_name
=
config
.
events
.
client
.
distribution_packages_status
;
...
@@ -89,6 +109,12 @@ function __send_package_status(socket, data, package_data) {
...
@@ -89,6 +109,12 @@ function __send_package_status(socket, data, package_data) {
});
});
}
}
function
__send_package_info
(
socket
,
data
)
{
__read_package_status
(
data
,
function
(
content
)
{
socket
.
emit
(
_e
.
package_info
,
content
);
});
}
function
__send_distribution_packages
(
event_name
,
socket
,
data
)
{
function
__send_distribution_packages
(
event_name
,
socket
,
data
)
{
var
distro_path
=
utils
.
get_distribution_pool_path
(
data
);
var
distro_path
=
utils
.
get_distribution_pool_path
(
data
);
utils
.
get_files_list
(
distro_path
,
true
,
function
(
packages
)
{
utils
.
get_files_list
(
distro_path
,
true
,
function
(
packages
)
{
...
@@ -162,6 +188,12 @@ function Client(socket) {
...
@@ -162,6 +188,12 @@ function Client(socket) {
__handler_get_file
(
socket
,
data
);
__handler_get_file
(
socket
,
data
);
});
});
socket
.
on
(
_e
.
package_info
,
function
(
data
)
{
if
(
!
utils
.
check_data_package
(
data
))
return
;
__send_package_info
(
socket
,
data
);
});
// on client disconnection close all watchers
// on client disconnection close all watchers
socket
.
on
(
'
disconnect
'
,
function
()
{
socket
.
on
(
'
disconnect
'
,
function
()
{
...
...
debomatic-webui/lib/config.js
View file @
d9d2976c
...
@@ -81,6 +81,7 @@ config.events.client = {};
...
@@ -81,6 +81,7 @@ config.events.client = {};
config
.
events
.
client
.
distribution_packages
=
'
c.distribution_packages
'
;
config
.
events
.
client
.
distribution_packages
=
'
c.distribution_packages
'
;
config
.
events
.
client
.
distribution_packages_status
=
'
c.distribution_packages_status
'
;
config
.
events
.
client
.
distribution_packages_status
=
'
c.distribution_packages_status
'
;
config
.
events
.
client
.
package_files_list
=
'
c.package_files_list
'
;
config
.
events
.
client
.
package_files_list
=
'
c.package_files_list
'
;
config
.
events
.
client
.
package_info
=
'
c.package_info
'
;
config
.
events
.
client
.
file
=
'
c.file
'
;
config
.
events
.
client
.
file
=
'
c.file
'
;
config
.
events
.
client
.
file_newcontent
=
'
c.file_newcontent
'
;
config
.
events
.
client
.
file_newcontent
=
'
c.file_newcontent
'
;
config
.
events
.
client
.
status
=
'
c.status
'
;
config
.
events
.
client
.
status
=
'
c.status
'
;
...
...
debomatic-webui/public/javascripts/page_distribution.js
View file @
d9d2976c
...
@@ -317,27 +317,6 @@ function Page_Distrubion(socket) {
...
@@ -317,27 +317,6 @@ function Page_Distrubion(socket) {
query_data
.
package
=
view
.
package
;
query_data
.
package
=
view
.
package
;
debug_socket
(
'
emit
'
,
_e
.
package_files_list
,
query_data
);
debug_socket
(
'
emit
'
,
_e
.
package_files_list
,
query_data
);
socket
.
emit
(
_e
.
package_files_list
,
query_data
);
socket
.
emit
(
_e
.
package_files_list
,
query_data
);
files
.
get_datestamp
();
}
},
get_datestamp
:
function
(
socket_data
)
{
if
(
Utils
.
check_view_package
(
view
))
{
if
(
socket_data
&&
socket_data
.
package
!=
view
.
package
.
orig_name
)
return
;
var
url
=
config
.
paths
.
debomatic
+
'
/
'
+
view
.
distribution
.
name
+
'
/pool/
'
+
view
.
package
.
orig_name
+
'
/
'
+
view
.
package
.
orig_name
+
'
.datestamp
'
;
debug
(
2
,
'
getting datestamp
'
);
$
.
get
(
url
,
function
(
data
)
{
data
=
data
.
replace
(
/
(\d
+:
\d
+
(
:
\d
+
)?)
$/mg
,
'
<b>$1</b>
'
);
data
=
data
.
replace
(
'
Build finished
'
,
'
finished
'
);
data
=
data
.
replace
(
'
Elapsed
'
,
'
elapsed
'
);
data
=
data
.
replace
(
/
\n
$/g
,
''
);
data
=
data
.
replace
(
/
\n
/g
,
'
-
'
);
data
=
data
.
replace
(
/at /g
,
''
);
$
(
"
#file .datestamp
"
).
html
(
data
);
});
}
}
},
},
select
:
function
()
{
select
:
function
()
{
...
@@ -358,6 +337,55 @@ function Page_Distrubion(socket) {
...
@@ -358,6 +337,55 @@ function Page_Distrubion(socket) {
},
},
};
};
var
package_info
=
{
set
:
function
(
socket_data
)
{
if
(
!
Utils
.
check_view_package
(
view
)
||
socket_data
.
package
!=
view
.
package
.
orig_name
)
{
return
;
}
function
get_time
(
timestamp
)
{
var
date
=
new
Date
(
timestamp
*
1000
);
var
locale
=
navigator
.
language
||
'
en-US
'
;
var
options
=
{
weekday
:
"
long
"
,
year
:
"
numeric
"
,
month
:
"
long
"
,
day
:
"
numeric
"
,
};
var
result
=
date
.
toLocaleDateString
(
locale
,
options
);
result
+=
'
<b>
'
+
date
.
toLocaleTimeString
()
+
'
</b>
'
;
return
result
;
}
var
info
=
""
;
if
(
socket_data
.
uploader
)
info
+=
"
Uploaded by
"
+
socket_data
.
uploader
+
'
-
'
;
info
+=
"
Build started
"
+
get_time
(
socket_data
.
start
);
if
(
socket_data
.
end
)
{
info
+=
'
- finished
'
+
get_time
(
socket_data
.
end
);
info
+=
'
- elapsed time: <b>
'
;
var
elapsed
=
new
Date
((
socket_data
.
end
-
socket_data
.
start
)
*
1000
);
if
(
elapsed
.
getUTCHours
()
>
0
)
info
+=
(
"
0
"
+
elapsed
.
getUTCHours
()).
slice
(
-
2
)
+
'
:
'
;
info
+=
(
"
0
"
+
elapsed
.
getUTCMinutes
()).
slice
(
-
2
)
+
'
:
'
+
(
"
0
"
+
elapsed
.
getUTCSeconds
()).
slice
(
-
2
);
}
$
(
"
#package_info
"
).
html
(
info
);
},
get
:
function
()
{
if
(
Utils
.
check_view_package
(
view
))
{
var
query_data
=
{};
query_data
.
distribution
=
view
.
distribution
;
query_data
.
package
=
view
.
package
;
debug_socket
(
'
emit
'
,
_e
.
package_info
,
query_data
);
socket
.
emit
(
_e
.
package_info
,
query_data
);
}
}
};
var
file
=
{
var
file
=
{
set
:
function
(
socket_data
)
{
set
:
function
(
socket_data
)
{
var
new_content
=
Utils
.
escape_html
(
socket_data
.
file
.
content
);
var
new_content
=
Utils
.
escape_html
(
socket_data
.
file
.
content
);
...
@@ -628,6 +656,7 @@ function Page_Distrubion(socket) {
...
@@ -628,6 +656,7 @@ function Page_Distrubion(socket) {
return
;
return
;
}
else
if
(
!
Utils
.
check_view_package
(
old_view
)
||
!
Utils
.
check_view_package
(
view
)
||
}
else
if
(
!
Utils
.
check_view_package
(
old_view
)
||
!
Utils
.
check_view_package
(
view
)
||
view
.
package
.
orig_name
!=
old_view
.
package
.
orig_name
)
{
// new package view
view
.
package
.
orig_name
!=
old_view
.
package
.
orig_name
)
{
// new package view
package_info
.
get
();
files
.
get
();
files
.
get
();
file
.
get
();
file
.
get
();
}
else
if
(
!
Utils
.
check_view_file
(
old_view
)
||
!
Utils
.
check_view_file
(
view
)
||
}
else
if
(
!
Utils
.
check_view_file
(
old_view
)
||
!
Utils
.
check_view_file
(
view
)
||
...
@@ -650,6 +679,7 @@ function Page_Distrubion(socket) {
...
@@ -650,6 +679,7 @@ function Page_Distrubion(socket) {
var
populate
=
function
()
{
var
populate
=
function
()
{
clean
();
clean
();
packages
.
get
();
packages
.
get
();
package_info
.
get
();
files
.
get
();
files
.
get
();
file
.
get
();
file
.
get
();
update
.
view
();
update
.
view
();
...
@@ -687,7 +717,9 @@ function Page_Distrubion(socket) {
...
@@ -687,7 +717,9 @@ function Page_Distrubion(socket) {
socket
.
on
(
config
.
events
.
broadcast
.
status_update
,
function
(
socket_data
)
{
socket
.
on
(
config
.
events
.
broadcast
.
status_update
,
function
(
socket_data
)
{
packages
.
set_status
(
socket_data
);
packages
.
set_status
(
socket_data
);
sticky
.
set_status
(
socket_data
);
sticky
.
set_status
(
socket_data
);
files
.
get_datestamp
(
socket_data
);
if
(
socket_data
.
distribution
==
view
.
distribution
.
name
&&
socket_data
.
package
==
view
.
package
.
orig_name
)
{
package_info
.
get
();
}
});
});
socket
.
on
(
_e
.
package_files_list
,
function
(
socket_data
)
{
socket
.
on
(
_e
.
package_files_list
,
function
(
socket_data
)
{
...
@@ -705,6 +737,11 @@ function Page_Distrubion(socket) {
...
@@ -705,6 +737,11 @@ function Page_Distrubion(socket) {
new_lines
.
push
(
socket_data
.
file
.
new_content
);
new_lines
.
push
(
socket_data
.
file
.
new_content
);
});
});
socket
.
on
(
_e
.
package_info
,
function
(
socket_data
)
{
debug_socket
(
'
received
'
,
_e
.
package_info
,
socket_data
);
package_info
.
set
(
socket_data
);
});
$
(
window
).
on
(
'
hashchange
'
,
function
()
{
$
(
window
).
on
(
'
hashchange
'
,
function
()
{
if
(
!
__check_hash_makes_sense
())
if
(
!
__check_hash_makes_sense
())
return
;
return
;
...
...
debomatic-webui/public/stylesheets/style.css
View file @
d9d2976c
...
@@ -189,15 +189,6 @@ footer .info {
...
@@ -189,15 +189,6 @@ footer .info {
color
:
#101010
;
color
:
#101010
;
}
}
#file
.datestamp
{
display
:
inline-block
;
background
:
#f4f4f4
;
padding
:
4px
10px
;
margin-bottom
:
10px
;
border-radius
:
4px
;
font-size
:
75%
;
}
#file
.preview
{
#file
.preview
{
overflow
:
hidden
;
overflow
:
hidden
;
}
}
...
@@ -206,3 +197,12 @@ footer .info {
...
@@ -206,3 +197,12 @@ footer .info {
padding
:
10px
12px
;
padding
:
10px
12px
;
float
:
right
;
float
:
right
;
}
}
#package_info
{
display
:
inline-block
;
background
:
#f4f4f4
;
padding
:
4px
10px
;
margin-bottom
:
10px
;
border-radius
:
4px
;
font-size
:
75%
;
}
debomatic-webui/views/distribution.ejs
View file @
d9d2976c
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
</header>
</header>
<div id="welcome"></div>
<div id="welcome"></div>
<div id="file">
<div id="file">
<div
class="datestamp
"></div>
<div
id="package_info
"></div>
<pre class="content"></pre>
<pre class="content"></pre>
<div id="fileOffset"></div>
<div id="fileOffset"></div>
</div>
</div>
...
...
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