admin_wizard.mako 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  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 desktop.views import commonheader, commonfooter
  18. from django.core.urlresolvers import reverse
  19. from django.utils.encoding import smart_unicode
  20. from django.utils.translation import ugettext as _
  21. %>
  22. <%namespace name="header" file="header.mako" />
  23. ${ commonheader(_('Quick Start'), "quickstart", user) | n,unicode }
  24. ${ header.menubar() }
  25. <div class="container-fluid">
  26. <div class="row-fluid" style="margin-bottom: 100px;">
  27. <div class="card card-small">
  28. <h2 class="card-heading simple">
  29. % if user.is_superuser:
  30. ${ _('Quick Start Wizard') } -
  31. % endif
  32. Hue&trade; ${version} - <a href="http://gethue.com" target="_blank" style="color:#777" title="${ _('Visit the project website!') }">${ _("The Hadoop UI") }</a>
  33. </h2>
  34. % if user.is_superuser:
  35. <div class="card-body">
  36. <br/>
  37. <div class="row-fluid">
  38. <div id="properties" class="section">
  39. <ul class="nav nav-tabs" style="margin-bottom: 0">
  40. <li class="active"><a href="#step1" class="step">${ _('Step 1:') } <i class="fa fa-cogs"></i> ${ _('Check Configuration') }</a></li>
  41. <li><a href="#step2" class="step">${ _('Step 2:') } <i class="fa fa-book"></i> ${ _('Examples') }</a></li>
  42. <li><a href="#step3" class="step">${ _('Step 3:') } <i class="fa fa-group"></i> ${ _('Users') }</a></li>
  43. <li><a id="lastStep" href="#step4" class="step">${ _('Step 4:') } <i class="fa fa-flag"></i> ${_('Go!') }</a></li>
  44. </ul>
  45. <div class="steps">
  46. <div id="step1" class="stepDetails">
  47. <div class="card card-tab">
  48. <h2 class="card-heading simple">${ _('Checking current configuration') }</h2>
  49. <div class="card-body">
  50. <div id="check-config-section" style="margin-bottom:20px">
  51. <div class="spinner">
  52. <!--[if !IE]> --><i class="fa fa-spinner fa-spin" style="font-size: 60px; color: #DDD"></i><!-- <![endif]-->
  53. <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
  54. </div>
  55. <div class="info hide"></div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div id="step2" class="stepDetails hide">
  61. <div class="card card-tab card-listcontent">
  62. <h2 class="card-heading simple">${ _('Install individual application examples') }</h2>
  63. <div class="card-body">
  64. <ul>
  65. % if 'beeswax' in app_names:
  66. <li>
  67. <a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
  68. data-sample-url="${ url('beeswax:install_examples') }">
  69. <i class="fa fa-download"></i> ${ apps['beeswax'].nice_name }
  70. </a>
  71. </li>
  72. % endif
  73. % if 'impala' in app_names:
  74. <li>
  75. <a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
  76. data-sample-url="${ url('impala:install_examples') }">
  77. <i class="fa fa-download"></i> ${ apps['impala'].nice_name }
  78. </a>
  79. </li>
  80. % endif
  81. % if 'search' in app_names:
  82. <li>
  83. <a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
  84. data-sample-url="${ url('search:install_examples') }">
  85. <i class="fa fa-download"></i> ${ apps['search'].nice_name }
  86. </a>
  87. </li>
  88. % endif
  89. % if 'spark' in app_names:
  90. <li>
  91. <a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
  92. data-sample-url="${ url('notebook:install_examples') }">
  93. <i class="fa fa-download"></i> ${ apps['spark'].nice_name }
  94. </a>
  95. </li>
  96. % endif
  97. % if 'oozie' in app_names:
  98. <li>
  99. <a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
  100. data-sample-url="${ url('oozie:install_examples') }">
  101. <i class="fa fa-download"></i> ${ apps['oozie'].nice_name }
  102. </a>
  103. </li>
  104. % endif
  105. % if 'hbase' in app_names:
  106. <li>
  107. <a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
  108. data-sample-url="${ url('hbase:install_examples') }">
  109. <i class="fa fa-download"></i> ${ apps['hbase'].nice_name }
  110. </a>
  111. </li>
  112. % endif
  113. % if 'pig' in app_names:
  114. <li>
  115. <a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
  116. data-sample-url="${ url('pig:install_examples') }">
  117. <i class="fa fa-download"></i> ${ apps['pig'].nice_name }
  118. </a>
  119. </li>
  120. % endif
  121. % if 'jobsub' in app_names:
  122. <li>
  123. <a href="javascript:void(0)" class="installBtn" data-loading-text="${ _('Installing...') }"
  124. data-sample-url="${ url('oozie:install_examples') }">
  125. <i class="fa fa-download"></i> ${ apps['jobsub'].nice_name }
  126. </a>
  127. </li>
  128. % endif
  129. </ul>
  130. </div>
  131. </div>
  132. </div>
  133. <div id="step3" class="stepDetails hide">
  134. <div class="card card-tab card-listcontent">
  135. <h2 class="card-heading simple">${ _('Create or import users') }</h2>
  136. <div class="card-body" style="margin-top: 10px">
  137. <a href="${ url('useradmin.views.list_users') }" target="_blank" style="padding-left: 2px"><img
  138. src="${ static('useradmin/art/icon_useradmin_48.png') }" class="app-icon"
  139. style="margin-right: 4px;"> ${ _('User Admin') }</a>
  140. </div>
  141. </div>
  142. <div class="card card-home card-tab card-tab-bordertop card-listcontent margin-top-30">
  143. <h2 class="card-heading simple">${ _('Tours and tutorials') }</h2>
  144. <div class="card-body" style="margin-top: 10px">
  145. <label class="checkbox">
  146. <input class="updatePreferences" type="checkbox" name="tours_and_tutorials"
  147. style="margin-right: 10px"
  148. title="${ _('Check to enable the tours and tutorials') }" ${ tours_and_tutorials and 'checked' or '' }/>
  149. ${ _('Display the "Available Tours" question mark when tours are available for a specific page.') }
  150. </label>
  151. </div>
  152. </div>
  153. <div class="card card-home card-tab card-tab-bordertop card-listcontent margin-top-30">
  154. <h2 class="card-heading simple">${ _('Anonymous usage analytics') }</h2>
  155. <div class="card-body" style="margin-top: 10px">
  156. <label class="checkbox">
  157. <input class="updatePreferences" type="checkbox" name="collect_usage" style="margin-right: 10px" title="${ _('Check to enable usage analytics') }" ${ collect_usage and 'checked' or '' }/>
  158. ${ _('Help improve Hue with anonymous usage analytics.') }
  159. <a href="javascript:void(0)" style="display: inline" data-trigger="hover" data-toggle="popover" data-placement="right" rel="popover"
  160. title="${ _('How does it work?') }"
  161. data-content="${ _('We are using Google Analytics to see how many times an application or specific section of an application is used, nothing more.') }">
  162. <i class="fa fa-question-circle"></i>
  163. </a>
  164. </label>
  165. </div>
  166. </div>
  167. </div>
  168. <div id="step4" class="stepDetails hide">
  169. <div class="card card-tab card-listcontent">
  170. <h2 class="card-heading simple">${ _('Use the applications') }</h2>
  171. <div class="card-body">
  172. <a href="${ url('desktop.views.home') }" style="padding-left: 2px; line-height: 24px; margin-right: 4px"><i class="fa fa-home" style="font-size: 24px; color: #338bb8; vertical-align: middle;"></i> ${ _('Hue Home') }</a>
  173. </div>
  174. </div>
  175. <div class="card card-home card-tab card-tab-bordertop card-listcontent">
  176. <h2 class="card-heading simple">${ _('Skip wizard next time') }</h2>
  177. <div class="card-body">
  178. <label class="checkbox">
  179. <input id="updateSkipWizard" type="checkbox"
  180. style="margin-right: 10px"
  181. title="${ _('Check to skip this wizard next time.') }"/>
  182. ${ _('Skip the Quick Start Wizard at next login and land directly on the home page.') }
  183. </label>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="form-actions">
  192. <a id="backBtn" class="btn disabled">${ _('Back') }</a>
  193. <a id="nextBtn" class="btn btn-primary disable-feedback">${ _('Next') }</a>
  194. <a id="doneBtn" class="btn btn-primary disable-feedback hide">${ _('Done') }</a>
  195. <div class="pull-right muted">${ _('Hue and the Hue logo are trademarks of Cloudera, Inc.') }</div>
  196. </div>
  197. % else:
  198. <div class="card-body">
  199. <p>
  200. ${ _('Learn more about Hue and Hadoop on') } <a href="http://gethue.com" target="_blank">http://gethue.com</a>.
  201. <span class="muted">${ _('Hue and the Hue logo are trademarks of Cloudera, Inc.') }</span>
  202. % if not user.is_authenticated():
  203. <%
  204. home_url = url('desktop.views.home')
  205. from desktop.conf import USE_NEW_EDITOR
  206. if USE_NEW_EDITOR.get():
  207. home_url = url('desktop.views.home2')
  208. %>
  209. <br/>
  210. <a href="${ home_url }" class="btn btn-primary" style="margin-top: 50px;margin-bottom: 20px"><i class="fa fa-sign-in"></i> ${ _('Sign in now!') }</a>
  211. % endif
  212. </p>
  213. </div>
  214. % endif
  215. </div>
  216. </div>
  217. </div>
  218. % if user.is_superuser:
  219. <style type="text/css">
  220. .steps {
  221. min-height: 300px;
  222. }
  223. input[type=submit] {
  224. margin-left: 50px;
  225. }
  226. @media all and (max-height: 800px) {
  227. .form-actions {
  228. position:fixed;
  229. bottom:0;
  230. margin:0;
  231. left:0;
  232. right:0;
  233. }
  234. }
  235. .footer {
  236. text-align: center;
  237. }
  238. .stepDetails .card .card-heading.simple {
  239. border-bottom: none;
  240. }
  241. </style>
  242. <script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
  243. <script type="text/javascript" charset="utf-8">
  244. $(document).ready(function(){
  245. window.setTimeout(function(){
  246. $.get("${ url('desktop.views.check_config') }", function(response) {
  247. $("#check-config-section .spinner").css({
  248. 'position': 'absolute',
  249. 'top': '-100px'
  250. });
  251. $("#check-config-section .info").html(response);
  252. $("#check-config-section .info").removeClass('hide');
  253. })
  254. .fail(function() { $(document).trigger('error', '${ _("Check config failed: ")}'); });
  255. }, 100);
  256. $("[rel='popover']").popover();
  257. $(".installBtn").click(function() {
  258. var button = $(this);
  259. $(button).button('loading');
  260. $.post($(this).data("sample-url"), function(data) {
  261. if (data.status == 0) {
  262. $(document).trigger('info','${ _("Examples refreshed") }');
  263. } else {
  264. $(document).trigger('error', data.message);
  265. }
  266. })
  267. .always(function(data) {
  268. $(button).button('reset');
  269. });
  270. });
  271. $(".installAllBtn").click(function() {
  272. var button = $(this);
  273. $(button).button('loading');
  274. var calls = jQuery.map($("[data-sample-url]"), function(app) {
  275. return $.post($(app).data("sample-url"), function(data) {
  276. if (data.status != 0) {
  277. $(document).trigger('error', data.message);
  278. }
  279. });
  280. });
  281. $.when.apply(this, calls)
  282. .then(function() {
  283. $(document).trigger('info', '${ _("Examples refreshed") }');
  284. })
  285. .always(function(data) {
  286. $(button).button('reset');
  287. });
  288. });
  289. var currentStep = "step1";
  290. routie({
  291. "step1":function () {
  292. showStep("step1");
  293. },
  294. "step2":function () {
  295. showStep("step2");
  296. },
  297. "step3":function () {
  298. showStep("step3");
  299. },
  300. "step4":function () {
  301. showStep("step4");
  302. }
  303. });
  304. function showStep(step) {
  305. currentStep = step;
  306. if (step != "step1") {
  307. $("#backBtn").removeClass("disabled");
  308. } else {
  309. $("#backBtn").addClass("disabled");
  310. }
  311. if (step != $(".stepDetails:last").attr("id")) {
  312. $("#nextBtn").removeClass("hide");
  313. $("#doneBtn").addClass("hide");
  314. } else {
  315. $("#nextBtn").addClass("hide");
  316. $("#doneBtn").removeClass("hide");
  317. }
  318. $("a.step").parent().removeClass("active");
  319. $("a.step[href=#" + step + "]").parent().addClass("active");
  320. if (step == "step4") {
  321. $("#lastStep").parent().addClass("active");
  322. }
  323. $(".stepDetails").hide();
  324. $("#" + step).show();
  325. }
  326. $("#backBtn").click(function () {
  327. var nextStep = (currentStep.substr(4) * 1 - 1);
  328. if (nextStep >= 1) {
  329. routie("step" + nextStep);
  330. }
  331. });
  332. $("#nextBtn").click(function () {
  333. var nextStep = (currentStep.substr(4) * 1 + 1);
  334. if (nextStep <= $(".step").length) {
  335. routie("step" + nextStep);
  336. }
  337. });
  338. $("#doneBtn").click(function () {
  339. location.href = "${ url('desktop.views.home') }";
  340. });
  341. $(".updatePreferences").click(function () {
  342. $.post("${ url('about:update_preferences') }", $("input").serialize(), function(data) {
  343. if (data.status == 0) {
  344. $(document).trigger('info', '${ _("Configuration updated") }');
  345. } else {
  346. $(document).trigger('error', data.data);
  347. }
  348. });
  349. });
  350. $("#updateSkipWizard").prop('checked', $.cookie("hueLandingPage", {path: "/"}) == "home");
  351. $("#updateSkipWizard").change(function () {
  352. $.cookie("hueLandingPage", this.checked ? "home" : "wizard", {path: "/"});
  353. });
  354. });
  355. </script>
  356. % endif
  357. ${ commonfooter(request, messages) | n,unicode }