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
212af295
Commit
212af295
authored
Aug 17, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'slaprunner'
parents
4a21f210
fba37096
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
78 deletions
+59
-78
slapos/runner/static/css/jqueryTabs.css
slapos/runner/static/css/jqueryTabs.css
+2
-1
slapos/runner/static/css/styles.css
slapos/runner/static/css/styles.css
+4
-2
slapos/runner/static/js/jquery/popup.js
slapos/runner/static/js/jquery/popup.js
+5
-1
slapos/runner/templates/instanceInspect.html
slapos/runner/templates/instanceInspect.html
+3
-2
slapos/runner/utils.py
slapos/runner/utils.py
+32
-47
slapos/runner/views.py
slapos/runner/views.py
+13
-25
No files found.
slapos/runner/static/css/jqueryTabs.css
View file @
212af295
...
@@ -54,7 +54,8 @@
...
@@ -54,7 +54,8 @@
margin
:
34px
0
0
;
margin
:
34px
0
0
;
}
}
.tabContents
{
.tabContents
{
padding
:
20px
padding
:
20px
;
min-height
:
250px
;
}
}
.tabContents
p
{
.tabContents
p
{
padding
:
0
0
10px
;
padding
:
0
0
10px
;
...
...
slapos/runner/static/css/styles.css
View file @
212af295
...
@@ -27,7 +27,8 @@ td{
...
@@ -27,7 +27,8 @@ td{
border-bottom
:
1px
solid
#A8A8A8
;
border-bottom
:
1px
solid
#A8A8A8
;
border-right
:
1px
solid
#A8A8A8
;
border-right
:
1px
solid
#A8A8A8
;
}
}
td
.propertie
{
padding-left
:
10px
;
color
:
blue
;}
td
.propertie
{
padding-left
:
10px
;
color
:
blue
;
width
:
178px
;}
.slapvalues
{
display
:
block
;
width
:
375px
;
word-wrap
:
break-word
}
td
.first
{
border-left
:
1px
solid
#A8A8A8
;}
td
.first
{
border-left
:
1px
solid
#A8A8A8
;}
th
{
th
{
background
:
#2281C1
;
background
:
#2281C1
;
...
@@ -505,6 +506,7 @@ h2.hight:hover{
...
@@ -505,6 +506,7 @@ h2.hight:hover{
width
:
754px
;
width
:
754px
;
padding
:
2px
;
padding
:
2px
;
height
:
450px
;
height
:
450px
;
font-size
:
13px
;
}
}
.log_btn
{
border
:
1px
solid
#678dad
;
border-top
:
none
;
height
:
22px
;
width
:
654px
;
margin
:
0
40px
10px
40px
;
.log_btn
{
border
:
1px
solid
#678dad
;
border-top
:
none
;
height
:
22px
;
width
:
654px
;
margin
:
0
40px
10px
40px
;
padding
:
4px
10px
4px
10px
;
font-size
:
16px
;
color
:
#4c6172
;}
padding
:
4px
10px
4px
10px
;
font-size
:
16px
;
color
:
#4c6172
;}
...
...
slapos/runner/static/js/jquery/popup.js
View file @
212af295
...
@@ -21,6 +21,10 @@
...
@@ -21,6 +21,10 @@
}
}
else
{
setupBox
();}
else
{
setupBox
();}
function
setupBox
(){
function
setupBox
(){
if
(
msg
==
undefined
){
msg
=
"
Cannot execute your request. Please make sure you are logged in!!
"
option
.
type
=
"
error
"
;
}
$box
.
empty
();
$box
.
empty
();
$box
.
css
(
'
top
'
,
'
-1000px
'
);
$box
.
css
(
'
top
'
,
'
-1000px
'
);
$box
.
show
();
$box
.
show
();
...
...
slapos/runner/templates/instanceInspect.html
View file @
212af295
...
@@ -62,13 +62,13 @@
...
@@ -62,13 +62,13 @@
</h2>
</h2>
<div
class=
"clear"
></div><br/>
<div
class=
"clear"
></div><br/>
<div
id=
"bcontent{{item[0]}}"
>
<div
id=
"bcontent{{item[0]}}"
>
<table
cellpadding=
"0"
cellspacing=
"0"
width=
"
100%
"
>
<table
cellpadding=
"0"
cellspacing=
"0"
width=
"
577
"
>
<tr>
<tr>
<th>
Parameter Name
</th><th>
Parameter Value
</th>
<th>
Parameter Name
</th><th>
Parameter Value
</th>
</tr>
</tr>
{% for k in item[1] %}
{% for k in item[1] %}
<tr>
<tr>
<td
class=
"propertie first"
>
{{k}}
</td><td
align=
'left'
>
{{item[1][k]}}
</td>
<td
class=
"propertie first"
>
{{k}}
</td><td
align=
'left'
>
<span
class=
"slapvalues"
>
{{item[1][k]}}
</span>
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</table>
</table>
...
@@ -140,3 +140,4 @@
...
@@ -140,3 +140,4 @@
</div>
</div>
{{instance}}
{{instance}}
{% endblock %}
{% endblock %}
slapos/runner/utils.py
View file @
212af295
This diff is collapsed.
Click to expand it.
slapos/runner/views.py
View file @
212af295
...
@@ -79,7 +79,7 @@ def doLogin():
...
@@ -79,7 +79,7 @@ def doLogin():
# software views
# software views
@
login_required
()
@
login_required
()
def
editSoftwareProfile
():
def
editSoftwareProfile
():
profile
=
getProfilePath
(
app
.
config
[
'
runner_work
dir'
],
app
.
config
[
'software_profile'
])
profile
=
getProfilePath
(
app
.
config
[
'
etc_
dir'
],
app
.
config
[
'software_profile'
])
if
profile
==
""
:
if
profile
==
""
:
flash
(
'Error: can not open profile, please select your project first'
)
flash
(
'Error: can not open profile, please select your project first'
)
return
render_template
(
'updateSoftwareProfile.html'
,
workDir
=
'workspace'
,
return
render_template
(
'updateSoftwareProfile.html'
,
workDir
=
'workspace'
,
...
@@ -92,18 +92,18 @@ def inspectSoftware():
...
@@ -92,18 +92,18 @@ def inspectSoftware():
else
:
else
:
result
=
app
.
config
[
'software_root'
]
result
=
app
.
config
[
'software_root'
]
return
render_template
(
'runResult.html'
,
softwareRoot
=
'software_root'
,
return
render_template
(
'runResult.html'
,
softwareRoot
=
'software_root'
,
softwares
=
loadSoftwareData
(
app
.
config
[
'
runner_work
dir'
]))
softwares
=
loadSoftwareData
(
app
.
config
[
'
etc_
dir'
]))
#remove content of compiled software release
#remove content of compiled software release
@
login_required
()
@
login_required
()
def
removeSoftware
():
def
removeSoftware
():
file_config
=
os
.
path
.
join
(
app
.
config
[
'
runner_work
dir'
],
".softdata"
)
file_config
=
os
.
path
.
join
(
app
.
config
[
'
etc_
dir'
],
".softdata"
)
if
isSoftwareRunning
(
app
.
config
)
or
isInstanceRunning
(
app
.
config
):
if
isSoftwareRunning
(
app
.
config
)
or
isInstanceRunning
(
app
.
config
):
flash
(
'Software installation or instantiation in progress, cannot remove'
)
flash
(
'Software installation or instantiation in progress, cannot remove'
)
elif
os
.
path
.
exists
(
file_config
):
elif
os
.
path
.
exists
(
file_config
):
svcStopAll
(
app
.
config
)
svcStopAll
(
app
.
config
)
shutil
.
rmtree
(
app
.
config
[
'software_root'
])
shutil
.
rmtree
(
app
.
config
[
'software_root'
])
os
.
remove
(
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
".softdata"
)
)
os
.
remove
(
file_config
)
flash
(
'Software removed'
)
flash
(
'Software removed'
)
return
redirect
(
url_for
(
'inspectSoftware'
))
return
redirect
(
url_for
(
'inspectSoftware'
))
...
@@ -121,12 +121,12 @@ def viewSoftwareLog():
...
@@ -121,12 +121,12 @@ def viewSoftwareLog():
else
:
else
:
result
=
'Not found yet'
result
=
'Not found yet'
return
render_template
(
'viewLog.html'
,
type
=
'software'
,
return
render_template
(
'viewLog.html'
,
type
=
'software'
,
result
=
result
)
result
=
result
.
encode
(
"utf-8"
)
)
# instance views
# instance views
@
login_required
()
@
login_required
()
def
editInstanceProfile
():
def
editInstanceProfile
():
profile
=
getProfilePath
(
app
.
config
[
'
runner_work
dir'
],
app
.
config
[
'instance_profile'
])
profile
=
getProfilePath
(
app
.
config
[
'
etc_
dir'
],
app
.
config
[
'instance_profile'
])
if
profile
==
""
:
if
profile
==
""
:
flash
(
'Error: can not open instance profile for this Software Release'
)
flash
(
'Error: can not open instance profile for this Software Release'
)
return
render_template
(
'updateInstanceProfile.html'
,
workDir
=
'workspace'
,
return
render_template
(
'updateInstanceProfile.html'
,
workDir
=
'workspace'
,
...
@@ -171,7 +171,7 @@ def removeInstance():
...
@@ -171,7 +171,7 @@ def removeInstance():
removeProxyDb
(
app
.
config
)
removeProxyDb
(
app
.
config
)
startProxy
(
app
.
config
)
startProxy
(
app
.
config
)
removeInstanceRoot
(
app
.
config
)
removeInstanceRoot
(
app
.
config
)
param_path
=
os
.
path
.
join
(
app
.
config
[
'
runner_work
dir'
],
".parameter.xml"
)
param_path
=
os
.
path
.
join
(
app
.
config
[
'
etc_
dir'
],
".parameter.xml"
)
if
os
.
path
.
exists
(
param_path
):
if
os
.
path
.
exists
(
param_path
):
os
.
remove
(
param_path
)
os
.
remove
(
param_path
)
flash
(
'Instance removed'
)
flash
(
'Instance removed'
)
...
@@ -193,7 +193,7 @@ def viewInstanceLog():
...
@@ -193,7 +193,7 @@ def viewInstanceLog():
else
:
else
:
result
=
'Not found yet'
result
=
'Not found yet'
return
render_template
(
'viewLog.html'
,
type
=
'instance'
,
return
render_template
(
'viewLog.html'
,
type
=
'instance'
,
result
=
result
)
result
=
result
.
encode
(
"utf-8"
)
)
@
login_required
()
@
login_required
()
def
stopAllPartition
():
def
stopAllPartition
():
...
@@ -210,15 +210,6 @@ def startStopProccess(process, action):
...
@@ -210,15 +210,6 @@ def startStopProccess(process, action):
svcStartStopProcess
(
app
.
config
,
process
,
action
)
svcStartStopProcess
(
app
.
config
,
process
,
action
)
return
redirect
(
url_for
(
'inspectInstance'
))
return
redirect
(
url_for
(
'inspectInstance'
))
@
login_required
()
def
viewBuildoudAnnotate
():
if
os
.
path
.
exists
(
app
.
config
[
'annotate_log'
]):
result
=
open
(
app
.
config
[
'annotate_log'
],
'r'
).
read
()
else
:
result
=
'Not found yet'
return
render_template
(
'viewLog.html'
,
type
=
'Instance'
,
result
=
result
,
running
=
isInstanceRunning
(
app
.
config
))
@
login_required
(
login_redirect
)
@
login_required
(
login_redirect
)
def
openProject
(
method
):
def
openProject
(
method
):
return
render_template
(
'projectFolder.html'
,
method
=
method
,
return
render_template
(
'projectFolder.html'
,
method
=
method
,
...
@@ -271,7 +262,7 @@ def getProjectStatus():
...
@@ -271,7 +262,7 @@ def getProjectStatus():
#view for current software release files
#view for current software release files
@
login_required
()
@
login_required
()
def
editCurrentProject
():
def
editCurrentProject
():
project
=
os
.
path
.
join
(
app
.
config
[
'
runner_work
dir'
],
".project"
)
project
=
os
.
path
.
join
(
app
.
config
[
'
etc_
dir'
],
".project"
)
if
os
.
path
.
exists
(
project
):
if
os
.
path
.
exists
(
project
):
return
render_template
(
'softwareFolder.html'
,
workDir
=
'workspace'
,
return
render_template
(
'softwareFolder.html'
,
workDir
=
'workspace'
,
project
=
open
(
project
).
read
(),
project
=
open
(
project
).
read
(),
...
@@ -438,11 +429,11 @@ def getPath():
...
@@ -438,11 +429,11 @@ def getPath():
#update instance parameter into a local xml file
#update instance parameter into a local xml file
@
login_required
()
@
login_required
()
def
saveParameterXml
():
def
saveParameterXml
():
project
=
os
.
path
.
join
(
app
.
config
[
'
runner_work
dir'
],
".project"
)
project
=
os
.
path
.
join
(
app
.
config
[
'
etc_
dir'
],
".project"
)
if
not
os
.
path
.
exists
(
project
):
if
not
os
.
path
.
exists
(
project
):
return
jsonify
(
code
=
0
,
result
=
"Please first open a Software Release"
)
return
jsonify
(
code
=
0
,
result
=
"Please first open a Software Release"
)
content
=
request
.
form
[
'parameter'
].
encode
(
"utf-8"
)
content
=
request
.
form
[
'parameter'
].
encode
(
"utf-8"
)
param_path
=
os
.
path
.
join
(
app
.
config
[
'
runner_work
dir'
],
".parameter.xml"
)
param_path
=
os
.
path
.
join
(
app
.
config
[
'
etc_
dir'
],
".parameter.xml"
)
try
:
try
:
f
=
open
(
param_path
,
'w'
)
f
=
open
(
param_path
,
'w'
)
f
.
write
(
content
)
f
.
write
(
content
)
...
@@ -465,7 +456,7 @@ def saveParameterXml():
...
@@ -465,7 +456,7 @@ def saveParameterXml():
#read instance parameters into the local xml file and return a dict
#read instance parameters into the local xml file and return a dict
@
login_required
()
@
login_required
()
def
getParameterXml
(
request
):
def
getParameterXml
(
request
):
param_path
=
os
.
path
.
join
(
app
.
config
[
'
runner_work
dir'
],
".parameter.xml"
)
param_path
=
os
.
path
.
join
(
app
.
config
[
'
etc_
dir'
],
".parameter.xml"
)
if
not
os
.
path
.
exists
(
param_path
):
if
not
os
.
path
.
exists
(
param_path
):
default
=
'<?xml version="1.0" encoding="utf-8"?>
\
n
'
default
=
'<?xml version="1.0" encoding="utf-8"?>
\
n
'
default
+=
'<instance>
\
n
</instance>'
default
+=
'<instance>
\
n
</instance>'
...
@@ -483,7 +474,6 @@ def getParameterXml(request):
...
@@ -483,7 +474,6 @@ def getParameterXml(request):
@
login_required
()
@
login_required
()
def
updateAccount
():
def
updateAccount
():
account
=
[]
account
=
[]
user
=
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
'.users'
)
account
.
append
(
request
.
form
[
'username'
].
strip
())
account
.
append
(
request
.
form
[
'username'
].
strip
())
account
.
append
(
request
.
form
[
'password'
].
strip
())
account
.
append
(
request
.
form
[
'password'
].
strip
())
account
.
append
(
request
.
form
[
'email'
].
strip
())
account
.
append
(
request
.
form
[
'email'
].
strip
())
...
@@ -504,7 +494,6 @@ def configAccount():
...
@@ -504,7 +494,6 @@ def configAccount():
last_account
=
getSession
(
app
.
config
)
last_account
=
getSession
(
app
.
config
)
if
not
last_account
:
if
not
last_account
:
account
=
[]
account
=
[]
user
=
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
'.users'
)
account
.
append
(
request
.
form
[
'username'
].
strip
())
account
.
append
(
request
.
form
[
'username'
].
strip
())
account
.
append
(
request
.
form
[
'password'
].
strip
())
account
.
append
(
request
.
form
[
'password'
].
strip
())
account
.
append
(
request
.
form
[
'email'
].
strip
())
account
.
append
(
request
.
form
[
'email'
].
strip
())
...
@@ -536,7 +525,6 @@ app.add_url_rule('/viewInstanceLog', 'viewInstanceLog', viewInstanceLog, methods
...
@@ -536,7 +525,6 @@ app.add_url_rule('/viewInstanceLog', 'viewInstanceLog', viewInstanceLog, methods
app
.
add_url_rule
(
'/stopAllPartition'
,
'stopAllPartition'
,
stopAllPartition
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/stopAllPartition'
,
'stopAllPartition'
,
stopAllPartition
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/tailProcess/name/<process>'
,
'tailProcess'
,
tailProcess
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/tailProcess/name/<process>'
,
'tailProcess'
,
tailProcess
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/startStopProccess/name/<process>/cmd/<action>'
,
'startStopProccess'
,
startStopProccess
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/startStopProccess/name/<process>/cmd/<action>'
,
'startStopProccess'
,
startStopProccess
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/viewBuildoudAnnotate'
,
'viewBuildoudAnnotate'
,
viewBuildoudAnnotate
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/getParameterXml/<request>"
,
'getParameterXml'
,
getParameterXml
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/getParameterXml/<request>"
,
'getParameterXml'
,
getParameterXml
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/stopSlapgrid"
,
'stopSlapgrid'
,
stopSlapgrid
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/stopSlapgrid"
,
'stopSlapgrid'
,
stopSlapgrid
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/slapgridResult"
,
'slapgridResult'
,
slapgridResult
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/slapgridResult"
,
'slapgridResult'
,
slapgridResult
,
methods
=
[
'POST'
])
...
...
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