From 45d91851aa2a5beadcc27418b55a6a5bbdeb19ca Mon Sep 17 00:00:00 2001
From: Nicolas Wavrant <nicolas.wavrant@tiolive.com>
Date: Tue, 28 Jan 2014 10:33:30 +0100
Subject: [PATCH] runner: FileTree in Editor page set to more used directories

---
 slapos/runner/static/js/scripts/softwareFolder.js | 8 ++++----
 slapos/runner/utils.py                            | 1 +
 slapos/runner/views.py                            | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/slapos/runner/static/js/scripts/softwareFolder.js b/slapos/runner/static/js/scripts/softwareFolder.js
index 56a624e..b63dde8 100644
--- a/slapos/runner/static/js/scripts/softwareFolder.js
+++ b/slapos/runner/static/js/scripts/softwareFolder.js
@@ -13,7 +13,7 @@ $(document).ready(function () {
         softwareDisplay = true,
         projectDir = $("input#project").val(),
         workdir = $("input#workdir").val(),
-        currentProject = workdir + "/" + projectDir.replace(workdir, "").split('/')[1],
+        currentProject = "workspace/" + projectDir.replace(workdir, "").split('/')[1],
         send = false,
         edit = false,
         ajaxResult = false,
@@ -24,7 +24,7 @@ $(document).ready(function () {
         current_file = null,
         favourite_list = new Array(),
         base_path = function () {
-            return softwareDisplay ? currentProject : 'workspace/';
+            return softwareDisplay ? currentProject : 'runner_workdir/';
         };
 
     function openFile(file) {
@@ -75,7 +75,7 @@ $(document).ready(function () {
     function switchContent() {
         if (!softwareDisplay) {
             $("span.swith_btn").empty();
-            $("span.swith_btn").append("Workspace");
+            $("span.swith_btn").append("Working dir");
             $('#fileTreeFull').show();
             $('#fileTree').hide();
         } else {
@@ -594,7 +594,7 @@ $(document).ready(function () {
     editor.renderer.setHScrollBarAlwaysVisible(false);
 
     initTree('#fileTree', currentProject, 'pfolder');
-    initTree('#fileTreeFull', 'workspace');
+    initTree('#fileTreeFull', 'runner_workdir');
     //bindContextMenu('#fileTree');
     $("#info").append("Current work tree: " + base_path());
 
diff --git a/slapos/runner/utils.py b/slapos/runner/utils.py
index 87b8616..c5fb600 100755
--- a/slapos/runner/utils.py
+++ b/slapos/runner/utils.py
@@ -719,6 +719,7 @@ def realpath(config, path, check_exist=True):
     'software_root': config['software_root'],
     'instance_root': config['instance_root'],
     'workspace': config['workspace'],
+    'runner_workdir': config['runner_workdir'],
     'software_link': config['software_link']
   }
   if key not in allow_list:
diff --git a/slapos/runner/views.py b/slapos/runner/views.py
index 730b77d..7cd8a62 100755
--- a/slapos/runner/views.py
+++ b/slapos/runner/views.py
@@ -301,7 +301,7 @@ def editCurrentProject():
   project = os.path.join(app.config['etc_dir'], ".project")
   projectList = listFolder(app.config, 'workspace')
   if os.path.exists(project) and projectList:
-    return render_template('softwareFolder.html', workDir='workspace',
+    return render_template('softwareFolder.html', workDir='runner_workdir',
                            project=open(project).read(),
                            projectList=projectList)
   elif not projectList:
-- 
2.30.9