Commit 46a5ef82 authored by Nicolas Wavrant's avatar Nicolas Wavrant

Update slaprunner editor and repository layout

Conflicts:
	slapos/runner/views.py
parent 56cb1129
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
overflow:hidden; overflow:hidden;
height:34px; height:34px;
position:absolute; position:absolute;
z-index:100; z-index:80;
} }
#tabContaier > ul > li{ #tabContaier > ul > li{
float:left; float:left;
......
...@@ -110,7 +110,7 @@ body { ...@@ -110,7 +110,7 @@ body {
height: 22px; height: 22px;
text-align: center; text-align: center;
color: #4c6172; color: #4c6172;
text-shadow: 0 1px 1px #fff; text-shadow: 0 1px 1px #F1F1F1;
overflow: hidden; overflow: hidden;
} }
#header .line{ #header .line{
...@@ -145,25 +145,6 @@ body { ...@@ -145,25 +145,6 @@ body {
margin-left: 28px; margin-left: 28px;
} }
#wmenu a.slapos_run{
background: url(../images/run_button.png) center no-repeat;
}
#wmenu a.slapos_run:hover{
background: #c2c2c2 url(../images/run_button2.png) center no-repeat;
}
#wmenu a.slapos_stop{
background: url(../images/stop_button.png) center no-repeat;
}
#wmenu a.slapos_stop:hover{
background: #c2c2c2 url(../images/stop_button2.png) center no-repeat;
}
#wmenu a.main_menu{
background: url(../images/main_menu.png) center no-repeat;
}
#wmenu a.main_menu:hover{
background: #c2c2c2 url(../images/main_menu_hover.png) center no-repeat;
}
#main #main
{ {
background: url(../images/main_bg_all.png) repeat-y; background: url(../images/main_bg_all.png) repeat-y;
...@@ -174,9 +155,9 @@ body { ...@@ -174,9 +155,9 @@ body {
.main_content{ .main_content{
position:relative; position:relative;
width: 99.6%; /*width: 99.6%;*/
height: 430px; height: 430px;
margin-top:10px; margin-top:2px;
border:1px solid #4c6172; border:1px solid #4c6172;
overflow:auto; overflow:auto;
} }
...@@ -191,8 +172,8 @@ body { ...@@ -191,8 +172,8 @@ body {
background: url(../images/content.png) repeat-y; background: url(../images/content.png) repeat-y;
width: 936px; width: 936px;
padding: 15px; padding: 15px;
padding-top:0; padding-top:1px;
padding-bottom:0; padding-bottom:2px;
min-height: 400px; min-height: 400px;
} }
...@@ -434,7 +415,7 @@ padding: 10px;height: 80px;padding-bottom:15px;} ...@@ -434,7 +415,7 @@ padding: 10px;height: 80px;padding-bottom:15px;}
.software_details{float: left;} .software_details{float: left;}
#details_box{ #details_box{
display:block; display:block;
margin-top:10px; margin-top:2px;
} }
#code{ #code{
float: right; float: right;
...@@ -443,7 +424,7 @@ padding: 10px;height: 80px;padding-bottom:15px;} ...@@ -443,7 +424,7 @@ padding: 10px;height: 80px;padding-bottom:15px;}
#details_head{margin-bottom: 10px;} #details_head{margin-bottom: 10px;}
#contentInfo{ #contentInfo{
width: 926px; width: 882px;
border: solid 1px #678dad; border: solid 1px #678dad;
background: #fff; background: #fff;
overflow: auto; overflow: auto;
...@@ -599,7 +580,6 @@ h2.hight:hover{ ...@@ -599,7 +580,6 @@ h2.hight:hover{
color: #737373; color: #737373;
font-weight: bold; font-weight: bold;
text-shadow: 0px 1px #FFF; text-shadow: 0px 1px #FFF;
margin-bottom: 9px;
font-size: 14px; font-size: 14px;
cursor:default; cursor:default;
word-wrap: break-word word-wrap: break-word
...@@ -651,7 +631,8 @@ select { ...@@ -651,7 +631,8 @@ select {
overflow: hidden; overflow: hidden;
padding: 4px; padding: 4px;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap;} white-space: nowrap;
min-width: 80px;}
a.lshare{ a.lshare{
background: #fff; background: #fff;
...@@ -679,6 +660,25 @@ a.no-right-border:focus{border-right:none} ...@@ -679,6 +660,25 @@ a.no-right-border:focus{border-right:none}
a.lshare img{ a.lshare img{
margin: 5px; margin: 5px;
} }
.box_header{
background: #E4E4E4;
width: 100%;
height: 30px;
padding-top: 2px;
text-indent: 5px;
color: #737373;
text-shadow: 0px 1px #F1F1F1;
border-bottom: 3px solid #6DB9DD;
}
.box_header li{float: left;border: 1px solid #AAB8C2;padding: 1px 5px 1px 0;margin-left: 5px;}
.box_header li:last-child{border:none}
.box_header li h2{padding-top: 2px;}
.box_header li > span{cursor: pointer; height: 22px; display: block;line-height: 22px;font-weight: bold;padding: 1px;}
.box_header li:hover{border: 1px solid #57A1D6;background: #C7C7C7;}
.box_header li:last-child:hover{background:none; border: none}
.box_header li>a{font-weight: bold; font-size:15px;display: block;padding: 2px;}
.save_btn{background: url(../images/icon_save.png) center right no-repeat;width: 60px;}
.swith_btn{background: url(../images/gnome-session-switch.png) center right no-repeat;width: 105px;}
#error{ #error{
padding: 0px; padding: 0px;
......
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
} }
.sf-menu ul { .sf-menu ul {
box-shadow: 2px 2px 6px rgba(0,0,0,.2); box-shadow: 2px 2px 6px rgba(0,0,0,.2);
min-width: 14em; /* allow long menu items to determine submenu width */ min-width: 16em; /* allow long menu items to determine submenu width */
*width: 14em; /* no auto sub width for IE7, see white-space comment below */ *width: 16em; /* no auto sub width for IE7, see white-space comment below */
border: 1px solid #C2C2C2; border: 1px solid #C2C2C2;
background: #E4E4E4; background: #E4E4E4;
border-left:none; border-left:none;
...@@ -70,6 +70,15 @@ ...@@ -70,6 +70,15 @@
width: 35px; width: 35px;
padding:7px; padding:7px;
} }
.sf-menu li.main_menu{
background: url(../images/main_menu.png) center no-repeat;
}
.sf-menu li.slapos_run{
background: url(../images/run_button.png) center no-repeat;
}
.sf-menu li.slapos_stop{
background: url(../images/stop_button.png) center no-repeat;
}
.sf-menu li:hover, .sf-menu li:hover,
.sf-menu li.sfHover { .sf-menu li.sfHover {
color: #fff;/*#0271BF;*/ color: #fff;/*#0271BF;*/
...@@ -78,6 +87,18 @@ ...@@ -78,6 +87,18 @@
-webkit-transition: none; -webkit-transition: none;
transition: none; transition: none;
} }
.sf-menu li.main_menu:hover,
.sf-menu li.main_menu.sfHover {
background: #c2c2c2 url(../images/main_menu_hover.png) center no-repeat;
}
.sf-menu li.slapos_stop:hover,
.sf-menu li.slapos_stop.sfHover{
background: #c2c2c2 url(../images/stop_button2.png) center no-repeat;
}
.sf-menu li.slapos_run:hover,
.sf-menu li.slapos_run.sfHover{
background: #c2c2c2 url(../images/run_button2.png) center no-repeat;
}
.sf-menu li a:hover{ .sf-menu li a:hover{
color: #fff; color: #fff;
} }
......
...@@ -25,6 +25,29 @@ $(document).ready(function () { ...@@ -25,6 +25,29 @@ $(document).ready(function () {
}); });
} }
function fetchRepo(){
$("#project").empty();
$.post($SCRIPT_ROOT + "/listDirectory", {name: 'workspace'}, function (data) {
var result = data.result, i;
if (result.length > 0){
$("#repoEmpty").hide();
$("#repoContent").show();
for (i = 0; i < result.length; i += 1) {
$("#project").append("<option value='"+result[i]+"'>"+result[i]+"</option>")
}
$("#project").change();
}
else{
$("#repoEmpty").show();
$("#repoContent").hide();
}
})
.error(function () {
$("#error").Popup("unable to fetch your project list, please check your project folder", {type: 'error', duration: 5000});
})
.complete(function () {});
}
var send = false, var send = false,
cloneRequest; cloneRequest;
...@@ -39,6 +62,9 @@ $(document).ready(function () { ...@@ -39,6 +62,9 @@ $(document).ready(function () {
$("input#https").change(function () { $("input#https").change(function () {
configRadio(); configRadio();
}); });
$("a#switchtoclone").click(function(){
$("#cloneTab").click();
});
$("#clone").click(function () { $("#clone").click(function () {
if (send) { if (send) {
cloneRequest.abort(); cloneRequest.abort();
...@@ -130,9 +156,9 @@ $(document).ready(function () { ...@@ -130,9 +156,9 @@ $(document).ready(function () {
}); });
return false; return false;
}); });
$("#gitTab").click(function(){
function selectFile(file) { if (! $(this).hasClass('active')){
//nothing fetchRepo();
return;
} }
});
}); });
...@@ -42,11 +42,35 @@ $(document).ready(function () { ...@@ -42,11 +42,35 @@ $(document).ready(function () {
return; return;
} }
if (method !== "file") { function initTree(tree, path, key){
$('#fileTree').fileTree({root: workdir, script: $SCRIPT_ROOT + '/openFolder', folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) { if (!key){
selectFile(file); key = '0';
}
$(tree).fancytree({
activate: function(event, data) {
var node = data.node;
},
click: function(event, data) {
selectFile(data.node.data.path +"/");
},
source: {
url: $SCRIPT_ROOT + "/fileBrowser",
data:{opt: 20, dir: path, key: key, listfiles: ''},
cache: false
},
lazyload: function(event, data) {
var node = data.node;
data.result = {
url: $SCRIPT_ROOT + "/fileBrowser",
data: {opt: 20, dir: node.data.path , key: node.key, listfiles: ''}
}
},
}); });
} }
if (method !== "file") {
initTree('#fileTree', workdir);
}
$("input#subfolder").val(""); $("input#subfolder").val("");
$("#create").click(function () { $("#create").click(function () {
if ($("input#software").val() === "" || !$("input#software").val().match(/^[\w\d._\-]+$/)) { if ($("input#software").val() === "" || !$("input#software").val().match(/^[\w\d._\-]+$/)) {
......
...@@ -28,7 +28,6 @@ $(document).ready(function () { ...@@ -28,7 +28,6 @@ $(document).ready(function () {
function gitStatus() { function gitStatus() {
var project = $("#project").val(), var project = $("#project").val(),
urldata = $("input#workdir").val() + "/" + project; urldata = $("input#workdir").val() + "/" + project;
$("#status").empty(); $("#status").empty();
$("#commit").hide(); $("#commit").hide();
$("#flash").empty(); $("#flash").empty();
...@@ -37,6 +36,9 @@ $(document).ready(function () { ...@@ -37,6 +36,9 @@ $(document).ready(function () {
$("#branchlist").hide(); $("#branchlist").hide();
return; return;
} }
else if (project === undefined || project === null){
return;
}
send = true; send = true;
getStatus = $.ajax({ getStatus = $.ajax({
type: "POST", type: "POST",
......
...@@ -23,7 +23,7 @@ $(document).ready(function () { ...@@ -23,7 +23,7 @@ $(document).ready(function () {
selection = "", selection = "",
edit_status = "", edit_status = "",
base_path = function () { base_path = function () {
return softwareDisplay ? projectDir : currentProject; return softwareDisplay ? currentProject : 'workspace/';
}; };
...@@ -55,9 +55,9 @@ $(document).ready(function () { ...@@ -55,9 +55,9 @@ $(document).ready(function () {
if (data.code === 1) { if (data.code === 1) {
$("#edit_info").empty(); $("#edit_info").empty();
name = file.split('/'); name = file.split('/');
if (file.length > 60) { if (file.length > 80) {
//substring title. //substring title.
start = file.length - 60; start = file.length - 80;
path = "..." + file.substring(file.indexOf("/", (start + 1))); path = "..." + file.substring(file.indexOf("/", (start + 1)));
} }
$("#edit_info").append(" " + path); $("#edit_info").append(" " + path);
...@@ -105,19 +105,21 @@ $(document).ready(function () { ...@@ -105,19 +105,21 @@ $(document).ready(function () {
function switchContent() { function switchContent() {
if (!softwareDisplay) { if (!softwareDisplay) {
$("#switch").empty(); $("span.swith_btn").empty();
$("#switch").append("Switch to Profile&nbsp;"); $("span.swith_btn").append("This project");
$('#fileTreeFull').show(); $('#fileTreeFull').show();
$('#fileTree').hide(); $('#fileTree').hide();
} else { } else {
$("#switch").empty(); $("span.swith_btn").empty();
$("#switch").append("Switch to Project"); $("span.swith_btn").append("Workspace");
$('#fileTree').show(); $('#fileTree').show();
$('#fileTreeFull').hide(); $('#fileTreeFull').hide();
} }
$("#info").empty(); $("#info").empty();
$("#info").append("Current work tree: " + base_path()); $("#info").append("Current work tree: " + base_path());
selection = ""; selection = "";
clipboardNode = null;
pasteMode = null;
} }
function getmd5sum(path) { function getmd5sum(path) {
...@@ -256,7 +258,7 @@ $(document).ready(function () { ...@@ -256,7 +258,7 @@ $(document).ready(function () {
if (data.indexOf('1') === -1) { if (data.indexOf('1') === -1) {
$("#error").Popup("Error: " + data, {type: 'error', duration: 5000}); $("#error").Popup("Error: " + data, {type: 'error', duration: 5000});
} else { } else {
$("#error").Popup("Operation complete!", {type: 'info', duration: 5000}); $("#error").Popup("Operation complete!", {type: 'confirm', duration: 5000});
} }
}, },
error: function(jqXHR, exception) { error: function(jqXHR, exception) {
...@@ -488,16 +490,9 @@ $(document).ready(function () { ...@@ -488,16 +490,9 @@ $(document).ready(function () {
new Mode("python", "Python", require("ace/mode/python").Mode, ["py"]), new Mode("python", "Python", require("ace/mode/python").Mode, ["py"]),
new Mode("buildout", "Python Buildout config", require("ace/mode/buildout").Mode, ["cfg"]) new Mode("buildout", "Python Buildout config", require("ace/mode/buildout").Mode, ["cfg"])
]; ];
/*
$('#fileTree').fileTree({ root: projectDir, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) { initTree('#fileTree', currentProject, 'pfolder');
selectFile(file); initTree('#fileTreeFull', 'workspace');
}, function (file) { openFile(file); });*/
/*$("#fileTree").fancytree();*/
/*$('#fileTreeFull').fileTree({ root: currentProject, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) {
selectFile(file);
}, function (file) { openFile(file); });*/
initTree('#fileTree', projectDir, 'pfolder');
initTree('#fileTreeFull', currentProject);
$("#info").append("Current work tree: " + base_path()); $("#info").append("Current work tree: " + base_path());
/*setDetailBox();*/ /*setDetailBox();*/
...@@ -506,6 +501,14 @@ $(document).ready(function () { ...@@ -506,6 +501,14 @@ $(document).ready(function () {
$("span#edit_status").html("*"); $("span#edit_status").html("*");
} }
}); });
editor.commands.addCommand({
name: 'myCommand',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function(editor) {
$("#save").click();
},
readOnly: false // false if this command should not apply in readOnly mode
});
$("#save").click(function () { $("#save").click(function () {
if (!edit) { if (!edit) {
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
<script src="{{ url_for('static', filename='js/jquery/jqueryTabs.js') }}" type="text/javascript" charset="utf-8"></script> <script src="{{ url_for('static', filename='js/jquery/jqueryTabs.js') }}" type="text/javascript" charset="utf-8"></script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<h2>SlapOS web runner parameters</h2><br/> <h2>Web runner parameters</h2><br/>
<div id="tabContaier"> <div id="tabContaier">
<ul> <ul>
<li><a href="#tab1" class="active">Your personal information</a></li> <li><a href="#tab1" class="active">Your personal information</a></li>
<li><a href="#tab2">Configurations</a></li> <!--<li><a href="#tab2">Configurations</a></li>-->
</ul><!-- //Tab buttons --> </ul><!-- //Tab buttons -->
<div class="tabDetails"> <div class="tabDetails">
<div id="tab1" class="tabContents"> <div id="tab1" class="tabContents">
...@@ -45,8 +45,8 @@ ...@@ -45,8 +45,8 @@
<input type="hidden" name="hasAccount" id="hasAccount" value="{{name}}"/> <input type="hidden" name="hasAccount" id="hasAccount" value="{{name}}"/>
</form> </form>
</div> </div>
<div id="tab2" class="tabContents"> <!--<div id="tab2" class="tabContents">
</div> </div>-->
</div> </div>
</div> </div>
{% if username %}<div id="file_info" class="file_info">leave passwords blank to preserve your current password... {% if username %}<div id="file_info" class="file_info">leave passwords blank to preserve your current password...
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div id="home_box"> <div id="home_box">
<div class="inner_box"> <div class="inner_box">
<div class="lmenu"> <div class="lmenu">
<h2><a href="{{ url_for('configRepo')}}">Clone a Repository into your local Workspace</a></h2> <h2><a href="{{ url_for('manageRepository')}}#tab1">Clone a Repository into your local Workspace</a></h2>
<p>Your repository will be cloned into your project folder, you will need the url of the repository. <p>Your repository will be cloned into your project folder, you will need the url of the repository.
This allows you to open and edit your local project copy and synchronize content with online repository. This allows you to open and edit your local project copy and synchronize content with online repository.
</p> </p>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="sright_menu"> <div class="sright_menu">
<h2><a href="{{ url_for('manageProject')}}">Manage Repositories</a></h2> <h2><a href="{{ url_for('manageRepository')}}#tab2">Manage Repositories</a></h2>
<p>You can view details of all repositories and commit your Software Release here.</p> <p>You can view details of all repositories and commit your Software Release here.</p>
<img src="{{ url_for('static', filename='images/manage_repo.png') }}" /> <img src="{{ url_for('static', filename='images/manage_repo.png') }}" />
</div> </div>
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
<h2>Instance inspection</h2><br/> <h2>Instance inspection</h2><br/>
<div id="tabContaier"> <div id="tabContaier">
<ul> <ul>
<li><a href="#tab1" class="active">Slapgrid Supervisor</a></li> <li><a href="#tab1" class="active">Process</a></li>
<li><a href="#tab2">SLAP Response</a></li> <li><a href="#tab2">Connection Information</a></li>
<li><a href="#tab3" id="parameterTab">SLAP Parameters</a></li> <li><a href="#tab3" id="parameterTab">Parameters</a></li>
<li><a href="#tab4" id="instancetabfiles">Partitions Content</a></li> <li><a href="#tab4" id="instancetabfiles">Partitions Content</a></li>
</ul><!-- //Tab buttons --> </ul><!-- //Tab buttons -->
<div class="tabDetails"> <div class="tabDetails">
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
{% if request.path != '/login' %} {% if request.path != '/login' %}
<div id="header"> <div id="header">
<div class="block_header"> <div class="block_header">
<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" 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('dologout') }}" style="float:left" title="Close your session"><img alt="" src="{{ url_for('static', filename='images/logout.png') }}" /></a> <a href="{{ url_for('dologout') }}" style="float:left" title="Close your session"><img alt="" src="{{ url_for('static', filename='images/logout.png') }}" /></a>
<h2 class="info">{% block title %}{% endblock %} - {{session.title}}</h2> <h2 class="info">{% block title %}{% endblock %} - {{session.title}}</h2>
...@@ -77,16 +77,16 @@ ...@@ -77,16 +77,16 @@
<div id="wmenu"> <div id="wmenu">
<ul class="sf-menu"> <ul class="sf-menu">
<li><a href="{{ url_for('editCurrentProject') }}">Editor</a></li> <li><a href="{{ url_for('editCurrentProject') }}">Editor</a></li>
<li><a href="{{ url_for('browseWorkspace') }}">Services</a></li> <li><a href="{{ url_for('inspectInstance') }}">Services</a></li>
<li><a href="{{ url_for('runSoftwareProfile') }}" id="softrun">Logs</a></li> <li><a href="{{ url_for('viewInstanceLog') }}">Logs</a></li>
<li><a href="{{ url_for('viewSoftwareLog') }}">Terminal</a></li> <li><a href="{{ url_for('viewSoftwareLog') }}">Terminal</a></li>
<li><a href="{{ url_for('inspectSoftware') }}">Git</a></li> <li><a href="{{ url_for('manageRepository')}}#tab2">Git</a></li>
<li class='right_menu'><a class="main_menu" href="{{ url_for('viewInstanceLog') }}"></a> <li class='right_menu main_menu'><a href="#"></a>
<ul> <ul>
<li><a href="{{ url_for('myAccount')}}">Parameters</a></li> <li><a href="{{ url_for('myAccount')}}">Parameters</a></li>
<li class='sep'></li> <li class='sep'></li>
<li><a href="#">Open Software Release</a></li> <li><a href="{{ url_for('openProject', method='open')}}">Open Software Release</a></li>
<li><a href="#">Create Software Release</a></li> <li><a href="{{ url_for('openProject', method='new')}}">Create Software Release</a></li>
<li class='sep'></li> <li class='sep'></li>
<li><a href="{{ url_for('browseWorkspace') }}">Browse Workspace</a></li> <li><a href="{{ url_for('browseWorkspace') }}">Browse Workspace</a></li>
<li><a href="{{ url_for('inspectSoftware') }}">My Softwares Releases</a></li> <li><a href="{{ url_for('inspectSoftware') }}">My Softwares Releases</a></li>
...@@ -94,7 +94,8 @@ ...@@ -94,7 +94,8 @@
<li><a href="{{ url_for('dologout') }}">Log out</a></li> <li><a href="{{ url_for('dologout') }}">Log out</a></li>
</ul> </ul>
</li> </li>
<li class='right_menu'><a class="slapos_run" href="{{ url_for('runInstanceProfile') }}" id="instrun"></a> <li class='right_menu slapos_run'><a href="{{ url_for('runInstanceProfile') }}" id="instrun"></a>
<!--<li><a href="{{ url_for('viewInstanceLog') }}" id="softrun">Logs</a></li>-->
</li> </li>
</ul> </ul>
</div> </div>
...@@ -139,16 +140,5 @@ ...@@ -139,16 +140,5 @@
</tr> </tr>
</tbody></table> </tbody></table>
</div> </div>
<div id="tooltip-home" style="display:none">
<span style="font-weight:bold">QUICK ACCESS TO MENU</span><br/><br/>
<div style="margin-top:3px;border-bottom: 1px dashed #666666; heigth:1px"></div>
<ul class="menu">
<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='new')}}">Create Software Release</a></li>
<li style="heigth:1px"></li>
</ul>
</div>
</body> </body>
</html> </html>
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
{% block title %}Manage your Project{% endblock %} {% block title %}Manage your Project{% endblock %}
{% block head %} {% block head %}
{{ super() }} {{ super() }}
<script src="{{ url_for('static', filename='js/jquery/jqueryFileTree.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/scripts/repo.js') }}" type="text/javascript" charset="utf-8"></script> <script src="{{ url_for('static', filename='js/scripts/repo.js') }}" type="text/javascript" charset="utf-8"></script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
......
...@@ -6,17 +6,18 @@ ...@@ -6,17 +6,18 @@
<link href="{{ url_for('static', filename='css/jqueryTabs.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" /> <link href="{{ url_for('static', filename='css/jqueryTabs.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
<link href="{{ url_for('static', filename='css/colorbox.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" /> <link href="{{ url_for('static', filename='css/colorbox.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
<script src="{{ url_for('static', filename='js/jquery/gsFileManager.js') }}" type="text/javascript" charset="utf-8"></script> <script src="{{ url_for('static', filename='js/jquery/gsFileManager.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/scripts/folder.js') }}" type="text/javascript" charset="utf-8"></script> <script src="{{ url_for('static', filename='js/scripts/cloneRepo.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/scripts/repo.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/jquery/jqueryTabs.js') }}" type="text/javascript" charset="utf-8"></script> <script src="{{ url_for('static', filename='js/jquery/jqueryTabs.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/jquery/jquery.colorbox-min.js') }}" type="text/javascript" charset="utf-8"></script> <script src="{{ url_for('static', filename='js/jquery/jquery.colorbox-min.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/ace/ace.js') }}" type="text/javascript" charset="utf-8"></script> <script src="{{ url_for('static', filename='js/ace/ace.js') }}" type="text/javascript" charset="utf-8"></script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<h2>Clone a project repository into your workspace</h2><br/>
<div id="tabContaier"> <div id="tabContaier">
<ul> <ul>
<li><a href="#tab1" class="active">Clone your repository</a></li> <li><a href="#tab1" class="active" id="cloneTab">Clone repository</a></li>
<li><a href="#tab2">Manage your project folder</a></li> <li><a href="#tab2" id="gitTab">Manage (GIT)</a></li>
<li><a href="#tab3">Browse</a></li>
</ul><!-- //Tab buttons --> </ul><!-- //Tab buttons -->
<div class="tabDetails"> <div class="tabDetails">
<div id="tab1" class="tabContents"> <div id="tab1" class="tabContents">
...@@ -74,6 +75,55 @@ ...@@ -74,6 +75,55 @@
<!--Fin tab1--> <!--Fin tab1-->
</div> </div>
<div id="tab2" class="tabContents"> <div id="tab2" class="tabContents">
<form action="" method=post>
<input type="hidden" name="subfolder" id="subfolder" value="" />
<h2 style="{% if project %}display:none{% endif %}" id="repoEmpty">
Your repository folder is empty. <a id="switchtoclone">Click here</a> to create a new one!
</h2>
<div id="repoContent" style="{% if not project %}display:none{% endif %}">
<label for='project'>Current Repository: </label>
<select id="project" name="project">
{% for folder in project%}
<option value="{{folder}}">{{folder}}</option>
{% endfor %}
</select>
<a id="switchtoclone" class="lshare">&nbsp;New repository&nbsp;</a>
<br/><br/>
<div id="contentInfo">
<div id="status" style="margin-bottom:20px;">
<h2>Please select one project...</h2>
</div>
<div id="branchlist" style="margin-bottom:20px;">
<h2>Your Repository Branches</h2>
<div style="margin-left:15px;">
<label for='activebranch'>Select your active Branch: </label>
<select name="activebranch" id="activebranch">
</select>
&nbsp;&nbsp;<label for='branchname'>Branch Name: </label>
<input type="text" name="branchname" id="branchname" size='22' value="Enter the branch name..." />
<input type="submit" name="addbranch" id ="addbranch" value="Add" class="button" title='add new branch: git checkout -b branch'/>
<input type="submit" name="docheckout" id ="docheckout" value="Checkout" class="button" title='add existing branch: git checkout branch'/>
<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'>Commit message: </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="" />
</div>
</div>
<br/>
</div>
</div>
</form>
</div>
<div id="tab3" class="tabContents">
<div id="fileNavigator"></div> <div id="fileNavigator"></div>
</div> </div>
</div> </div>
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
{% block title %}{% if method == "new" %}Adding new software{%else%}Open existing project{%endif%}{% endblock %} {% block title %}{% if method == "new" %}Adding new software{%else%}Open existing project{%endif%}{% endblock %}
{% block head %} {% block head %}
{{ super() }} {{ super() }}
<link href="{{ url_for('static', filename='css/jqueryFileTree.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" /> <link href="{{ url_for('static', filename='css/ui.fancytree.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
<script src="{{ url_for('static', filename='js/jquery/jqueryFileTree.js') }}" type="text/javascript" charset="utf-8"></script> <script src="{{ url_for('static', filename='js/jquery/jquery.fancytree.min.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/scripts/project.js') }}" type="text/javascript" charset="utf-8"></script> <script src="{{ url_for('static', filename='js/scripts/project.js') }}" type="text/javascript" charset="utf-8"></script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
......
...@@ -39,23 +39,29 @@ ...@@ -39,23 +39,29 @@
</ul> </ul>
<div id="software_folder"> <div id="software_folder">
<div class="software_details">
<div> <div>
<a href="#" id="switch" class="lshare no-right-border" style="float:left">Switch to Project</a> <ul class='box_header'>
<a href="#" id="clearselect" class="lshare no-right-border" style="float:left">Reset</a> <li id="switch"><span class="swith_btn" title="Switch between differents file source">Workspace</span></li>
<a href="#" id="save" class="lshare" style="float:left">Save</a> <li id="save"><span class="save_btn" title="Save current file. Hint: Use Ctrl+S">Save</span></li>
<li>
<h2>
<a style="display:none" id='option' href='#' rel='tooltip' title='Show more option'>[Current file]</a><span id="edit_info">No file in editor</span>
<span id="edit_status"></span>
</h2>
</li>
</ul>
<!--<a href="#" id="clearselect" class="lshare no-right-border" style="float:left">Clean</a>-->
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="software_details">
<div id="details_box"> <div id="details_box">
<div id="fileTree" class="file_tree_short"></div> <div id="fileTree" class="file_tree_short"></div>
<div id="fileTreeFull" style='display:none' class="file_tree_short"></div> <div id="fileTreeFull" style='display:none' class="file_tree_short"></div>
</div> </div>
</div> </div>
<div id="code"> <div id="code">
<h2 class='title'>
<a style="display:none" id='option' href='#' rel='tooltip' title='Show more option'>[Current file]</a><span id="edit_info">No file in editor</span>
<span id="edit_status"></span>
</h2>
<div class="main_content"> <div class="main_content">
<pre id="editor"> <pre id="editor">
...@@ -67,13 +73,12 @@ ...@@ -67,13 +73,12 @@
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div id="file_info" class="file_info"><span id="info"></span></div> <div id="file_info" class="file_info"><span id="info"></span></div>
<br/>
</form> </form>
<div id="tooltip-option" style="display:none"> <div id="tooltip-option" style="display:none">
<span class="list first-list">MD5 SUM for the current file</span> <span class="list first-list">MD5 SUM for the current file</span>
<a id='getmd5' href="#">Get or Update md5sum</a> <a id='getmd5' href="#">Get or Update md5sum</a>
<div class="sep"></div> <div class="sep"></div>
<span class="list">Add Project to Develop</span> <span class="list">Add project development</span>
<ul id="plist"> <ul id="plist">
{% for name in projectList%} {% for name in projectList%}
<li><input type="checkbox" name="develop" value="{{name}}" id="{{name}}"> <li><input type="checkbox" name="develop" value="{{name}}" id="{{name}}">
......
...@@ -450,94 +450,22 @@ def svcStartStopProcess(config, process, action): ...@@ -450,94 +450,22 @@ def svcStartStopProcess(config, process, action):
cmd[action], process]).communicate()[0] cmd[action], process]).communicate()[0]
def getFolderContent(config, folder): def listFolder(config, path):
""" """Return the list of folder into path
Read all file and folder into specified directory
Args:
config: Slaprunner configuration.
folder: the directory to read.
Returns:
Html formatted string or error message when fail.
"""
r = ['<ul class="jqueryFileTree" style="display: none;">']
try:
folder = str(folder)
r = ['<ul class="jqueryFileTree" style="display: none;">']
d = urllib.unquote(folder)
realdir = realpath(config, d)
if realdir:
ldir = sorted(os.listdir(realdir), key=str.lower)
else:
r.append('Could not load directory: Permission denied')
ldir = []
for f in ldir:
if f.startswith('.'): # do not displays this file/folder
continue
ff = os.path.join(d, f)
if os.path.isdir(os.path.join(realdir, f)):
r.append('<li class="directory collapsed"><a href="#%s" rel="%s/">%s</a></li>' % (ff, ff, f))
else:
e = os.path.splitext(f)[1][1:] # get .ext and remove dot
r.append('<li class="file ext_%s"><a href="#%s" rel="%s">%s</a></li>' % (e, ff, ff, f))
r.append('</ul>')
except Exception as e:
r.append('Could not load directory: %s' % str(e))
r.append('</ul>')
return jsonify(result=''.join(r))
def getFolder(config, folder):
"""
Read list of folder for the specified directory
Args:
config: Slaprunner configuration.
folder: the directory to read.
Returns:
Html formatted string or error message when fail.
"""
r = ['<ul class="jqueryFileTree" style="display: none;">']
try:
folder = str(folder)
r = ['<ul class="jqueryFileTree" style="display: none;">']
d = urllib.unquote(folder)
realdir = realpath(config, d)
if not realdir:
r.append('Could not load directory: Permission denied')
ldir = []
else:
ldir = sorted(os.listdir(realdir), key=str.lower)
for f in ldir:
if f.startswith('.'): # do not display this file/folder
continue
ff = os.path.join(d, f)
if os.path.isdir(os.path.join(realdir, f)):
r.append('<li class="directory collapsed"><a href="#%s" rel="%s/">%s</a></li>' % (ff, ff, f))
r.append('</ul>')
except Exception as e:
r.append('Could not load directory: %s' % str(e))
r.append('</ul>')
return jsonify(result=''.join(r))
def getProjectList(folder):
"""Return the list of projet (folder) into the workspace
Agrs: Agrs:
folder: path of the workspace path: path of the directory to list
Returns: Returns:
a list that contains each folder name. a list that contains each folder name.
""" """
project = [] folderList = []
project_list = sorted(os.listdir(folder), key=str.lower) folder = realpath(config, path)
for elt in project_list: if folder:
path_list = sorted(os.listdir(folder), key=str.lower)
for elt in path_list:
if os.path.isdir(os.path.join(folder, elt)): if os.path.isdir(os.path.join(folder, elt)):
project.append(elt) folderList.append(elt)
return project return folderList
def configNewSR(config, projectpath): def configNewSR(config, projectpath):
......
...@@ -13,9 +13,8 @@ from flask import (Flask, request, redirect, url_for, render_template, ...@@ -13,9 +13,8 @@ from flask import (Flask, request, redirect, url_for, render_template,
g, flash, jsonify, session, abort, send_file) g, flash, jsonify, session, abort, send_file)
from slapos.runner.process import killRunningProcess from slapos.runner.process import killRunningProcess
from slapos.runner.utils import (checkSoftwareFolder, configNewSR, getFolder, from slapos.runner.utils import (checkSoftwareFolder, configNewSR, getProfilePath,
getFolderContent, getProfilePath, listFolder, getProjectTitle, getSession,
getProjectList, getProjectTitle, getSession,
getSlapStatus, getSvcStatus, getSlapStatus, getSvcStatus,
getSvcTailProcess, isInstanceRunning, getSvcTailProcess, isInstanceRunning,
isSoftwareRunning, isSoftwareReleaseReady, isText, isSoftwareRunning, isSoftwareReleaseReady, isText,
...@@ -95,10 +94,11 @@ def dologout(): ...@@ -95,10 +94,11 @@ def dologout():
return redirect(url_for('login')) return redirect(url_for('login'))
def configRepo(): def manageRepository():
public_key = open(app.config['public_key']).read() public_key = open(app.config['public_key']).read()
account = getSession(app.config) account = getSession(app.config)
return render_template('cloneRepository.html', workDir='workspace', return render_template('manageRepository.html', workDir='workspace',
project=listFolder(app.config, 'workspace'),
public_key=public_key, name=account[3].decode('utf-8'), public_key=public_key, name=account[3].decode('utf-8'),
email=account[2]) email=account[2])
...@@ -257,12 +257,9 @@ def cloneRepository(): ...@@ -257,12 +257,9 @@ def cloneRepository():
return cloneRepo(data) return cloneRepo(data)
def readFolder(): def listDirectory():
return getFolderContent(app.config, request.form['dir']) folderList = listFolder(app.config, request.form['name'])
return jsonify(result=folderList)
def openFolder():
return getFolder(app.config, request.form['dir'])
def createSoftware(): def createSoftware():
...@@ -300,7 +297,7 @@ def editCurrentProject(): ...@@ -300,7 +297,7 @@ def editCurrentProject():
if os.path.exists(project): if os.path.exists(project):
return render_template('softwareFolder.html', workDir='workspace', return render_template('softwareFolder.html', workDir='workspace',
project=open(project).read(), project=open(project).read(),
projectList=getProjectList(app.config['workspace'])) projectList=listFolder(app.config, 'workspace'))
return redirect(url_for('configRepo')) return redirect(url_for('configRepo'))
...@@ -728,9 +725,8 @@ app.add_url_rule('/createSoftware', 'createSoftware', createSoftware, ...@@ -728,9 +725,8 @@ app.add_url_rule('/createSoftware', 'createSoftware', createSoftware,
methods=['POST']) methods=['POST'])
app.add_url_rule('/cloneRepository', 'cloneRepository', cloneRepository, app.add_url_rule('/cloneRepository', 'cloneRepository', cloneRepository,
methods=['POST']) methods=['POST'])
app.add_url_rule('/openFolder', 'openFolder', openFolder, methods=['POST']) app.add_url_rule('/listDirectory', 'listDirectory', listDirectory, methods=['POST'])
app.add_url_rule('/readFolder', 'readFolder', readFolder, methods=['POST']) app.add_url_rule('/manageRepository', 'manageRepository', manageRepository)
app.add_url_rule('/configRepo', 'configRepo', configRepo)
app.add_url_rule("/saveParameterXml", 'saveParameterXml', saveParameterXml, app.add_url_rule("/saveParameterXml", 'saveParameterXml', saveParameterXml,
methods=['POST']) methods=['POST'])
app.add_url_rule("/getPath", 'getPath', getPath, methods=['POST']) app.add_url_rule("/getPath", 'getPath', getPath, methods=['POST'])
......
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