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
Nicolas Wavrant
slapos.toolbox
Commits
9764ac1f
Commit
9764ac1f
authored
Aug 25, 2017
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try to implement the link verb in slapos.buildout
parent
20d085dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
13 deletions
+15
-13
slapos/runner/static/js/scripts/project.js
slapos/runner/static/js/scripts/project.js
+3
-2
slapos/runner/templates/projectFolder.html
slapos/runner/templates/projectFolder.html
+4
-1
slapos/runner/utils.py
slapos/runner/utils.py
+2
-3
slapos/runner/views.py
slapos/runner/views.py
+6
-7
No files found.
slapos/runner/static/js/scripts/project.js
View file @
9764ac1f
...
...
@@ -100,14 +100,15 @@ $(document).ready(function () {
$
(
"
#flash
"
).
fadeOut
(
'
normal
'
);
$
(
"
#flash
"
).
empty
();
$
(
"
#flash
"
).
fadeIn
(
'
normal
'
);
if
(
$
(
"
input#path
"
).
val
()
===
""
)
{
var
choice
=
$
(
"
input#path
"
).
val
()
||
$
(
"
input#url
"
).
val
();
if
(
choice
===
""
)
{
$
(
"
#error
"
).
Popup
(
"
Select a valid Software Release folder!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/setCurrentProject
'
,
data
:
"
path=
"
+
$
(
"
input#path
"
).
val
()
,
data
:
"
path=
"
+
choice
,
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
window
.
location
.
href
=
$SCRIPT_ROOT
+
'
/editSoftwareProfile
'
;
...
...
slapos/runner/templates/projectFolder.html
View file @
9764ac1f
...
...
@@ -28,7 +28,10 @@
</div>
{% elif method == "open" %}
<div
id=
"openSoftware"
>
<h2
class=
"hight"
>
Select the folder of your software release into the box
</h2>
<h2
class=
"hight"
>
Enter a URL
</h2>
<input
type=
"text"
name=
"path"
id=
"url"
value=
""
/>
<h2
class=
"hight"
>
Or Select the folder of your software release into the box
</h2>
<div
class=
'space'
></div>
<div
id=
"fileTree"
class=
"file_tree"
></div>
<div
id=
"file_info"
class=
"file_info"
>
...
...
slapos/runner/utils.py
View file @
9764ac1f
...
...
@@ -29,9 +29,7 @@ from passlib.apache import HtpasswdFile
import
slapos.slap
from
slapos.grid.utils
import
md5digest
# Setup default flask (werkzeug) parser
logger
=
logging
.
getLogger
(
'werkzeug'
)
logger
=
logging
.
getLogger
(
'slaprunner'
)
TRUE_VALUES
=
(
1
,
'1'
,
True
,
'true'
,
'True'
)
...
...
@@ -794,6 +792,7 @@ def realpath(config, path, check_exist=True):
this file.
"""
_isurl = re.compile('
([
a
-
zA
-
Z0
-
9
+
.
-
]
+
):
//
').match
logger.info('
Nicolas
:
path
%
s
is
url
?
%
s
' % (path, _isurl(path)))
if _isurl(path):
return path
split_path = path.split('
/
')
...
...
slapos/runner/views.py
View file @
9764ac1f
...
...
@@ -18,6 +18,7 @@ import slapos
from
slapos.runner.utils
import
(
checkSoftwareFolder
,
configNewSR
,
checkUserCredential
,
createNewUser
,
getBuildAndRunParams
,
getProfilePath
,
getSlapgridResult
,
html_escape
,
listFolder
,
getBuildAndRunParams
,
getProjectTitle
,
getRcode
,
updateUserCredential
,
getSlapStatus
,
getSvcStatus
,
...
...
@@ -44,10 +45,8 @@ app = Flask(__name__)
app
.
config
[
'MAX_CONTENT_LENGTH'
]
=
20
*
1024
*
1024
file_request
=
FileBrowser
(
app
.
config
)
# Setup default flask (werkzeug) parser
import
logging
logger
=
logging
.
getLogger
(
'werkzeug'
)
logger
=
logging
.
getLogger
(
'slaprunner'
)
def
login_redirect
(
*
args
,
**
kwargs
):
return
redirect
(
url_for
(
'login'
))
...
...
@@ -244,14 +243,13 @@ def getFileLog():
if
not
os
.
path
.
exists
(
file_path
):
raise
IOError
if
not
isText
(
file_path
):
return
jsonify
(
code
=
0
,
result
=
"Can not open binary file, please select a text file!"
)
content
=
"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
())
content
=
f
.
read
()
return
jsonify
(
code
=
1
,
result
=
html_escape
(
content
))
except
:
return
jsonify
(
code
=
0
,
result
=
"Warning: Log file doesn't exist yet or empty log!!"
)
...
...
@@ -304,6 +302,7 @@ def checkFolder():
def
setCurrentProject
():
logger
.
info
(
'NICOLAS: setCurrentProject for %s'
%
request
.
form
[
'path'
])
if
configNewSR
(
app
.
config
,
request
.
form
[
'path'
]):
session
[
'title'
]
=
getProjectTitle
(
app
.
config
)
return
jsonify
(
code
=
1
,
result
=
""
)
...
...
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