Browse Source

HUE-725 [shell] Remove old files from Hue 1

Cleaning of the index page too
Romain Rigaux 13 years ago
parent
commit
319e194659

+ 6 - 32
apps/shell/src/shell/templates/index.mako

@@ -18,51 +18,25 @@ from desktop.views import commonheader, commonfooter
 from django.utils.translation import ugettext as _
 %>
 
-% if shells:
-    ${commonheader(_('Hue Shell'), "shell", user, "100px")}
-% else:
-    ${commonheader(_('Hue Shell'), "shell", user)}
-% endif
 
+${commonheader(_('Hue Shell'), "shell", user, "100px")}
 
-% if shells:
 <div class="subnav subnav-fixed">
     <div class="container-fluid">
         <ul class="nav nav-pills">
-            % if len(shells) == 1:
-                % if shells[0]["exists"]:
-                    <li><a href="${url('shell.views.create')}?keyName=${shells[0]["keyName"]}" class="${shells[0]["keyName"]}">${shells[0]["niceName"]}</a></li>
+            % for shell in shells:
+                % if shell["exists"]:
+                    <li><a href="${url('shell.views.create')}?keyName=${shell["keyName"]}" class="${shell["keyName"]}">${shell["niceName"]}</a></li>
                 % else:
-                    <li><a href="#" class="disabled">${shells[0]["niceName"]}</a></li>
+                    <li><a href="#" class="disabled">${shell["niceName"]}</a></li>
                 % endif
-            % else:
-                % if shells[0]["exists"]:
-                    <li><a href="${url('shell.views.create')}?keyName=${shells[0]["keyName"]}" class="${shells[0]["keyName"]}">${shells[0]["niceName"]}</a></li>
-                % else:
-                    <li><a href="#" class="disabled">${shells[0]["niceName"]}</a></li>
-                % endif
-                % for item in shells[1:-1]:
-                    % if item["exists"]:
-                        <li><a href="${url('shell.views.create')}?keyName=${item["keyName"]}" class="${item["keyName"]}">${item["niceName"]}</a></li>
-                    % else:
-                        <li><a href="#" class="disabled">${item["niceName"]}</a></li>
-                    % endif
-                % endfor
-                % if shells[-1]["exists"]:
-                    <li><a href="${url('shell.views.create')}?keyName=${shells[-1]["keyName"]}" class="${shells[-1]["keyName"]}">${shells[-1]["niceName"]}</a></li>
-                % else:
-                    <li><a href="#" class="disabled">${shells[-1]["niceName"]}</a></li>
-                % endif
-            % endif
+            % endfor
         </ul>
     </div>
 </div>
 
-% endif
-
 
 <div class="container-fluid">
-
   % if shell_id:
     <style type="text/css" media="screen">
         body {

+ 2 - 2
apps/shell/src/shell/tests.py

@@ -77,8 +77,8 @@ def test_spawning_check():
   client = make_logged_in_client(username="test", is_superuser=True)
 
   get_urls = ["/shell/", "/shell/create"]
-  post_urls = ["/shell/create", "/shell/process_command", "/shell/restore_shell",
-               "/shell/kill_shell", "/shell/retrieve_output", "/shell/add_to_output"]
+  post_urls = ["/shell/create", "/shell/process_command", "/shell/kill_shell",
+               "/shell/retrieve_output", "/shell/add_to_output"]
   for url in get_urls:
     response = client.get(url, follow=True)
     assert "The webserver currently running Hue does not support the Shell" in response.content

+ 0 - 1
apps/shell/src/shell/urls.py

@@ -20,7 +20,6 @@ from django.conf.urls.defaults import patterns, url
 urlpatterns = patterns('shell',
   url(r'^$', 'views.index'),
   url(r'^process_command/?$', 'views.process_command'),
-  url(r'^restore_shell/?$', 'views.restore_shell'),
   url(r'^kill_shell/?$', 'views.kill_shell'),
   url(r'^create/?$', 'views.create'),
   url(r'^retrieve_output/?$', 'views.retrieve_output'),

+ 0 - 18
apps/shell/src/shell/views.py

@@ -79,24 +79,6 @@ def kill_shell(request):
   result = shell_manager.kill_shell(username, shell_id)
   return HttpResponse(result)
 
-def restore_shell(request):
-  if not _running_with_spawning(request):
-    result = simplejson.dumps({ constants.NOT_RUNNING_SPAWNING : True })
-    return HttpResponse(result, mimetype="application/json")
-  shell_manager = ShellManager.global_instance()
-  username = request.user.username
-  shell_id = request.POST[constants.SHELL_ID]
-  SHELL_OUTPUT_LOGGER.info("%s %s - shell_id:%s - Attempting restore" %
-                      (request.META.get('REMOTE_ADDR'), username, shell_id))
-  result = shell_manager.get_previous_output(username, shell_id)
-  log_output = {}
-  if constants.OUTPUT in result:
-    log_output[constants.OUTPUT] = result[constants.OUTPUT]
-  log_output = repr(log_output)
-  SHELL_OUTPUT_LOGGER.info("%s %s - shell_id:%s - Restore output: '%s'" %
-              (request.META.get('REMOTE_ADDR'), username, shell_id, log_output ))
-  return HttpResponse(simplejson.dumps(result), mimetype="application/json")
-
 def process_command(request):
   if not _running_with_spawning(request):
     result = simplejson.dumps({ constants.NOT_RUNNING_SPAWNING : True })