Commit 7c98e0a2 authored by Nicolas Wavrant's avatar Nicolas Wavrant

slaprunner : code added cleaned

parent 72b353f0
...@@ -122,7 +122,7 @@ def gitCommit(project, msg): ...@@ -122,7 +122,7 @@ def gitCommit(project, msg):
Args: Args:
project: directory of the local repository project: directory of the local repository
msg: commit message""" msg: commit message"""
code = 0 code = 1
json = "" json = ""
repo = Repo(project) repo = Repo(project)
if repo.is_dirty: if repo.is_dirty:
...@@ -134,7 +134,6 @@ def gitCommit(project, msg): ...@@ -134,7 +134,6 @@ def gitCommit(project, msg):
#Commit all modified and untracked files #Commit all modified and untracked files
git.commit('-a', '-m', msg) git.commit('-a', '-m', msg)
else: else:
code = 1
json = "Nothing to be commited" json = "Nothing to be commited"
return jsonify(code=code, result=json) return jsonify(code=code, result=json)
...@@ -145,7 +144,6 @@ def gitPush(project): ...@@ -145,7 +144,6 @@ def gitPush(project):
msg: commit message""" msg: commit message"""
code = 0 code = 0
json = "" json = ""
import pdb;pdb.set_trace()
repo = Repo(project) repo = Repo(project)
try: try:
git = repo.git git = repo.git
......
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
/*global $, document, $SCRIPT_ROOT */ /*global $, document, $SCRIPT_ROOT */
/* vim: set et sts=4: */ /* vim: set et sts=4: */
$.valHooks.textarea = {
get: function (elem) {
"use strict";
return elem.value.replace(/\r?\n/g, "\r\n");
}
};
$(document).ready(function () { $(document).ready(function () {
"use strict"; "use strict";
...@@ -24,7 +31,6 @@ $(document).ready(function () { ...@@ -24,7 +31,6 @@ $(document).ready(function () {
$("#status").empty(); $("#status").empty();
$("#commit").hide(); $("#commit").hide();
$("#push").hide();
$("#flash").empty(); $("#flash").empty();
if (project === "") { if (project === "") {
$("#status").append("<h2>Please select one project...</h2><br/><br/>"); $("#status").append("<h2>Please select one project...</h2><br/><br/>");
...@@ -47,7 +53,6 @@ $(document).ready(function () { ...@@ -47,7 +53,6 @@ $(document).ready(function () {
$("#status").append("<p>" + message + "</p>"); $("#status").append("<p>" + message + "</p>");
if (data.dirty) { if (data.dirty) {
$("#commit").show(); $("#commit").show();
$("#push").show();
$("#status").append("<br/><h2>Display Diff for current Project</h2>"); $("#status").append("<br/><h2>Display Diff for current Project</h2>");
$("#status").append("<p style='font-size:15px;'>You have changes in your project." + $("#status").append("<p style='font-size:15px;'>You have changes in your project." +
" <a href='" + $SCRIPT_ROOT + "/getProjectDiff/" " <a href='" + $SCRIPT_ROOT + "/getProjectDiff/"
...@@ -121,9 +126,9 @@ $(document).ready(function () { ...@@ -121,9 +126,9 @@ $(document).ready(function () {
checkout("0"); checkout("0");
return false; return false;
}); });
$("#commit").click(function () { $("#commitb").click(function () {
if ($("input#commitmsg").val() === "" || if ($("input#commitmsg").val() === "" ||
$("input#commitmsg").val() === "Enter message...") { $("textarea#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;
} }
...@@ -134,11 +139,11 @@ $(document).ready(function () { ...@@ -134,11 +139,11 @@ $(document).ready(function () {
var project = $("#project").val(); var project = $("#project").val();
$("#imgwaitting").fadeIn('normal'); $("#imgwaitting").fadeIn('normal');
//$("#commit").empty(); //$("#commit").empty();
$("#commit").attr("value", "Wait..."); $("#commitb").attr("value", "Wait...");
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: $SCRIPT_ROOT + '/commitProjectFiles', url: $SCRIPT_ROOT + '/commitProjectFiles',
data: {project: $("input#workdir").val() + "/" + project, msg: $("input#commitmsg").val()}, data: {project: $("input#workdir").val() + "/" + project, msg: $("textarea#commitmsg").val()},
success: function (data) { success: function (data) {
if (data.code === 1) { if (data.code === 1) {
if (data.result !== "") { if (data.result !== "") {
...@@ -146,19 +151,20 @@ $(document).ready(function () { ...@@ -146,19 +151,20 @@ $(document).ready(function () {
} else { } else {
$("#error").Popup("Commit done!", {type: 'confirm', duration: 3000}); $("#error").Popup("Commit done!", {type: 'confirm', duration: 3000});
} }
$("#commit").hide();
gitStatus(); gitStatus();
} else { } else {
$("#error").Popup(data.result, {type: 'error'}); $("#error").Popup(data.result, {type: 'error'});
} }
$("#imgwaitting").hide(); $("#imgwaitting").hide();
$("#commit").empty(); $("#commitmsg").empty();
$("#commit").attr("value", "Commit"); $("#commitb").attr("value", "Commit");
send = false; send = false;
} }
}); });
return false; return false;
}); });
$("#push").click(function() { $("#push").click(function () {
if (send) { if (send) {
return false; return false;
} }
...@@ -168,7 +174,7 @@ $(document).ready(function () { ...@@ -168,7 +174,7 @@ $(document).ready(function () {
type: "POST", type: "POST",
url: $SCRIPT_ROOT + '/pushProjectFiles', url: $SCRIPT_ROOT + '/pushProjectFiles',
data: {project: $("input#workdir").val() + "/" + project}, data: {project: $("input#workdir").val() + "/" + project},
success: function(data) { success: function (data) {
if (data.code === 1) { if (data.code === 1) {
if (data.result !== "") { if (data.result !== "") {
$("#error").Popup(data.result, {type: 'error', duration: 5000}); $("#error").Popup(data.result, {type: 'error', duration: 5000});
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</div> </div>
<div class="wmenu"> <div class="wmenu">
<ul> <ul>
<li><a href="{{ url_for('editSoftwareProfile') }}">Profiles 4</a></li> <li><a href="{{ url_for('editSoftwareProfile') }}">Profiles</a></li>
<li><a href="{{ url_for('browseWorkspace') }}">Workspace</a></li> <li><a href="{{ url_for('browseWorkspace') }}">Workspace</a></li>
<li class='sep'></li> <li class='sep'></li>
<li><a href="{{ url_for('runSoftwareProfile') }}" id="softrun">Run software</a></li> <li><a href="{{ url_for('runSoftwareProfile') }}" id="softrun">Run software</a></li>
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<label for='commitmsg'>Commit message: </label> <label for='commitmsg'>Commit message: </label>
<textarea name="commitmsg" id="commitmsg" cols="40" rows="3"> <textarea name="commitmsg" id="commitmsg" cols="40" rows="3">
</textarea> </textarea>
<input type="submit" name="commit" id ="commit" value="Commit" class="button"/> <input type="submit" name="commit" id ="commitb" 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>
......
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