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
Xiaowu Zhang
slapos.toolbox
Commits
1650be7b
Commit
1650be7b
authored
Jul 17, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: get rid off bad use of tests on var in javascript
parent
48eeebec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
slapos/runner/static/js/scripts/process.js
slapos/runner/static/js/scripts/process.js
+11
-11
No files found.
slapos/runner/static/js/scripts/process.js
View file @
1650be7b
/*jslint undef: true */
/*jslint undef: true */
/*global $, window, $SCRIPT_ROOT, setRunningState, setCookie, getCookie, deleteCookie */
/*global $, window, $SCRIPT_ROOT, setRunningState, setCookie, getCookie, deleteCookie */
/*global currentState: true, running: true, $current: true,
processType: true, currentProces
s: true */
/*global currentState: true, running: true, $current: true,
currentProcess: true, processType
s: true */
/*global sendStop: true, openedlogpage: true, logReadingPosition: true, speed: true */
/*global sendStop: true, openedlogpage: true, logReadingPosition: true, speed: true */
/*global isRunning: true */
/*global isRunning: true */
/* vim: set et sts=4: */
/* vim: set et sts=4: */
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
var
url
=
$SCRIPT_ROOT
+
"
/slapgridResult
"
;
var
url
=
$SCRIPT_ROOT
+
"
/slapgridResult
"
;
var
currentState
=
false
;
var
currentState
=
false
;
var
running
=
true
;
var
running
=
true
;
var
processType
=
""
;
var
currentProcess
=
""
;
var
currentProcess
;
var
processTypes
=
{
instance
:
"
instance
"
,
software
:
"
software
"
}
;
var
sendStop
=
false
;
var
sendStop
=
false
;
var
forcedStop
=
false
;
var
forcedStop
=
false
;
var
openedlogpage
=
""
;
//content software or instance if the current page is software or instance log, otherwise nothing
var
openedlogpage
=
""
;
//content software or instance if the current page is software or instance log, otherwise nothing
...
@@ -91,14 +91,14 @@ function getRunningState() {
...
@@ -91,14 +91,14 @@ function getRunningState() {
run_success
=
0
,
run_success
=
0
,
param
=
{
param
=
{
position
:
logReadingPosition
,
position
:
logReadingPosition
,
log
:
(
openedlogpage
!==
""
)
?
processType
.
toLowerCase
()
:
""
log
:
(
openedlogpage
!==
""
)
?
currentProcess
:
""
},
},
jqxhr
=
$
.
post
(
url
,
param
,
function
(
data
)
{
jqxhr
=
$
.
post
(
url
,
param
,
function
(
data
)
{
running
=
data
.
result
;
running
=
data
.
result
;
if
(
data
.
instance
.
state
)
{
if
(
data
.
instance
.
state
)
{
processType
=
"
Instance
"
;
currentProcess
=
processTypes
.
instance
;
}
else
if
(
data
.
software
.
state
)
{
}
else
if
(
data
.
software
.
state
)
{
processType
=
"
Software
"
;
currentProcess
=
processTypes
.
software
;
}
}
//show accurate right panel
//show accurate right panel
if
(
running
)
{
if
(
running
)
{
...
@@ -108,7 +108,7 @@ function getRunningState() {
...
@@ -108,7 +108,7 @@ function getRunningState() {
writeLogs
(
data
);
writeLogs
(
data
);
setRunningState
(
data
);
setRunningState
(
data
);
if
(
data
.
result
)
{
if
(
data
.
result
)
{
updateStatus
(
processType
.
toLowerCase
()
,
"
running
"
);
updateStatus
(
currentProcess
,
"
running
"
);
}
else
{
}
else
{
build_success
=
(
data
.
software
.
success
===
0
)?
"
terminated
"
:
"
failed
"
;
build_success
=
(
data
.
software
.
success
===
0
)?
"
terminated
"
:
"
failed
"
;
run_success
=
(
data
.
instance
.
success
===
0
)?
"
terminated
"
:
"
failed
"
;
run_success
=
(
data
.
instance
.
success
===
0
)?
"
terminated
"
:
"
failed
"
;
...
@@ -131,7 +131,7 @@ function stopProcess() {
...
@@ -131,7 +131,7 @@ function stopProcess() {
var
urlfor
=
$SCRIPT_ROOT
+
"
stopSlapgrid
"
,
var
urlfor
=
$SCRIPT_ROOT
+
"
stopSlapgrid
"
,
type
=
"
slapgrid-sr
"
;
type
=
"
slapgrid-sr
"
;
if
(
processType
===
"
Instance
"
)
{
if
(
currentProcess
===
processTypes
.
instance
)
{
type
=
"
slapgrid-cp
"
;
type
=
"
slapgrid-cp
"
;
}
}
$
.
post
(
urlfor
,
{
type
:
type
},
function
(
data
)
{
$
.
post
(
urlfor
,
{
type
:
type
},
function
(
data
)
{
...
@@ -229,13 +229,13 @@ function setRunningState(data) {
...
@@ -229,13 +229,13 @@ function setRunningState(data) {
}
}
}
else
{
}
else
{
if
(
$
(
"
#running
"
).
is
(
"
:visible
"
)
)
{
if
(
$
(
"
#running
"
).
is
(
"
:visible
"
)
)
{
$
(
"
#error
"
).
Popup
(
"
Slapgrid finished running your
"
+
processType
+
"
P
rofile
"
,
{
type
:
'
info
'
,
duration
:
3000
});
$
(
"
#error
"
).
Popup
(
"
Slapgrid finished running your
"
+
currentProcess
+
"
p
rofile
"
,
{
type
:
'
info
'
,
duration
:
3000
});
if
(
forcedStop
)
{
if
(
forcedStop
)
{
updateStatus
(
'
instance
'
,
'
stopped
'
);
updateStatus
(
'
instance
'
,
'
stopped
'
);
updateStatus
(
'
software
'
,
'
stopped
'
);
updateStatus
(
'
software
'
,
'
stopped
'
);
}
}
else
{
else
{
updateStatus
(
processType
.
toLowerCase
()
,
'
terminated
'
);
updateStatus
(
currentProcess
,
'
terminated
'
);
}
}
//Update window!!!
//Update window!!!
$
(
"
#slapswitch
"
).
attr
(
'
rel
'
,
'
opend
'
);
$
(
"
#slapswitch
"
).
attr
(
'
rel
'
,
'
opend
'
);
...
@@ -256,7 +256,7 @@ function setRunningState(data) {
...
@@ -256,7 +256,7 @@ function setRunningState(data) {
function
runProcess
(
urlfor
)
{
function
runProcess
(
urlfor
)
{
"
use strict
"
;
"
use strict
"
;
if
(
!
isRunning
())
{
if
(
!
isRunning
())
{
currentProcess
=
$
.
post
(
urlfor
);
$
.
post
(
urlfor
);
if
(
$
(
"
#running_info
"
).
children
(
'
span
'
).
length
>
0
)
{
if
(
$
(
"
#running_info
"
).
children
(
'
span
'
).
length
>
0
)
{
$
(
"
#running_info
"
).
children
(
'
p
'
).
remove
();
$
(
"
#running_info
"
).
children
(
'
p
'
).
remove
();
}
}
...
...
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