analytics.mako 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ## Licensed to Cloudera, Inc. under one
  2. ## or more contributor license agreements. See the NOTICE file
  3. ## distributed with this work for additional information
  4. ## regarding copyright ownership. Cloudera, Inc. licenses this file
  5. ## to you under the Apache License, Version 2.0 (the
  6. ## "License"); you may not use this file except in compliance
  7. ## with the License. You may obtain a copy of the License at
  8. ##
  9. ## http://www.apache.org/licenses/LICENSE-2.0
  10. ##
  11. ## Unless required by applicable law or agreed to in writing, software
  12. ## distributed under the License is distributed on an "AS IS" BASIS,
  13. ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ## See the License for the specific language governing permissions and
  15. ## limitations under the License.
  16. <%!
  17. from django.utils.translation import ugettext as _
  18. from desktop import conf
  19. from desktop.views import commonheader, commonfooter
  20. %>
  21. <%
  22. MAIN_SCROLLABLE = "'.page-content'"
  23. if conf.CUSTOM.BANNER_TOP_HTML.get():
  24. TOP_SNAP = "78px"
  25. else:
  26. TOP_SNAP = "50px"
  27. %>
  28. <%namespace name="actionbar" file="actionbar.mako" />
  29. <%namespace name="layout" file="about_layout.mako" />
  30. <script type="text/javascript">
  31. (function () {
  32. var AnalyticsViewModel = function () {
  33. var self = this;
  34. self.stats = ko.observableArray();
  35. self.fetchAnalytics = function () {
  36. window.simpleGet('/desktop/analytics/api/admin_stats', {}, {
  37. successCallback: function (data) {
  38. self.stats(data.admin_stats);
  39. }
  40. });
  41. };
  42. };
  43. $(document).ready(function () {
  44. var viewModel = new AnalyticsViewModel();
  45. ko.applyBindings(viewModel, $('#analyticsComponents')[0]);
  46. });
  47. })();
  48. </script>
  49. ${ layout.menubar(section='analytics') }
  50. <div id="analyticsComponents" class="container-fluid">
  51. <a href="javascript:void(0)" data-bind="click: function() { selectedConnectorCategory('All'); section('installed-connectors-page'); }">
  52. ${ _('Analytics') }
  53. </a>
  54. <textarea data-bind="text: stats" readonly></textarea>
  55. </script>