Bladeren bron

HUE-8888 [useradmin] Light refactoring of message strings

Romain 5 jaren geleden
bovenliggende
commit
cc661b00ee

+ 4 - 14
apps/useradmin/src/useradmin/templates/list_organizations.mako

@@ -52,7 +52,7 @@ ${ layout.menubar(section='organizations') }
       <%def name="creation()">
         %if is_admin(user):
           <a id="addGroupBtn" href="${url('useradmin.views.edit_group')}" class="btn"><i
-              class="fa fa-plus-circle"></i> ${_('Add group')}</a>
+              class="fa fa-plus-circle"></i> ${_('Add organization')}</a>
           % if is_ldap_setup:
             <a id="addLdapGroupBtn" href="${url('useradmin.views.add_ldap_groups')}" class="btn"><i
                 class="fa fa-refresh"></i> ${_('Add/Sync LDAP group')}</a>
@@ -73,9 +73,9 @@ ${ layout.menubar(section='organizations') }
             <div class="select-all hue-checkbox fa"></div>
           </th>
         %endif
-        <th>${_('Group Name')}</th>
+        <th>${_('Organization Name')}</th>
         <th>${_('Members')}</th>
-        <th>${_('Permissions')}</th>
+        <th>${_('Group & Permissions Counts')}</th>
       </tr>
       </thead>
       <tbody>
@@ -88,17 +88,7 @@ ${ layout.menubar(section='organizations') }
             </td>
           % endif
           <td>
-            % if is_admin(user):
-              <strong>
-                <a title="${ _('Edit %(groupname)s') % dict(groupname=group.name) }"
-                  href="${ url('useradmin.views.edit_group', name=group.name) }"
-                  data-row-selector="true">
-                    ${group.name}
-                </a>
-              </strong>
-            % else:
-              <strong>${group.name}</strong>
-            % endif
+            <strong>${ group.name }</strong>
           </td>
           <td>${ ', '.join([group_user.username for group_user in group.organizationuser_set.all()]) }</td>
           <td>${ group.organizationgroup_set.count() } ${ group.huepermission_set.count() }</td>

+ 3 - 1
desktop/core/src/desktop/lib/export_csvxls.py

@@ -66,6 +66,8 @@ def file_reader(fh):
 
 def encode_row(row, encoding=None, make_excel_links=False):
   encoded_row = []
+  encoding = encoding or i18n.get_site_encoding()
+
   for cell in row:
     if isinstance(cell, six.string_types):
       cell = re.sub(ILLEGAL_CHARS, '?', cell)
@@ -73,7 +75,7 @@ def encode_row(row, encoding=None, make_excel_links=False):
         cell = re.compile('(https?://.+)', re.IGNORECASE).sub(r'=HYPERLINK("\1")', cell)
     cell = nullify(cell)
     if not isinstance(cell, numbers.Number):
-      cell = smart_str(cell, encoding or i18n.get_site_encoding(), strings_only=True, errors='replace')
+      cell = smart_str(cell, encoding, strings_only=True, errors='replace')
     encoded_row.append(cell)
   return encoded_row
 

+ 1 - 1
desktop/libs/notebook/src/notebook/tasks.py

@@ -43,7 +43,7 @@ from desktop.settings import CACHES_CELERY_KEY, CACHES_CELERY_QUERY_RESULT_KEY
 from useradmin.models import User
 
 from notebook.api import _get_statement
-from notebook.conf import  ENABLE_NOTEBOOK_2
+from notebook.conf import ENABLE_NOTEBOOK_2
 from notebook.connectors.base import get_api, QueryExpired, ExecutionWrapper, QueryError
 from notebook.models import make_notebook, MockedDjangoRequest, Notebook
 from notebook.sql_utils import get_current_statement