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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos.toolbox
Commits
4e9565fa
Commit
4e9565fa
authored
Jan 31, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solve some basic UI problems on webrunner
parent
01f5d15d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
76 additions
and
34 deletions
+76
-34
slapos/runner/gittools.py
slapos/runner/gittools.py
+23
-19
slapos/runner/static/css/styles.css
slapos/runner/static/css/styles.css
+4
-3
slapos/runner/static/scripts/repo.js
slapos/runner/static/scripts/repo.js
+35
-1
slapos/runner/static/scripts/softwareFolder.js
slapos/runner/static/scripts/softwareFolder.js
+1
-1
slapos/runner/templates/cloneRepository.html
slapos/runner/templates/cloneRepository.html
+1
-1
slapos/runner/templates/manageProject.html
slapos/runner/templates/manageProject.html
+8
-4
slapos/runner/templates/updateSoftwareProfile.html
slapos/runner/templates/updateSoftwareProfile.html
+0
-1
slapos/runner/utils.py
slapos/runner/utils.py
+3
-2
slapos/runner/views.py
slapos/runner/views.py
+1
-2
No files found.
slapos/runner/gittools.py
View file @
4e9565fa
...
...
@@ -65,16 +65,9 @@ def switchBranch(project, name):
if
name
==
current_branch
:
json
=
"This is already your active branch for this project"
else
:
i
=
0
json
=
"Error: Can not found branch '"
+
name
+
"'"
repo
.
heads
.
master
.
checkout
()
for
b
in
branches
:
if
b
.
name
==
name
:
repo
.
heads
[
i
].
checkout
()
code
=
1
json
=
""
break
i
=
i
+
1
git
=
repo
.
git
git
.
checkout
(
name
)
except
Exception
,
e
:
json
=
str
(
e
)
return
jsonify
(
code
=
code
,
result
=
json
)
...
...
@@ -84,7 +77,8 @@ def createBranch(project, name):
json
=
""
try
:
repo
=
Repo
(
project
)
b
=
repo
.
create_head
(
name
)
git
=
repo
.
git
git
.
checkout
(
'-b'
,
name
)
code
=
1
except
Exception
,
e
:
json
=
str
(
e
)
...
...
@@ -101,25 +95,22 @@ def getDiff(project):
result
=
str
(
e
)
return
result
def
gitPush
(
project
,
msg
,
fetch
=
False
):
def
gitPush
(
project
,
msg
):
code
=
0
json
=
""
commit
=
False
undo_
commit
=
False
try
:
repo
=
Repo
(
project
)
if
repo
.
is_dirty
:
git
=
repo
.
git
current_branch
=
repo
.
active_branch
.
name
current_branch
=
repo
.
active_branch
.
name
#add file to be commited
files
=
repo
.
untracked_files
for
f
in
files
:
git
.
add
(
f
)
#Commit all modified and untracked files
git
.
commit
(
'-a'
,
'-m'
,
msg
)
commit
=
True
if
fetch
:
git
.
fetch
(
'--all'
)
git
.
rebase
(
'origin/'
+
current_branch
)
undo_commit
=
True
#push changes to repo
git
.
push
(
'origin'
,
current_branch
)
code
=
1
...
...
@@ -127,7 +118,20 @@ def gitPush(project, msg, fetch=False):
json
=
"Nothing to be commited"
code
=
1
except
Exception
,
e
:
if
commit
:
if
undo_
commit
:
git
.
reset
(
"HEAD^1"
)
#undo previous commit
json
=
str
(
e
)
return
jsonify
(
code
=
code
,
result
=
json
)
\ No newline at end of file
return
jsonify
(
code
=
code
,
result
=
json
)
def
gitPull
(
project
):
result
=
""
code
=
0
try
:
repo
=
Repo
(
project
)
git
=
repo
.
git
current_branch
=
repo
.
active_branch
.
name
git
.
pull
()
code
=
1
except
Exception
,
e
:
result
=
str
(
e
)
return
jsonify
(
code
=
code
,
result
=
result
)
\ No newline at end of file
slapos/runner/static/css/styles.css
View file @
4e9565fa
...
...
@@ -454,7 +454,8 @@ body {
margin
:
5px
;
}
#contentInfo
h2
,
.hight
{
#contentInfo
h2
,
.hight
{
background
:
#e4e4e4
;
width
:
100%
;
height
:
25px
;
padding-top
:
2px
;
...
...
@@ -463,11 +464,11 @@ body {
text-shadow
:
0px
1px
#FFF
;
}
#contentInfo
h2
,
.show
{
.show
{
background
:
#e4e4e4
url(../images/arrow_up.png)
97%
50%
no-repeat
;
}
#contentInfo
h2
,
.hide
{
.hide
{
background
:
#e4e4e4
url(../images/arrow_down.png)
97%
50%
no-repeat
;
}
...
...
slapos/runner/static/scripts/repo.js
View file @
4e9565fa
...
...
@@ -67,7 +67,7 @@ $(document).ready( function() {
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/pushProjectFiles
'
,
data
:
"
project=
"
+
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
project
+
"
&msg=
"
+
$
(
"
input#commitmsg
"
).
val
()
,
data
:
{
project
:
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
project
,
msg
:
$
(
"
input#commitmsg
"
).
val
()}
,
success
:
function
(
data
){
if
(
data
.
code
==
1
){
if
(
data
.
result
!=
""
){
...
...
@@ -88,6 +88,40 @@ $(document).ready( function() {
});
return
false
;
});
/*
$("#pullbranch").click(function(){
if (send){
return false;
}
send = true;
var project = $("#project").val();
$("#pullimgwaitting").fadeIn('normal');
$("#pullbranch").empty();
$("#pullbranch").attr("value", "Wait...");
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/pullProjectFiles',
data: "project=" + $("input#workdir").val() + "/" + project,
success: function(data){
if(data.code == 1){
if (data.result != ""){
error(data.result);
}
else
error("Pull done!");
gitStatus();
}
else{
error(data.result);
}
$("#pullimgwaitting").hide()
$("#pullbranch").empty();
$("#pullbranch").attr("value", "Git Pull");
send = false;
}
});
return false;
});*/
function
gitStatus
(){
var
project
=
$
(
"
#project
"
).
val
();
$
(
"
#status
"
).
empty
();
...
...
slapos/runner/static/scripts/softwareFolder.js
View file @
4e9565fa
...
...
@@ -78,7 +78,7 @@ $(document).ready( function() {
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/saveFileContent
'
,
data
:
"
file=
"
+
$
(
"
input#subfolder
"
).
val
()
+
"
&content=
"
+
editor
.
getSession
().
getValue
()
,
data
:
{
file
:
$
(
"
input#subfolder
"
).
val
(),
content
:
editor
.
getSession
().
getValue
()}
,
success
:
function
(
data
){
if
(
data
.
code
==
1
){
$
(
"
#flash
"
).
fadeOut
(
'
normal
'
);
...
...
slapos/runner/templates/cloneRepository.html
View file @
4e9565fa
...
...
@@ -28,7 +28,7 @@
{{public_key}}
</textarea>
<p>
to use git with https, please enter your repository url like this
<strong><i>
https://your_login:your_pass
eword@your_repository_url
</i></strong></p><br/><br/>
<strong><i>
https://your_login:your_pass
word@your_repository
</i></strong></p><br/><br/>
<div
id=
"file_navigation"
>
<h2>
Your project folder
</h2>
<div
id=
"fileTree"
class=
"file_tree"
></div>
...
...
slapos/runner/templates/manageProject.html
View file @
4e9565fa
...
...
@@ -27,18 +27,22 @@
<div
id=
"branchlist"
style=
"margin-bottom:20px;"
>
<h2>
Your Repository Branches
</h2>
<div
style=
"margin-left:15px;"
>
<label
for=
'activebranch'
>
Select
the active Branch here
:
</label>
<label
for=
'activebranch'
>
Select
your active Branch
:
</label>
<select
name=
"activebranch"
id=
"activebranch"
>
</select>
<label
for=
'branchname'
>
Branch Name:
</label>
<input
type=
"text"
name=
"branchname"
id=
"branchname"
size=
'2
0
'
value=
"Enter the branch name..."
/>
<label
for=
'branchname'
>
Branch Name:
</label>
<input
type=
"text"
name=
"branchname"
id=
"branchname"
size=
'2
2
'
value=
"Enter the branch name..."
/>
<input
type=
"submit"
name=
"addbranch"
id =
"addbranch"
value=
"Add"
class=
"button"
/>
<br/>
<!--<label for='pullbranch'>Update your local repository: </label>-->
<!--<input type="submit" name="pullbranch" id ="pullbranch" value="Pull" class="button"/>-->
<!--<img class="waitting" id="pullimgwaitting" src="{{ url_for('static', filename='images/waiting.gif') }}" alt="" />-->
</div>
</div>
<div
id=
"push"
style=
"margin-bottom:20px;"
>
<h2>
Commit All your changes (On active branch)
</h2>
<div
style=
"margin-left:15px;"
>
<label
for=
'commitmsg'
>
Enter your commit message her
e:
</label>
<label
for=
'commitmsg'
>
Commit messag
e:
</label>
<input
type=
"text"
name=
"commitmsg"
id=
"commitmsg"
size=
'40'
value=
"Enter message..."
/>
<input
type=
"submit"
name=
"commit"
id =
"commit"
value=
"Commit"
class=
"button"
/>
<img
class=
"waitting"
id=
"imgwaitting"
src=
"{{ url_for('static', filename='images/waiting.gif') }}"
alt=
""
/>
...
...
slapos/runner/templates/updateSoftwareProfile.html
View file @
4e9565fa
...
...
@@ -10,7 +10,6 @@
{% block body %}
<form
method=
post
class=
add-entry
>
<dl>
<dt><strong>
Note:
</strong>
Url of instance.cfg is
<tt>
{{ instance_url }}
</tt></dt>
<dd><h2>
Software Profile:
</h2></dd>
<dd>
<div
class=
"main_content"
>
...
...
slapos/runner/utils.py
View file @
4e9565fa
...
...
@@ -185,7 +185,7 @@ def getProfile(peojectDir, profileName):
if
os
.
path
.
exists
(
profile
):
return
open
(
profile
).
read
()
else
:
return
''
return
None
def
getProfilePath
(
peojectDir
,
profile
):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
peojectDir
,
".project"
)):
...
...
@@ -297,7 +297,8 @@ def getFolder(folder):
def getProjectList(folder):
project = []
for elt in os.listdir(folder):
project_list = sorted(os.listdir(folder), key=str.lower)
for elt in project_list:
project.append(elt)
return project
...
...
slapos/runner/views.py
View file @
4e9565fa
...
...
@@ -31,8 +31,7 @@ def editSoftwareProfile():
if
profile
==
""
:
flash
(
'Error: can not open profile, please select your project first'
)
return
render_template
(
'updateSoftwareProfile.html'
,
profile
=
profile
,
instance_url
=
url_for
(
'getInstance'
,
_external
=
True
))
profile
=
profile
)
@
app
.
route
(
'/software.cfg'
,
methods
=
[
'GET'
,
'POST'
])
def
getSoftware
():
...
...
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