Browse Source

[core] Unify examples installation

Romain Rigaux 12 years ago
parent
commit
43806f0

+ 3 - 3
apps/about/src/about/templates/admin_wizard.mako

@@ -55,8 +55,8 @@ ${ commonheader(_('About Hue'), "quick_start", user, "100px") | n,unicode }
     <ul class="nav nav-tabs">
       <li class="active"><a href="#step1" class="step">${ _('Step 1:') } <i class="icon-cogs"></i> ${ _('Check Configuration') }</a></li>
       <li><a href="#step2" class="step">${ _('Step 2:') } <i class="icon-book"></i> ${ _('Examples') }</a></li>
-      <li><a href="#step3" class="step">${ _('Step 3:') } <i class="icon-user"></i> ${ _('Users') }</a></li>
-      <li><a id="lastStep" href="${ url('desktop.views.home') }" class="step">${ _('Step 4:') } <i class="icon-home"></i> ${_('Use Hue') }</a></li>
+      <li><a href="#step3" class="step">${ _('Step 3:') } <i class="icon-group"></i> ${ _('Users') }</a></li>
+      <li><a id="lastStep" href="${ url('desktop.views.home') }" class="step">${ _('Step 4:') } <i class="icon-flag"></i> ${_('Go !') }</a></li>
     </ul>
 
     <div class="steps" >
@@ -75,7 +75,7 @@ ${ commonheader(_('About Hue'), "quick_start", user, "100px") | n,unicode }
           <span class="icon">
             <i class="icon-th-list"></i>
           </span>
-          <h5>${ _('Install or re-install available app examples') }</h5>
+          <h5>${ _('Install or re-install the application examples') }</h5>
         </div>
         <div class="widget-content">
           <ul>

+ 0 - 97
apps/beeswax/src/beeswax/templates/index.mako

@@ -1,97 +0,0 @@
-## Licensed to Cloudera, Inc. under one
-## or more contributor license agreements.  See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership.  Cloudera, Inc. licenses this file
-## to you under the Apache License, Version 2.0 (the
-## "License"); you may not use this file except in compliance
-## with the License.  You may obtain a copy of the License at
-##
-##     http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-<%!
-from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
-%>
-
-<%namespace name="comps" file="beeswax_components.mako" />
-<%namespace name="layout" file="layout.mako" />
-
-${ commonheader(_('Beeswax'), app_name, user, '100px') | n,unicode }
-${layout.menubar(section='tables')}
-
-<div class="container-fluid">
-    <div class="row-fluid">
-        <div class="span3">
-            <div class="well sidebar-nav">
-                <ul class="nav nav-list">
-                    % if not examples_installed:
-                    <li class="nav-header">${_('Examples')}</li>
-                    <li><a href="#installSamples" data-toggle="modal">${_('Install Samples')}</a></li>
-                    % endif
-                    <li class="nav-header">${_('Tables')}</li>
-                    <li><a href="${ url('catalog:show_tables') }">${_('Show Tables')}</a></li>
-                    <li><a href="${ url(app_name + ':create_table') }">${_('Create Table')}</a></li>
-                    <li class="nav-header">${_('Queries')}</li>
-                    <li><a href="${ url(app_name + ':list_designs') }">${_('Saved Queries')}</a></li>
-                    <li><a href="${ url(app_name + ':execute_query') }">${_('Execute Query')}</a></li>
-                    <li><a href="${ url(app_name + ':list_query_history') }">${_('Query History')}</a></li>
-                    <li class="nav-header">${_('Configuration')}</li>
-                    <li><a href="${ url(app_name + ':configuration') }">${_('Configuration')}</a></li>
-                    <li><a href="${ url(app_name + ':configuration') }?include_hadoop=1">${_('Extended Configuration')}</a></li>
-                </ul>
-            </div>
-        </div>
-        <div class="span9">
-            <h1>${_('Welcome to Beeswax for Hive')}</h1>
-            ${_("To get started with Beeswax you'll first need set up some data:")}
-            <a href="${ url(app_name + ':create_table') }" class='btn'>${_('Import Data')}</a>
-            ${_("or")} <a href="#installSamples" data-toggle="modal" class='btn'>${_('Install Samples')}</a>
-        </div>
-    </div>
-</div>
-
-<div id="installSamples" class="modal hide fade">
-    <div class="modal-header">
-        <a href="#" class="close" data-dismiss="modal">&times;</a>
-        <h3>${_('Install samples')}</h3>
-    </div>
-    <div class="modal-body">
-      <div id="installSamplesMessage"></div>
-    </div>
-    <div class="modal-footer">
-        <a href="#" class="btn" data-dismiss="modal">${_('Cancel')}</a>
-        <a href="#" id="installSamplesBtn" class="btn btn-primary">${_('Yes, install samples')}</a>
-    </div>
-</div>
-
-
-<script type="text/javascript" charset="utf-8">
-    $(document).ready(function(){
-        $.getJSON("${ url(app_name + ':install_examples') }",function(data){
-            $("#installSamplesMessage").text(data.title);
-        });
-
-        $("#installSamplesBtn").click(function(){
-            $.post(
-                "${ url(app_name + ':install_examples') }",
-                { submit:"Submit" },
-                function(result){
-                    if (result.creationSucceeded){
-                        window.location.href = "/beeswax/tables";
-                    }
-                    else {
-                        var message = "${_('There was an error processing your request:')} " + result.message;
-                        $("#installSamplesMessage").addClass("alert").addClass("alert-error").text(message);
-                    }
-                }
-            );
-        });
-    });
-</script>
-
-${ commonfooter(messages) | n,unicode }

+ 1 - 2
apps/beeswax/src/beeswax/tests.py

@@ -43,7 +43,6 @@ from desktop.lib.test_utils import grant_access
 from beeswaxd import ttypes
 
 import beeswax.create_table
-import beeswax.create_database
 import beeswax.forms
 import beeswax.hive_site
 import beeswax.models
@@ -55,7 +54,7 @@ from beeswax.test_base import make_query, wait_for_query_to_finish, verify_histo
   BEESWAXD_TEST_PORT
 from beeswax.design import hql_query, _strip_trailing_semicolon
 from beeswax.data_export import download
-from beeswax.models import SavedQuery, QueryHistory
+from beeswax.models import SavedQuery
 from beeswax.server import dbms
 from beeswax.server.beeswax_lib import BeeswaxDataTable, BeeswaxClient
 from beeswax.test_base import BeeswaxSampleProvider

+ 0 - 8
apps/beeswax/src/beeswax/views.py

@@ -57,14 +57,6 @@ SAVE_RESULTS_CTAS_TIMEOUT = 300         # seconds
 
 
 def index(request):
-  try:
-    tables = dbms.get(request.user).get_tables()
-    if not tables:
-      examples_installed = beeswax.models.MetaInstall.get().installed_example
-      return render("index.mako", request, {'examples_installed': examples_installed})
-  except:
-    pass
-
   return execute_query(request)
 
 

+ 0 - 43
apps/catalog/src/catalog/templates/tables.mako

@@ -38,9 +38,6 @@ ${ commonheader(_('Tables'), 'catalog', user) | n,unicode }
                     </li>
                     </span>
                     <li class="nav-header">${_('Actions')}</li>
-                    % if not examples_installed:
-                    <li><a href="#installSamples" data-toggle="modal">${_('Install samples')}</a></li>
-                    % endif
                     <li><a href="${ url('beeswax:import_wizard', database=database) }">${_('Create a new table from a file')}</a></li>
                     <li><a href="${ url('beeswax:create_table', database=database) }">${_('Create a new table manually')}</a></li>
                 </ul>
@@ -82,24 +79,6 @@ ${ commonheader(_('Tables'), 'catalog', user) | n,unicode }
     </div>
 </div>
 
-% if not examples_installed:
-<div id="installSamples" class="modal hide fade">
-  <div class="modal-header">
-    <a href="#" class="close" data-dismiss="modal">&times;</a>
-    <h3>${_('Install samples')}</h3>
-  </div>
-  <div class="modal-body">
-    <div id="installSamplesMessage">
-
-    </div>
-  </div>
-  <div class="modal-footer">
-    <a href="#" class="btn" data-dismiss="modal">${_('Cancel')}</a>
-    <a href="#" id="installSamplesBtn" class="btn btn-primary">${_('Yes, install samples')}</a>
-  </div>
-</div>
-% endif
-
 <div id="dropTable" class="modal hide fade">
   <form id="dropTableForm" action="${ url('catalog:drop_table', database=database) }" method="POST">
     <div class="modal-header">
@@ -157,28 +136,6 @@ ${ commonheader(_('Tables'), 'catalog', user) | n,unicode }
       $('#db_form').submit();
     });
 
-    % if not examples_installed:
-        $.getJSON("${ url('beeswax:install_examples') }", function (data) {
-          $("#installSamplesMessage").text(data.title);
-        });
-
-        $("#installSamplesBtn").click(function () {
-          $.post(
-              "${ url('beeswax:install_examples') }",
-              { submit:"Submit" },
-              function (result) {
-                if (result.creationSucceeded) {
-                  window.location.href = "${ url('catalog:show_tables') }";
-                }
-                else {
-                  var message = "${_('There was an error processing your request:')} " + result.message;
-                  $("#installSamplesMessage").addClass("alert").addClass("alert-error").text(message);
-                }
-              }
-          );
-        });
-    % endif
-
     $(".selectAll").click(function () {
       if ($(this).attr("checked")) {
         $(this).removeAttr("checked").removeClass("icon-ok");

+ 0 - 2
apps/catalog/src/catalog/views.py

@@ -96,7 +96,6 @@ def show_tables(request, database=None):
     db_form = DbForm(initial={'database': database}, databases=databases)
 
   tables = db.get_tables(database=database)
-  examples_installed = MetaInstall.get().installed_example
 
   resp = render("tables.mako", request, {
     'breadcrumbs': [
@@ -106,7 +105,6 @@ def show_tables(request, database=None):
       }
     ],
     'tables': tables,
-    'examples_installed': examples_installed,
     'db_form': db_form,
     'database': database,
     'tables_json': json.dumps(tables),

+ 3 - 20
apps/jobbrowser/src/jobbrowser/templates/jobs.mako

@@ -15,7 +15,6 @@
 ## limitations under the License.
 <%
   from jobbrowser.views import get_state_link
-  from desktop import appmanager
   from django.template.defaultfilters import urlencode
   from desktop.views import commonheader, commonfooter
   from django.utils.translation import ugettext as _
@@ -28,11 +27,10 @@
 %   endif
 </%def>
 
-% if jobs or filtered:
 ${ commonheader(_('Job Browser'), "jobbrowser", user) | n,unicode }
 <div class="container-fluid">
-<h1>${_('Job Browser')}</h1>
-<form class="well form-inline" action="/jobbrowser/jobs" method="GET">
+  <h1>${_('Job Browser')}</h1>
+  <form class="well form-inline" action="/jobbrowser/jobs" method="GET">
     <label>
     ${_('Job status:')}
     <select name="state" class="submitter">
@@ -62,7 +60,7 @@ ${ commonheader(_('Job Browser'), "jobbrowser", user) | n,unicode }
         ${_('Username:')}
         <input type="text" name="user" title="${_('User Name Filter')}" value="${ user_filter or '' }" placeholder="${_('User Name Filter')}" class="submitter input-large search-query" />
     </label>
-</form>
+  </form>
 
 
 % if not jobs:
@@ -151,21 +149,6 @@ ${ commonheader(_('Job Browser'), "jobbrowser", user) | n,unicode }
         </tbody>
     </table>
     % endif
-
-    % else:
-        ${ commonheader(_('Job Browser'), "jobbrowser", user) | n,unicode }
-        <div class="container-fluid">
-        <h1>${_('Welcome to the Job Browser')}</h1>
-        <div>
-            <p>${_("There aren't any jobs running. Let's fix that.")}</p>
-            % if appmanager.get_desktop_module('jobsub') is not None:
-                <a href="/jobsub/">${_('Launch the Job Designer')}</a><br/>
-            % endif
-            % if appmanager.get_desktop_module('beeswax') is not None:
-                <a href="/beeswax/">${_('Launch Beeswax')}</a><br/>
-            % endif
-    </div>
-    % endif
 </div>
 
 <div id="killModal" class="modal hide fade">

+ 3 - 3
apps/oozie/src/oozie/templates/editor/list_bundles.mako

@@ -61,16 +61,16 @@ ${ layout.menubar(section='bundles') }
         <tr>
           <td data-row-selector-exclude="true">
             <div class="hueCheckbox bundleCheck" data-row-selector-exclude="true"
-              % if bundle.is_accessible(currentuser):
+              % if bundle.is_accessible(user):
                   data-clone-url="${ url('oozie:clone_bundle', bundle=bundle.id) }"
                   data-submit-url="${ url('oozie:submit_bundle', bundle=bundle.id) }"
               % endif
-              % if bundle.is_editable(currentuser):
+              % if bundle.is_editable(user):
                   data-delete-id="${ bundle.id }"
               % endif
               >
             </div>
-            % if bundle.is_accessible(currentuser):
+            % if bundle.is_accessible(user):
               <a href="${ url('oozie:edit_bundle', bundle=bundle.id) }" data-row-selector="true"/>
             % endif
           </td>

+ 3 - 3
apps/oozie/src/oozie/templates/editor/list_coordinators.mako

@@ -60,16 +60,16 @@ ${ layout.menubar(section='coordinators') }
         <tr>
           <td data-row-selector-exclude="true">
             <div class="hueCheckbox coordinatorCheck" data-row-selector-exclude="true"
-              % if coordinator.is_accessible(currentuser):
+              % if coordinator.is_accessible(user):
                   data-clone-url="${ url('oozie:clone_coordinator', coordinator=coordinator.id) }"
                   data-submit-url="${ url('oozie:submit_coordinator', coordinator=coordinator.id) }"
               % endif
-              % if coordinator.is_editable(currentuser):
+              % if coordinator.is_editable(user):
                   data-delete-id="${ coordinator.id }"
               % endif
               >
             </div>
-            % if coordinator.is_accessible(currentuser):
+            % if coordinator.is_accessible(user):
               <a href="${ url('oozie:edit_coordinator', coordinator=coordinator.id) }" data-row-selector="true"/>
             % endif
           </td>

+ 3 - 21
apps/oozie/src/oozie/templates/editor/list_workflows.mako

@@ -41,9 +41,6 @@ ${ layout.menubar(section='workflows') }
     <%def name="creation()">
         <a href="${ url('oozie:create_workflow') }" class="btn"><i class="icon-plus-sign"></i> ${ _('Create') }</a>
         <a href="${ url('oozie:import_workflow') }" class="btn"><i class="icon-plus-sign"></i> ${ _('Import') }</a>
-        % if currentuser.is_superuser:
-          <a href="#installSamples" data-toggle="modal" class="btn"><i class="icon-download-alt"></i> ${ _('Setup Examples') }</a>
-        % endif
     </%def>
   </%actionbar:render>
 
@@ -65,16 +62,16 @@ ${ layout.menubar(section='workflows') }
         <tr>
           <td data-row-selector-exclude="true">
              <div class="hueCheckbox workflowCheck" data-row-selector-exclude="true"
-              % if workflow.is_accessible(currentuser):
+              % if workflow.is_accessible(user):
                   data-submit-url="${ url('oozie:submit_workflow', workflow=workflow.id) }"
                   data-schedule-url="${ url('oozie:schedule_workflow', workflow=workflow.id) }"
                   data-clone-url="${ url('oozie:clone_workflow', workflow=workflow.id) }"
               % endif
-              % if workflow.is_editable(currentuser):
+              % if workflow.is_editable(user):
                   data-delete-id="${ workflow.id }"
               % endif
             ></div>
-            % if workflow.is_accessible(currentuser):
+            % if workflow.is_accessible(user):
               <a href="${ url('oozie:edit_workflow', workflow=workflow.id) }" data-row-selector="true"></a>
             % endif
           </td>
@@ -115,21 +112,6 @@ ${ layout.menubar(section='workflows') }
   </form>
 </div>
 
-<div id="installSamples" class="modal hide fade">
-  <form id="installSamplesForm" action="${url('oozie:setup_app')}" method="POST">
-    <div class="modal-header">
-      <a href="#" class="close" data-dismiss="modal">&times;</a>
-      <h3>${ _('Set up the workspaces and examples?') }</h3>
-    </div>
-    <div class="modal-body">
-      ${ _('Hue is going to re-create the workspaces and re-install the examples.') }
-    </div>
-    <div class="modal-footer">
-      <a href="#" class="btn" data-dismiss="modal">${ _('No') }</a>
-      <input type="submit" class="btn btn-primary" value="${ _('Yes') }"/>
-    </div>
-  </form>
-</div>
 
 <script src="/static/ext/js/datatables-paging-0.1.js" type="text/javascript" charset="utf-8"></script>
 <script src="/static/ext/js/knockout-2.1.0.js" type="text/javascript" charset="utf-8"></script>

+ 0 - 3
apps/oozie/src/oozie/views/editor.py

@@ -69,7 +69,6 @@ def list_workflows(request):
   return render('editor/list_workflows.mako', request, {
     'jobs': list(data),
     'json_jobs': json.dumps(list(data.values_list('id', flat=True))),
-    'currentuser': request.user,
     'show_setup_app': show_setup_app,
   })
 
@@ -89,7 +88,6 @@ def list_coordinators(request, workflow_id=None):
   return render('editor/list_coordinators.mako', request, {
     'jobs': list(data),
     'json_jobs': json.dumps(list(data.values_list('id', flat=True))),
-    'currentuser': request.user,
   })
 
 
@@ -106,7 +104,6 @@ def list_bundles(request):
   return render('editor/list_bundles.mako', request, {
     'jobs': list(data),
     'json_jobs': json.dumps(list(data.values_list('id', flat=True))),
-    'currentuser': request.user,
   })