浏览代码

[desktop] Move data collection to ini

Can be configured more easily
Romain Rigaux 12 年之前
父节点
当前提交
5d30681

+ 1 - 22
apps/about/src/about/templates/admin_wizard.mako

@@ -175,7 +175,7 @@ ${ commonheader(_('Quick Start'), "quickstart", user, "100px") | n,unicode }
           <span class="icon">
             <i class="icon-th-list"></i>
           </span>
-          <h5>${ _('Create or import users.') }</h5>
+          <h5>${ _('Create or import users') }</h5>
         </div>
         <div class="widget-content">
         <a  href="${ url('useradmin.views.list_users') }" target="_blank"><img src="/useradmin/static/art/icon_useradmin_24.png"> ${ _('User Admin') }</a>
@@ -197,27 +197,6 @@ ${ commonheader(_('Quick Start'), "quickstart", user, "100px") | n,unicode }
         </div>
       </div>
 
-      <div class="widget-box">
-        <div class="widget-title">
-          <span class="icon">
-            <i class="icon-th-list"></i>
-          </span>
-          <h5>${ _('Anonymous usage analytics') }</h5>
-        </div>
-        <div class="widget-content" style="padding-left: 14px">
-          <label class="checkbox">
-            <input class="updatePreferences" type="checkbox" name="collect_usage" style="margin-right: 10px" title="${ ('Check to enable usage analytics') }" ${ collect_usage and "checked" }/>
-            ${ ('Help improve Hue with anonymous usage analytics.') }
-            <a href="javascript:void(0)" style="display: inline" data-trigger="hover" data-toggle="popover" data-placement="right" rel="popover"
-               title="${_('How does it work?') }"
-               data-content="${ ('We are using Google Analytics to see how many times an application or specific section of an application is used, nothing more.') }">
-               <i class="icon-question-sign"></i>
-            </a>
-          </label>
-        </div>
-      </div>
-    </div>
-
     <div id="step4" class="stepDetails hide">
       <div class="widget-box">
         <div class="widget-title">

+ 0 - 4
apps/about/src/about/views.py

@@ -36,7 +36,6 @@ def admin_wizard(request):
   apps = appmanager.get_apps(request.user)
   app_names = [app.name for app in sorted(apps, key=lambda app: app.menu_index)]
 
-  collect_usage = Settings.get_settings().collect_usage
   tours_and_tutorials = Settings.get_settings().tours_and_tutorials
 
   return render('admin_wizard.mako', request, {
@@ -44,7 +43,6 @@ def admin_wizard(request):
       'check_config': check_config(request).content,
       'apps': dict([(app.name, app) for app in apps]),
       'app_names': app_names,
-      'collect_usage': collect_usage,
       'tours_and_tutorials': tours_and_tutorials,
       'trash_enabled': get_trash_interval()
   })
@@ -56,11 +54,9 @@ def update_preferences(request):
   if request.method == 'POST':
     try:
       settings = Settings.get_settings()
-      settings.collect_usage = request.POST.get('collect_usage', False)
       settings.tours_and_tutorials = request.POST.get('tours_and_tutorials', False)
       settings.save()
       response['status'] = 0
-      response['collect_usage'] = settings.collect_usage
       response['tours_and_tutorials'] = settings.tours_and_tutorials
     except Exception, e:
       response['data'] = str(e)

+ 30 - 26
desktop/conf.dist/hue.ini

@@ -64,6 +64,10 @@
   # Default encoding for site data
   ## default_site_encoding=utf-8
 
+  # Help improve Hue with anonymous usage analytics.
+  # Use Google Analytics to see how many times an application or specific section of an application is used, nothing more.
+  ## collect_usage=true
+
   # Administrators
   # ----------------
   [[django_admins]]
@@ -113,40 +117,40 @@
   # -------------------------------------------------------------------
   [[ldap]]
 
-  # The search base for finding users and groups
-  ## base_dn="DC=mycompany,DC=com"
+    # The search base for finding users and groups
+    ## base_dn="DC=mycompany,DC=com"
 
-  # The NT domain to connect to (only for use with Active Directory)
-  ## nt_domain=mycompany.com
+    # The NT domain to connect to (only for use with Active Directory)
+    ## nt_domain=mycompany.com
 
-  # URL of the LDAP server
-  ## ldap_url=ldap://auth.mycompany.com
+    # URL of the LDAP server
+    ## ldap_url=ldap://auth.mycompany.com
 
-  # A PEM-format file containing certificates for the CA's that
-  # Hue will trust for authentication over TLS.
-  # The certificate for the CA that signed the
-  # LDAP server certificate must be included among these certificates.
-  # See more here http://www.openldap.org/doc/admin24/tls.html.
-  ## ldap_cert=
-  ## use_start_tls=true
+    # A PEM-format file containing certificates for the CA's that
+    # Hue will trust for authentication over TLS.
+    # The certificate for the CA that signed the
+    # LDAP server certificate must be included among these certificates.
+    # See more here http://www.openldap.org/doc/admin24/tls.html.
+    ## ldap_cert=
+    ## use_start_tls=true
 
-  # Distinguished name of the user to bind as -- not necessary if the LDAP server
-  # supports anonymous searches
-  ## bind_dn="CN=ServiceAccount,DC=mycompany,DC=com"
+    # Distinguished name of the user to bind as -- not necessary if the LDAP server
+    # supports anonymous searches
+    ## bind_dn="CN=ServiceAccount,DC=mycompany,DC=com"
 
-  # Password of the bind user -- not necessary if the LDAP server supports
-  # anonymous searches
-  ## bind_password=
+    # Password of the bind user -- not necessary if the LDAP server supports
+    # anonymous searches
+    ## bind_password=
 
-  # Pattern for searching for usernames -- Use <username> for the parameter
-  # For use when using LdapBackend for Hue authentication
-  ## ldap_username_pattern="uid=<username>,ou=People,dc=mycompany,dc=com"
+    # Pattern for searching for usernames -- Use <username> for the parameter
+    # For use when using LdapBackend for Hue authentication
+    ## ldap_username_pattern="uid=<username>,ou=People,dc=mycompany,dc=com"
 
-  # Create users in Hue when they try to login with their LDAP credentials
-  # For use when using LdapBackend for Hue authentication
-  ## create_users_on_login = true
+    # Create users in Hue when they try to login with their LDAP credentials
+    # For use when using LdapBackend for Hue authentication
+    ## create_users_on_login = true
 
-      [[[users]]]
+    [[[users]]]
 
       # Base filter for searching for users
       ## user_filter="objectclass=*"

+ 30 - 26
desktop/conf/pseudo-distributed.ini.tmpl

@@ -73,6 +73,10 @@
   # Default encoding for site data
   ## default_site_encoding=utf-8
 
+  # Help improve Hue with anonymous usage analytics.
+  # Use Google Analytics to see how many times an application or specific section of an application is used, nothing more.
+  ## collect_usage=true
+
   # Administrators
   # ----------------
   [[django_admins]]
@@ -122,40 +126,40 @@
   # -------------------------------------------------------------------
   [[ldap]]
 
-  # The search base for finding users and groups
-  ## base_dn="DC=mycompany,DC=com"
+    # The search base for finding users and groups
+    ## base_dn="DC=mycompany,DC=com"
 
-  # The NT domain to connect to (only for use with Active Directory)
-  ## nt_domain=mycompany.com
+    # The NT domain to connect to (only for use with Active Directory)
+    ## nt_domain=mycompany.com
 
-  # URL of the LDAP server
-  ## ldap_url=ldap://auth.mycompany.com
+    # URL of the LDAP server
+    ## ldap_url=ldap://auth.mycompany.com
 
-  # A PEM-format file containing certificates for the CA's that
-  # Hue will trust for authentication over TLS.
-  # The certificate for the CA that signed the
-  # LDAP server certificate must be included among these certificates.
-  # See more here http://www.openldap.org/doc/admin24/tls.html.
-  ## ldap_cert=
-  ## use_start_tls=true
+    # A PEM-format file containing certificates for the CA's that
+    # Hue will trust for authentication over TLS.
+    # The certificate for the CA that signed the
+    # LDAP server certificate must be included among these certificates.
+    # See more here http://www.openldap.org/doc/admin24/tls.html.
+    ## ldap_cert=
+    ## use_start_tls=true
 
-  # Distinguished name of the user to bind as -- not necessary if the LDAP server
-  # supports anonymous searches
-  ## bind_dn="CN=ServiceAccount,DC=mycompany,DC=com"
+    # Distinguished name of the user to bind as -- not necessary if the LDAP server
+    # supports anonymous searches
+    ## bind_dn="CN=ServiceAccount,DC=mycompany,DC=com"
 
-  # Password of the bind user -- not necessary if the LDAP server supports
-  # anonymous searches
-  ## bind_password=
+    # Password of the bind user -- not necessary if the LDAP server supports
+    # anonymous searches
+    ## bind_password=
 
-  # Pattern for searching for usernames -- Use <username> for the parameter
-  # For use when using LdapBackend for Hue authentication
-  ## ldap_username_pattern="uid=<username>,ou=People,dc=mycompany,dc=com"
+    # Pattern for searching for usernames -- Use <username> for the parameter
+    # For use when using LdapBackend for Hue authentication
+    ## ldap_username_pattern="uid=<username>,ou=People,dc=mycompany,dc=com"
 
-  # Create users in Hue when they try to login with their LDAP credentials
-  # For use when using LdapBackend for Hue authentication
-  ## create_users_on_login = true
+    # Create users in Hue when they try to login with their LDAP credentials
+    # For use when using LdapBackend for Hue authentication
+    ## create_users_on_login = true
 
-      [[[users]]]
+    [[[users]]]
 
       # Base filter for searching for users
       ## user_filter="objectclass=*"

+ 14 - 0
desktop/core/src/desktop/conf.py

@@ -38,29 +38,35 @@ HTTP_HOST = Config(
   help=_("HTTP host to bind to."),
   type=str,
   default="0.0.0.0")
+
 HTTP_PORT = Config(
   key="http_port",
   help=_("HTTP port to bind to."),
   type=int,
   default=8888)
+
 SSL_CERTIFICATE = Config(
   key="ssl_certificate",
   help=_("Filename of SSL Certificate"),
   default=None)
+
 SSL_PRIVATE_KEY = Config(
   key="ssl_private_key",
   help=_("Filename of SSL RSA Private Key"),
   default=None)
+
 ENABLE_SERVER = Config(
   key="enable_server",
   help=_("If set to false, runcpserver will not actually start the web server.  Used if Apache is being used as a WSGI container."),
   type=coerce_bool,
   default=True)
+
 CHERRYPY_SERVER_THREADS = Config(
   key="cherrypy_server_threads",
   help=_("Number of threads used by the CherryPy web server."),
   type=int,
   default=10)
+
 SECRET_KEY = Config(
   key="secret_key",
   help=_("Used in hashing algorithms for sessions."),
@@ -72,6 +78,14 @@ USER_ACCESS_HISTORY_SIZE = Config(
   type=int,
   default=10)
 
+COLLECT_USAGE = Config(
+  key="collect_usage",
+  help=_("Help improve Hue with anonymous usage analytics."
+         "Use Google Analytics to see how many times an application or specific section of an application is used, nothing more."),
+  type=coerce_bool,
+  default=True)
+
+
 def is_https_enabled():
   return bool(SSL_CERTIFICATE.get() and SSL_PRIVATE_KEY.get())
 

+ 1 - 1
desktop/core/src/desktop/views.py

@@ -329,7 +329,7 @@ def commonfooter(messages=None):
   return render_to_string("common_footer.html", {
     'messages': messages,
     'version': settings.HUE_DESKTOP_VERSION,
-    'collect_usage': hue_settings.collect_usage,
+    'collect_usage': desktop.conf.COLLECT_USAGE.get(),
     'tours_and_tutorials': hue_settings.tours_and_tutorials
   })