Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hardik Juneja
slapos.toolbox
Commits
a85d892f
Commit
a85d892f
authored
Jul 17, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: /viewLog correctly displays the actual status of last slapgrid run
parent
16aae696
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
41 deletions
+50
-41
slapos/runner/static/css/styles.css
slapos/runner/static/css/styles.css
+1
-1
slapos/runner/static/js/scripts/process.js
slapos/runner/static/js/scripts/process.js
+49
-40
No files found.
slapos/runner/static/css/styles.css
View file @
a85d892f
...
@@ -534,7 +534,7 @@ padding: 10px;height: 80px;padding-bottom:15px;}
...
@@ -534,7 +534,7 @@ padding: 10px;height: 80px;padding-bottom:15px;}
.log_info_box
div
.state_terminated
span
{
.log_info_box
div
.state_terminated
span
{
background
:
#00C800
;
background
:
#00C800
;
}
}
.log_info_box
div
.state_waiting
span
,
.log_info_box
div
.state_stopped
span
{
.log_info_box
div
.state_waiting
span
,
.log_info_box
div
.state_stopped
span
,
.log_info_box
div
.state_failed
span
{
background
:
#FF3131
;
background
:
#FF3131
;
}
}
...
...
slapos/runner/static/js/scripts/process.js
View file @
a85d892f
...
@@ -49,10 +49,46 @@ function removeFirstLog() {
...
@@ -49,10 +49,46 @@ function removeFirstLog() {
$
(
"
#salpgridLog p:first-child
"
).
remove
();
$
(
"
#salpgridLog p:first-child
"
).
remove
();
}
}
function
writeLogs
(
data
)
{
"
use strict
"
;
var
log_info
=
""
,
size
=
data
.
content
.
position
-
logReadingPosition
;
if
(
size
<
0
)
{
clearAll
();
}
if
(
logReadingPosition
!==
0
&&
data
.
content
.
truncated
)
{
log_info
=
"
<p class='info' rel='0'>SLAPRUNNER INFO: SLAPGRID-LOG HAS BEEN TRUNCATED HERE. To see full log reload your log page</p>
"
;
}
logReadingPosition
=
data
.
content
.
position
;
if
(
data
.
content
.
content
!==
""
)
{
if
(
data
.
content
.
content
!==
""
)
{
$
(
"
#salpgridLog
"
).
append
(
log_info
+
"
<p rel='
"
+
size
+
"
'>
"
+
data
.
content
.
content
.
toHtmlChar
()
+
"
</p>
"
);
$
(
"
#salpgridLog
"
)
.
scrollTop
(
$
(
"
#salpgridLog
"
)[
0
].
scrollHeight
-
$
(
"
#salpgridLog
"
).
height
());
}
}
if
(
running
&&
openedlogpage
!==
""
)
{
$
(
"
#salpgridLog
"
).
show
();
$
(
"
#manualLog
"
).
hide
();
$
(
"
#slapstate
"
).
show
();
$
(
"
#openloglist
"
).
hide
();
}
currentLogSize
+=
parseInt
(
size
,
10
);
if
(
currentLogSize
>
maxLogSize
)
{
//Remove the first element into log div
removeFirstLog
();
if
(
currentLogSize
>
maxLogSize
)
{
removeFirstLog
();
//in cas of previous <p/> size is 0
}
}
}
function
getRunningState
()
{
function
getRunningState
()
{
"
use strict
"
;
"
use strict
"
;
var
size
=
0
,
var
build_success
=
0
,
log_info
=
""
,
run_success
=
0
,
param
=
{
param
=
{
position
:
logReadingPosition
,
position
:
logReadingPosition
,
log
:
(
openedlogpage
!==
""
)
?
processType
.
toLowerCase
()
:
""
log
:
(
openedlogpage
!==
""
)
?
processType
.
toLowerCase
()
:
""
...
@@ -64,35 +100,15 @@ function getRunningState() {
...
@@ -64,35 +100,15 @@ function getRunningState() {
}
else
if
(
data
.
software
.
state
)
{
}
else
if
(
data
.
software
.
state
)
{
processType
=
"
Software
"
;
processType
=
"
Software
"
;
}
}
writeLogs
(
data
);
setRunningState
(
data
);
setRunningState
(
data
);
size
=
data
.
content
.
position
-
logReadingPosition
;
if
(
data
.
result
)
{
if
(
size
<
0
)
{
updateStatus
(
processType
.
toLowerCase
(),
"
running
"
);
clearAll
();
}
else
{
}
build_success
=
(
data
.
software
.
success
===
0
)?
"
terminated
"
:
"
failed
"
;
if
(
logReadingPosition
!==
0
&&
data
.
content
.
truncated
)
{
run_success
=
(
data
.
instance
.
success
===
0
)?
"
terminated
"
:
"
failed
"
;
log_info
=
"
<p class='info' rel='0'>SLAPRUNNER INFO: SLAPGRID-LOG HAS BEEN TRUNCATED HERE. To see full log reload your log page</p>
"
;
updateStatus
(
"
software
"
,
build_success
);
}
updateStatus
(
"
instance
"
,
run_success
);
logReadingPosition
=
data
.
content
.
position
;
if
(
data
.
content
.
content
!==
""
)
{
if
(
data
.
content
.
content
!==
""
)
{
$
(
"
#salpgridLog
"
).
append
(
log_info
+
"
<p rel='
"
+
size
+
"
'>
"
+
data
.
content
.
content
.
toHtmlChar
()
+
"
</p>
"
);
$
(
"
#salpgridLog
"
)
.
scrollTop
(
$
(
"
#salpgridLog
"
)[
0
].
scrollHeight
-
$
(
"
#salpgridLog
"
).
height
());
}
}
if
(
running
&&
openedlogpage
!==
""
)
{
$
(
"
#salpgridLog
"
).
show
();
$
(
"
#manualLog
"
).
hide
();
$
(
"
#slapstate
"
).
show
();
$
(
"
#openloglist
"
).
hide
();
}
currentLogSize
+=
parseInt
(
size
,
10
);
if
(
currentLogSize
>
maxLogSize
)
{
//Remove the first element into log div
removeFirstLog
();
if
(
currentLogSize
>
maxLogSize
)
{
removeFirstLog
();
//in cas of previous <p/> size is 0
}
}
}
}).
error
(
function
()
{
}).
error
(
function
()
{
clearAll
(
false
);
clearAll
(
false
);
...
@@ -169,8 +185,9 @@ function updateStatus(elt, val) {
...
@@ -169,8 +185,9 @@ function updateStatus(elt, val) {
break
;
break
;
case
"
running
"
:
case
"
running
"
:
$
(
src
).
children
(
'
p
'
).
text
(
"
Processing
"
);
$
(
src
).
children
(
'
p
'
).
text
(
"
Processing
"
);
processType
=
elt
;
break
;
getRunningState
()
case
"
failed
"
:
$
(
src
).
children
(
'
p
'
).
text
(
"
Failed
"
);
break
;
break
;
}
}
// in case of failure
// in case of failure
...
@@ -203,13 +220,6 @@ function setRunningState(data) {
...
@@ -203,13 +220,6 @@ function setRunningState(data) {
$
(
"
#softrun
"
).
addClass
(
'
slapos_stop
'
);
$
(
"
#softrun
"
).
addClass
(
'
slapos_stop
'
);
$
(
"
#running img
"
).
before
(
'
<p id="running_info" class="instance">Running instance...</p>
'
);
$
(
"
#running img
"
).
before
(
'
<p id="running_info" class="instance">Running instance...</p>
'
);
}
}
if
(
processType
===
"
Software
"
)
{
running
=
false
;
$
(
"
#running_info
"
).
remove
();
$
(
"
#softrun
"
).
addClass
(
'
slapos_run
'
);
$
(
"
#softrun
"
).
removeClass
(
'
slapos_stop
'
);
$
(
"
#instrun
"
).
click
();
}
}
}
}
}
}
else
{
}
else
{
...
@@ -228,7 +238,6 @@ function setRunningState(data) {
...
@@ -228,7 +238,6 @@ function setRunningState(data) {
}
}
$
(
"
#running
"
).
hide
();
$
(
"
#running
"
).
hide
();
$
(
"
#running_info
"
).
remove
();
$
(
"
#running_info
"
).
remove
();
running
=
false
;
//nothing is currently running
$
(
"
#softrun
"
).
removeClass
(
'
slapos_stop
'
);
$
(
"
#softrun
"
).
removeClass
(
'
slapos_stop
'
);
$
(
"
#softrun
"
).
addClass
(
'
slapos_run
'
);
$
(
"
#softrun
"
).
addClass
(
'
slapos_run
'
);
if
(
$
(
"
#running
"
).
children
(
'
span
'
).
length
>
0
)
{
if
(
$
(
"
#running
"
).
children
(
'
span
'
).
length
>
0
)
{
...
...
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