Sfoglia il codice sorgente

[core] Install all examples button

Romain Rigaux 12 anni fa
parent
commit
c9d6e6b2f3

+ 41 - 8
apps/about/src/about/templates/admin_wizard.mako

@@ -78,41 +78,59 @@ ${ commonheader(_('Quick Start'), "quickstart", user, "100px") | n,unicode }
           <span class="icon">
           <span class="icon">
             <i class="icon-th-list"></i>
             <i class="icon-th-list"></i>
           </span>
           </span>
-          <h5>${ _('Install or re-install the application examples') }</h5>
+          <h5>${ _('Install all the application examples') }</h5>
+        </div>
+        <div class="widget-content">
+          <ul>
+          <li>
+            <a href="#" class="installAllBtn" data-loading-text="${ _('Installing...') }">
+             <i class="icon-download-alt"></i> ${ _('All') }
+            </a>
+          </li>
+          </ul>
+        </div>
+      </div>
+
+      <div class="widget-box">
+        <div class="widget-title">
+          <span class="icon">
+            <i class="icon-th-list"></i>
+          </span>
+          <h5>${ _('Install individual application examples') }</h5>
         </div>
         </div>
         <div class="widget-content">
         <div class="widget-content">
           <ul>
           <ul>
         % if 'beeswax' in app_names:
         % if 'beeswax' in app_names:
           <li>
           <li>
-            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-url="${ url('beeswax:install_examples') }">
+            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-sample-url="${ url('beeswax:install_examples') }">
              <i class="icon-download-alt"></i> ${ apps['beeswax'].nice_name }
              <i class="icon-download-alt"></i> ${ apps['beeswax'].nice_name }
             </a>
             </a>
           </li>
           </li>
         % endif
         % endif
         % if 'impala' in app_names:
         % if 'impala' in app_names:
           <li>
           <li>
-            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-url="${ url('impala:install_examples') }">
+            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-sample-url="${ url('impala:install_examples') }">
              <i class="icon-download-alt"></i> ${ apps['impala'].nice_name }
              <i class="icon-download-alt"></i> ${ apps['impala'].nice_name }
             </a>
             </a>
           </li>
           </li>
         % endif
         % endif
         % if 'jobsub' in app_names:
         % if 'jobsub' in app_names:
           <li>
           <li>
-            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-url="${ url('oozie:install_examples') }">
+            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-sample-url="${ url('oozie:install_examples') }">
               <i class="icon-download-alt"></i> ${ apps['jobsub'].nice_name }
               <i class="icon-download-alt"></i> ${ apps['jobsub'].nice_name }
             </a>
             </a>
           </li>
           </li>
         % endif
         % endif
         % if 'oozie' in app_names:
         % if 'oozie' in app_names:
           <li>
           <li>
-            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-url="${ url('oozie:install_examples') }">
+            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-sample-url="${ url('oozie:install_examples') }">
               <i class="icon-download-alt"></i> ${ apps['oozie'].nice_name }
               <i class="icon-download-alt"></i> ${ apps['oozie'].nice_name }
             </a>
             </a>
           </li>
           </li>
         % endif
         % endif
         % if 'pig' in app_names:
         % if 'pig' in app_names:
           <li>
           <li>
-            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-url="${ url('pig:install_examples') }">
+            <a href="#" class="installBtn" data-loading-text="${ _('Installing...') }" data-sample-url="${ url('pig:install_examples') }">
              <i class="icon-download-alt"></i> ${ apps['pig'].nice_name }
              <i class="icon-download-alt"></i> ${ apps['pig'].nice_name }
             </a>
             </a>
           </li>
           </li>
@@ -131,7 +149,7 @@ ${ commonheader(_('Quick Start'), "quickstart", user, "100px") | n,unicode }
           <h5>${ _('Go create or import users') }</h5>
           <h5>${ _('Go create or import users') }</h5>
         </div>
         </div>
         <div class="widget-content">
         <div class="widget-content">
-	      <a  href="${ url('useradmin.views.list_users') }" target="_blank">${ _('User Admin') } <img src="/useradmin/static/art/icon_useradmin_24.png"></a>
+        <a  href="${ url('useradmin.views.list_users') }" target="_blank"><img src="/useradmin/static/art/icon_useradmin_24.png"> ${ _('User Admin') }</a>
         </div>
         </div>
       </div>
       </div>
 
 
@@ -203,7 +221,7 @@ $(document).ready(function(){
   $(".installBtn").click(function() {
   $(".installBtn").click(function() {
     var button = $(this);
     var button = $(this);
     $(button).button('loading');
     $(button).button('loading');
-    $.post($(this).data("url"), function(data) {
+    $.post($(this).data("sample-url"), function(data) {
       if (data.status == 0) {
       if (data.status == 0) {
         $.jHueNotify.info('${ _("Examples refreshed") }');
         $.jHueNotify.info('${ _("Examples refreshed") }');
       } else {
       } else {
@@ -215,6 +233,21 @@ $(document).ready(function(){
     });
     });
   });
   });
 
 
+  $(".installAllBtn").click(function() {
+    var button = $(this);
+    $(button).button('loading');
+    var calls = jQuery.map($("[data-sample-url]"), function(app) {
+      return $.post($(app).data("sample-url"));
+    });
+    $.when.apply(this, calls)
+      .then(function() {
+        $.jHueNotify.info('${ _("Examples refreshed") }');
+      })
+      .always(function(data) {
+        $(button).button('reset');
+      });
+  });
+
   var currentStep = "step1";
   var currentStep = "step1";
 
 
   routie({
   routie({

+ 4 - 4
apps/about/static/help/index.html

@@ -21,14 +21,14 @@
       and lets you view configuration and logs. </p>
       and lets you view configuration and logs. </p>
 
 
     <div class="section" id="topic_3__section_nph_qgn_1k"><a name="topic_3__section_nph_qgn_1k"><!-- --></a><h2 class="title sectiontitle">Starting About Hue</h2>
     <div class="section" id="topic_3__section_nph_qgn_1k"><a name="topic_3__section_nph_qgn_1k"><!-- --></a><h2 class="title sectiontitle">Starting About Hue</h2>
-      
+
       <p class="p"> To start the About Hue application, click <a name="topic_3__image_vms_qgn_1k"><!-- --></a><img class="image" id="topic_3__image_vms_qgn_1k" src="/static/art/help/quick_start.png"/> in the navigation bar at the top of the Hue browser page. It opens
       <p class="p"> To start the About Hue application, click <a name="topic_3__image_vms_qgn_1k"><!-- --></a><img class="image" id="topic_3__image_vms_qgn_1k" src="/static/art/help/quick_start.png"/> in the navigation bar at the top of the Hue browser page. It opens
         to the Quick Start Wizard screen. </p>
         to the Quick Start Wizard screen. </p>
 
 
     </div>
     </div>
 
 
     <div class="section" id="topic_3__section_ert_5zh_zj"><a name="topic_3__section_ert_5zh_zj"><!-- --></a><h2 class="title sectiontitle">Quick Start Wizard</h2>
     <div class="section" id="topic_3__section_ert_5zh_zj"><a name="topic_3__section_ert_5zh_zj"><!-- --></a><h2 class="title sectiontitle">Quick Start Wizard</h2>
-      
+
       <p class="p">The Quick Start wizard allows you to perform the following Hue setup operations by clicking
       <p class="p">The Quick Start wizard allows you to perform the following Hue setup operations by clicking
         the tab of each step or sequentially by clicking <span class="ph uicontrol">Next</span> in each
         the tab of each step or sequentially by clicking <span class="ph uicontrol">Next</span> in each
         screen:</p>
         screen:</p>
@@ -57,7 +57,7 @@
     </div>
     </div>
 
 
     <div class="section" id="topic_3__section_ott_vzh_zj"><a name="topic_3__section_ott_vzh_zj"><!-- --></a><h2 class="title sectiontitle">Configuration</h2>
     <div class="section" id="topic_3__section_ott_vzh_zj"><a name="topic_3__section_ott_vzh_zj"><!-- --></a><h2 class="title sectiontitle">Configuration</h2>
-      
+
       <p class="p">Displays a list of the installed Hue applications and their
       <p class="p">Displays a list of the installed Hue applications and their
         configuration. The location of the folder containing the Hue configuration files is shown at
         configuration. The location of the folder containing the Hue configuration files is shown at
         the top of the page. Hue configuration settings are in the <samp class="ph codeph">hue.ini</samp> configuration file. </p>
         the top of the page. Hue configuration settings are in the <samp class="ph codeph">hue.ini</samp> configuration file. </p>
@@ -70,7 +70,7 @@
     </div>
     </div>
 
 
     <div class="section" id="topic_3__section_qfz_vzh_zj"><a name="topic_3__section_qfz_vzh_zj"><!-- --></a><h2 class="title sectiontitle">Server Logs</h2>
     <div class="section" id="topic_3__section_qfz_vzh_zj"><a name="topic_3__section_qfz_vzh_zj"><!-- --></a><h2 class="title sectiontitle">Server Logs</h2>
-      
+
       <p class="p">Displays the Hue Server log and allows you to download the log to your
       <p class="p">Displays the Hue Server log and allows you to download the log to your
         local system in a zip file.</p>
         local system in a zip file.</p>
 
 

+ 1 - 1
apps/beeswax/src/beeswax/views.py

@@ -889,7 +889,7 @@ def install_examples(request):
     try:
     try:
       app_name = get_app_name(request)
       app_name = get_app_name(request)
       beeswax.management.commands.beeswax_install_examples.Command().handle_noargs(app_name=app_name)
       beeswax.management.commands.beeswax_install_examples.Command().handle_noargs(app_name=app_name)
-      response['status'] = 0
+      response['status'] = 0 # Always return 0 currently
     except Exception, err:
     except Exception, err:
       LOG.exception(err)
       LOG.exception(err)
       response['message'] = str(err)
       response['message'] = str(err)