Explorar o código

HUE-8758 [editor] Link to add connector page when no snippet configured and admin

Romain %!s(int64=5) %!d(string=hai) anos
pai
achega
65a4c38e36

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

@@ -55,7 +55,7 @@ ${ layout.menubar(section='quick_start') }
 
            <div class="span2">
             <ul class="nav nav-pills nav-vertical-pills">
-              <li class="active"><a href="#step1" class="step">${ _('Step 1:') } <i class="fa fa-cogs"></i> ${ _('Checks') }</a></li>
+              <li class="active"><a href="#step1" class="step">${ _('Step 1:') } <i class="fa fa-check"></i> ${ _('Checks') }</a></li>
               <li><a href="#step2" class="step">${ _('Step 2:') } <i class="fa fa-exchange"></i> ${ _('Connectors') }</a></li>
               <li><a href="#step3" class="step">${ _('Step 3:') } <i class="fa fa-book"></i> ${ _('Examples') }</a></li>
               <li><a id="lastStep" href="#step4" class="step">${ _('Step 4:') } <i class="fa fa-group"></i> ${ _('Users') }</a></li>
@@ -78,13 +78,13 @@ ${ layout.menubar(section='quick_start') }
 
           <div id="step2" class="stepDetails hide">
             <h3>${ _('Add connectors to data services') }</h3>
-            <span id="connectorCounts">...</span> ${ _('connectors are installed.') }
+            <span id="connectorCounts">...</span> ${ _('connectors installed') }
 
             % if has_connectors():
             <ul class="unstyled samples margin-top-20">
               <li>
                 <a href="${ url('desktop.lib.connectors.views.index') }" title="${ _('Open the connector configuration page') }">
-                  <i class="fa fa-exchange"></i> ${ _('Configuration page') }
+                  <i class="fa fa-plus-plus"></i> ${ _('Add a Database') }
                 </a>
               </li>
               <li>

+ 17 - 3
desktop/libs/notebook/src/notebook/templates/notebook.mako

@@ -14,8 +14,10 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 <%!
+  from desktop.auth.backend import is_admin
+  from desktop.conf import ENABLE_CONNECTORS
   from desktop.views import commonfooter, commonshare
-  from desktop import conf
+
   from django.utils.translation import ugettext as _
   from notebook.conf import ENABLE_NOTEBOOK_2
 %>
@@ -31,12 +33,24 @@
 % if ENABLE_NOTEBOOK_2.get():
   ${ editorComponents2.includes(is_embeddable=is_embeddable, suffix='notebook') }
   ${ editorComponents2.topBar(suffix='notebook') }
+
   <%editorComponents2:commonHTML is_embeddable="${is_embeddable}" suffix="notebook">
     <%def name="addSnippetHTML()">
-      <h1 class="empty" data-bind="visible: $root.availableSnippets().length == 0">${ _('There are no snippets configured.') }</h1>
+      <h1 class="empty" data-bind="visible: $root.availableSnippets().length == 0">
+        ${ _('There are no snippets configured.') }
+
+        % if ENABLE_CONNECTORS.get() and is_admin(request.user):
+          <br>
+          <a data-bind="hueLink: '${ url('desktop.lib.connectors.views.index') }'" title="${ _('Open the connector configuration page') }">
+            <i class="fa fa-plus-circle"></i> ${ _('Add a Database connector') }
+          </a>
+        % endif
+      </h1>
 
       <!-- ko if: $root.availableSnippets().length > 0 -->
-    <h1 class="empty" data-bind="visible: snippets().length == 0">${ _('Add a snippet to start your new notebook') }</h1>
+    <h1 class="empty" data-bind="visible: snippets().length == 0">
+      ${ _('Add a snippet to start your new notebook') }
+    </h1>
 
     <div class="add-snippet" data-bind="component: {
       name: 'add-snippet-menu',