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
Łukasz Nowak
slapos.toolbox
Commits
c7b58897
Commit
c7b58897
authored
Feb 14, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update log management, add custom log file...
Conflicts: slapos/runner/views.py
parent
b8c15775
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
448 additions
and
104 deletions
+448
-104
slapos/runner/static/css/styles.css
slapos/runner/static/css/styles.css
+12
-7
slapos/runner/static/images/plus.png
slapos/runner/static/images/plus.png
+0
-0
slapos/runner/static/js/scripts/process.js
slapos/runner/static/js/scripts/process.js
+68
-22
slapos/runner/static/js/scripts/softwareFolder.js
slapos/runner/static/js/scripts/softwareFolder.js
+1
-1
slapos/runner/static/js/scripts/viewlog.js
slapos/runner/static/js/scripts/viewlog.js
+267
-23
slapos/runner/templates/layout.html
slapos/runner/templates/layout.html
+5
-7
slapos/runner/templates/viewLog.html
slapos/runner/templates/viewLog.html
+60
-25
slapos/runner/views.py
slapos/runner/views.py
+35
-19
No files found.
slapos/runner/static/css/styles.css
View file @
c7b58897
...
@@ -94,7 +94,7 @@ body {
...
@@ -94,7 +94,7 @@ body {
font-size
:
1.08em
;
font-size
:
1.08em
;
color
:
#2D73B1
;
color
:
#2D73B1
;
}
}
#running
p
.
instanc
e
{
#running
p
.
softwar
e
{
border-left
:
4px
solid
#1E73BD
;
border-left
:
4px
solid
#1E73BD
;
}
}
#running
img
{
#running
img
{
...
@@ -476,12 +476,11 @@ padding: 10px;height: 80px;padding-bottom:15px;}
...
@@ -476,12 +476,11 @@ padding: 10px;height: 80px;padding-bottom:15px;}
}
}
.log_info_box
h2
{
.log_info_box
h2
{
font-weight
:
bold
;
font-weight
:
bold
;
padding
:
5
px
;
padding
:
2
px
;
padding-left
:
20px
;
padding-left
:
20px
;
text-align
:
left
;
text-align
:
left
;
color
:
#fff
;
color
:
#fff
;
display
:
block
;
display
:
block
;
height
:
20px
;
font-size
:
16px
;
font-size
:
16px
;
margin-top
:
20px
;
margin-top
:
20px
;
}
}
...
@@ -489,20 +488,26 @@ padding: 10px;height: 80px;padding-bottom:15px;}
...
@@ -489,20 +488,26 @@ padding: 10px;height: 80px;padding-bottom:15px;}
margin-top
:
0
;
margin-top
:
0
;
}
}
.log_info_box
h2
.software
{
.log_info_box
h2
.software
,
h2
.boxtitle
{
background
:
#1E73BD
;
background
:
#1E73BD
;
}
}
.log_info_box
h2
.instance
{
.log_info_box
h2
.instance
{
background
:
#C753C4
;
background
:
#C753C4
;
}
}
.log_info_box
ul
li
{
padding
:
5px
;
font-size
:
14px
;
color
:
#777B7C
;
font-weight
:
bold
;
margin
:
3px
0
;
cursor
:
pointer
;
border
:
1px
solid
#fff
}
.log_info_box
ul
li
:hover
{
background
:
#EBEBEB
}
.log_info_box
ul
li
.checked
{
border
:
1px
solid
#DADADA
}
.add_btn
{
background
:
url(../images/plus.png)
center
left
no-repeat
;
display
:
block
;
margin
:
2px
;
opacity
:
0.6
;
min-width
:
22px
;
height
:
22px
;
text-indent
:
30px
;
font-weight
:
bold
;
padding-top
:
7px
;}
.add_btn
:hover
{
opacity
:
1
;}
#s
r
_run_state
,
#instance_run_state
{
#s
oftware
_run_state
,
#instance_run_state
{
color
:
#000
;
color
:
#000
;
font-weight
:
bold
;
font-weight
:
bold
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
#s
r
_run_state
p
,
#instance_run_state
p
{
#s
oftware
_run_state
p
,
#instance_run_state
p
{
padding-top
:
3
px
;
padding-top
:
2
px
;
font-size
:
16px
;
font-size
:
16px
;
}
}
...
...
slapos/runner/static/images/plus.png
0 → 100644
View file @
c7b58897
266 Bytes
slapos/runner/static/js/scripts/process.js
View file @
c7b58897
...
@@ -10,10 +10,10 @@
...
@@ -10,10 +10,10 @@
var
url
=
$SCRIPT_ROOT
+
"
/slapgridResult
"
;
var
url
=
$SCRIPT_ROOT
+
"
/slapgridResult
"
;
var
currentState
=
false
;
var
currentState
=
false
;
var
running
=
true
;
var
running
=
true
;
var
$current
;
var
processType
=
""
;
var
processType
=
""
;
var
currentProcess
;
var
currentProcess
;
var
sendStop
=
false
;
var
sendStop
=
false
;
var
forcedStop
=
false
;
var
processState
=
"
Checking
"
;
//define slapgrid running state
var
processState
=
"
Checking
"
;
//define slapgrid running state
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
var
logReadingPosition
=
0
;
var
logReadingPosition
=
0
;
...
@@ -56,7 +56,7 @@ function getRunningState() {
...
@@ -56,7 +56,7 @@ function getRunningState() {
log_info
=
""
,
log_info
=
""
,
param
=
{
param
=
{
position
:
logReadingPosition
,
position
:
logReadingPosition
,
log
:
(
processState
!==
"
Checking
"
&&
openedlogpage
===
processType
.
toLowerCase
())
?
openedlogpage
:
""
log
:
(
processState
!==
"
Checking
"
&&
openedlogpage
!==
""
)
?
processType
.
toLowerCase
()
:
""
},
},
jqxhr
=
$
.
post
(
url
,
param
,
function
(
data
)
{
jqxhr
=
$
.
post
(
url
,
param
,
function
(
data
)
{
setRunningState
(
data
);
setRunningState
(
data
);
...
@@ -75,6 +75,8 @@ function getRunningState() {
...
@@ -75,6 +75,8 @@ function getRunningState() {
if
(
running
&&
processState
===
"
Checking
"
&&
openedlogpage
!==
""
)
{
if
(
running
&&
processState
===
"
Checking
"
&&
openedlogpage
!==
""
)
{
$
(
"
#salpgridLog
"
).
show
();
$
(
"
#salpgridLog
"
).
show
();
$
(
"
#manualLog
"
).
hide
();
$
(
"
#manualLog
"
).
hide
();
$
(
"
#slapstate
"
).
show
();
$
(
"
#openloglist
"
).
hide
();
}
}
processState
=
running
?
"
Running
"
:
"
Stopped
"
;
processState
=
running
?
"
Running
"
:
"
Stopped
"
;
currentLogSize
+=
parseInt
(
size
,
10
);
currentLogSize
+=
parseInt
(
size
,
10
);
...
@@ -107,7 +109,7 @@ function stopProcess() {
...
@@ -107,7 +109,7 @@ function stopProcess() {
var
urlfor
=
$SCRIPT_ROOT
+
"
stopSlapgrid
"
,
var
urlfor
=
$SCRIPT_ROOT
+
"
stopSlapgrid
"
,
type
=
"
slapgrid-sr
"
;
type
=
"
slapgrid-sr
"
;
if
(
$
(
"
#instrun
"
).
text
()
===
"
Stop i
nstance
"
)
{
if
(
processType
===
"
I
nstance
"
)
{
type
=
"
slapgrid-cp
"
;
type
=
"
slapgrid-cp
"
;
}
}
$
.
post
(
urlfor
,
{
type
:
type
},
function
(
data
)
{
$
.
post
(
urlfor
,
{
type
:
type
},
function
(
data
)
{
...
@@ -121,6 +123,7 @@ function stopProcess() {
...
@@ -121,6 +123,7 @@ function stopProcess() {
.
complete
(
function
()
{
.
complete
(
function
()
{
sendStop
=
false
;
sendStop
=
false
;
processState
=
"
Stopped
"
;
processState
=
"
Stopped
"
;
forcedStop
=
true
;
});
});
}
}
}
}
...
@@ -128,29 +131,50 @@ function stopProcess() {
...
@@ -128,29 +131,50 @@ function stopProcess() {
function
bindRun
()
{
function
bindRun
()
{
"
use strict
"
;
"
use strict
"
;
$
(
"
#softrun
"
).
click
(
function
()
{
$
(
"
#softrun
"
).
click
(
function
()
{
if
(
$
(
"
#softrun
"
).
text
()
===
"
Stop software
"
)
{
if
(
$
(
this
).
hasClass
(
'
slapos_stop
'
)
)
{
stopProcess
();
stopProcess
();
}
else
{
}
else
{
if
(
!
isRunning
())
{
if
(
!
isRunning
())
{
setCookie
(
"
slapgridCMD
"
,
"
Software
"
);
setCookie
(
"
slapgridCMD
"
,
"
Software
"
);
window
.
location
.
href
=
$SCRIPT_ROOT
+
"
/view
Software
Log
"
;
window
.
location
.
href
=
$SCRIPT_ROOT
+
"
/viewLog
"
;
}
}
}
}
return
false
;
return
false
;
});
});
$
(
"
#instrun
"
).
click
(
function
()
{
$
(
"
#instrun
"
).
click
(
function
()
{
if
(
$
(
"
#
instrun
"
).
text
()
===
"
Stop instance
"
)
{
if
(
$
(
"
#
softrun
"
).
hasClass
(
'
slapos_stop
'
)
)
{
stopProcess
();
stopProcess
();
}
else
{
}
else
{
if
(
!
isRunning
())
{
if
(
!
isRunning
())
{
setCookie
(
"
slapgridCMD
"
,
"
Instance
"
);
setCookie
(
"
slapgridCMD
"
,
"
Instance
"
);
window
.
location
.
href
=
$SCRIPT_ROOT
+
"
/view
Instance
Log
"
;
window
.
location
.
href
=
$SCRIPT_ROOT
+
"
/viewLog
"
;
}
}
}
}
return
false
;
return
false
;
});
});
}
}
function
updateStatus
(
elt
,
val
)
{
"
use strict
"
;
var
src
=
'
#
'
+
elt
+
'
_run_state
'
,
value
=
'
state_
'
+
val
;
$
(
src
).
removeClass
();
$
(
src
).
addClass
(
value
);
switch
(
val
)
{
case
"
waiting
"
:
$
(
src
).
children
(
'
p
'
).
text
(
"
Waiting for starting
"
);
break
;
case
"
stopped
"
:
$
(
src
).
children
(
'
p
'
).
text
(
"
Stopped by user
"
);
break
;
case
"
terminated
"
:
$
(
src
).
children
(
'
p
'
).
text
(
"
Complete
"
);
break
;
case
"
running
"
:
$
(
src
).
children
(
'
p
'
).
text
(
"
Processing
"
);
break
;
}
}
function
setRunningState
(
data
)
{
function
setRunningState
(
data
)
{
"
use strict
"
;
"
use strict
"
;
if
(
data
.
result
)
{
if
(
data
.
result
)
{
...
@@ -159,31 +183,45 @@ function setRunningState(data) {
...
@@ -159,31 +183,45 @@ function setRunningState(data) {
running
=
true
;
running
=
true
;
//change run menu title and style
//change run menu title and style
if
(
data
.
software
)
{
if
(
data
.
software
)
{
$
(
"
#softrun
"
).
empty
();
if
(
$
(
"
#running
"
).
children
(
'
span
'
).
length
===
0
)
{
$
(
"
#softrun
"
).
append
(
"
Stop software
"
);
$
(
"
#softrun
"
).
removeClass
(
'
slapos_run
'
);
$
(
"
#softrun
"
).
css
(
"
color
"
,
"
#0271BF
"
);
$
(
"
#softrun
"
).
addClass
(
'
slapos_stop
'
);
$current
=
$
(
"
#softrun
"
);
$
(
"
#running img
"
).
before
(
'
<p id="running_info" class="software">Building software...</p>
'
);
}
processType
=
"
Software
"
;
processType
=
"
Software
"
;
}
}
if
(
data
.
instance
)
{
if
(
data
.
instance
)
{
$
(
"
#instrun
"
).
empty
();
///Draft!!
$
(
"
#instrun
"
).
append
(
"
Stop instance
"
);
if
(
$
(
"
#running
"
).
children
(
'
span
'
).
length
===
0
)
{
$
(
"
#instrun
"
).
css
(
"
color
"
,
"
#0271BF
"
);
$
(
"
#softrun
"
).
removeClass
(
'
slapos_run
'
);
$current
=
$
(
"
#instrun
"
);
$
(
"
#softrun
"
).
addClass
(
'
slapos_stop
'
);
$
(
"
#running img
"
).
before
(
'
<p id="running_info" class="instance">Running instance...</p>
'
);
}
processType
=
"
Instance
"
;
processType
=
"
Instance
"
;
}
}
}
}
}
else
{
}
else
{
if
(
$
(
"
#running
"
).
is
(
"
:visible
"
)
)
{
$
(
"
#error
"
).
Popup
(
"
Slapgrid finished running your
"
+
processType
+
"
Profile
"
,
{
type
:
'
info
'
,
duration
:
3000
});
if
(
forcedStop
)
{
updateStatus
(
'
instance
'
,
'
stopped
'
);
updateStatus
(
'
software
'
,
'
stopped
'
);
}
else
{
updateStatus
(
processType
.
toLowerCase
(),
'
terminated
'
);
}
//Update window!!!
$
(
"
#slapswitch
"
).
attr
(
'
rel
'
,
'
opend
'
);
$
(
"
#slapswitch
"
).
text
(
'
Access application
'
);
}
$
(
"
#running
"
).
hide
();
$
(
"
#running
"
).
hide
();
running
=
false
;
//nothing is currently running
running
=
false
;
//nothing is currently running
if
(
$current
!==
undefined
)
{
$
(
"
#softrun
"
).
removeClass
(
'
slapos_stop
'
);
$current
.
empty
();
$
(
"
#softrun
"
).
addClass
(
'
slapos_run
'
);
$current
.
append
(
"
Run
"
+
processType
.
toLowerCase
());
if
(
$
(
"
#running
"
).
children
(
'
span
'
).
length
>
0
)
{
$current
.
css
(
"
color
"
,
"
#275777
"
);
$
(
"
#running
"
).
children
(
'
p
'
).
remove
();
$current
=
undefined
;
currentState
=
false
;
$
(
"
#error
"
).
Popup
(
"
Slapgrid finished running your
"
+
processType
+
"
Profile
"
,
{
type
:
'
info
'
,
duration
:
3000
});
}
}
currentState
=
false
;
}
}
currentState
=
data
.
result
;
currentState
=
data
.
result
;
}
}
...
@@ -197,6 +235,9 @@ function runProcess(urlfor, data) {
...
@@ -197,6 +235,9 @@ function runProcess(urlfor, data) {
.
error
(
function
()
{
.
error
(
function
()
{
$
(
"
#error
"
).
Popup
(
"
Failled to run Slapgrid
"
,
{
type
:
'
error
'
,
duration
:
3000
});
$
(
"
#error
"
).
Popup
(
"
Failled to run Slapgrid
"
,
{
type
:
'
error
'
,
duration
:
3000
});
});
});
if
(
$
(
"
#running_info
"
).
children
(
'
span
'
).
length
>
0
)
{
$
(
"
#running_info
"
).
children
(
'
p
'
).
remove
();
}
setRunningState
(
data
);
setRunningState
(
data
);
setTimeout
(
getRunningState
,
6000
);
setTimeout
(
getRunningState
,
6000
);
}
}
...
@@ -208,14 +249,19 @@ function checkSavedCmd() {
...
@@ -208,14 +249,19 @@ function checkSavedCmd() {
if
(
!
result
)
{
if
(
!
result
)
{
return
false
;
return
false
;
}
}
forcedStop
=
false
;
if
(
result
===
"
Software
"
)
{
if
(
result
===
"
Software
"
)
{
running
=
false
;
running
=
false
;
runProcess
((
$SCRIPT_ROOT
+
"
/runSoftwareProfile
"
),
runProcess
((
$SCRIPT_ROOT
+
"
/runSoftwareProfile
"
),
{
result
:
true
,
instance
:
false
,
software
:
true
});
{
result
:
true
,
instance
:
false
,
software
:
true
});
updateStatus
(
'
software
'
,
'
running
'
);
updateStatus
(
'
instance
'
,
'
waiting
'
);
}
else
if
(
result
===
"
Instance
"
)
{
}
else
if
(
result
===
"
Instance
"
)
{
running
=
false
;
running
=
false
;
runProcess
((
$SCRIPT_ROOT
+
"
/runInstanceProfile
"
),
runProcess
((
$SCRIPT_ROOT
+
"
/runInstanceProfile
"
),
{
result
:
true
,
instance
:
true
,
software
:
false
});
{
result
:
true
,
instance
:
true
,
software
:
false
});
updateStatus
(
'
software
'
,
'
terminated
'
);
updateStatus
(
'
instance
'
,
'
running
'
);
}
}
deleteCookie
(
"
slapgridCMD
"
);
deleteCookie
(
"
slapgridCMD
"
);
return
(
result
!==
null
);
return
(
result
!==
null
);
...
...
slapos/runner/static/js/scripts/softwareFolder.js
View file @
c7b58897
...
@@ -551,7 +551,7 @@ $(document).ready(function () {
...
@@ -551,7 +551,7 @@ $(document).ready(function () {
function
addToFavourite
(
filepath
){
function
addToFavourite
(
filepath
){
var
i
=
favourite_list
.
length
,
var
i
=
favourite_list
.
length
,
filename
=
filepath
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
;
filename
=
filepath
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
if
(
i
===
0
){
if
(
i
===
0
){
$
(
"
#tooltip-filelist ul
"
).
empty
();
$
(
"
#tooltip-filelist ul
"
).
empty
();
}
}
...
...
slapos/runner/static/js/scripts/viewlog.js
View file @
c7b58897
This diff is collapsed.
Click to expand it.
slapos/runner/templates/layout.html
View file @
c7b58897
...
@@ -70,9 +70,7 @@
...
@@ -70,9 +70,7 @@
<div
class=
"line"
></div>
<div
class=
"line"
></div>
<h2
class=
"info"
>
{% block title %}{% endblock %} - {{session.title}}
</h2>
<h2
class=
"info"
>
{% block title %}{% endblock %} - {{session.title}}
</h2>
<div
class=
"run"
>
<div
class=
"run"
>
<div
id=
"running"
>
<div
id=
"running"
style=
"display:none"
>
<p
id=
"running_info"
class=
'software'
>
Building software...
</p>
<!--<p id="running_info" class='instance'>Running instance...</p>-->
<img
alt=
""
src=
"{{ url_for('static', filename='images/ajax_roller.gif') }}"
height=
'26'
title=
"slapgrid is currently running"
/>
<img
alt=
""
src=
"{{ url_for('static', filename='images/ajax_roller.gif') }}"
height=
'26'
title=
"slapgrid is currently running"
/>
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
</div>
...
@@ -82,8 +80,8 @@
...
@@ -82,8 +80,8 @@
<ul
class=
"sf-menu"
>
<ul
class=
"sf-menu"
>
<li><a
href=
"{{ url_for('editCurrentProject') }}"
>
Editor
</a></li>
<li><a
href=
"{{ url_for('editCurrentProject') }}"
>
Editor
</a></li>
<li><a
href=
"{{ url_for('inspectInstance') }}"
>
Services
</a></li>
<li><a
href=
"{{ url_for('inspectInstance') }}"
>
Services
</a></li>
<li><a
href=
"{{ url_for('view
Instance
Log') }}"
>
Logs
</a></li>
<li><a
href=
"{{ url_for('viewLog') }}"
>
Logs
</a></li>
<li><a
href=
"{{ url_for('view
Software
Log') }}"
>
Terminal
</a></li>
<li><a
href=
"{{ url_for('viewLog') }}"
>
Terminal
</a></li>
<li><a
href=
"{{ url_for('manageRepository')}}#tab2"
>
Git
</a></li>
<li><a
href=
"{{ url_for('manageRepository')}}#tab2"
>
Git
</a></li>
<li
class=
'right_menu main_menu'
><a
href=
"#"
></a>
<li
class=
'right_menu main_menu'
><a
href=
"#"
></a>
<ul>
<ul>
...
@@ -93,7 +91,7 @@
...
@@ -93,7 +91,7 @@
<li><a
href=
"{{ url_for('openProject', method='new')}}"
>
Create Software Release
</a></li>
<li><a
href=
"{{ url_for('openProject', method='new')}}"
>
Create Software Release
</a></li>
<li
class=
'sep'
></li>
<li
class=
'sep'
></li>
<li><a
href=
"{{ url_for('removeInstance') }}"
id=
"removeIst"
>
Destroy All Services
</a></li>
<li><a
href=
"{{ url_for('removeInstance') }}"
id=
"removeIst"
>
Destroy All Services
</a></li>
<li><a
href=
"{{ url_for('runInstanceProfile') }}"
>
Redeploy Services
</a></li>
<li><a
href=
"{{ url_for('runInstanceProfile') }}"
id=
"instrun"
>
Redeploy Services
</a></li>
<li
class=
'sep'
></li>
<li
class=
'sep'
></li>
<li><a
href=
"{{ url_for('browseWorkspace') }}"
>
Browse Workspace
</a></li>
<li><a
href=
"{{ url_for('browseWorkspace') }}"
>
Browse Workspace
</a></li>
<li><a
href=
"{{ url_for('inspectSoftware') }}"
>
My Softwares Releases
</a></li>
<li><a
href=
"{{ url_for('inspectSoftware') }}"
>
My Softwares Releases
</a></li>
...
@@ -101,7 +99,7 @@
...
@@ -101,7 +99,7 @@
<li><a
href=
"{{ url_for('dologout') }}"
>
Log out
</a></li>
<li><a
href=
"{{ url_for('dologout') }}"
>
Log out
</a></li>
</ul>
</ul>
</li>
</li>
<li
class=
'right_menu slapos_run'
><a
href=
"{{ url_for('runSoftwareProfile') }}"
id=
"instrun
"
></a>
<li
class=
'right_menu slapos_run'
id=
"softrun"
><a
href=
"{{ url_for('runSoftwareProfile') }}
"
></a>
<!--<li class='right_menu slapos_top'><a href="{{ url_for('runInstanceProfile') }}" id="instrun"></a>-->
<!--<li class='right_menu slapos_top'><a href="{{ url_for('runInstanceProfile') }}" id="instrun"></a>-->
</li>
</li>
</ul>
</ul>
...
...
slapos/runner/templates/viewLog.html
View file @
c7b58897
{% extends "layout.html" %}
{% extends "layout.html" %}
{% block title %}View
{{ type }}
log{% endblock %}
{% block title %}View log{% endblock %}
{% block head %}
{% block head %}
{{ super() }}
{{ super() }}
<script
src=
"{{ url_for('static', filename='js/scripts/viewlog.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<script
src=
"{{ url_for('static', filename='js/scripts/viewlog.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<link
href=
"{{ url_for('static', filename='css/ui.fancytree.css', _external=False) }}"
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
/>
<script
src=
"{{ url_for('static', filename='js/jquery/jquery.fancytree.min.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<link
href=
"{{ url_for('static', filename='css/colorbox.css', _external=False) }}"
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
/>
<script
src=
"{{ url_for('static', filename='js/jquery/jquery.colorbox-min.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
{% endblock %}
{% endblock %}
{% block body %}
{% block body %}
<input
type=
"hidden"
name=
"type"
value=
"{{type}}"
id=
"type"
/>
<h2
class=
"hight hide"
id=
"logheader"
>
Slapgrid result for {{ type }}
</h2>
<h2
class=
"hight hide"
id=
"logheader"
>
Inspecting current slapgrid log - Click for more options
</h2>
<div
class=
"log_btn"
id=
"logconfigbox"
style=
"display:none"
>
<div
class=
"log_btn"
id=
"logconfigbox"
style=
"display:none"
>
<span
style=
"margin-left:15px; font-size: 18px;"
>
Update parameters
</span>
<span
style=
"margin-left:15px; font-size: 18px;"
>
Update parameters
</span>
...
@@ -20,37 +25,67 @@
...
@@ -20,37 +25,67 @@
<div
class=
'space'
></div>
<div
class=
'space'
></div>
<div
class=
"log_content"
>
<div
class=
"log_content"
>
<div
class=
"log"
id=
"salpgridLog"
></div>
<div
class=
"log"
id=
"salpgridLog"
></div>
<
textarea
class=
"log"
readonly
id=
"manualLog"
style=
"display:none"
>
{{result}}
</textarea
>
<
div
class=
"log"
id=
"manualLog"
style=
"display:none"
></div
>
</div>
</div>
<div
class=
"log_information"
>
<div
class=
"log_information"
>
<div
class=
"log_info_box"
>
<div
class=
"log_info_box"
>
<h2
class=
"software"
>
Building State
</h2>
<div
id=
"slapstate"
>
<div
class=
"log_content_box"
>
<h2
class=
"software"
>
Building State
</h2>
<div
id=
"sr_run_state"
class=
"state_running"
>
<div
class=
"log_content_box"
>
<span
class=
"legend"
></span>
<div
id=
"software_run_state"
class=
"state_running"
>
<p>
Processing
</p>
<span
class=
"legend"
></span>
<div
class=
"clear"
></div>
<p>
Processing
</p>
<div
class=
"clear"
></div>
</div>
<p>
SlapOS rebuild your software from source, allowing you to easily patch or add any free software.
<a
href=
"#"
>
Lean how!
</a></p>
</div>
</div>
<p>
SlapOS rebuild your software from source, allowing you to easily patch or add any free software.
<a
href=
"#"
>
Lean how!
</a></p>
</div>
<h2
class=
"instance"
>
Running State
</h2>
<h2
class=
"instance"
>
Running State
</h2>
<div
class=
"log_content_box"
>
<div
class=
"log_content_box"
>
<!--<div id="instance_run_state" class="state_terminated">-->
<!--<div id="instance_run_state" class="state_terminated">-->
<!--<div id="instance_run_state" class="state_stopped">-->
<!--<div id="instance_run_state" class="state_stopped">-->
<div
id=
"instance_run_state"
class=
"state_waiting"
>
<div
id=
"instance_run_state"
class=
"state_waiting"
>
<span
class=
"legend"
></span>
<span
class=
"legend"
></span>
<p>
Waiting for starting
</p>
<p>
Waiting for starting
</p>
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
<p>
SlapOS configure your running environment to match your needs.
<a
href=
"#"
>
Lean how!
</a></p>
</div>
</div>
<p>
SlapOS configure your running environment to match your needs.
<a
href=
"#"
>
Lean how!
</a></p>
</div>
<div
class=
"separator"
></div>
<div
class=
"separator"
></div>
<div
style=
"height: 38px; text-align: center; padding-top: 25px;"
>
<div
style=
"height: 38px; text-align: center; padding-top: 25px;"
>
<a
href=
"#"
id=
"switch"
class=
"lshare"
rel=
"stop"
>
STOP PROCESS
</a>
<a
href=
"#"
id=
"slapswitch"
class=
"lshare"
rel=
"stop"
>
STOP PROCESS
</a>
</div>
</div>
<div
id=
"openloglist"
>
<h2
class=
"boxtitle"
>
Select log file to view
</h2>
<div
style=
"height: 340px; margin-bottom: 10px;"
>
<div
id=
'addbox'
style=
"display:none"
>
<a
href=
"#inline_content"
id=
"inlineViewer"
class=
"add_btn"
>
ADD FILE
</a>
<div
class=
"separator"
></div>
</div>
<ul>
<li
rel=
'software.log'
>
Software.log
</li>
<li
rel=
'instance.log'
class=
'checked'
>
Instance.log
</li>
</ul>
</div>
<div
class=
"separator"
></div>
<div
style=
"height: 38px; text-align: left; padding: 20px 0 0 15px;"
>
<a
id=
"logEdit"
class=
"lshare no-right-border"
style=
"float:left"
>
Edit list
</a>
<a
id=
"refreshlog"
class=
"lshare"
style=
"float:left"
>
Refresh log
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
'clear'
></div>
<div
class=
'clear'
></div>
<!-- This contains the hidden content for inline calls -->
<div
style=
'display:none'
>
<div
id=
'inline_content'
style=
'padding:10px; background:#fff;'
>
<div
style=
'border: solid 1px #678dad; height: 300px; overflow: auto;'
>
<div
id=
"fileTree"
></div>
</div>
<input
type=
submit
value=
"Add file"
id=
"addfile"
class=
"button"
>
</div>
</div>
{% endblock %}
{% endblock %}
slapos/runner/views.py
View file @
c7b58897
...
@@ -144,15 +144,6 @@ def runSoftwareProfile():
...
@@ -144,15 +144,6 @@ def runSoftwareProfile():
return
jsonify
(
result
=
False
)
return
jsonify
(
result
=
False
)
def
viewSoftwareLog
():
if
os
.
path
.
exists
(
app
.
config
[
'software_log'
]):
result
=
tail
(
open
(
app
.
config
[
'software_log'
]),
lines
=
1500
)
else
:
result
=
'Not found yet'
return
render_template
(
'viewLog.html'
,
type
=
'software'
,
result
=
result
.
encode
(
"utf-8"
))
# instance views
# instance views
def
editInstanceProfile
():
def
editInstanceProfile
():
profile
=
getProfilePath
(
app
.
config
[
'etc_dir'
],
app
.
config
[
'instance_profile'
])
profile
=
getProfilePath
(
app
.
config
[
'etc_dir'
],
app
.
config
[
'instance_profile'
])
...
@@ -217,13 +208,37 @@ def runInstanceProfile():
...
@@ -217,13 +208,37 @@ def runInstanceProfile():
return
jsonify
(
result
=
False
)
return
jsonify
(
result
=
False
)
<<<<<<<
HEAD
def
viewInstanceLog
():
def
viewInstanceLog
():
if
os
.
path
.
exists
(
app
.
config
[
'instance_log'
]):
if
os
.
path
.
exists
(
app
.
config
[
'instance_log'
]):
result
=
open
(
app
.
config
[
'instance_log'
]).
read
()
result
=
open
(
app
.
config
[
'instance_log'
]).
read
()
=======
@
login_required
()
def
viewLog
():
return
render_template
(
'viewLog.html'
)
@
login_required
()
def
getFileLog
():
logfile
=
request
.
form
.
get
(
'filename'
,
''
).
encode
(
'utf-8'
)
if
logfile
==
"instance.log"
:
file_path
=
app
.
config
[
'instance_log'
]
elif
logfile
==
"software.log"
:
file_path
=
app
.
config
[
'software_log'
]
>>>>>>>
7
beebdd
...
Update
log
management
,
add
custom
log
file
...
else
:
else
:
result
=
'Not found yet'
file_path
=
realpath
(
app
.
config
,
logfile
)
return
render_template
(
'viewLog.html'
,
type
=
'instance'
,
try
:
result
=
result
.
encode
(
"utf-8"
))
if
not
isText
(
file_path
):
return
jsonify
(
code
=
0
,
result
=
"Can not open binary file, please select a text file!"
)
if
'truncate'
in
request
.
form
:
content
=
tail
(
open
(
file_path
),
int
(
request
.
form
[
'truncate'
]))
return
jsonify
(
code
=
1
,
result
=
content
)
else
:
with
open
(
file_path
)
as
f
:
return
jsonify
(
code
=
1
,
result
=
f
.
read
())
except
:
return
jsonify
(
code
=
0
,
result
=
"Warning: Log file doesn't exist yet or empty log!!"
)
def
stopAllPartition
():
def
stopAllPartition
():
...
@@ -349,12 +364,13 @@ def getFileContent():
...
@@ -349,12 +364,13 @@ def getFileContent():
def
saveFileContent
():
def
saveFileContent
():
file_path
=
realpath
(
app
.
config
,
request
.
form
[
'file'
])
file_path
=
realpath
(
app
.
config
,
request
.
form
[
'file'
]
,
False
)
if
file_path
:
if
file_path
:
open
(
file_path
,
'w'
).
write
(
request
.
form
[
'content'
].
encode
(
"utf-8"
))
with
open
(
file_path
,
'w'
)
as
f
:
f
.
write
(
request
.
form
[
'content'
].
encode
(
"utf-8"
))
return
jsonify
(
code
=
1
,
result
=
""
)
return
jsonify
(
code
=
1
,
result
=
""
)
else
:
else
:
return
jsonify
(
code
=
0
,
result
=
"
Error: No such file!
"
)
return
jsonify
(
code
=
0
,
result
=
"
Rejected!! Cannot access to this location.
"
)
def
changeBranch
():
def
changeBranch
():
...
@@ -657,8 +673,6 @@ app.add_url_rule('/inspectSoftware', 'inspectSoftware', inspectSoftware)
...
@@ -657,8 +673,6 @@ app.add_url_rule('/inspectSoftware', 'inspectSoftware', inspectSoftware)
app
.
add_url_rule
(
'/removeSoftware'
,
'removeSoftware'
,
removeSoftware
)
app
.
add_url_rule
(
'/removeSoftware'
,
'removeSoftware'
,
removeSoftware
)
app
.
add_url_rule
(
'/runSoftwareProfile'
,
'runSoftwareProfile'
,
app
.
add_url_rule
(
'/runSoftwareProfile'
,
'runSoftwareProfile'
,
runSoftwareProfile
,
methods
=
[
'GET'
,
'POST'
])
runSoftwareProfile
,
methods
=
[
'GET'
,
'POST'
])
app
.
add_url_rule
(
'/viewSoftwareLog'
,
'viewSoftwareLog'
,
viewSoftwareLog
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/editInstanceProfile'
,
'editInstanceProfile'
,
app
.
add_url_rule
(
'/editInstanceProfile'
,
'editInstanceProfile'
,
editInstanceProfile
)
editInstanceProfile
)
app
.
add_url_rule
(
'/inspectInstance'
,
'inspectInstance'
,
app
.
add_url_rule
(
'/inspectInstance'
,
'inspectInstance'
,
...
@@ -668,8 +682,10 @@ app.add_url_rule('/supervisordStatus', 'supervisordStatus',
...
@@ -668,8 +682,10 @@ app.add_url_rule('/supervisordStatus', 'supervisordStatus',
app
.
add_url_rule
(
'/runInstanceProfile'
,
'runInstanceProfile'
,
app
.
add_url_rule
(
'/runInstanceProfile'
,
'runInstanceProfile'
,
runInstanceProfile
,
methods
=
[
'GET'
,
'POST'
])
runInstanceProfile
,
methods
=
[
'GET'
,
'POST'
])
app
.
add_url_rule
(
'/removeInstance'
,
'removeInstance'
,
removeInstance
)
app
.
add_url_rule
(
'/removeInstance'
,
'removeInstance'
,
removeInstance
)
app
.
add_url_rule
(
'/viewInstanceLog'
,
'viewInstanceLog'
,
app
.
add_url_rule
(
'/viewLog'
,
'viewLog'
,
viewInstanceLog
,
methods
=
[
'GET'
])
viewLog
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/getFileLog"
,
'getFileLog'
,
getFileLog
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/stopAllPartition'
,
'stopAllPartition'
,
app
.
add_url_rule
(
'/stopAllPartition'
,
'stopAllPartition'
,
stopAllPartition
,
methods
=
[
'GET'
])
stopAllPartition
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/tailProcess/name/<process>'
,
'tailProcess'
,
app
.
add_url_rule
(
'/tailProcess/name/<process>'
,
'tailProcess'
,
...
...
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