瀏覽代碼

[search] Improve look of Collection properties page

Romain Rigaux 12 年之前
父節點
當前提交
6b504f9

+ 2 - 2
apps/search/src/search/models.py

@@ -370,8 +370,8 @@ margin-top: 2px;
 class Collection(models.Model):
   # Perms coming with https://issues.cloudera.org/browse/HUE-950
   enabled = models.BooleanField(default=True)
-  name = models.CharField(max_length=40, verbose_name=_t('Solr name'))
-  label = models.CharField(max_length=100)
+  name = models.CharField(max_length=40, verbose_name=_t('Solr index name pointing to'))
+  label = models.CharField(max_length=100, verbose_name=_t('Friendlier name in UI'))
   is_core_only = models.BooleanField(default=False)
   cores = models.TextField(default=json.dumps({}), verbose_name=_t('Collection with cores data'), help_text=_t('Solr json'))
   properties = models.TextField(

+ 3 - 3
apps/search/src/search/templates/admin_collection_properties.mako

@@ -57,15 +57,15 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
         <a href="#schema" data-toggle="tab">${_('Schema')}</a>
       </li>
       <li>
-        <a href="#properties" data-toggle="tab">${_('Cores')}</a>
+        <a href="#properties" data-toggle="tab">${_('Indexes')}</a>
       </li>
     </ul>
     <div class="tab-content">
       <div class="tab-pane active" id="index">
         <div class="fieldWrapper">
-          ${ utils.render_field(collection_form['enabled']) }
-          ${ utils.render_field(collection_form['name']) }
+          ${ utils.render_field(collection_form['enabled']) }          
           ${ utils.render_field(collection_form['label']) }
+          ${ utils.render_field(collection_form['name']) }          
         </div>
 
 	    <div class="form-actions">

+ 3 - 72
apps/search/src/search/templates/admin_collection_properties_solr_properties.mako

@@ -22,63 +22,14 @@
 <%namespace name="macros" file="macros.mako" />
 
 
-<%def name="indexProperty(key)">
-  % if hue_collection.is_core_only:
-    % if key in solr_collection["status"][hue_collection.name]["index"]:
-      ${ solr_collection["status"][hue_collection.name]["index"][key] }
-    % endif
-  % else:
-    % for key, value in solr_collection.iteritems():
-      ${ key } : ${ value }
-    % endfor
-  % endif
-</%def>
-
-<%def name="collectionProperty(key)">
-  % if hue_collection.is_core_only:
-    % if key in solr_collection["status"][hue_collection.name]:
-      ${ solr_collection["status"][hue_collection.name][key] }
-    % endif
-  % else:
-    % for key, value in solr_collection.iteritems():
-      ${ key } : ${ value }
-    % endfor
-  % endif
-</%def>
-
 <%layout:skeleton>
+  <%def name="no_navigation()">
+  </%def>
+
   <%def name="title()">
   </%def>
 
   <%def name="content()">
-
-  % if not hue_collection.is_core_only:
-    <div class="tab-content">
-      <div class="tab-pane active" id="index_properties">
-        <table class="table">
-          <thead>
-          <tr>
-            <th width="20%">${_('Property')}</th>
-            <th>${_('Value')}</th>
-          </tr>
-          </thead>
-          <tbody>
-          <tr>
-            % for key, value in solr_collection.iteritems():
-              <td>${ key }</td>
-              <td>${ value }</td>
-            % endfor
-          </tr>
-          </tbody>
-        </table>
-      </div>
-    </div>
-  % else:
-    <ul class="nav nav-tabs">
-      <li class="active"><a href="#index_properties" data-toggle="tab">${_('Index properties')}</a></li>
-      <li><a href="#collection_properties" data-toggle="tab">${_('Collection properties')}</a></li>
-    </ul>
-
     <div class="tab-content">
       <div class="tab-pane active" id="index_properties">
         <table class="table">
@@ -98,26 +49,6 @@
           </tbody>
         </table>
       </div>
-      <div class="tab-pane" id="collection_properties">
-        <table class="table">
-          <thead>
-          <tr>
-            <th width="20%">${_('Property')}</th>
-            <th>${_('Value')}</th>
-          </tr>
-          </thead>
-          <tbody>
-          <tr>
-            % for key, value in solr_collection.iteritems():
-              <td>${ key }</td>
-              <td>${ value }</td>
-            % endfor
-          </tr>
-          </tbody>
-        </table>
-      </div>
     </div>
-  % endif
-
   </%def>
 </%layout:skeleton>

+ 10 - 8
apps/search/src/search/templates/layout.mako

@@ -25,18 +25,20 @@
   <link rel="stylesheet" href="/static/ext/chosen/chosen.css">
   <script src="/static/ext/chosen/chosen.jquery.min.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>
-
-
+  
   <div class="search-bar" style="height: 30px">
+    % if not hasattr(caller, "no_navigation"):
       <div class="pull-right" style="margin-top: 4px; margin-right: 20px">
         <a href="${ url('search:index') }"><i class="icon-share-alt"></i> ${ _('Search page') }</a> &nbsp; &nbsp;
         <a href="${ url('search:admin_collections') }"><i class="icon-sitemap"></i> ${ _('Collection manager') }</a>
       </div>
-    %if hasattr(caller, "title"):
-      ${caller.title()}
-    %else:
-        <h4>${_('Search Admin')}</h4>
-    %endif
+    % endif
+
+    % if hasattr(caller, "title"):
+      ${ caller.title() }
+    % else:
+        <h4>${ _('Search Admin') }</h4>
+    % endif
   </div>
 
   <div class="container-fluid">
@@ -79,7 +81,7 @@
         <a href="${ url('search:admin_collection_properties', collection_id=hue_collection.id) }"><i class="icon-reorder"></i> ${_('Properties')}</a>
       </li>
       <li>
-        <a href="${ url('search:index') }?collection_id=${ hue_collection.id }"><i class="icon-search"></i> ${ _('Search this collection') }</a>
+        <a href="${ url('search:index') }?collection_id=${ hue_collection.id }"><i class="icon-search"></i> ${ _('Search it') }</a>
       </li>
 
       <li class="nav-header">${_('Template')}</li>