Commit b677f7d4 authored by Alain Takoudjou's avatar Alain Takoudjou

Update some features at javascript and UI

parent decbd4b3
...@@ -70,7 +70,7 @@ overflow-y: scroll; ...@@ -70,7 +70,7 @@ overflow-y: scroll;
.block_header{ .block_header{
text-align: left; text-align: left;
padding-left: 25px; padding-left: 20px;
height: 30px; height: 30px;
} }
...@@ -84,7 +84,7 @@ overflow-y: scroll; ...@@ -84,7 +84,7 @@ overflow-y: scroll;
font-weight: normal; font-weight: normal;
padding-top: 3px; padding-top: 3px;
float: left; float: left;
width: 690px; width: 656px;
height: 22px; height: 22px;
text-align: center; text-align: center;
color: #4c6172; color: #4c6172;
...@@ -260,11 +260,8 @@ overflow-y: scroll; ...@@ -260,11 +260,8 @@ overflow-y: scroll;
box-shadow: 1px 1px 1px #888888; box-shadow: 1px 1px 1px #888888;
} }
.button:active { .button:active {
background-position: 0 top; background: #eee;
position: relative; color: #000;
top: 1px;
padding: 6px 10px 4px;
box-shadow: 1px 1px 1px #888888;
} }
.focusField{ .focusField{
...@@ -644,6 +641,7 @@ a.lshare img{ ...@@ -644,6 +641,7 @@ a.lshare img{
width: 30px; width: 30px;
height:22px; height:22px;
} }
#error p{white-space: pre-wrap; word-wrap: break-word; width: 430px; padding-bottom: 5px;}
.noscroll { .noscroll {
overflow: hidden; overflow: hidden;
} }
......
...@@ -97,7 +97,13 @@ $(document).ready( function() { ...@@ -97,7 +97,13 @@ $(document).ready( function() {
$("#clone").empty(); $("#clone").empty();
$("#clone").append("Clone"); $("#clone").append("Clone");
send = false; send = false;
} },
error: function(request,error) {
$("#error").Popup("unable to clone your project, please check your internet connection", {type:'error', duration:3000});
$("#imgwaitting").hide();
$("#clone").empty();
$("#clone").append("Clone");
}
}); });
return false; return false;
}); });
......
...@@ -9,27 +9,33 @@ $(document).ready( function() { ...@@ -9,27 +9,33 @@ $(document).ready( function() {
$("#info").append("Please select your file or folder into the box..."); $("#info").append("Please select your file or folder into the box...");
fillContent(); fillContent();
}); });
function selectFile(file){ function selectFile(file){
var relativeFile = file.replace(runnerDir + "/" + $("#softwarelist").val(), ""); var relativeFile = file.replace(runnerDir + "/" + $("#softwarelist").val(), "");
$("#info").empty(); $("#info").empty();
$("#info").append("Selection: " + relativeFile); $("#info").append("Selection: " + relativeFile);
return; return;
} }
function fillContent(){ function fillContent(){
var folder = $("#softwarelist").val(); var folder = $("#softwarelist").val();
var elt = $("option:selected", $("#softwarelist")); var elt = $("option:selected", $("#softwarelist"));
$('#fileTree').fileTree({ root: runnerDir + "/" + folder, script: $SCRIPT_ROOT + '/readFolder', if(elt.val() !== "No Software Release found"){
folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function(file) { $('#fileTree').fileTree({ root: runnerDir + "/" + folder, script: $SCRIPT_ROOT + '/readFolder',
selectFile(file); folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function(file) {
}, function(file){ viewFile(file)}); selectFile(file);
$("#softcontent").empty(); }, function(file){ viewFile(file)});
$("#softcontent").append("File content: " + elt.attr('title')); $("#softcontent").empty();
$("#softcontent").append("File content: " + elt.attr('title'));
}
} }
$("#open").click(function(){ $("#open").click(function(){
var elt = $("option:selected", $("#softwarelist")); var elt = $("option:selected", $("#softwarelist"));
if(elt.val() === "No Software Release found"){
$("#error").Popup("Please select your Software Release", {type:'alert', duration:5000});
return false;
}
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: $SCRIPT_ROOT + '/setCurrentProject', url: $SCRIPT_ROOT + '/setCurrentProject',
...@@ -39,14 +45,18 @@ $(document).ready( function() { ...@@ -39,14 +45,18 @@ $(document).ready( function() {
location.href = $SCRIPT_ROOT + '/editSoftwareProfile' location.href = $SCRIPT_ROOT + '/editSoftwareProfile'
} }
else{ else{
$("#error").Popup(data.result, {type:'error'}); $("#error").Popup(data.result, {type:'error', duration:5000});
} }
} }
}); });
return false; return false;
}); });
$("#delete").click(function(){ $("#delete").click(function(){
if($("#softwarelist").val() === "No Software Release found"){
$("#error").Popup("Please select your Software Release", {type:'alert', duration:5000});
return false;
}
if(send) return; if(send) return;
send = false; send = false;
$.ajax({ $.ajax({
...@@ -55,21 +65,27 @@ $(document).ready( function() { ...@@ -55,21 +65,27 @@ $(document).ready( function() {
data: "name=" + $("#softwarelist").val(), data: "name=" + $("#softwarelist").val(),
success: function(data){ success: function(data){
if(data.code == 1){ if(data.code == 1){
var folder = $("#softwarelist").val(); var folder = $("#softwarelist").val();
$('#fileTree').fileTree({ root: runnerDir + "/" + folder, script: $SCRIPT_ROOT + '/readFolder', folderEvent: 'click', expandSpeed: 750,
collapseSpeed: 750, multiFolder: false, selectFolder: true }, function(file) {
selectFile(file);
setupFileTree(runnerDir);
}, function(file){ viewFile(file)});
$("input#file").val(""); $("input#file").val("");
$("#info").empty(); $("#info").empty();
$("#info").append("Please select your file or folder into the box..."); $("#info").append("Please select your file or folder into the box...");
$("#softwarelist").empty(); $("#softwarelist").empty();
for(i=0; i<data.result.length; i++){ for(i=0; i<data.result.length; i++){
$("#softwarelist").append('<option value="' + data.result[i]["md5"] + $("#softwarelist").append('<option value="' + data.result[i]["md5"] +
'" title="' + data.result[i]["title"] +'" rel="' + '" title="' + data.result[i]["title"] +'" rel="' +
data.result[i]["path"] +'">' + data.result[i]["title"] + '</option>'); data.result[i]["path"] +'">' + data.result[i]["title"] + '</option>');
} }
if(data.result.length < 1){
$("#softwarelist").append('<option>No Software Release found</option>');
$('#fileTree').empty();
}
else{
folder = $("#softwarelist").val();
$('#fileTree').fileTree({ root: runnerDir + "/" + folder, script: $SCRIPT_ROOT + '/readFolder', folderEvent: 'click', expandSpeed: 750,
collapseSpeed: 750, multiFolder: false, selectFolder: true }, function(file) {
selectFile(file);
}, function(file){ viewFile(file)});
}
$("#error").Popup("Operation complete, Selected Software Release has been delete!", {type:'confirm', duration:5000}); $("#error").Popup("Operation complete, Selected Software Release has been delete!", {type:'confirm', duration:5000});
} }
else{ else{
...@@ -78,15 +94,15 @@ $(document).ready( function() { ...@@ -78,15 +94,15 @@ $(document).ready( function() {
send = false; send = false;
} }
}); });
return false; return false;
}); });
function viewFile(file){ function viewFile(file){
//User have double click on file in to the fileTree //User have double click on file in to the fileTree
var name = file.replace(runnerDir + "/" + $("#softwarelist").val(), "/software"); var name = file.replace(runnerDir + "/" + $("#softwarelist").val(), "/software");
loadFileContent(file, name); loadFileContent(file, name);
} }
function loadFileContent(file, filename){ function loadFileContent(file, filename){
$.ajax({ $.ajax({
type: "POST", type: "POST",
...@@ -99,14 +115,14 @@ $(document).ready( function() { ...@@ -99,14 +115,14 @@ $(document).ready( function() {
type: "POST", type: "POST",
url: $SCRIPT_ROOT + '/getFileContent', url: $SCRIPT_ROOT + '/getFileContent',
data: {file:file, truncate:1500}, data: {file:file, truncate:1500},
success: function(data){ success: function(data){
if(data.code == 1){ if(data.code == 1){
$("#inline_content").empty(); $("#inline_content").empty();
$("#inline_content").append('<h2 style="color: #4c6172; font: 18px \'Helvetica Neue\', Helvetica, Arial, sans-serif;">Inspect Software Content: ' + $("#inline_content").append('<h2 style="color: #4c6172; font: 18px \'Helvetica Neue\', Helvetica, Arial, sans-serif;">Inspect Software Content: ' +
filename +'</h2>'); filename +'</h2>');
$("#inline_content").append('<br/><div class="main_content"><pre id="editor"></pre></div>'); $("#inline_content").append('<br/><div class="main_content"><pre id="editor"></pre></div>');
setupEditor(); setupEditor();
$(".inline").colorbox({inline:true, width: "847px", onComplete:function(){ $(".inline").colorbox({inline:true, width: "847px", onComplete:function(){
editor.getSession().setValue(data.result); editor.getSession().setValue(data.result);
}}); }});
$(".inline").click(); $(".inline").click();
...@@ -128,11 +144,11 @@ $(document).ready( function() { ...@@ -128,11 +144,11 @@ $(document).ready( function() {
} }
}); });
} }
function setupEditor(){ function setupEditor(){
editor = ace.edit("editor"); editor = ace.edit("editor");
editor.setTheme("ace/theme/crimson_editor"); editor.setTheme("ace/theme/crimson_editor");
var CurentMode = require("ace/mode/text").Mode; var CurentMode = require("ace/mode/text").Mode;
editor.getSession().setMode(new CurentMode()); editor.getSession().setMode(new CurentMode());
editor.getSession().setTabSize(2); editor.getSession().setTabSize(2);
......
$(document).ready( function() { $(document).ready( function() {
var send = false; var send = false;
//change background
$("body").css("background", "#9C9C9C");
$("#login").click(function(){ $("#login").click(function(){
if (send) return false; if (send) return false;
if($("input#clogin").val() === "" || !$("input#clogin").val().match(/^[\w\d\.-]+$/)){ if($("input#clogin").val() === "" || !$("input#clogin").val().match(/^[\w\d\.-]+$/)){
......
...@@ -106,7 +106,7 @@ function setRunningState(data){ ...@@ -106,7 +106,7 @@ function setRunningState(data){
$current.css("color", "#000"); $current.css("color", "#000");
$current = undefined; $current = undefined;
currentState = false; currentState = false;
$("#error").Popup("Successfully run " + processType + " Profile", {type:'info', duration:3000}); $("#error").Popup("Slapgrid completely finish running your " + processType + " Profile", {type:'info', duration:3000});
} }
} }
currentState = data.result; currentState = data.result;
......
{% extends "layout.html" %} {% extends "layout.html" %}
{% block title %}SlapOs buildout web based runner {% endblock %} {% block title %}SlapOS buildout web based runner {% endblock %}
{% block body %} {% block body %}
<div id="home_box"> <div id="home_box">
<div class="inner_box"> <div class="inner_box">
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</div> </div>
<div class="umenu"> <div class="umenu">
<h2><a href="{{ url_for('myAccount')}}">Your Account</a></h2> <h2><a href="{{ url_for('myAccount')}}">Your Account</a></h2>
<p>Click here to Manage your account</p> <p>Update your account informations</p>
<img src="{{ url_for('static', filename='images/user_card.png') }}" /> <img src="{{ url_for('static', filename='images/user_card.png') }}" />
</div> </div>
<div class="clear"></div> <div class="clear"></div>
......
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
<a href="{{ url_for('home') }}" style="float:left;" id="home" {% if request.path != '/' %}rel="tooltip"{% endif %} title="Home"><img alt="" src="{{ url_for('static', filename='images/home.png') }}" /></a> <a href="{{ url_for('home') }}" style="float:left;" id="home" {% if request.path != '/' %}rel="tooltip"{% endif %} title="Home"><img alt="" src="{{ url_for('static', filename='images/home.png') }}" /></a>
<div class="line"></div> <div class="line"></div>
<a href="{{ url_for('editCurrentProject') }}" style="float:left" title="Edit your current project"><img alt="" src="{{ url_for('static', filename='images/project.png') }}" /></a> <a href="{{ url_for('editCurrentProject') }}" style="float:left" title="Edit your current project"><img alt="" src="{{ url_for('static', filename='images/project.png') }}" /></a>
<div class="line"></div>
<a href="{{ url_for('logout') }}" style="float:left" title="Close your session"><img alt="" src="{{ url_for('static', filename='images/logout.png') }}" /></a>
<div class="line"></div> <div class="line"></div>
<h2 class="info">{% block title %}{% endblock %} - {{session.title}}</h2> <h2 class="info">{% block title %}{% endblock %} - {{session.title}}</h2>
<div class="run"><span id="running" style="display:none"><img alt="" src="{{ url_for('static', filename='images/ajax_roller.gif') }}" <div class="run"><span id="running" style="display:none"><img alt="" src="{{ url_for('static', filename='images/ajax_roller.gif') }}"
...@@ -121,9 +123,9 @@ ...@@ -121,9 +123,9 @@
<div style="margin-top:3px;border-bottom: 1px dashed #666666; heigth:1px"></div> <div style="margin-top:3px;border-bottom: 1px dashed #666666; heigth:1px"></div>
<ul> <ul>
<li><a href="{{ url_for('manageProject')}}">Manage Repositories</a></li> <li><a href="{{ url_for('manageProject')}}">Manage Repositories</a></li>
<li><a href="{{ url_for('configRepo')}}" >Clone your repository</a></li>
<li><a href="{{ url_for('openProject', method='open')}}">Open Software Release</a></li> <li><a href="{{ url_for('openProject', method='open')}}">Open Software Release</a></li>
<li><a href="{{ url_for('openProject', method='new')}}">Create Software Release</a></li> <li><a href="{{ url_for('openProject', method='new')}}">Create Software Release</a></li>
<li><a href="{{ url_for('logout')}}" >Close your session</a></li>
</ul> </ul>
</div> </div>
</body> </body>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<input type="hidden" name="runnerdir" id="runnerdir" value="{{softwareRoot}}" /> <input type="hidden" name="runnerdir" id="runnerdir" value="{{softwareRoot}}" />
<label for='softwarelist'>Select software: </label> <label for='softwarelist'>Select software: </label>
<select name="softwarelist" id="softwarelist"> <select name="softwarelist" id="softwarelist">
{%if not softwares %}<option >No Software Release found</option>{% endif %}
{%for soft in softwares %} {%for soft in softwares %}
<option value="{{soft['md5']}}" title="{{soft['title']}}" rel="{{soft['path']}}">{{soft['title']}}</option> <option value="{{soft['md5']}}" title="{{soft['title']}}" rel="{{soft['path']}}">{{soft['title']}}</option>
{%endfor%} {%endfor%}
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
&nbsp;&nbsp;<button id ="delete" class="button" title="Remove this software">Remove</button> &nbsp;&nbsp;<button id ="delete" class="button" title="Remove this software">Remove</button>
&nbsp;&nbsp;<button id ="open" class="button" title="Set this software as current software release">Open</button> &nbsp;&nbsp;<button id ="open" class="button" title="Set this software as current software release">Open</button>
<br/><br/> <br/><br/>
<h2 id="softcontent">No content to displays</h2> <h2 id="softcontent">No file or folder to display</h2>
<div id="fileTree" class="file_tree" style='height:200px;' title="Double click to open file"></div> <div id="fileTree" class="file_tree" style='height:200px;' title="Double click to open file"></div>
<div id="file_info" class="file_info"> <div id="file_info" class="file_info">
<span id="info">Please select your file or folder into the box...</span></div> <span id="info">Please select your file or folder into the box...</span></div>
......
...@@ -51,6 +51,7 @@ def checkLogin(config, login, pwd): ...@@ -51,6 +51,7 @@ def checkLogin(config, login, pwd):
Returns: Returns:
a list of user informations or False if authentication fail. a list of user informations or False if authentication fail.
list=[username, password, email, complete_name]
""" """
user = getSession(config) user = getSession(config)
salt = "runner81" #to be changed salt = "runner81" #to be changed
...@@ -162,8 +163,6 @@ def updateProxy(config): ...@@ -162,8 +163,6 @@ def updateProxy(config):
xml_result = readParameters(param_path) xml_result = readParameters(param_path)
partition_parameter_kw = None partition_parameter_kw = None
if type(xml_result) != type('') and xml_result.has_key('instance'): if type(xml_result) != type('') and xml_result.has_key('instance'):
for item in xml_result['instance'].keys():
xml_result['instance'][item] = xml_result['instance'][item].decode('utf-8')
partition_parameter_kw = xml_result['instance'] partition_parameter_kw = xml_result['instance']
computer.updateConfiguration(xml_marshaller.dumps(slap_config)) computer.updateConfiguration(xml_marshaller.dumps(slap_config))
sr_request = slap.registerOpenOrder().request(profile, partition_reference=getSoftwareReleaseName(config), sr_request = slap.registerOpenOrder().request(profile, partition_reference=getSoftwareReleaseName(config),
...@@ -582,6 +581,9 @@ def configNewSR(config, projectpath): ...@@ -582,6 +581,9 @@ def configNewSR(config, projectpath):
removeProxyDb(config) removeProxyDb(config)
startProxy(config) startProxy(config)
removeInstanceRoot(config) removeInstanceRoot(config)
param_path = os.path.join(config['runner_workdir'], ".parameter.xml")
if os.path.exists(param_path):
os.remove(param_path)
open(os.path.join(config['runner_workdir'], ".project"), 'w').write(projectpath) open(os.path.join(config['runner_workdir'], ".project"), 'w').write(projectpath)
return True return True
else: else:
......
...@@ -25,8 +25,6 @@ def before_request(): ...@@ -25,8 +25,6 @@ def before_request():
# general views # general views
@app.route('/') @app.route('/')
def home(): def home():
if not os.path.exists(app.config['workspace']) or len(os.listdir(app.config['workspace'])) == 0:
return redirect(url_for('configRepo'))
return render_template('index.html') return render_template('index.html')
@app.route("/login") @app.route("/login")
...@@ -154,6 +152,9 @@ def removeInstance(): ...@@ -154,6 +152,9 @@ 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_workdir'], ".parameter.xml")
if os.path.exists(param_path):
os.remove(param_path)
flash('Instance removed') flash('Instance removed')
return redirect(url_for('inspectInstance')) return redirect(url_for('inspectInstance'))
......
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