Commit 00da056c authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: commits can be done throught webrunner git interface

parent 278d10ec
...@@ -137,8 +137,8 @@ def gitCommit(project, msg): ...@@ -137,8 +137,8 @@ def gitCommit(project, msg):
git.add(f) git.add(f)
#Commit all modified and untracked files #Commit all modified and untracked files
git.commit('-a', '-m', msg) git.commit('-a', '-m', msg)
else:
code = 1 code = 1
else:
json = "Nothing to be commited" json = "Nothing to be commited"
return jsonify(code=code, result=json) return jsonify(code=code, result=json)
......
...@@ -171,7 +171,7 @@ $(document).ready(function () { ...@@ -171,7 +171,7 @@ $(document).ready(function () {
}); });
$("#commitbutton").click(function () { $("#commitbutton").click(function () {
if ($("input#commitmsg").val() === "" || if ($("input#commitmsg").val() === "" ||
$("textarea#commitmsg").val() === "Enter message...") { $("input#commitmsg").val() === "Enter message...") {
$("#error").Popup("Please Enter the commit message", {type: 'alert', duration: 3000}); $("#error").Popup("Please Enter the commit message", {type: 'alert', duration: 3000});
return false; return false;
} }
...@@ -181,12 +181,12 @@ $(document).ready(function () { ...@@ -181,12 +181,12 @@ $(document).ready(function () {
send = true; send = true;
var project = $("#project").val(); var project = $("#project").val();
$("#imgwaitting").fadeIn('normal'); $("#imgwaitting").fadeIn('normal');
//$("#commit").empty(); $("#commitmsg").empty();
$("#commitbbutton").attr("value", "Wait..."); $("#commitbutton").attr("value", "Wait...");
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: $SCRIPT_ROOT + '/commitProjectFiles', url: $SCRIPT_ROOT + '/commitProjectFiles',
data: {project: $("input#workdir").val() + "/" + project, msg: $("textarea#commitmsg").val()}, data: {project: $("input#workdir").val() + "/" + project, msg: $("input#commitmsg").val()},
success: function (data) { success: function (data) {
if (data.code === 1) { if (data.code === 1) {
if (data.result !== "") { if (data.result !== "") {
......
...@@ -111,12 +111,12 @@ ...@@ -111,12 +111,12 @@
<!--<img class="waitting" id="pullimgwaitting" src="{{ url_for('static', filename='images/waiting.gif') }}" alt="" />--> <!--<img class="waitting" id="pullimgwaitting" src="{{ url_for('static', filename='images/waiting.gif') }}" alt="" />-->
</div> </div>
</div> </div>
<div id="push" style="margin-bottom:20px;"> <div id="commit" style="margin-bottom:20px;">
<h2>Commit All your changes (On active branch)</h2> <h2>Commit All your changes (On active branch)</h2>
<div style="margin-left:15px;"> <div style="margin-left:15px;">
<label for='commitmsg'>Commit message: </label> <label for='commitmsg'>Commit message: </label>
<input type="text" name="commitmsg" id="commitmsg" size='40' value="Enter message..." /> <input type="text" name="commitmsg" id="commitmsg" size='40' value="Enter message..." />
<input type="submit" name="commit" id ="commit" value="Commit" class="button"/> <input type="submit" name="commit" id ="commitbutton" value="Commit" class="button"/>
<img class="waitting" id="imgwaitting" src="{{ url_for('static', filename='images/waiting.gif') }}" alt="" /> <img class="waitting" id="imgwaitting" src="{{ url_for('static', filename='images/waiting.gif') }}" alt="" />
</div> </div>
</div> </div>
......
...@@ -403,6 +403,14 @@ def getProjectDiff(): ...@@ -403,6 +403,14 @@ def getProjectDiff():
result="Error: No such file or directory. PERMISSION DENIED!") result="Error: No such file or directory. PERMISSION DENIED!")
def commitProjectFiles():
path = realpath(app.config, request.form['project'])
if path:
return gitCommit(path, request.form['msg'])
else:
return jsonify(code=0, result="Can not read folder: Permission Denied")
def pushProjectFiles(): def pushProjectFiles():
path = realpath(app.config, request.form['project']) path = realpath(app.config, request.form['project'])
if path: if path:
...@@ -787,6 +795,8 @@ app.add_url_rule("/slapgridResult", 'slapgridResult', ...@@ -787,6 +795,8 @@ app.add_url_rule("/slapgridResult", 'slapgridResult',
app.add_url_rule("/getmd5sum", 'getmd5sum', getmd5sum, methods=['POST']) app.add_url_rule("/getmd5sum", 'getmd5sum', getmd5sum, methods=['POST'])
app.add_url_rule("/checkFileType", 'checkFileType', checkFileType, app.add_url_rule("/checkFileType", 'checkFileType', checkFileType,
methods=['POST']) methods=['POST'])
app.add_url_rule("/commitProjectFiles", 'commitProjectFiles', commitProjectFiles,
methods=['POST'])
app.add_url_rule("/pullProjectFiles", 'pullProjectFiles', pullProjectFiles, app.add_url_rule("/pullProjectFiles", 'pullProjectFiles', pullProjectFiles,
methods=['POST']) methods=['POST'])
app.add_url_rule("/pushProjectFiles", 'pushProjectFiles', pushProjectFiles, app.add_url_rule("/pushProjectFiles", 'pushProjectFiles', pushProjectFiles,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment