editor_components.mako 126 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065
  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. import sys
  18. from webpack_loader.templatetags.webpack_loader import render_bundle
  19. from desktop import conf
  20. from desktop.auth.backend import is_admin
  21. from desktop.views import _ko, antixss
  22. from desktop.webpack_utils import get_hue_bundles
  23. from metadata.conf import has_optimizer, OPTIMIZER
  24. from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_BATCH_EXECUTE, ENABLE_EXTERNAL_STATEMENT, ENABLE_PRESENTATION
  25. from desktop.lib.django_util import nonce_attribute
  26. if sys.version_info[0] > 2:
  27. from django.utils.translation import gettext as _
  28. else:
  29. from django.utils.translation import ugettext as _
  30. %>
  31. <%def name="includes(is_embeddable=False, suffix='')">
  32. <link rel="stylesheet" href="${ static('dashboard/css/common_dashboard.css') }">
  33. % if not is_embeddable:
  34. <link rel="stylesheet" href="${ static('notebook/css/notebook-layout.css') }">
  35. % endif
  36. <link rel="stylesheet" href="${ static('notebook/css/notebook.css') }">
  37. <link rel="stylesheet" href="${ static('desktop/ext/css/bootstrap-editable.css') }">
  38. <link rel="stylesheet" href="${ static('desktop/ext/css/medium-editor.min.css') }">
  39. <link rel="stylesheet" href="${ static('desktop/css/bootstrap-medium-editor.css') }">
  40. <link rel="stylesheet" href="${ static('desktop/ext/css/bootstrap-datepicker.min.css') }">
  41. % if not is_embeddable:
  42. <script src="${ static('desktop/js/share2.vm.js') }"></script>
  43. % endif
  44. % if ENABLE_QUERY_SCHEDULING.get():
  45. <script src="${ static('oozie/js/coordinator-editor.ko.js') }"></script>
  46. <script src="${ static('oozie/js/list-oozie-coordinator.ko.js') }"></script>
  47. % endif
  48. <script src="${ static('desktop/js/ko.common-dashboard.js') }" type="text/javascript" charset="utf-8"></script>
  49. %if ENABLE_QUERY_BUILDER.get():
  50. <!-- For query builder -->
  51. <link rel="stylesheet" href="${ static('desktop/ext/css/jquery.contextMenu.min.css') }">
  52. <script src="${ static('desktop/js/queryBuilder.js') }"></script>
  53. <script>
  54. // query-builder-menu is the class to use
  55. // Callback will run after each rule add, just focus to the queryBuilder tab
  56. QueryBuilder.bindMenu('.query-builder-menu', function () {
  57. $("a[href='#queryBuilderTab']").click();
  58. });
  59. function generateQuery() {
  60. var result = QueryBuilder.buildHiveQuery();
  61. if (result.status == "fail") {
  62. $("#invalidQueryBuilder${ suffix }").modal("show");
  63. } else {
  64. replaceAce(result.query);
  65. }
  66. }
  67. window.setInterval(function(){
  68. if ($('#queryBuilder tbody').length > 0 && $('#queryBuilder tbody').find('tr').length > 0){
  69. $('.button-panel').show();
  70. $('#queryBuilder').show();
  71. $('#queryBuilderAlert').hide();
  72. } else {
  73. $('.button-panel').hide();
  74. $('#queryBuilder').hide();
  75. $('#queryBuilderAlert').show();
  76. }
  77. }, 500, 'editor' + (hueUtils.getParameter('type') ? '-' + hueUtils.getParameter('type') : ''));
  78. </script>
  79. <!-- End query builder imports -->
  80. % endif
  81. % for bundle in get_hue_bundles('notebook'):
  82. ${ render_bundle(bundle) | n,unicode }
  83. % endfor
  84. <!--[if IE 9]>
  85. <script src="${ static('desktop/ext/js/classList.min.js') }" type="text/javascript" charset="utf-8"></script>
  86. <![endif]-->
  87. <%namespace name="dashboard" file="/common_dashboard.mako" />
  88. </%def>
  89. <%def name="topBar(suffix='')">
  90. <style type="text/css">
  91. % if conf.CUSTOM.BANNER_TOP_HTML.get():
  92. .search-bar {
  93. top: 58px!important;
  94. }
  95. .show-assist,
  96. .show-assist-right {
  97. top: 110px!important;
  98. }
  99. .main-content {
  100. top: 112px!important;
  101. }
  102. .context-panel {
  103. height: calc(100% - 104px);
  104. top: 104px;
  105. }
  106. % endif
  107. </style>
  108. <div class="navbar hue-title-bar" data-bind="visible: ! $root.isPresentationMode() && ! $root.isResultFullScreenMode()">
  109. <div class="navbar-inner">
  110. <div class="container-fluid">
  111. <!-- ko template: { name: 'notebook-menu-buttons-${ suffix }' } --><!-- /ko -->
  112. <div class="nav-collapse">
  113. <ul class="nav editor-nav">
  114. <li class="app-header" style="display:none" data-bind="visible: true">
  115. <!-- ko if: editorMode -->
  116. <a data-bind="hueLink: '${ url('notebook:editor') }?type=' + editorType(), attr: { 'title': editorTypeTitle() + '${ _(' Editor') }'}" style="cursor: pointer">
  117. <!-- ko template: { name: 'app-icon-template', data: { icon: editorIcon() } } --><!-- /ko -->
  118. <span data-bind="text: editorTypeTitle"></span>
  119. <!-- ko component: { name: 'hue-favorite-app', params: { app: 'editor', interpreter: editorType() }} --><!-- /ko -->
  120. </a>
  121. <!-- /ko -->
  122. <!-- ko ifnot: editorMode -->
  123. <i class="fa fa-file-text-o app-icon" style="vertical-align: middle"></i>
  124. Notebook
  125. <!-- ko component: { name: 'hue-favorite-app', params: { app: 'notebook' }} --><!-- /ko -->
  126. <!-- /ko -->
  127. </li>
  128. <!-- ko with: selectedNotebook -->
  129. <li class="no-horiz-padding">
  130. <a>&nbsp;</a>
  131. </li>
  132. <li data-bind="visible: isHistory" style="display: none" class="no-horiz-padding muted">
  133. <a title="${ _('This is a history query') }"><i class="fa fa-fw fa-history"></i></a>
  134. </li>
  135. <li data-bind="visible: directoryUuid" style="display: none" class="no-horiz-padding muted">
  136. <a title="${ _('Open directory of this query') }" data-bind="hueLink: '/home/?uuid=' + directoryUuid()"
  137. class="pointer inactive-action" href="javascript:void(0)"><i class="fa fa-fw fa-folder-o"></i>
  138. </a>
  139. </li>
  140. <li data-bind="visible: parentSavedQueryUuid" style="display: none" class="no-horiz-padding muted">
  141. <a title="${ _('Click to open original saved query') }" data-bind="click: function() { $root.openNotebook(parentSavedQueryUuid()) }" class="pointer inactive-action">
  142. <i class="fa fa-fw fa-file-o"></i>
  143. </a>
  144. </li>
  145. <li data-bind="visible: isSaved() && ! isHistory() && ! parentSavedQueryUuid()" style="display: none" class="no-horiz-padding muted">
  146. <a title="${ _('This is a saved query') }"><i class="fa fa-fw fa-file-o"></i></a>
  147. </li>
  148. <li data-bind="visible: isSchedulerJobRunning" style="display: none" class="no-horiz-padding muted">
  149. <a title="${ _('Click to open original saved query') }" data-bind="click: function() { $root.openNotebook(parentSavedQueryUuid()) }" class="pointer inactive-action">
  150. ${ _("Scheduling on") }
  151. </a>
  152. </li>
  153. <li class="query-name no-horiz-padding skip-width-calculation">
  154. <a href="javascript:void(0)">
  155. <div class="notebook-name-desc" data-bind="editable: name, editableOptions: { inputclass: 'notebook-name-input', enabled: true, placement: 'bottom', emptytext: '${_ko('Add a name...')}', tpl: '<input type=\'text\' maxlength=\'255\'>' }"></div>
  156. </a>
  157. </li>
  158. <li class="skip-width-calculation" data-bind="tooltip: { placement: 'bottom', title: description }">
  159. <a href="javascript:void(0)">
  160. <div class="notebook-name-desc" data-bind="editable: description, editableOptions: { type: 'textarea', enabled: true, placement: 'bottom', emptytext: '${_ko('Add a description...')}' }"></div>
  161. </a>
  162. </li>
  163. <!-- /ko -->
  164. </ul>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. <script type="text/html" id="notebook-menu-buttons-${ suffix }">
  170. <div class="pull-right margin-right-10">
  171. % if ENABLE_PRESENTATION.get():
  172. <!-- ko with: selectedNotebook() -->
  173. <div class="btn-group">
  174. <a class="btn" data-bind="click: function() { isPresentationMode(!isPresentationMode()); },
  175. css: {'btn-inverse': $root.isPresentationMode()}, attr: {title: isPresentationMode() ? '${ _ko('Exit presentation') }' : '${ _ko('View as a presentation') }'}">
  176. <i class="fa fa-line-chart"></i>
  177. </a>
  178. <!-- ko if: $root.canSave() -->
  179. <a class="btn dropdown-toggle" data-toggle="dropdown" href="javascript: void(0)"><span class="caret"></span></a>
  180. <ul class="dropdown-menu pull-right">
  181. <li>
  182. <a class="pointer" title="${ _ko('Whether to open in presentation or editor mode by default') }" data-bind="click: function() { isPresentationModeDefault(!isPresentationModeDefault()); }">
  183. <i class="fa" data-bind="css: {'fa-toggle-on': isPresentationModeDefault(), 'fa-toggle-off': !isPresentationModeDefault()}"></i> ${ _('Open as presentation') }
  184. </a>
  185. </li>
  186. </ul>
  187. <!-- /ko -->
  188. </div>
  189. <!-- /ko -->
  190. % endif
  191. <div class="btn-group">
  192. <a class="btn" data-testid="editor--save--button" rel="tooltip" data-placement="bottom" data-loading-text="${ _("Saving...") }" data-bind="click: function() { if ($root.canSave() ) { saveNotebook() } else { $('#saveAsModal${ suffix }').modal('show');} }, attr: { title: $root.canSave() ? '${ _ko('Save') }' : '${ _ko('Save As') }' }">
  193. <i class="fa fa-save"></i>
  194. </a>
  195. <!-- ko if: $root.canSave -->
  196. <a class="btn dropdown-toggle" data-toggle="dropdown" href="javascript: void(0)"><span class="caret"></span></a>
  197. <ul class="dropdown-menu pull-right">
  198. <li>
  199. <a class="pointer" data-bind="click: function() { $('#saveAsModal${ suffix }').modal('show'); }">
  200. <i class="fa fa-fw fa-save"></i> ${ _('Save as...') }
  201. </a>
  202. </li>
  203. </ul>
  204. <!-- /ko -->
  205. </div>
  206. <!-- ko template: { ifnot: editorMode() || isPresentationMode(), name: 'notebook-actions' }--><!-- /ko -->
  207. <!-- ko ifnot: isPresentationMode() -->
  208. <div class="dropdown pull-right margin-left-10" data-testid="editor--actions--dropdown">
  209. <a class="btn" data-toggle="dropdown" href="javascript: void(0)">
  210. <i class="fa fa-fw fa-ellipsis-v"></i>
  211. </a>
  212. <ul class="dropdown-menu pull-right">
  213. <li>
  214. <!-- ko if: editorMode -->
  215. <a href="javascript:void(0)" data-testid="editor--new-document--button" data-bind="click: function() { hueUtils.removeURLParameter('editor'); newNotebook($root.editorType(), null, selectedNotebook() ? $root.selectedNotebook().snippets()[0].currentQueryTab() : null); }, attr: { 'title': '${ _('New ') }' + editorTypeTitle() + '${ _(' Query') }' }">
  216. <i class="fa fa-fw fa-file-o"></i> ${ _('New') }
  217. </a>
  218. <!-- /ko -->
  219. <!-- ko ifnot: editorMode -->
  220. <a href="javascript:void(0)" data-bind="click: newNotebook">
  221. <i class="fa fa-fw fa-file-o"></i> ${ _('New Notebook') }
  222. </a>
  223. <!-- /ko -->
  224. </li>
  225. <li>
  226. <a href="javascript:void(0)" data-bind="publish: { 'assist.show.documents': editorMode() ? 'query-' + editorType() : editorType() }">
  227. <svg class="hi hi-fw hi-bigger"><use href="#hi-documents"></use></svg> <span data-bind="text: editorMode() ? '${ _ko('Queries') }' : '${ _ko('Notebooks') }'"></span>
  228. </a>
  229. </li>
  230. <li class="divider"></li>
  231. <!-- ko if: $root.canSave -->
  232. <!-- ko if: sharingEnabled -->
  233. <li>
  234. <a class="share-link pointer" data-bind="click: prepareShareModal,
  235. css: {'isShared': isShared()}">
  236. <i class="fa fa-fw fa-users"></i> ${ _('Share') }
  237. </a>
  238. </li>
  239. <!-- /ko -->
  240. <!-- /ko -->
  241. <li>
  242. <a class="pointer" data-bind="publish: {'context.panel.visible': true}">
  243. <i class="fa fa-fw fa-cogs"></i> ${ _('Session') }
  244. </a>
  245. </li>
  246. </ul>
  247. </div>
  248. <!-- /ko -->
  249. </div>
  250. </script>
  251. <!-- ko if: $root.isResultFullScreenMode() -->
  252. <a class="hueAnchor collapse-results hidden" href="javascript:void(0)" title="${ _('Collapse results') }"
  253. data-bind="click: function(){ $root.isResultFullScreenMode(false); }, css: { hidden: !$root.isResultFullScreenMode() }">
  254. <i class="fa fa-times fa-fw"></i>
  255. </a>
  256. <!-- /ko -->
  257. <!-- ko if: $root.isPresentationMode() -->
  258. <a class="hueAnchor collapse-results hidden" href="javascript:void(0)" title="${ _('Exit presentation') }"
  259. data-bind="click: function(){ $root.selectedNotebook().isPresentationMode(false); }, css: { hidden: !$root.isPresentationMode() }">
  260. <i class="fa fa-times fa-fw"></i>
  261. </a>
  262. <!-- /ko -->
  263. <div class="player-toolbar margin-top-10" data-bind="visible: $root.isPresentationMode()" style="display: none">
  264. <!-- ko if: $root.isPresentationMode() -->
  265. <!-- ko if: $root.selectedNotebook() -->
  266. <!-- ko if: $root.selectedNotebook().name() || $root.selectedNotebook().description() -->
  267. <h2 class="margin-left-30 margin-right-10 inline padding-left-5" data-bind="text: $root.selectedNotebook().name"></h2>
  268. <h2 class="muted inline" data-bind="text: $root.selectedNotebook().description"></h2>
  269. <div class="clearfix"></div>
  270. <!-- /ko -->
  271. <!-- ko template: { name: 'notebook-menu-buttons-${ suffix }' } --><!-- /ko -->
  272. <div class="margin-left-30 margin-top-10 padding-left-5 margin-bottom-20">
  273. <!-- ko template: { name: 'notebook-actions' } --><!-- /ko -->
  274. <!-- ko if: $root.preEditorTogglingSnippet -->
  275. <!-- ko template: { if: $root.isPresentationMode(), name: 'snippet-variables', data: $root.preEditorTogglingSnippet }--><!-- /ko -->
  276. <!-- /ko -->
  277. </div>
  278. <!-- /ko -->
  279. <!-- /ko -->
  280. </div>
  281. </%def>
  282. <%def name="commonHTML(is_embeddable=False, suffix='')">
  283. <div id="helpModal${ suffix }" class="modal transparent-modal hide" data-backdrop="true" style="width:980px;margin-left:-510px!important">
  284. <div class="modal-header">
  285. <button type="button" class="close" data-dismiss="modal" aria-label="${ _('Close') }"><span aria-hidden="true">&times;</span></button>
  286. <h2 class="modal-title">${_('Editor help')}</h2>
  287. </div>
  288. <div class="modal-body">
  289. <!-- ko component: 'aceKeyboardShortcuts' --><!-- /ko -->
  290. </div>
  291. <div class="modal-footer">
  292. <a href="javascript: void(0)" class="btn" data-dismiss="modal">${_('Close')}</a>
  293. </div>
  294. </div>
  295. <div id="combinedContentModal${ suffix }" class="modal hide" data-backdrop="true" style="width:780px;margin-left:-410px!important">
  296. <div class="modal-header">
  297. <button type="button" class="close" data-dismiss="modal" aria-label="${ _('Close') }"><span aria-hidden="true">&times;</span></button>
  298. <h2 class="modal-title">${_('All Notebook content')}</h2>
  299. </div>
  300. <div class="modal-body">
  301. <pre data-bind="oneClickSelect, text: combinedContent"></pre>
  302. </div>
  303. <div class="modal-footer">
  304. <a href="javascript: void(0)" class="btn" data-dismiss="modal">${_('Close')}</a>
  305. </div>
  306. </div>
  307. % if ENABLE_QUERY_BUILDER.get():
  308. <div id="invalidQueryBuilder${ suffix }" class="modal hide">
  309. <div class="modal-header">
  310. <button type="button" class="close" data-dismiss="modal" aria-label="${ _('Close') }"><span aria-hidden="true">&times;</span></button>
  311. <h2 class="modal-title">${_('Invalid Query')}</h2>
  312. </div>
  313. <div class="modal-body">
  314. <p>${_('Query requires a select or an aggregate.')}</p>
  315. </div>
  316. <div class="modal-footer">
  317. <a class="btn" data-dismiss="modal">${_('Close')}</a>
  318. </div>
  319. </div>
  320. % endif
  321. % if not is_embeddable:
  322. <a title="${_('Toggle Assist')}" class="pointer show-assist" data-bind="visible: !$root.isLeftPanelVisible() && $root.assistAvailable(), click: function() { $root.isLeftPanelVisible(true); huePubSub.publish('assist.set.manual.visibility'); }">
  323. <i class="fa fa-chevron-right"></i>
  324. </a>
  325. <a title="${_('Toggle Assist')}" class="pointer show-assist-right" data-bind="visible: !$root.isRightPanelVisible() && $root.isRightPanelAvailable(), click: function() { $root.isRightPanelVisible(true); huePubSub.publish('assist.set.manual.visibility'); }">
  326. <i class="fa fa-chevron-left"></i>
  327. </a>
  328. % endif
  329. <div data-bind="css: {'main-content': true, 'editor-mode': $root.editorMode()}">
  330. <div class="vertical-full container-fluid" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() || $root.isPresentationMode() || $root.isResultFullScreenMode() ? '0' : '20px' }" >
  331. <div class="vertical-full">
  332. <div class="vertical-full tab-pane row-fluid panel-container" data-bind="css: { active: selectedNotebook() === $data }, template: { name: 'notebook${ suffix }'}">
  333. </div>
  334. </div>
  335. </div>
  336. </div>
  337. <script type="text/html" id="notebook${ suffix }">
  338. % if not is_embeddable:
  339. <div class="assist-container left-panel" data-bind="visible: isLeftPanelVisible() && assistAvailable()">
  340. <a title="${_('Toggle Assist')}" class="pointer hide-assist" data-bind="click: function() { isLeftPanelVisible(false); huePubSub.publish('assist.set.manual.visibility'); }">
  341. <i class="fa fa-chevron-left"></i>
  342. </a>
  343. <div class="assist" data-bind="component: {
  344. name: 'assist-panel',
  345. params: {
  346. user: user,
  347. sql: {
  348. navigationSettings: {
  349. openDatabase: false,
  350. openItem: false,
  351. showStats: true,
  352. pinEnabled: true
  353. },
  354. },
  355. visibleAssistPanels: editorMode() ? ['sql'] : []
  356. }
  357. }"></div>
  358. </div>
  359. <div class="resizer" data-bind="visible: isLeftPanelVisible() && assistAvailable(), splitDraggable : { appName: 'notebook', leftPanelVisible: isLeftPanelVisible, rightPanelVisible: isRightPanelVisible, rightPanelAvailable: isRightPanelAvailable, onPosition: function(){ huePubSub.publish('split.draggable.position') } }"><div class="resize-bar">&nbsp;</div></div>
  360. % endif
  361. <div class="content-panel" data-bind="event: { scroll: function(){ var ls = $(MAIN_SCROLLABLE).data('lastScroll'); if (ls && ls != $(MAIN_SCROLLABLE).scrollTop()){ $(document).trigger('hideAutocomplete'); }; $(MAIN_SCROLLABLE).data('lastScroll', $(MAIN_SCROLLABLE).scrollTop()) } }, with: selectedNotebook">
  362. <div>
  363. <div class="row-fluid row-container sortable-snippets" data-bind="css: {'is-editing': $root.isEditing, 'margin-left-10': $root.isPresentationMode},
  364. sortable: {
  365. template: 'snippet${ suffix }',
  366. data: snippets,
  367. isEnabled: true,
  368. options: {
  369. 'handle': '.move-widget',
  370. 'axis' : 'y',
  371. 'opacity': 0.8,
  372. 'placeholder': 'snippet-move-placeholder',
  373. 'greedy': true,
  374. 'stop': function(event, ui) {
  375. var $element = $(event.target);
  376. $element.find('.snippet-body').slideDown('fast', function () { $(MAIN_SCROLLABLE).scrollTop(lastWindowScrollPosition); });
  377. },
  378. 'helper': function(event) {
  379. lastWindowScrollPosition = $(MAIN_SCROLLABLE).scrollTop();
  380. var $element = $(event.target);
  381. $element.find('.snippet-body').slideUp('fast', function () {
  382. $('.sortable-snippets').sortable('refreshPositions')
  383. });
  384. var _par = $('<div>')
  385. .css('overflow', 'hidden')
  386. .addClass('card-widget snippet-move-helper')
  387. .width($element.parents('.snippet').width());
  388. $('<h2>')
  389. .addClass('card-heading')
  390. .html($element.parents('h2').html())
  391. .appendTo(_par)
  392. .find('.hover-actions, .snippet-actions')
  393. .removeClass('hover-actions')
  394. .removeClass('snippet-actions');
  395. $('<pre>')
  396. .addClass('dragging-pre muted')
  397. .html(ko.dataFor($element.parents('.card-widget')[0]).statement())
  398. .appendTo(_par);
  399. _par.css('height', '100px');
  400. return _par;
  401. }
  402. },
  403. dragged: function (widget) {
  404. $('.snippet-body').slideDown('fast', function () { $(MAIN_SCROLLABLE).scrollTop(lastWindowScrollPosition); });
  405. }
  406. }">
  407. </div>
  408. % if hasattr(caller, "addSnippetHTML"):
  409. ${ caller.addSnippetHTML() }
  410. % endif
  411. </div>
  412. </div>
  413. % if not is_embeddable:
  414. <!-- ko if: isRightPanelAvailable -->
  415. <div class="resizer" data-bind="visible: isRightPanelVisible, splitDraggable : { isRightPanel: true, appName: 'notebook', leftPanelVisible: isLeftPanelVisible, rightPanelVisible: isRightPanelVisible, rightPanelAvailable: isRightPanelAvailable, onPosition: function(){ huePubSub.publish('split.draggable.position') } }" style="display: none;"><div class="resize-bar">&nbsp;</div></div>
  416. <!-- /ko -->
  417. <div class="assist-container right-panel" data-bind="visible: isRightPanelVisible() && isRightPanelAvailable()" style="display:none;">
  418. <a title="${_('Toggle Assist')}" class="pointer hide-assist-right" data-bind="click: function() { isRightPanelVisible(false); huePubSub.publish('assist.set.manual.visibility'); }">
  419. <i class="fa fa-chevron-right"></i>
  420. </a>
  421. <div class="assist" data-bind="component: {
  422. name: 'right-assist-panel',
  423. params: {
  424. rightAssistAvailable: isRightPanelAvailable
  425. }
  426. }" >
  427. </div>
  428. </div>
  429. % endif
  430. </script>
  431. <script type="text/html" id="notebook-session-config-template${ suffix }">
  432. <!-- ko with: selectedNotebook() -->
  433. <form class="form-horizontal session-config">
  434. <fieldset>
  435. <!-- ko ifnot: sessions().length -->
  436. <p>${ _('There are currently no active sessions, please reload the page.') }</p>
  437. <!-- /ko -->
  438. <!-- ko foreach: sessions -->
  439. <h4 style="clear:left; display: inline-block">
  440. <span data-bind="text: $parents[1].getSnippetName(type())"></span>
  441. <!-- ko if: typeof session_id != 'undefined' && session_id -->
  442. <span data-bind="text: session_id"></span>
  443. <!-- /ko -->
  444. </h4>
  445. <div class="session-actions">
  446. <a class="inactive-action pointer" title="${ _('Recreate session') }" rel="tooltip" data-bind="click: function() { $parent.restartSession($data) }">
  447. <i class="fa fa-refresh" data-bind="css: { 'fa-spin': restarting }"></i> ${ _('Recreate') }
  448. </a>
  449. <a class="inactive-action pointer margin-left-10" title="${ _('Close session') }" rel="tooltip" data-bind="click: function() { $parent.closeAndRemoveSession($data) }">
  450. <i class="fa fa-times"></i> ${ _('Close') }
  451. </a>
  452. % if conf.USE_DEFAULT_CONFIGURATION.get():
  453. <a class="inactive-action pointer margin-left-10" title="${ _('Save session settings as default') }" rel="tooltip" data-bind="click: function() { $parent.saveDefaultUserProperties($data) }"><i class="fa fa-save"></i> ${ _('Set as default settings') }</a>
  454. % endif
  455. <!-- ko if: type() == 'impala' && typeof http_addr != 'undefined' -->
  456. <a class="margin-left-10" data-bind="attr: {'href': http_addr()}" target="_blank">
  457. <span data-bind="text: http_addr().replace(/^(https?):\/\//, '')"></span> <i class="fa fa-external-link"></i>
  458. </a>
  459. <!-- /ko -->
  460. </div>
  461. % if conf.USE_DEFAULT_CONFIGURATION.get():
  462. <div style="width:100%;">
  463. <!-- ko component: { name: 'property-selector', params: { properties: properties } } --><!-- /ko -->
  464. </div>
  465. % endif
  466. <div style="clear:both; padding-left: 120px;">
  467. <!-- ko if: availableNewProperties().length -->
  468. <a class="pointer" style="padding:5px;" data-bind="click: selectedSessionProperty() && function() {
  469. properties.push(ko.mapping.fromJS({'name': selectedSessionProperty(), 'value': ''}));
  470. selectedSessionProperty('');
  471. }" style="margin-left:10px;vertical-align: text-top;">
  472. </a>
  473. <!-- /ko -->
  474. </div>
  475. <!-- /ko -->
  476. <br/>
  477. </fieldset>
  478. </form>
  479. <!-- /ko -->
  480. </script>
  481. <script type="text/html" id="snippetIcon${ suffix }">
  482. <!-- ko if: viewSettings().snippetImage -->
  483. <img class="snippet-icon-image" data-bind="attr: { 'src': viewSettings().snippetImage }" alt="${ _('Snippet icon') }">
  484. <!-- /ko -->
  485. <!-- ko if: viewSettings().snippetIcon -->
  486. <i class="fa snippet-icon" data-bind="css: viewSettings().snippetIcon"></i>
  487. <!-- /ko -->
  488. </script>
  489. <script type="text/html" id="snippet-log${ suffix }">
  490. <div class="snippet-log-container margin-bottom-10" data-bind="visible: showLogs">
  491. <div data-bind="delayedOverflow: 'slow', css: resultsKlass" style="margin-top: 5px; position: relative;">
  492. <a href="javascript: void(0)" class="inactive-action close-logs-overlay" data-bind="click: function(){ showLogs(false) }">&times;</a>
  493. <ul data-bind="visible: jobs().length > 0, foreach: jobs" class="unstyled jobs-overlay">
  494. <li data-bind="attr: {'id': $data.name.substr(4)}">
  495. % if is_embeddable:
  496. <a class="pointer" data-bind="text: $.trim($data.name), click: function() { huePubSub.publish('show.jobs.panel', {id: $data.name, interface: $parent.type() == 'impala' ? 'queries' : 'jobs', compute: $parent.compute}); }, clickBubble: false"></a>
  497. % else:
  498. <a data-bind="text: $.trim($data.name), hueLink: $data.url"></a>
  499. % endif
  500. <!-- ko if: typeof percentJob === 'function' && percentJob() > -1 -->
  501. <div class="progress-job progress pull-left" style="background-color: #FFF; width: 100%" data-bind="css: {'progress-warning': percentJob() < 100, 'progress-success': percentJob() === 100}">
  502. <div class="bar" data-bind="style: {'width': percentJob() + '%'}"></div>
  503. </div>
  504. <!-- /ko -->
  505. <div class="clearfix"></div>
  506. </li>
  507. </ul>
  508. <span data-bind="visible: !$root.isPresentationMode() || !$root.isHidingCode()">
  509. <pre data-bind="visible: (!result.logs() || result.logs().length == 0) && jobs().length > 0" class="logs logs-bigger">${ _('No logs available at this moment.') }</pre>
  510. <pre data-bind="visible: result.logs() && result.logs().length > 0, text: result.logs, logScroller: result.logs, logScrollerVisibilityEvent: showLogs" class="logs logs-bigger logs-populated"></pre>
  511. </span>
  512. </div>
  513. <div class="snippet-log-resizer" data-bind="visible: result.logs().length > 0, logResizer: {parent: '.snippet-log-container', target: '.logs-populated', mainScrollable: MAIN_SCROLLABLE, onStart: hideFixedHeaders, onResize: function(){ hideFixedHeaders(); redrawFixedHeaders(500); }, minHeight: 50}">
  514. <i class="fa fa-ellipsis-h"></i>
  515. </div>
  516. </div>
  517. <div class="snippet-log-container margin-bottom-10">
  518. <div data-bind="visible: ! result.hasResultset() && status() == 'available' && result.fetchedOnce(), css: resultsKlass, click: function(){ }" style="display:none;">
  519. <pre class="margin-top-10 no-margin-bottom"><i class="fa fa-check muted"></i> ${ _('Success.') }</pre>
  520. </div>
  521. <div data-bind="visible: result.hasResultset() && status() == 'available' && result.data().length == 0 && result.fetchedOnce() && result.explanation().length <= 0, css: resultsKlass" style="display:none;">
  522. <!-- ko if: result.hasMore -->
  523. <pre class="margin-top-10 no-margin-bottom"><i class="fa fa-spin fa-spinner"></i> ${ _('Loading...') }</pre>
  524. <!-- /ko -->
  525. <!-- ko ifnot: result.hasMore -->
  526. <pre class="margin-top-10 no-margin-bottom"><i class="fa fa-check muted"></i> ${ _("Done. 0 results.") }</pre>
  527. <!-- /ko -->
  528. </div>
  529. <div data-bind="visible: status() == 'expired', css: resultsKlass" style="display:none;">
  530. <pre class="margin-top-10 no-margin-bottom"><i class="fa fa-check muted"></i> ${ _("Results have expired, rerun the query if needed.") }</pre>
  531. </div>
  532. <!-- ko if: status() == 'available' && ! result.fetchedOnce() -->
  533. <div data-bind="css: resultsKlass">
  534. <pre class="margin-top-10 no-margin-bottom"><i class="fa fa-spin fa-spinner"></i> ${ _('Loading...') }</pre>
  535. </div>
  536. <!-- /ko -->
  537. </div>
  538. </script>
  539. <script type="text/html" id="query-tabs${ suffix }">
  540. <div class="query-history-container" data-bind="onComplete: function(){ redrawFixedHeaders(200); }">
  541. <div data-bind="delayedOverflow: 'slow', css: resultsKlass" style="margin-top: 5px; position: relative;">
  542. <ul class="nav nav-tabs nav-tabs-editor">
  543. <li data-bind="click: function(){ currentQueryTab('queryHistory'); }, css: {'active': currentQueryTab() == 'queryHistory'}, onClickOutside: function () { if ($parent.historyFilterVisible() && $parent.historyFilter() === '') { $parent.historyFilterVisible(false) } }">
  544. <a class="inactive-action" data-testid="editor--query-history--tab" style="display:inline-block" href="#queryHistory" data-toggle="tab">${_('Query History')}</a>
  545. <div style="margin-left: -15px;" class="inline-block inactive-action pointer visible-on-hover" title="${_('Search the query history')}" data-bind="click: function(data, e){ $parent.historyFilterVisible(!$parent.historyFilterVisible()); if ($parent.historyFilterVisible()) { window.setTimeout(function(){ $(e.target).parent().siblings('input').focus(); }, 0); } else { $parent.historyFilter('') }}"><i class="snippet-icon fa fa-search"></i></div>
  546. <input class="input-small inline-tab-filter" data-testid="editor--query-history-search--input" type="text" data-bind="visible: $parent.historyFilterVisible, clearable: $parent.historyFilter, valueUpdate:'afterkeydown'" placeholder="${ _('Search...') }">
  547. <div class="dropdown inline-block inactive-action pointer visible-on-hover">
  548. <a class="" data-toggle="dropdown" href="javascript: void(0)">
  549. <i class="fa fa-fw fa-ellipsis-v"></i>
  550. </a>
  551. <ul class="dropdown-menu">
  552. <li data-bind="visible: $parent.history().length > 0">
  553. <!-- ko if: editorMode -->
  554. <a data-target="#clearHistoryModal${ suffix }" data-toggle="modal" rel="tooltip">
  555. <i class="fa fa-fw fa-calendar-times-o"></i> Clear
  556. </a>
  557. <!-- /ko -->
  558. <!-- ko ifnot: editorMode --><!-- /ko -->
  559. </li>
  560. <li><a href="javascript:void(0);" data-bind="click: exportHistory.bind($data)"><i class="fa fa-fw fa-download"></i> ${_('Export')}</a></li>
  561. <li><a href="javascript:void(0);" data-bind="publish: { 'show.import.documents.modal': { importedCallback: refreshHistory.bind($data), isHistory: true }}"><i class="fa fa-fw fa-upload"></i> ${_('Import' )}</a></li>
  562. </ul>
  563. </div>
  564. </li>
  565. <li class="margin-right-20" data-bind="click: function(){ currentQueryTab('savedQueries'); }, css: {'active': currentQueryTab() == 'savedQueries'}, onClickOutside: function () { if (queriesFilterVisible() && queriesFilter() === '') { queriesFilterVisible(false) } }">
  566. <a class="inactive-action" data-testid="editor--saved-queries--tab" style="display:inline-block" href="#savedQueries" data-toggle="tab">${_('Saved Queries')}</a>
  567. <div style="margin-left: -15px;" class="inline-block inactive-action pointer visible-on-hover" title="${_('Search the saved queries')}" data-bind="visible: !queriesHasErrors(), click: function(data, e){ queriesFilterVisible(!queriesFilterVisible()); if (queriesFilterVisible()) { window.setTimeout(function(){ $(e.target).parent().siblings('input').focus(); }, 0); } else { queriesFilter('') }}"><i class="snippet-icon fa fa-search"></i></div>
  568. <input class="input-small inline-tab-filter" data-testid="editor--query-history-search--input" type="text" data-bind="visible: queriesFilterVisible, clearable: queriesFilter, valueUpdate:'afterkeydown'" placeholder="${ _('Search...') }">
  569. </li>
  570. % if ENABLE_QUERY_BUILDER.get():
  571. <!-- ko if: isSqlDialect -->
  572. <li style="margin-right: 25px;" data-bind="click: function(){ currentQueryTab('queryBuilderTab'); }, css: {'active': currentQueryTab() == 'queryBuilderTab'}"><a class="inactive-action" href="#queryBuilderTab" data-toggle="tab">${_('Query Builder')}</a></li>
  573. <!-- /ko -->
  574. % endif
  575. <!-- ko if: result.hasSomeResults -->
  576. <li data-bind="click: function(){ currentQueryTab('queryResults'); }, css: {'active': currentQueryTab() == 'queryResults'}">
  577. <a class="inactive-action" style="display:inline-block" href="#queryResults" data-toggle="tab">${_('Results')}
  578. <!-- ko if: result.rows() != null -->
  579. (<span data-bind="text: result.rows().toLocaleString() + (type() == 'impala' && result.rows() == 1024 ? '+' : '')" title="${ _('Number of rows') }"></span>)
  580. <!-- /ko -->
  581. </a>
  582. <div style="margin-left: -15px;" class="inline-block">
  583. <!-- ko if: showGrid -->
  584. <div class="inline-block inactive-action pointer visible-on-hover" title="${_('Search the results')}" data-bind="click: function(data, e){ $(e.target).parents('.snippet').find('.resultTable').hueDataTable().fnShowSearch() }">
  585. <i class="snippet-icon fa fa-search"></i>
  586. </div>
  587. <!-- /ko -->
  588. <div class="inline-block inactive-action pointer visible-on-hover" title="${_('Expand results')}" rel="tooltip" data-bind="css: { 'margin-left-10': !showGrid()}, visible: !$root.isResultFullScreenMode(), click: function(){ $root.isResultFullScreenMode(true); }">
  589. <i class="snippet-icon fa fa-expand"></i>
  590. </div>
  591. <div class="inline-block inactive-action pointer visible-on-hover" title="${_('Collapse results')}" rel="tooltip" data-bind="visible: $root.isResultFullScreenMode(), click: function(){ $root.isResultFullScreenMode(false); }">
  592. <i class="snippet-icon fa fa-compress"></i>
  593. </div>
  594. </div>
  595. </li>
  596. <!-- /ko -->
  597. <!-- ko if: result.explanation().length > 0 -->
  598. <li data-bind="click: function(){ currentQueryTab('queryExplain'); }, css: {'active': currentQueryTab() == 'queryExplain'}"><a class="inactive-action" href="#queryExplain" data-toggle="tab">${_('Explain')}</a></li>
  599. <!-- /ko -->
  600. <!-- ko foreach: pinnedContextTabs -->
  601. <li data-bind="click: function() { $parent.currentQueryTab(tabId) }, css: { 'active': $parent.currentQueryTab() === tabId }">
  602. <a class="inactive-action" data-toggle="tab" data-bind="attr: { 'href': '#' + tabId }">
  603. <i class="snippet-icon fa" data-bind="css: iconClass"></i> <span data-bind="text: title"></span>
  604. <div class="inline-block inactive-action margin-left-10 pointer" data-bind="click: function () { $parent.removeContextTab($data); }">
  605. <i class="snippet-icon fa fa-times"></i>
  606. </div>
  607. </a>
  608. </li>
  609. <!-- /ko -->
  610. <!-- ko if: HAS_WORKLOAD_ANALYTICS && type() === 'impala' -->
  611. <li data-bind="visible: showExecutionAnalysis, click: function(){ currentQueryTab('executionAnalysis'); }, css: {'active': currentQueryTab() == 'executionAnalysis'}"><a class="inactive-action" href="#executionAnalysis" data-toggle="tab" data-bind="click: function(){ $('a[href=\'#executionAnalysis\']').tab('show'); }, event: {'shown': fetchExecutionAnalysis }"><span>${_('Execution Analysis')} </span><span></span></a></li>
  612. <!-- /ko -->
  613. </ul>
  614. <div class="tab-content" style="border: none; overflow-x: hidden">
  615. <div class="tab-pane" style="min-height:80px;" id="queryHistory" data-bind="css: {'active': currentQueryTab() == 'queryHistory'}, style: { 'height' : $parent.historyInitialHeight() > 0 ? Math.max($parent.historyInitialHeight(), 40) + 'px' : '' }">
  616. <!-- ko if: $parent.loadingHistory -->
  617. <div class="margin-top-10 margin-left-10">
  618. <i class="fa fa-spinner fa-spin muted"></i>
  619. </div>
  620. <!-- /ko -->
  621. <!-- ko ifnot: $parent.loadingHistory -->
  622. <!-- ko if: $parent.history().length === 0 && $parent.historyFilter() === '' -->
  623. <div class="margin-top-10 margin-left-10" style="font-style: italic">${ _("No queries to be shown.") }</div>
  624. <!-- /ko -->
  625. <!-- ko if: $parent.history().length === 0 && $parent.historyFilter() !== '' -->
  626. <div class="margin-top-10 margin-left-10" style="font-style: italic">${ _('No queries found for') } <strong data-bind="text: $parent.historyFilter"></strong>.</div>
  627. <!-- /ko -->
  628. <!-- ko if: $parent.history().length > 0 -->
  629. <table class="table table-condensed margin-top-10 history-table">
  630. <tbody data-bind="foreach: { data: $parent.history, afterRender: function(){ huePubSub.publish('editor.calculate.history.height'); } }">
  631. <tr data-bind="click: function() { if (uuid() != $root.selectedNotebook().uuid()) { $root.openNotebook(uuid()); } }, css: { 'highlight': uuid() == $root.selectedNotebook().uuid(), 'pointer': uuid() != $root.selectedNotebook().uuid() }">
  632. <td style="width: 100px" class="muted" data-bind="style: {'border-top-width': $index() == 0 ? '0' : ''}">
  633. <span data-bind="momentFromNow: {data: lastExecuted, interval: 10000, titleFormat: 'LLL'}"></span>
  634. </td>
  635. <td style="width: 25px" class="muted" data-bind="style: {'border-top-width': $index() == 0 ? '0' : ''}">
  636. <!-- ko switch: status -->
  637. <!-- ko case: 'running' -->
  638. <div class="history-status" data-bind="tooltip: { title: '${ _ko("Query running") }', placement: 'bottom' }"><i class="fa fa-fighter-jet fa-fw"></i></div>
  639. <!-- /ko -->
  640. <!-- ko case: 'failed' -->
  641. <div class="history-status" data-bind="tooltip: { title: '${ _ko("Query failed") }', placement: 'bottom' }"><i class="fa fa-exclamation fa-fw"></i></div>
  642. <!-- /ko -->
  643. <!-- ko case: 'available' -->
  644. <div class="history-status" data-bind="tooltip: { title: '${ _ko("Result available") }', placement: 'bottom' }"><i class="fa fa-check fa-fw"></i></div>
  645. <!-- /ko -->
  646. <!-- ko case: 'expired' -->
  647. <div class="history-status" data-bind="tooltip: { title: '${ _ko("Result expired") }', placement: 'bottom' }"><i class="fa fa-unlink fa-fw"></i></div>
  648. <!-- /ko -->
  649. <!-- /ko -->
  650. </td>
  651. <td style="width: 25px" class="muted" data-bind="ellipsis: {data: name(), length: 30}, style: {'border-top-width': $index() == 0 ? '0' : ''}"></td>
  652. <td data-bind="style: {'border-top-width': $index() == 0 ? '0' : ''}, click: function(){ if (window.getSelection().toString() === '' && uuid() != $root.selectedNotebook().uuid()) { $root.openNotebook(uuid()) } }, clickBubble: false"><div data-bind="highlight: { value: query, dialect: $parent.type }"></div></td>
  653. </tr>
  654. </tbody>
  655. </table>
  656. <!-- /ko -->
  657. <!-- ko with: $parent -->
  658. <div class="pagination" data-bind="visible: historyTotalPages() > 1">
  659. <ul>
  660. <li data-bind="css: { 'disabled' : historyCurrentPage() === 1 }"><a href="javascript: void(0);" data-bind="click: function() { prevHistoryPage(); }">${ _("Prev") }</a></li>
  661. <li class="active"><span data-bind="text: historyCurrentPage() + '/' + historyTotalPages()"></span></li>
  662. <li data-bind="css: { 'disabled' : historyCurrentPage() === historyTotalPages() }"><a href="javascript: void(0);" data-bind="click: function() { nextHistoryPage(); }">${ _("Next") }</a></li>
  663. </ul>
  664. </div>
  665. <!-- /ko -->
  666. <!-- /ko -->
  667. </div>
  668. <div class="tab-pane" id="savedQueries" data-bind="css: {'active': currentQueryTab() == 'savedQueries'}" style="overflow: hidden">
  669. <!-- ko if: loadingQueries -->
  670. <div class="margin-top-10 margin-left-10">
  671. <i class="fa fa-spinner fa-spin muted"></i>
  672. </div>
  673. <!-- /ko -->
  674. <!-- ko if: queriesHasErrors() -->
  675. <div class="margin-top-10 margin-left-10" style="font-style: italic">${ _("Error loading my queries") }</div>
  676. <!-- /ko -->
  677. <!-- ko if: !queriesHasErrors() && !loadingQueries() && queries().length === 0 && queriesFilter() === '' -->
  678. <div class="margin-top-10 margin-left-10" style="font-style: italic">${ _("You don't have any saved queries.") }</div>
  679. <!-- /ko -->
  680. <!-- ko if: !queriesHasErrors() && !loadingQueries() && queries().length === 0 && queriesFilter() !== '' -->
  681. <div class="margin-top-10 margin-left-10" style="font-style: italic">${ _('No queries found for') } <strong data-bind="text: queriesFilter"></strong>.</div>
  682. <!-- /ko -->
  683. <!-- ko if: !queriesHasErrors() && !loadingQueries() && queries().length > 0 -->
  684. <table class="table table-condensed margin-top-10 history-table">
  685. <thead>
  686. <tr>
  687. <th style="width: 16%">${ _("Name") }</th>
  688. <th style="width: 50%">${ _("Description") }</th>
  689. <th style="width: 18%">${ _("Owner") }</th>
  690. <th style="width: 16%">${ _("Last Modified") }</th>
  691. </tr>
  692. </thead>
  693. <tbody data-bind="foreach: queries">
  694. <tr data-bind="click: function() { if (uuid() != $root.selectedNotebook().uuid()) { $root.openNotebook(uuid(), 'savedQueries'); } }, css: { 'highlight': uuid() == $root.selectedNotebook().uuid(), 'pointer': uuid() != $root.selectedNotebook().uuid() }">
  695. <td style="width: 16%"><span data-bind="ellipsis: {data: name(), length: 50}"></span></td>
  696. <td style="width: 50%; white-space: normal"><span data-bind="text: description"></span></td>
  697. <td style="width: 18%"><span data-bind="text: owner"></span></td>
  698. <td style="width: 16%"><span data-bind="text: localeFormat(last_modified())"></span></td>
  699. </tr>
  700. </tbody>
  701. </table>
  702. <!-- /ko -->
  703. <div class="pagination" data-bind="visible: queriesTotalPages() > 1">
  704. <ul>
  705. <li data-bind="css: { 'disabled' : queriesCurrentPage() === 1 }"><a href="javascript: void(0);" data-bind="click: prevQueriesPage">${ _("Prev") }</a></li>
  706. <li class="active"><span data-bind="text: queriesCurrentPage() + '/' + queriesTotalPages()"></span></li>
  707. <li data-bind="css: { 'disabled' : queriesCurrentPage() === queriesTotalPages() }"><a href="javascript: void(0);" data-bind="click: nextQueriesPage">${ _("Next") }</a></li>
  708. </ul>
  709. </div>
  710. </div>
  711. % if ENABLE_QUERY_BUILDER.get():
  712. <div class="tab-pane margin-top-10" id="queryBuilderTab" data-bind="css: {'active': currentQueryTab() == 'queryBuilderTab'}">
  713. <div id="queryBuilderAlert" style="display: none" class="alert">${ _('There are currently no rules defined. To get started, right click on any table column in the SQL Assist panel.') }</div>
  714. <table id="queryBuilder" class="table table-condensed">
  715. <thead>
  716. <tr>
  717. <th width="10%">${ _('Table') }</th>
  718. <th>${ _('Column') }</th>
  719. <th width="10%">${ _('Operation') }</th>
  720. <th width="5%">&nbsp;</th>
  721. <th width="1%">&nbsp;</th>
  722. </tr>
  723. </thead>
  724. </table>
  725. <div class="button-panel">
  726. <button class="btn btn-primary disable-feedback" data-bind="click: generateQuery">${_('Build query')}</button>
  727. </div>
  728. </div>
  729. % endif
  730. <div class="tab-pane" id="queryResults" data-bind="css: {'active': currentQueryTab() == 'queryResults'}">
  731. <!-- ko template: { if: ['text', 'jar', 'py', 'markdown'].indexOf(type()) == -1, name: 'snippet-results${ suffix }' } --><!-- /ko -->
  732. </div>
  733. <!-- ko if: result.explanation().length > 0 -->
  734. <div class="tab-pane" id="queryExplain" data-bind="css: {'active': currentQueryTab() == 'queryExplain'}">
  735. <!-- ko template: { name: 'snippet-explain${ suffix }' } --><!-- /ko -->
  736. </div>
  737. <!-- /ko -->
  738. <!-- ko if: HAS_WORKLOAD_ANALYTICS && type() === 'impala' -->
  739. <div class="tab-pane" id="executionAnalysis" data-bind="css: {'active': currentQueryTab() == 'executionAnalysis'}" style="padding: 10px;">
  740. <!-- ko component: { name: 'hue-execution-analysis' } --><!-- /ko -->
  741. </div>
  742. <!-- /ko -->
  743. <!-- ko foreach: pinnedContextTabs -->
  744. <div class="tab-pane" style="height: 300px; position: relative; overflow: hidden;" data-bind="attr: { 'id': tabId }, css: {'active': $parent.currentQueryTab() === tabId }">
  745. <div style="display: flex; flex-direction: column; margin-top: 10px; overflow: hidden; height: 100%; position: relative;" data-bind="template: 'context-popover-contents'"></div>
  746. </div>
  747. <!-- /ko -->
  748. </div>
  749. </div>
  750. </div>
  751. </script>
  752. <script type="text/html" id="doc-search-autocomp-item">
  753. <a>
  754. <div>
  755. <strong style="font-size: 14px;" data-bind="html: name"></strong>
  756. <div style="width: 190px; overflow: hidden; white-space: nowrap; text-overflow:ellipsis; font-size: 12px;" class="muted" data-bind="text: description"></div>
  757. </div>
  758. </a>
  759. </script>
  760. <script type="text/html" id="longer-operation${ suffix }">
  761. <div rel="tooltip" data-placement="bottom" data-bind="tooltip, fadeVisible: showLongOperationWarning" title="${ _('The query is hanging and taking longer than expected.') }" class="inline-block margin-right-10">
  762. <i class="fa fa-exclamation-triangle warning"></i>
  763. </div>
  764. </script>
  765. <script type="text/html" id="query-redacted${ suffix }">
  766. <div rel="tooltip" data-placement="bottom" data-bind="tooltip, fadeVisible: is_redacted" title="${ _('The current query has been redacted to hide sensitive information.') }" class="inline-block margin-right-10">
  767. <i class="fa fa-low-vision warning"></i>
  768. </div>
  769. </script>
  770. <script type="text/html" id="notebook-snippet-header${ suffix }">
  771. <!-- ko if: $root.isPresentationMode() || $root.isResultFullScreenMode() -->
  772. <div class="inline">
  773. <!-- ko if: name() -->
  774. <span data-bind="text: name"></span>
  775. <!-- /ko -->
  776. <!-- ko if: !name() && !$root.isHidingCode() -->
  777. <span>${ _("Add -- comments on top of the SQL statement to display a title") }</span>
  778. <!-- /ko -->
  779. </div>
  780. <!-- /ko -->
  781. <!-- ko if: ! $root.isPresentationMode() && ! $root.isResultFullScreenMode() -->
  782. <div class="inactive-action hover-actions inline">
  783. <span class="inactive-action" data-bind="css: { 'empty-title': name() === '' }, editable: name, editableOptions: { emptytext: '${_ko('My Snippet')}', mode: 'inline', enabled: true, placement: 'right' }" style="border:none;color: #DDD"></span>
  784. </div>
  785. <div class="hover-actions inline pull-right" style="font-size: 15px;">
  786. <!-- ko template: { name: 'query-redacted${ suffix }' } --><!-- /ko -->
  787. <!-- ko template: { name: 'longer-operation${ suffix }' } --><!-- /ko -->
  788. <span class="execution-timer" data-bind="visible: type() != 'text' && status() != 'ready' && status() != 'loading', text: result.executionTime().toHHMMSS()" title="${ _('Execution time') }"></span>
  789. <!-- ko template: { name: 'snippet-header-database-selection' } --><!-- /ko -->
  790. <!-- ko template: { name: 'snippet-header-statement-type${ suffix }' } --><!-- /ko -->
  791. <a class="inactive-action move-widget" href="javascript:void(0)"><i class="fa fa-arrows"></i></a>
  792. <a class="inactive-action" href="javascript:void(0)" data-bind="toggle: settingsVisible, visible: hasProperties, css: { 'blue' : settingsVisible }" title="${ _('Snippet settings') }"><i class="fa fa-cog"></i></a>
  793. <a class="inactive-action" href="javascript:void(0)" data-bind="click: function(){ $root.removeSnippet($parent, $data); }"><i class="fa fa-times"></i></a>
  794. </div>
  795. <!-- /ko -->
  796. </script>
  797. <script type="text/html" id="editor-snippet-header${ suffix }">
  798. <div class="hover-actions inline pull-right" style="font-size: 15px; position: relative;" data-bind="style: { 'marginRight': $root.isPresentationMode() || $root.isResultFullScreenMode() ? '40px' : '0' }">
  799. <!-- ko template: { name: 'query-redacted${ suffix }' } --><!-- /ko -->
  800. <!-- ko template: { name: 'longer-operation${ suffix }' } --><!-- /ko -->
  801. <span class="execution-timer" data-bind="visible: type() != 'text' && status() != 'ready' && status() != 'loading', text: result.executionTime().toHHMMSS()" title="${ _('Execution time') }"></span>
  802. <!-- ko template: { name: 'snippet-header-database-selection' } --><!-- /ko -->
  803. <!-- ko template: { name: 'snippet-header-statement-type${ suffix }' } --><!-- /ko -->
  804. <a class="inactive-action margin-left-10" href="javascript:void(0)" data-bind="toggle: settingsVisible, visible: hasProperties, css: { 'blue' : settingsVisible }" title="${ _('Query settings') }"><i class="fa fa-cog"></i></a>
  805. <a class="inactive-action margin-left-10 pointer" title="${ _('Show editor help') }" data-toggle="modal" data-target="#helpModal${ suffix }"><i class="fa fa-question"></i></a>
  806. </div>
  807. </script>
  808. <script type="text/html" id="snippet-header-database-selection">
  809. <!-- ko if: isSqlDialect() || type() == 'spark2' -->
  810. <!-- ko component: {
  811. name: 'hue-context-selector',
  812. params: {
  813. connector: connector,
  814. compute: compute,
  815. namespace: namespace,
  816. availableDatabases: availableDatabases,
  817. database: database,
  818. hideDatabases: !isSqlDialect()
  819. }
  820. } --><!-- /ko -->
  821. <!-- /ko -->
  822. </script>
  823. <script type="text/html" id="snippet-header-statement-type${ suffix }">
  824. % if ENABLE_EXTERNAL_STATEMENT.get():
  825. <!-- ko if: isSqlDialect() -->
  826. <div data-bind="component: { name: 'hue-drop-down', params: { titleName: '${ _ko('Type') }', value: statementType, entries: statementTypes, linkTitle: '${ _ko('Statement type') }' } }" style="display: inline-block"></div>
  827. <!-- /ko -->
  828. % endif
  829. </script>
  830. <script type="text/html" id="snippet${ suffix }">
  831. <div data-bind="visibleOnHover: { override: inFocus() || settingsVisible() || dbSelectionVisible() || $root.editorMode() || saveResultsModalVisible(), selector: '.hover-actions' }">
  832. <div class="snippet-container row-fluid" data-bind="visibleOnHover: { override: $root.editorMode() || inFocus() || saveResultsModalVisible(), selector: '.snippet-actions' }">
  833. <div class="snippet card card-widget" data-bind="css: {'notebook-snippet' : ! $root.editorMode(), 'editor-mode': $root.editorMode(), 'active-editor': inFocus, 'snippet-text' : type() == 'text'}, attr: {'id': 'snippet_' + id()}, clickForAceFocus: ace">
  834. <div style="position: relative;">
  835. <div class="snippet-row" style="position: relative;">
  836. <div class="snippet-left-bar">
  837. <!-- ko template: { if: ! $root.editorMode() && ! $root.isPresentationMode() && ! $root.isResultFullScreenMode(), name: 'notebook-snippet-type-controls${ suffix }' } --><!-- /ko -->
  838. <!-- ko template: { if: ['text', 'markdown'].indexOf(type()) == -1 && ! $root.isResultFullScreenMode(), name: 'snippet-execution-controls${ suffix }' } --><!-- /ko -->
  839. </div>
  840. <div class="snippet-body" data-bind="clickForAceFocus: ace, visible: ! $root.isResultFullScreenMode()">
  841. <h5 class="card-heading-print" data-bind="text: name, css: {'visible': name() != ''}"></h5>
  842. <h2 style="margin-left:5px;padding: 3px 0" class="card-heading simple" data-bind="dblclick: function(){ if (!$root.editorMode() && !$root.isPresentationMode()) { $parent.newSnippetAbove(id()) } }, clickForAceFocus: ace">
  843. <!-- ko template: { if: $root.editorMode(), name: 'editor-snippet-header${ suffix }' } --><!-- /ko -->
  844. <!-- ko template: { if: ! $root.editorMode(), name: 'notebook-snippet-header${ suffix }' } --><!-- /ko -->
  845. </h2>
  846. <!-- ko template: { if: ['text', 'jar', 'java', 'spark2', 'distcp', 'shell', 'mapreduce', 'py', 'markdown'].indexOf(type()) == -1, name: 'code-editor-snippet-body${ suffix }' } --><!-- /ko -->
  847. <!-- ko template: { if: type() == 'text', name: 'text-snippet-body${ suffix }' } --><!-- /ko -->
  848. <!-- ko template: { if: type() == 'markdown', name: 'markdown-snippet-body${ suffix }' } --><!-- /ko -->
  849. <!-- ko template: { if: ['java', 'distcp', 'shell', 'mapreduce', 'jar', 'py', 'spark2'].indexOf(type()) != -1, name: 'executable-snippet-body${ suffix }' } --><!-- /ko -->
  850. </div>
  851. <div style="position: absolute; top:25px; margin-left:35px; width: calc(100% - 35px)" data-bind="style: { 'z-index': 400 - $index() }">
  852. <!-- ko template: 'snippet-settings${ suffix }' --><!-- /ko -->
  853. </div>
  854. </div>
  855. <!-- ko template: { if: ['text', 'markdown'].indexOf(type()) == -1, name: 'snippet-execution-status${ suffix }' } --><!-- /ko -->
  856. <!-- ko template: { if: $root.editorMode() && ! $root.isResultFullScreenMode() && ['jar', 'java', 'spark2', 'distcp', 'shell', 'mapreduce', 'py'].indexOf(type()) == -1, name: 'snippet-code-resizer${ suffix }' } --><!-- /ko -->
  857. <!-- ko if: !$root.isResultFullScreenMode() -->
  858. <!-- ko template: 'snippet-log${ suffix }' --><!-- /ko -->
  859. <!-- /ko -->
  860. <!-- ko if: $root.editorMode() -->
  861. <!-- ko template: 'query-tabs${ suffix }' --><!-- /ko -->
  862. <!-- /ko -->
  863. <!-- ko ifnot: $root.editorMode() -->
  864. <!-- ko template: { if: ['text', 'jar', 'java', 'distcp', 'shell', 'mapreduce', 'py', 'markdown'].indexOf(type()) == -1, name: 'snippet-results${ suffix }' } --><!-- /ko -->
  865. <!-- /ko -->
  866. <div class="clearfix"></div>
  867. </div>
  868. </div>
  869. </div>
  870. </div>
  871. </script>
  872. <script type="text/html" id="snippet-settings${ suffix }">
  873. <div class="snippet-settings" data-bind="slideVisible: settingsVisible" style="position: relative; z-index: 100;">
  874. <div class="snippet-settings-header">
  875. <h4><i class="fa fa-cog"></i> ${ _('Settings') }</h4>
  876. </div>
  877. <div class="snippet-settings-body">
  878. <form class="form-horizontal">
  879. <!-- ko template: { if: typeof properties().driverCores != 'undefined', name: 'property', data: { type: 'number', label: '${ _ko('Driver Cores') }', value: properties().driverCores, title: '${ _ko('Number of cores used by the driver, only in cluster mode (Default: 1)') }'}} --><!-- /ko -->
  880. <!-- ko template: { if: typeof properties().executorCores != 'undefined', name: 'property', data: { type: 'number', label: '${ _ko('Executor Cores') }', value: properties().executorCores, title: '${ _ko('Number of cores per executor (Default: 1)') }' }} --><!-- /ko -->
  881. <!-- ko template: { if: typeof properties().numExecutors != 'undefined', name: 'property', data: { type: 'number', label: '${ _ko('Executors') }', value: properties().numExecutors, title: '${ _ko('Number of executors to launch (Default: 2)') }' }} --><!-- /ko -->
  882. <!-- ko template: { if: typeof properties().queue != 'undefined', name: 'property', data: { type: 'string', label: '${ _ko('Queue') }', value: properties().queue, title: '${ _ko('The YARN queue to submit to (Default: default)') }' }} --><!-- /ko -->
  883. <!-- ko template: { if: typeof properties().archives != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko('Archives') }', value: properties().archives, title: '${ _ko('Archives to be extracted into the working directory of each executor (YARN only)') }', placeholder: '${ _ko('e.g. file.zip') }'}} --><!-- /ko -->
  884. <!-- ko template: { if: typeof properties().files != 'undefined', name: 'property', data: { type: 'hdfs-files', label: '${ _ko('Files') }', value: properties().files, visibleObservable: settingsVisible, title: '${ _ko('Files to be placed in the working directory of each executor.') }'}} --><!-- /ko -->
  885. <!-- ko template: { if: typeof properties().functions != 'undefined', name: 'property', data: { type: 'functions', label: '${ _ko('Functions') }', value: properties().functions, visibleObservable: settingsVisible, title: '${ _ko('UDFs name and class') }'}} --><!-- /ko -->
  886. <!-- ko template: { if: typeof properties().settings != 'undefined', name: 'property', data: { type: 'settings', label: '${ _ko('Settings') }', value: properties().settings, visibleObservable: settingsVisible, title: '${ _ko('Properties') }'}} --><!-- /ko -->
  887. <!-- ko template: { if: typeof properties().spark_opts != 'undefined', name: 'property', data: { type: 'csv', label: '${ _ko('Spark Arguments') }', value: properties().spark_opts, title: '${ _ko('Names and values of Spark parameters') }', placeholder: '${ _ko('e.g. --executor-memory 20G --num-executors 50') }'}} --><!-- /ko -->
  888. <!-- ko template: { if: typeof properties().parameters != 'undefined', name: 'property', data: { type: 'csv', label: '${ _ko('Parameters') }', value: properties().parameters, title: '${ _ko('Names and values of Pig parameters and options') }', placeholder: '${ _ko('e.g. input /user/data, -param input=/user/data, -optimizer_off SplitFilter, -verbose') }'}} --><!-- /ko -->
  889. <!-- ko template: { if: typeof properties().hadoopProperties != 'undefined', name: 'property', data: { type: 'csv', label: '${ _ko('Hadoop properties') }', value: properties().hadoopProperties, title: '${ _ko('Name and values of Hadoop properties') }', placeholder: '${ _ko('e.g. mapred.job.queue.name=production, mapred.map.tasks.speculative.execution=false') }'}} --><!-- /ko -->
  890. <!-- ko template: { if: typeof properties().resources != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko('Resources') }', value: properties().resources, title: '${ _ko('HDFS Files or compressed files') }', placeholder: '${ _ko('e.g. /tmp/file, /tmp.file.zip') }'}} --><!-- /ko -->
  891. <!-- ko template: { if: typeof properties().capture_output != 'undefined', name: 'property', data: { type: 'boolean', label: '${ _ko('Capture output') }', value: properties().capture_output, title: '${ _ko('If capturing the output of the shell script') }' }} --><!-- /ko -->
  892. </form>
  893. </div>
  894. <a class="pointer demi-modal-chevron" data-bind="click: function() { settingsVisible(! settingsVisible()) }"><i class="fa fa-chevron-up"></i></a>
  895. </div>
  896. </script>
  897. <script type="text/html" id="code-editor-snippet-body${ suffix }">
  898. <!-- ko if: HAS_SQL_ANALYZER && (type() == 'impala' || type() == 'hive') && ! $root.isPresentationMode() && ! $root.isResultFullScreenMode() -->
  899. <div class="sql-analyzer-container" data-bind="css: { 'active': showSqlAnalyzer }">
  900. <!-- ko if: hasSuggestion() -->
  901. <!-- ko with: suggestion() -->
  902. <!-- ko if: parseError -->
  903. <!-- ko if: $parent.compatibilityTargetPlatform().value === $parent.type() && $parent.compatibilitySourcePlatform().value === $parent.type() -->
  904. <div class="sql-analyzer-icon error" data-bind="click: function(){ $parent.showSqlAnalyzer(! $parent.showSqlAnalyzer()) }, attr: { 'title': $parent.showSqlAnalyzer() ? '${ _ko('Close Validator') }' : '${ _ko('Open Validator') }'}">
  905. <i class="fa fa-exclamation"></i>
  906. </div>
  907. <!-- ko if: $parent.showSqlAnalyzer -->
  908. <span class="sql-analyzer-explanation alert-error alert-neutral">${ _('The query has a parse error.') }</span>
  909. <!-- /ko -->
  910. <!-- /ko -->
  911. ## Oracle, MySQL compatibility... as they return a parseError and not encounteredString.
  912. <!-- ko if: $parent.compatibilityTargetPlatform().value !== $parent.type() || $parent.type() !== $parent.compatibilitySourcePlatform().value -->
  913. <div class="sql-analyzer-icon warning" data-bind="click: function(){ $parent.showSqlAnalyzer(! $parent.showSqlAnalyzer()) }, attr: { 'title': $parent.showSqlAnalyzer() ? '${ _ko('Close Validator') }' : '${ _ko('Open Validator') }'}">
  914. <i class="fa fa-exclamation"></i>
  915. </div>
  916. <!-- ko if: $parent.showSqlAnalyzer -->
  917. <span class="sql-analyzer-explanation alert-warning alert-neutral">${ _('This ') } <span data-bind="text: $parent.compatibilitySourcePlatform().name"></span> ${ _(' query is not compatible with ') } <span data-bind="text: $parent.compatibilityTargetPlatform().name"></span>.</span>
  918. <!-- /ko -->
  919. <!-- /ko -->
  920. <!-- /ko -->
  921. <!-- ko if: !parseError() && ($parent.compatibilityTargetPlatform().value !== $parent.type() || $parent.compatibilitySourcePlatform().value !== $parent.type()) -->
  922. <!-- ko if: queryError.encounteredString().length == 0 -->
  923. <div class="sql-analyzer-icon success" data-bind="click: function(){ $parent.showSqlAnalyzer(! $parent.showSqlAnalyzer()) }, attr: { 'title': $parent.showSqlAnalyzer() ? '${ _ko('Close Validator') }' : '${ _ko('Open Validator') }'}">
  924. <i class="fa fa-check"></i>
  925. </div>
  926. <!-- ko if: $parent.showSqlAnalyzer -->
  927. <span class="sql-analyzer-explanation alert-success alert-neutral">
  928. ${ _('The ') } <div data-bind="component: { name: 'hue-drop-down', params: { value: $parent.compatibilitySourcePlatform, entries: $parent.compatibilitySourcePlatforms, labelAttribute: 'name' } }" style="display: inline-block"></div>
  929. <!-- ko if: $parent.compatibilitySourcePlatform().value === $parent.type() -->
  930. ${ _(' query is compatible with ') } <span data-bind="text: $parent.compatibilityTargetPlatform().name"></span>.
  931. <a href="javascript:void(0)" data-bind="click: function() { $parent.type($parent.compatibilityTargetPlatform().value); }">${ _('Execute it with ') } <span data-bind="text: $parent.compatibilityTargetPlatform().name"></span></a>.
  932. <!-- /ko -->
  933. <!-- ko if: $parent.compatibilitySourcePlatform().value !== $parent.type() -->
  934. ${ _(' query is compatible with ') } <span data-bind="text: $parent.compatibilityTargetPlatform().name"></span>.
  935. <!-- /ko -->
  936. </span>
  937. <!-- /ko -->
  938. <!-- /ko -->
  939. <!-- ko ifnot: queryError.encounteredString().length == 0 -->
  940. <div class="sql-analyzer-icon warning" data-bind="click: function(){ $parent.showSqlAnalyzer(! $parent.showSqlAnalyzer()) }, attr: { 'title': $parent.showSqlAnalyzer() ? '${ _ko('Close Validator') }' : '${ _ko('Open Validator') }'}">
  941. <i class="fa fa-exclamation"></i>
  942. </div>
  943. <!-- ko if: $parent.showSqlAnalyzer -->
  944. <span class="sql-analyzer-explanation alert-warning alert-neutral">${ _('This query is not compatible with ') } <span data-bind="text: $parent.compatibilityTargetPlatform().name"></span>.</span>
  945. <!-- /ko -->
  946. <!-- /ko -->
  947. <!-- /ko -->
  948. <!-- /ko -->
  949. <!-- /ko -->
  950. <!-- ko if: ! hasSuggestion() && topRisk() -->
  951. <!-- ko if: topRisk().risk === 'low' -->
  952. <div class="sql-analyzer-icon success" data-bind="click: function () { huePubSub.publish('assist.highlight.risk.suggestions'); }, tooltip: { placement: 'bottom' }" title="${ _('Some low risks were detected, see the assistant for details.') }">
  953. <i class="fa fa-check"></i>
  954. </div>
  955. <!-- /ko -->
  956. <!-- ko if: topRisk().risk == 'medium' -->
  957. <div class="sql-analyzer-icon warning" data-bind="click: function () { huePubSub.publish('assist.highlight.risk.suggestions'); }, tooltip: { placement: 'bottom' }" title="${ _('Some medium risks were detected, see the assistant for details.') }">
  958. <i class="fa fa-exclamation"></i>
  959. </div>
  960. <!-- /ko -->
  961. <!-- ko if: topRisk().risk == 'high' -->
  962. <div class="sql-analyzer-icon error" data-bind="click: function () { huePubSub.publish('assist.highlight.risk.suggestions'); }, tooltip: { placement: 'bottom' }" title="${ _('Some high risks were detected, see the assistant for details.') }">
  963. <i class="fa fa-exclamation"></i>
  964. </div>
  965. <!-- /ko -->
  966. <!-- /ko -->
  967. <!-- ko if: hasSuggestion() == '' && ! topRisk() -->
  968. <div class="sql-analyzer-icon success" data-bind="click: function () { huePubSub.publish('assist.highlight.risk.suggestions'); }, tooltip: { placement: 'bottom' }" title="${ _('Query validated, no issues found.') }">
  969. <i class="fa fa-check"></i>
  970. </div>
  971. <!-- /ko -->
  972. </div>
  973. <!-- /ko -->
  974. <div class="row-fluid" style="margin-bottom: 5px">
  975. <div class="editor span12" data-bind="css: {'single-snippet-editor ace-container-resizable' : $root.editorMode() }, clickForAceFocus: ace, visible: ! $root.isResultFullScreenMode() && ! ($root.isPresentationMode() && $root.isHidingCode())">
  976. <!-- ko if: statementType() == 'file' -->
  977. <div class="margin-top-10">
  978. <label class="pull-left" style="margin-top: 6px;margin-right: 10px;">${_('Query File')}</label>
  979. <input type="text" class="pull-left input-xxlarge filechooser-input" data-bind="value: statementPath, valueUpdate: 'afterkeydown', filechooser: statementPath, filechooserOptions: { skipInitialPathIfEmpty: true, linkMarkup: true }" placeholder="${ _('Path to file, e.g. /user/hue/sample.sql') }"/>
  980. <!-- ko if: statementPath() -->
  981. <div class="inline-block" style="margin-top: 4px">
  982. <a data-bind="hueLink: '/filebrowser/view=' + statementPath()" title="${ _('Open') }">
  983. <i class="fa fa-external-link-square"></i>
  984. </a>
  985. </div>
  986. <a class="btn" data-bind="click: function() { getExternalStatement(); }"><i class="fa fa-lg fa-refresh"></i></a>
  987. <!-- /ko -->
  988. </div>
  989. <div class="clearfix margin-bottom-20"></div>
  990. <!-- /ko -->
  991. <!-- ko if: statementType() == 'document' -->
  992. <div class="margin-top-10">
  993. <!-- ko if: associatedDocumentLoading -->
  994. <i class="fa fa-spinner fa-spin muted"></i>
  995. <!-- /ko -->
  996. <label class="pull-left" style="margin-top: 6px;margin-right: 10px;" data-bind="visible: !associatedDocumentLoading()">${_('Document')}</label>
  997. <div class="selectize-wrapper" style="width: 300px;" data-bind="visible: !associatedDocumentLoading()">
  998. <select placeholder="${ _('Search your documents...') }" data-bind="documentChooser: { loading: associatedDocumentLoading, value: associatedDocumentUuid, document: associatedDocument, type: type }"></select>
  999. </div>
  1000. <!-- ko if: associatedDocument() -->
  1001. <div class="pull-left" style="margin-top: 4px">
  1002. <a data-bind="hueLink: associatedDocument().absoluteUrl" title="${ _('Open') }">
  1003. <i class="fa fa-external-link-square"></i>
  1004. </a>
  1005. <span data-bind='text: associatedDocument().description' style="padding: 3px; margin-top: 2px" class="muted"></span>
  1006. </div>
  1007. <!-- /ko -->
  1008. </div>
  1009. <div class="clearfix margin-bottom-20"></div>
  1010. <!-- /ko -->
  1011. <div class="ace-editor" data-bind="visible: statementType() === 'text' || statementType() !== 'text' && externalStatementLoaded(), css: {'single-snippet-editor ace-editor-resizable' : $root.editorMode(), 'active-editor': inFocus }, attr: { id: id() }, delayedOverflow: 'slow', aceEditor: {
  1012. snippet: $data,
  1013. contextTooltip: '${ _ko("Right-click for details") }',
  1014. expandStar: '${ _ko("Right-click to expand with columns") }',
  1015. highlightedRange: result.statement_range,
  1016. readOnly: $root.isPresentationMode(),
  1017. aceOptions: {
  1018. showLineNumbers: $root.editorMode(),
  1019. showGutter: $root.editorMode(),
  1020. maxLines: $root.editorMode() ? null : 25,
  1021. minLines: $root.editorMode() ? null : 3
  1022. }
  1023. }, style: {opacity: statementType() !== 'text' || $root.isPresentationMode() ? '0.75' : '1', 'min-height': $root.editorMode() ? '0' : '48px', 'top': $root.editorMode() && statementType() !== 'text' ? '60px' : '0'}"></div>
  1024. <!-- ko component: { name: 'hueAceAutocompleter', params: { editor: ace.bind($data), snippet: $data } } --><!-- /ko -->
  1025. <!-- ko component: { name: 'hue-editor-droppable-menu', params: { editor: ace.bind($data), parentDropTarget: '.editor' } } --><!-- /ko -->
  1026. </div>
  1027. <div class="clearfix"></div>
  1028. <!-- ko template: { if: ! $root.isPresentationMode() && ! $root.isResultFullScreenMode(), name: 'snippet-variables' }--><!-- /ko -->
  1029. </div>
  1030. <div class="clearfix"></div>
  1031. </script>
  1032. <script type="text/html" id="notebook-actions">
  1033. <div class="btn-group">
  1034. <!-- ko if: $root.selectedNotebook() -->
  1035. <!-- ko with: $root.selectedNotebook() -->
  1036. <a class="btn" rel="tooltip" data-placement="bottom" title="${ _("Execute all") }" data-bind="visible: ! isExecutingAll(), click: function() { executeAll(); }">
  1037. <i class="fa fa-fw fa-play"></i>
  1038. </a>
  1039. <!-- ko if: ! (snippets()[executingAllIndex()] && snippets()[executingAllIndex()].isCanceling()) -->
  1040. <a class="btn red" rel="tooltip" data-placement="bottom" title="${ _("Stop all") }" data-bind="visible: isExecutingAll(), click: function() { cancelExecutingAll(); }">
  1041. <i class="fa fa-fw fa-stop"></i>
  1042. </a>
  1043. <!-- /ko -->
  1044. <!-- ko if: snippets()[executingAllIndex()] && snippets()[executingAllIndex()].isCanceling() -->
  1045. <a class="btn" style="cursor: default;" title="${ _('Canceling operation...') }">
  1046. <i class="fa fa-fw fa-spinner snippet-side-single fa-spin"></i>
  1047. </a>
  1048. <!-- /ko -->
  1049. <!-- /ko -->
  1050. <a class="btn dropdown-toggle" data-toggle="dropdown" href="javascript: void(0)">
  1051. <span class="caret"></span>
  1052. </a>
  1053. <ul class="dropdown-menu">
  1054. <li>
  1055. <a class="pointer" rel="tooltip" data-placement="bottom" data-bind="click: function() { $root.selectedNotebook().isHidingCode(! $root.isHidingCode()); }, attr: { 'title': $root.isHidingCode() ? '${ _ko('Show the logic') }' : '${ _ko('Hide the logic') }' }">
  1056. <i class="fa fa-fw" data-bind="css: { 'fa-expand': $root.isHidingCode(), 'fa-compress': ! $root.isHidingCode() }"></i>
  1057. <span data-bind="visible: $root.isHidingCode">${ _('Show the code') }</span>
  1058. <span data-bind="visible: ! $root.isHidingCode()">${ _('Hide the code') }</span>
  1059. </a>
  1060. </li>
  1061. <li>
  1062. <a class="pointer" data-bind="click: function() { $root.selectedNotebook().clearResults() }">
  1063. <i class="fa fa-fw fa-eraser"></i> ${ _('Clear results') }
  1064. </a>
  1065. </li>
  1066. <li>
  1067. <a href="javascript:void(0)" data-bind="click: displayCombinedContent, visible: ! $root.isPresentationMode() ">
  1068. <i class="fa fa-fw fa-file-text-o"></i> ${ _('Show all content') }
  1069. </a>
  1070. </li>
  1071. </ul>
  1072. <!-- /ko -->
  1073. </div>
  1074. </script>
  1075. <script type="text/html" id="snippet-variables">
  1076. <div class="variables">
  1077. <ul data-bind="foreach: variables" class="unstyled inline">
  1078. <li>
  1079. <div class="input-prepend margin-top-10">
  1080. <!-- ko ifnot: path() -->
  1081. <span class="muted add-on" data-bind="text: name"></span>
  1082. <!-- /ko -->
  1083. <!-- ko if: path() -->
  1084. <a href="javascript:void(0);" data-bind="click: $root.showContextPopover" style="float: left"> <span class="muted add-on" data-bind="text: name"></span></a>
  1085. <!-- /ko -->
  1086. <!-- ko if: meta.type() === 'text' -->
  1087. <!-- ko if: meta.placeholder() -->
  1088. <input class="input-medium" type="text" data-bind="value: value, attr: { value: value, type: type, placeholder: meta.placeholder() || '${ _ko('Variable value') }' }, valueUpdate: 'afterkeydown', event: { 'keydown': $parent.onKeydownInVariable }, autogrowInput: { minWidth: 150, maxWidth: 270, comfortZone: 15 }">
  1089. <!-- /ko -->
  1090. <!-- ko ifnot: meta.placeholder() -->
  1091. <!-- ko if: type() == 'datetime-local' -->
  1092. <input class="input-medium" type="text" data-bind="attr: { value: value }, value: value, datepicker: { momentFormat: 'YYYY-MM-DD HH:mm:ss.S' }">
  1093. <!-- /ko -->
  1094. <!-- ko if: type() == 'date' -->
  1095. <input class="input-medium" type="text" data-bind="attr: { value: value }, value: value, datepicker: { momentFormat: 'YYYY-MM-DD' }">
  1096. <!-- /ko -->
  1097. <!-- ko if: type() == 'checkbox' -->
  1098. <input class="input-medium" type="checkbox" data-bind="checked: value">
  1099. <!-- /ko -->
  1100. <!-- ko ifnot: (type() == 'datetime-local' || type() == 'date' || type() == 'checkbox') -->
  1101. <input class="input-medium" type="text" value="true" data-bind="value: value, attr: { value: value, type: type() || 'text', step: step }, valueUpdate: 'afterkeydown', event: { 'keydown': $parent.onKeydownInVariable }, autogrowInput: { minWidth: 150, maxWidth: 270, comfortZone: 15 }">
  1102. <!-- /ko -->
  1103. <!-- /ko -->
  1104. <!-- /ko -->
  1105. <!-- ko if: meta.type() === 'select' -->
  1106. <select data-bind="
  1107. selectize: sample,
  1108. optionsText: 'text',
  1109. optionsValue: 'value',
  1110. selectizeOptions: {
  1111. create: function (input) {
  1112. sampleUser().push({ text: ko.observable(input), value: ko.observable(input) });
  1113. return { text: input, value: input };
  1114. }
  1115. },
  1116. value: value,
  1117. event: { 'keydown': $parent.onKeydownInVariable }
  1118. "></select>
  1119. <!-- /ko -->
  1120. </div>
  1121. </li>
  1122. </ul>
  1123. </div>
  1124. </script>
  1125. <script type="text/html" id="snippet-chart-settings${ suffix }">
  1126. <div>
  1127. <!-- ko if: chartType() != '' && [window.HUE_CHARTS.TYPES.TIMELINECHART, window.HUE_CHARTS.TYPES.BARCHART].indexOf(chartType()) >= 0 -->
  1128. <ul class="nav nav-list" style="border: none; background-color: #FFF">
  1129. <li class="nav-header">${_('type')}</li>
  1130. </ul>
  1131. <div data-bind="visible: chartType() != ''">
  1132. <select data-bind="selectedOptions: chartTimelineType, optionsCaption: '${_ko('Choose a type...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a type...") }', update: chartTimelineType, dropdownAutoWidth: true}">
  1133. <option value="bar">${ _("Bars") }</option>
  1134. <option value="line">${ _("Lines") }</option>
  1135. </select>
  1136. </div>
  1137. <!-- /ko -->
  1138. <!-- ko if: chartType() != '' && chartType() === window.HUE_CHARTS.TYPES.PIECHART -->
  1139. <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != ''">
  1140. <li class="nav-header">${_('value')}</li>
  1141. </ul>
  1142. <div>
  1143. <select data-bind="options: result.cleanedNumericMeta, value: chartYSingle, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartYSingle, dropdownAutoWidth: true}" class="input-medium"></select>
  1144. </div>
  1145. <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != ''">
  1146. <li class="nav-header">${_('legend')}</li>
  1147. </ul>
  1148. <div>
  1149. <select data-bind="options: result.cleanedMeta, value: chartX, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartX, dropdownAutoWidth: true}" class="input-medium"></select>
  1150. </div>
  1151. <!-- /ko -->
  1152. <!-- ko if: chartType() != '' && chartType() !== window.HUE_CHARTS.TYPES.PIECHART -->
  1153. <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != ''">
  1154. <li data-bind="visible: [window.HUE_CHARTS.TYPES.MAP, window.HUE_CHARTS.TYPES.GRADIENTMAP].indexOf(chartType()) == -1" class="nav-header">${_('x-axis')}</li>
  1155. <li data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.GRADIENTMAP" class="nav-header">${_('region')}</li>
  1156. <li data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.MAP" class="nav-header">${_('latitude')}</li>
  1157. </ul>
  1158. <div>
  1159. <select data-bind="options: ([window.HUE_CHARTS.TYPES.BARCHART, window.HUE_CHARTS.TYPES.GRADIENTMAP, window.HUE_CHARTS.TYPES.TIMELINECHART].indexOf(chartType()) > -1) ? ( chartType() == window.HUE_CHARTS.TYPES.TIMELINECHART ? result.cleanedDateTimeMeta : result.cleanedMeta ) : result.cleanedNumericMeta, value: chartX, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartX, dropdownAutoWidth: true}" class="input-medium"></select>
  1160. </div>
  1161. <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != ''">
  1162. <li data-bind="visible: [window.HUE_CHARTS.TYPES.MAP, window.HUE_CHARTS.TYPES.GRADIENTMAP].indexOf(chartType()) == -1" class="nav-header">${_('y-axis')}</li>
  1163. <li data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.GRADIENTMAP" class="nav-header">${_('value')}</li>
  1164. <li data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.MAP" class="nav-header">${_('longitude')}</li>
  1165. </ul>
  1166. <div style="max-height: 220px" data-bind="delayedOverflow, visible: chartType() != '' && ((chartType() == window.HUE_CHARTS.TYPES.BARCHART && !chartXPivot()) || chartType() == window.HUE_CHARTS.TYPES.LINECHART || chartType() == window.HUE_CHARTS.TYPES.TIMELINECHART)">
  1167. <ul class="unstyled" data-bind="foreach: result.cleanedNumericMeta" style="margin-bottom: 0">
  1168. <li><label class="checkbox"><input type="checkbox" data-bind="checkedValue: name, checked: $parent.chartYMulti" /> <span data-bind="text: $data.name"></span></label></li>
  1169. </ul>
  1170. </div>
  1171. <div data-bind="visible: (chartType() == window.HUE_CHARTS.TYPES.BARCHART && chartXPivot()) || chartType() == window.HUE_CHARTS.TYPES.MAP || chartType() == window.HUE_CHARTS.TYPES.GRADIENTMAP || chartType() == window.HUE_CHARTS.TYPES.SCATTERCHART">
  1172. <select data-bind="options: chartType() == window.HUE_CHARTS.TYPES.GRADIENTMAP ? result.cleanedMeta : result.cleanedNumericMeta, value: chartYSingle, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartYSingle, dropdownAutoWidth: true}" class="input-medium"></select>
  1173. </div>
  1174. <!-- /ko -->
  1175. <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() === window.HUE_CHARTS.TYPES.BARCHART">
  1176. <li class="nav-header">${_('group')}</li>
  1177. </ul>
  1178. <div data-bind="visible: chartType() === window.HUE_CHARTS.TYPES.BARCHART">
  1179. <select data-bind="options: result.cleanedMeta, value: chartXPivot, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column to pivot...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column to pivot...") }', update: chartXPivot, dropdownAutoWidth: true}" class="input-medium"></select>
  1180. </div>
  1181. <ul class="nav nav-list" style="border: none; background-color: #FFF">
  1182. <li class="nav-header">${_('limit')}</li>
  1183. </ul>
  1184. <div>
  1185. <select data-bind="options: chartLimits, value: chartLimit, optionsCaption: '${_ko('Limit the number of results to...')}', select2: { width: '100%', placeholder: '${ _ko("Limit the number of results to...") }', update: chartLimit, dropdownAutoWidth: true}" class="input-medium"></select>
  1186. </div>
  1187. <!-- ko if: chartType() != '' && chartType() == window.HUE_CHARTS.TYPES.MAP -->
  1188. <ul class="nav nav-list" style="border: none; background-color: #FFF">
  1189. <li class="nav-header">${_('type')}</li>
  1190. </ul>
  1191. <div data-bind="visible: chartType() != ''">
  1192. <select data-bind="selectedOptions: chartMapType, optionsCaption: '${_ko('Choose a type...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a type...") }', update: chartMapType, dropdownAutoWidth: true}">
  1193. <option value="marker">${ _("Markers") }</option>
  1194. <option value="heat">${ _("Heatmap") }</option>
  1195. </select>
  1196. </div>
  1197. <!-- ko if: chartMapType() == 'marker' -->
  1198. <ul class="nav nav-list" style="border: none; background-color: #FFF">
  1199. <li class="nav-header">${_('label')}</li>
  1200. </ul>
  1201. <div>
  1202. <select data-bind="options: result.cleanedMeta, value: chartMapLabel, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartMapLabel, dropdownAutoWidth: true}" class="input-medium"></select>
  1203. </div>
  1204. <!-- /ko -->
  1205. <!-- ko if: chartMapType() == 'heat' -->
  1206. <ul class="nav nav-list" style="border: none; background-color: #FFF">
  1207. <li class="nav-header">${_('intensity')}</li>
  1208. </ul>
  1209. <div>
  1210. <select data-bind="options: result.cleanedNumericMeta, value: chartMapHeat, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartMapHeat, dropdownAutoWidth: true}" class="input-medium"></select>
  1211. </div>
  1212. <!-- /ko -->
  1213. <!-- /ko -->
  1214. <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.SCATTERCHART">
  1215. <li class="nav-header">${_('scatter size')}</li>
  1216. </ul>
  1217. <div data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.SCATTERCHART">
  1218. <select data-bind="options: result.cleanedNumericMeta, value: chartScatterSize, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartScatterSize, dropdownAutoWidth: true}" class="input-medium"></select>
  1219. </div>
  1220. <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != '' && chartType() == window.HUE_CHARTS.TYPES.SCATTERCHART">
  1221. <li class="nav-header">${_('scatter group')}</li>
  1222. </ul>
  1223. <div data-bind="visible: chartType() != '' && chartType() == window.HUE_CHARTS.TYPES.SCATTERCHART">
  1224. <select data-bind="options: result.cleanedMeta, value: chartScatterGroup, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartScatterGroup, dropdownAutoWidth: true}" class="input-medium"></select>
  1225. </div>
  1226. <!-- ko if: chartType() != '' && chartType() == window.HUE_CHARTS.TYPES.GRADIENTMAP -->
  1227. <ul class="nav nav-list" style="border: none; background-color: #FFF">
  1228. <li class="nav-header">${_('scope')}</li>
  1229. </ul>
  1230. <div data-bind="visible: chartType() != ''">
  1231. <select data-bind="selectedOptions: chartScope, optionsCaption: '${_ko('Choose a scope...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a scope...") }', update: chartScope, dropdownAutoWidth: true}">
  1232. <option value="world">${ _("World") }</option>
  1233. <option value="europe">${ _("Europe") }</option>
  1234. <option value="aus">${ _("Australia") }</option>
  1235. <option value="bra">${ _("Brazil") }</option>
  1236. <option value="can">${ _("Canada") }</option>
  1237. <option value="chn">${ _("China") }</option>
  1238. <option value="fra">${ _("France") }</option>
  1239. <option value="deu">${ _("Germany") }</option>
  1240. <option value="ita">${ _("Italy") }</option>
  1241. <option value="jpn">${ _("Japan") }</option>
  1242. <option value="gbr">${ _("UK") }</option>
  1243. <option value="usa">${ _("USA") }</option>
  1244. </select>
  1245. </div>
  1246. <!-- /ko -->
  1247. <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != '' && chartType() != window.HUE_CHARTS.TYPES.MAP && chartType() != window.HUE_CHARTS.TYPES.GRADIENTMAP && chartType() != window.HUE_CHARTS.TYPES.SCATTERCHART">
  1248. <li class="nav-header">${_('sorting')}</li>
  1249. </ul>
  1250. <div class="btn-group" data-toggle="buttons-radio" data-bind="visible: chartType() != '' && chartType() != window.HUE_CHARTS.TYPES.MAP && chartType() != window.HUE_CHARTS.TYPES.GRADIENTMAP && chartType() != window.HUE_CHARTS.TYPES.SCATTERCHART">
  1251. <a rel="tooltip" data-placement="top" title="${_('No sorting')}" href="javascript:void(0)" class="btn" data-bind="css: {'active': chartSorting() == 'none'}, click: function(){ chartSorting('none'); }"><i class="fa fa-align-left fa-rotate-270"></i></a>
  1252. <a rel="tooltip" data-placement="top" title="${_('Sort ascending')}" href="javascript:void(0)" class="btn" data-bind="css: {'active': chartSorting() == 'asc'}, click: function(){ chartSorting('asc'); }"><i class="fa fa-sort-amount-asc fa-rotate-270"></i></a>
  1253. <a rel="tooltip" data-placement="top" title="${_('Sort descending')}" href="javascript:void(0)" class="btn" data-bind="css: {'active': chartSorting() == 'desc'}, click: function(){ chartSorting('desc'); }"><i class="fa fa-sort-amount-desc fa-rotate-270"></i></a>
  1254. </div>
  1255. </div>
  1256. </script>
  1257. <script type="text/html" id="snippet-grid-settings${ suffix }">
  1258. <div class="snippet-grid-settings" data-bind="delayedOverflow">
  1259. <table class="table table-condensed margin-top-10 no-border">
  1260. <thead>
  1261. <tr>
  1262. <th width="16">
  1263. <input class="all-meta-checked no-margin-top" type="checkbox" data-bind="enable: !result.isMetaFilterVisible() && result.filteredMeta().length > 0, event: { change: function(){ toggleAllResultColumns($element); result.clickFilteredMetaCheck() } }, checked: result.filteredMetaChecked" />
  1264. </th>
  1265. <th colspan="2" class="nav-header-like">
  1266. <span class="meta-title pointer" data-bind="click: function() { result.isMetaFilterVisible(true); }, attr: { title: result.filteredColumnCount() }">${_('columns')}</span>
  1267. (<span class="meta-title pointer" data-bind="click: function() { result.isMetaFilterVisible(true); }, text: result.filteredColumnCount()"></span>)
  1268. <span class="inactive-action" href="javascript:void(0)" data-bind="click: function(){ result.isMetaFilterVisible(true); }, css: { 'blue' : result.isMetaFilterVisible }"><i class="pointer fa fa-search" title="${ _('Search') }"></i></span>
  1269. </th>
  1270. </tr>
  1271. <tr data-bind="visible: result.isMetaFilterVisible">
  1272. <td colspan="3">
  1273. <div class="context-popover-inline-autocomplete" style="display: block;">
  1274. <!-- ko component: {
  1275. name: 'inline-autocomplete',
  1276. params: {
  1277. placeHolder: '${ _ko('Filter columns...') }',
  1278. querySpec: result.metaFilter,
  1279. facets: Object.keys(SQL_COLUMNS_KNOWN_FACET_VALUES),
  1280. knownFacetValues: SQL_COLUMNS_KNOWN_FACET_VALUES,
  1281. autocompleteFromEntries: result.autocompleteFromEntries
  1282. }
  1283. } --><!-- /ko -->
  1284. ##<input class="meta-filter" type="text" data-bind="blurHide: result.isMetaFilterVisible, clearable: result.metaFilter, valueUpdate:'afterkeydown'" placeholder="${ _('Filter columns...') }" title="${ _('Type column:xxx or type:yyy for specific filters.') }" style="width: 257px" />
  1285. </div>
  1286. </td>
  1287. </tr>
  1288. </thead>
  1289. <tbody class="unstyled filtered-meta" data-bind="foreach: result.filteredMeta">
  1290. <tr data-bind="visible: name != ''">
  1291. <td><input class="no-margin-top" type="checkbox" data-bind="event: { change: function() { $parent.toggleResultColumn($element, originalIndex);} }, checked: checked" /></td>
  1292. <td><a class="pointer" data-bind="click: function(){ $parent.scrollToResultColumn($element); }, attr: { title: name + ' - ' + type}"><span data-bind="text: name"></span></a></td>
  1293. <td><span data-bind="text: type" class="muted margin-left-20"></span></td>
  1294. </tr>
  1295. </tbody>
  1296. <tfoot>
  1297. <tr>
  1298. <td colspan="3">
  1299. <div class="margin-top-10 muted meta-noresults" data-bind="visible: result.filteredMeta().length === 0">
  1300. ${ _('No results found') }
  1301. </div>
  1302. </td>
  1303. </tr>
  1304. </tfoot>
  1305. </table>
  1306. </div>
  1307. </script>
  1308. <script type="text/html" id="snippet-explain${ suffix }">
  1309. <pre class="no-margin-bottom" data-bind="text: result.explanation"></pre>
  1310. </script>
  1311. <script type="text/html" id="snippet-results${ suffix }">
  1312. <div class="snippet-row" data-bind="slideVisible: result.hasSomeResults">
  1313. <div class="snippet-left-bar">
  1314. <!-- ko template: { if: result.type() == 'table' && result.hasSomeResults(), name: 'snippet-result-controls${ suffix }' }--><!-- /ko -->
  1315. </div>
  1316. <div class="result-body">
  1317. <div class="row-fluid" data-bind="visible: result.type() != 'table'" style="display:none; max-height: 400px; margin: 10px 0; overflow-y: auto">
  1318. <!-- ko if: result.data().length != 0 && result.data()[0][1] != "" -->
  1319. <pre data-bind="text: result.data()[0][1]" class="no-margin-bottom"></pre>
  1320. <!-- /ko -->
  1321. <!-- ko ifnot: result.data().length != 0 && result.data()[0][1] != "" -->
  1322. <pre class="no-margin-bottom"><i class="fa fa-check muted"></i> ${ _("Done.") }</pre>
  1323. <!-- /ko -->
  1324. <!-- ko if: result.images().length != 0 -->
  1325. <ul class="unstyled results-images" data-bind="foreach: result.images()">
  1326. <li>
  1327. <img data-bind="attr: {'src': 'data:image/png;base64,' + $data}" class="margin-bottom-10" alt="${ _('Result image') }"/>
  1328. </li>
  1329. </ul>
  1330. <!-- /ko -->
  1331. </div>
  1332. <div class="row-fluid table-results" data-bind="visible: result.type() == 'table'" style="display: none; max-height: 400px; min-height: 290px;">
  1333. <div>
  1334. <div class="column-side" data-bind="visible: isResultSettingsVisible, css:{'span3 result-settings': isResultSettingsVisible, 'hidden': ! isResultSettingsVisible()}" style="position:relative;white-space: nowrap;">
  1335. <!-- ko template: { name: 'snippet-grid-settings${ suffix }', if: showGrid } --><!-- /ko -->
  1336. <!-- ko template: { name: 'snippet-chart-settings${ suffix }', if: showChart } --><!-- /ko -->
  1337. <div class="resize-bar" style="top: 0; right: -10px; cursor: col-resize;"></div>
  1338. </div>
  1339. <div class="grid-side" data-bind="css: {'span9': isResultSettingsVisible, 'span12 nomargin': ! isResultSettingsVisible() }">
  1340. <div data-bind="visible: showGrid, delayedOverflow: 'slow', css: resultsKlass" style="display: none;">
  1341. <table class="table table-condensed resultTable">
  1342. <thead>
  1343. <tr data-bind="foreach: result.meta">
  1344. <th class="sorting" data-bind="text: ($index() == 0 ? '&nbsp;' : $data.name), css: typeof cssClass != 'undefined' ? cssClass : 'sort-string', attr: {title: $data.type }, style:{'width': $index() == 0 ? '1%' : '', 'height': $index() == 0 ? '32px' : ''}, click: function(obj, e){ $(e.target).parents('table').trigger('sort', obj); }"></th>
  1345. </tr>
  1346. </thead>
  1347. <tbody>
  1348. </tbody>
  1349. </table>
  1350. <div data-bind="visible: status() == 'expired' && result.data() && result.data().length > 99, css: resultsKlass" style="display:none;">
  1351. <pre class="margin-top-10"><i class="fa fa-check muted"></i> ${ _("Results have expired, rerun the query if needed.") }</pre>
  1352. </div>
  1353. </div>
  1354. <div data-bind="visible: showChart" class="chart-container" style="display:none;">
  1355. <h1 class="empty" data-bind="visible: !hasDataForChart()">${ _('Select the chart parameters on the left') }</h1>
  1356. <div data-bind="visible: hasDataForChart">
  1357. <!-- ko if: chartType() == window.HUE_CHARTS.TYPES.PIECHART -->
  1358. <div data-bind="attr:{'id': 'pieChart_'+id()}, pieChart: {data: {counts: result.data, sorting: chartSorting(), snippet: $data, limit: chartLimit()}, fqs: ko.observableArray([]),
  1359. transformer: $root.ChartTransformers.pie, maxWidth: 350, parentSelector: '.chart-container' }, visible: chartType() == window.HUE_CHARTS.TYPES.PIECHART" class="chart"></div>
  1360. <!-- /ko -->
  1361. <!-- ko if: chartType() == window.HUE_CHARTS.TYPES.BARCHART -->
  1362. <div data-bind="attr:{'id': 'barChart_'+id()}, barChart: {skipWindowResize: true, datum: {counts: result.data, sorting: chartSorting(), snippet: $data, limit: chartLimit()}, fqs: ko.observableArray([]), hideSelection: true, enableSelection: false, hideStacked: hideStacked,
  1363. transformer: $root.ChartTransformers.multiSerie, stacked: false, showLegend: true, isPivot: typeof chartXPivot() !== 'undefined', type: chartTimelineType}, stacked: true, showLegend: true, visible: chartType() == window.HUE_CHARTS.TYPES.BARCHART" class="chart"></div>
  1364. <!-- /ko -->
  1365. <!-- ko if: chartType() == window.HUE_CHARTS.TYPES.LINECHART -->
  1366. <div data-bind="attr:{'id': 'lineChart_'+id()}, lineChart: {datum: {counts: result.data, sorting: chartSorting(), snippet: $data, limit: chartLimit()},
  1367. transformer: $root.ChartTransformers.multiSerie, showControls: false, enableSelection: false }, visible: chartType() == window.HUE_CHARTS.TYPES.LINECHART" class="chart"></div>
  1368. <!-- /ko -->
  1369. <!-- ko if: chartType() == window.HUE_CHARTS.TYPES.TIMELINECHART -->
  1370. <div data-bind="attr:{'id': 'timelineChart_'+id()}, timelineChart: {type: chartTimelineType, skipWindowResize: true, datum: {counts: result.data, sorting: chartSorting(), snippet: $data, limit: chartLimit()}, fqs: ko.observableArray([]), hideSelection: true, enableSelection: false, hideStacked: hideStacked,
  1371. transformer: $root.ChartTransformers.timeline, stacked: false, showLegend: true}, visible: chartType() == window.HUE_CHARTS.TYPES.TIMELINECHART" class="chart"></div>
  1372. <!-- /ko -->
  1373. <!-- ko if: chartType() == window.HUE_CHARTS.TYPES.MAP -->
  1374. <div data-bind="attr:{'id': 'leafletMapChart_'+id()}, leafletMapChart: {datum: {counts: result.data, sorting: chartSorting(), snippet: $data, limit: chartLimit()},
  1375. transformer: $root.ChartTransformers.leafletMap, showControls: false, height: 380, visible: chartType() == window.HUE_CHARTS.TYPES.MAP, forceRedraw: true}" class="chart"></div>
  1376. <!-- /ko -->
  1377. <!-- ko if: chartType() == window.HUE_CHARTS.TYPES.GRADIENTMAP -->
  1378. <div data-bind="attr:{'id': 'gradientMapChart_'+id()}, mapChart: {data: {counts: result.data, sorting: chartSorting(), snippet: $data, scope: chartScope(), limit: chartLimit()},
  1379. transformer: $root.ChartTransformers.map, isScale: true, showControls: false, height: 380, maxWidth: 750, parentSelector: '.chart-container', visible: chartType() == window.HUE_CHARTS.TYPES.GRADIENTMAP}" class="chart"></div>
  1380. <!-- /ko -->
  1381. <!-- ko if: chartType() == window.HUE_CHARTS.TYPES.SCATTERCHART -->
  1382. <div data-bind="attr:{'id': 'scatterChart_'+id()}, scatterChart: {datum: {counts: result.data, snippet: $data, limit: chartLimit()},
  1383. transformer: $root.ChartTransformers.scatter, maxWidth: 350, y: chartYSingle(), x: chartX(), size: chartScatterSize(), group: chartScatterGroup() }, visible: chartType() == window.HUE_CHARTS.TYPES.SCATTERCHART" class="chart"></div>
  1384. <!-- /ko -->
  1385. </div>
  1386. </div>
  1387. </div>
  1388. </div>
  1389. </div>
  1390. </div>
  1391. </div>
  1392. </script>
  1393. <script type="text/html" id="text-snippet-body${ suffix }">
  1394. <div data-bind="attr: {'id': 'editor_' + id()}, html: statement_raw, value: statement_raw, medium: {}" data-placeHolder="${ _('Type your text here, select some text to format it') }" class="text-snippet"></div>
  1395. </script>
  1396. <script type="text/html" id="markdown-snippet-body${ suffix }">
  1397. <!-- ko ifnot: $root.isPresentationMode() -->
  1398. <div class="row-fluid">
  1399. <div class="span6" data-bind="clickForAceFocus: ace">
  1400. <div class="ace-editor" data-bind="attr: { id: id }, aceEditor: {
  1401. snippet: $data,
  1402. updateOnInput: true
  1403. }"></div>
  1404. </div>
  1405. <div class="span6">
  1406. <div data-bind="html: renderMarkdown(), attr: {'id': 'liveMD' + id()}"></div>
  1407. </div>
  1408. </div>
  1409. <!-- /ko -->
  1410. <!-- ko if: $root.isPresentationMode() -->
  1411. <div data-bind="html: renderMarkdown()"></div>
  1412. <!-- /ko -->
  1413. </script>
  1414. <script type="text/html" id="executable-snippet-body${ suffix }">
  1415. <div style="padding:10px;">
  1416. <form class="form-horizontal">
  1417. <!-- ko if: type() == 'distcp' -->
  1418. <div class="control-group">
  1419. <label class="control-label">${_('Source')}</label>
  1420. <div class="controls">
  1421. <input type="text" class="input-xxlarge filechooser-input" data-bind="value: properties().source_path, valueUpdate: 'afterkeydown', filechooser: properties().source_path, filechooserOptions: { linkMarkup: true, skipInitialPathIfEmpty: true, openOnFocus: true }" placeholder="${ _('Source path to copy, e.g. ${nameNode1}/path/to/input.txt') }"/>
  1422. </div>
  1423. </div>
  1424. <div class="control-group">
  1425. <label class="control-label">${_('Destination')}</label>
  1426. <div class="controls">
  1427. <input type="text" class="input-xxlarge filechooser-input" data-bind="value: properties().destination_path, valueUpdate: 'afterkeydown', filechooser: properties().destination_path, filechooserOptions: { linkMarkup: true, skipInitialPathIfEmpty: true, openOnFocus: true }" placeholder="${ _('Destination path, e.g. ${nameNode2}/path/to/output.txt') }"/>
  1428. </div>
  1429. </div>
  1430. <div class="control-group">
  1431. <label class="control-label">${_('Variables')}</label>
  1432. <div class="controls">
  1433. <!-- ko template: { if: typeof properties().distcp_parameters != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko("Arguments") }', value: properties().distcp_parameters, title: '${ _ko("Arguments for the script") }', placeholder: '${ _ko("e.g. MAX=10, PATH=$PATH:/user/path") }' } } --><!-- /ko -->
  1434. </div>
  1435. </div>
  1436. <!-- /ko -->
  1437. <!-- ko if: type() == 'shell' -->
  1438. <div class="control-group">
  1439. <label class="control-label">${_('Script path')}</label>
  1440. <div class="controls">
  1441. <input type="text" class="input-xxlarge filechooser-input" data-bind="value: properties().command_path, valueUpdate: 'afterkeydown', filechooser: properties().command_path, filechooserOptions: { linkMarkup: true, skipInitialPathIfEmpty: true, openOnFocus: true, selectFolder: false }" placeholder="${ _('Source path to the command') }"/>
  1442. </div>
  1443. </div>
  1444. <div class="control-group">
  1445. <label class="control-label">${_('Variables')}</label>
  1446. <div class="controls">
  1447. <!-- ko template: { if: typeof properties().arguments != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko("Arguments") }', value: properties().arguments, title: '${ _ko("Arguments for the script") }', placeholder: '${ _ko("e.g. MAX=10, PATH=$PATH:/user/path") }' } } --><!-- /ko -->
  1448. <!-- ko template: { if: typeof properties().env_var != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko("Environment") }', value: properties().env_var, title: '${ _ko("Environment variable for the script") }', placeholder: '${ _ko("e.g. CLASSPATH=/path/file.jar") }' } } --><!-- /ko -->
  1449. </div>
  1450. </div>
  1451. <!-- /ko -->
  1452. <!-- ko if: type() == 'mapreduce' -->
  1453. <div class="control-group">
  1454. <label class="control-label">${_('Jar path')}</label>
  1455. <div class="controls">
  1456. <input type="text" class="input-xxlarge filechooser-input" data-bind="value: properties().app_jar, valueUpdate: 'afterkeydown', filechooser: properties().app_jar, filechooserOptions: { linkMarkup: true, skipInitialPathIfEmpty: true, openOnFocus: true, selectFolder: false }" placeholder="${ _('Source path to the main MapReduce jar') }"/>
  1457. </div>
  1458. </div>
  1459. <div class="control-group">
  1460. <label class="control-label">${_('Properties')}</label>
  1461. <div class="controls">
  1462. <!-- ko template: { if: typeof properties().hadoopProperties != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko('Hadoop Properties') }', value: properties().hadoopProperties, title: '${ _ko('Name and values of Hadoop properties') }', placeholder: '${ _ko('e.g. mapred.job.queue.name=production, mapred.map.tasks.speculative.execution=false') }'}} --><!-- /ko -->
  1463. </div>
  1464. </div>
  1465. <!-- /ko -->
  1466. <!-- ko if: type() == 'jar' || type() == 'java' -->
  1467. <div class="control-group">
  1468. <label class="control-label">${_('Path')}</label>
  1469. <div class="controls">
  1470. <input type="text" class="input-xxlarge filechooser-input" data-bind="value: properties().app_jar, valueUpdate: 'afterkeydown', filechooser: properties().app_jar, filechooserOptions: { linkMarkup: true, skipInitialPathIfEmpty: true, openOnFocus: true, selectFolder: false }" placeholder="${ _('Path to application jar, e.g. hdfs://localhost:8020/user/hue/oozie-examples.jar') }"/>
  1471. </div>
  1472. </div>
  1473. <div class="control-group">
  1474. <label class="control-label">${_('Class')}</label>
  1475. <div class="controls">
  1476. <input type="text" class="input-xxlarge" data-bind="value: properties().class, valueUpdate: 'afterkeydown'" placeholder="${ _('Class name of application, e.g. org.apache.oozie.example.SparkFileCopy') }"/>
  1477. </div>
  1478. </div>
  1479. <div class="control-group">
  1480. <label class="control-label">${_('Variables')}</label>
  1481. <div class="controls">
  1482. <!-- ko template: { if: typeof properties().arguments != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko("Arguments") }', value: properties().arguments, title: '${ _ko("Arguments for the script") }', placeholder: '${ _ko("e.g. MAX=10, PATH=$PATH:/user/path") }' } } --><!-- /ko -->
  1483. </div>
  1484. </div>
  1485. <!-- /ko -->
  1486. <!-- ko if: type() == 'py'-->
  1487. <div class="control-group">
  1488. <label class="control-label">${_('Path')}</label>
  1489. <div class="controls">
  1490. <input type="text" class="input-xxlarge" data-bind="value: properties().py_file, valueUpdate: 'afterkeydown', filechooser: properties().py_file, filechooserOptions: { linkMarkup: true, skipInitialPathIfEmpty: true, openOnFocus: true, selectFolder: false }" placeholder="${ _('Path to python file, e.g. script.py') }"/>
  1491. </div>
  1492. </div>
  1493. <!-- /ko -->
  1494. <!-- ko if: type() == 'spark2' -->
  1495. <div class="control-group">
  1496. <!-- ko template: { if: typeof properties().jars != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko('Libs') }', value: properties().jars, title: '${ _ko('Path to jar or python files.') }', placeholder: '${ _ko('e.g. /user/hue/pi.py') }'}} --><!-- /ko -->
  1497. </div>
  1498. <!-- ko if: $.grep(properties().jars(), function(val, index) { return val.toLowerCase().endsWith('.jar'); }).length > 0 -->
  1499. <div class="control-group">
  1500. <label class="control-label">
  1501. ${_('Class')}
  1502. </label>
  1503. <div class="controls">
  1504. <input type="text" class="input-xxlarge" data-bind="value: properties().class, valueUpdate: 'afterkeydown'" placeholder="${ _('Class name of application, e.g. org.apache.oozie.example.SparkFileCopy') }"/>
  1505. </div>
  1506. </div>
  1507. <!-- /ko -->
  1508. <div class="control-group">
  1509. <!-- ko template: { if: typeof properties().spark_arguments != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko('Arguments') }', value: properties().spark_arguments, title: '${ _ko('Arguments to the application.') }', placeholder: '${ _ko('e.g. 10, /user/hue/input') }'}} --><!-- /ko -->
  1510. </div>
  1511. <!-- /ko -->
  1512. </form>
  1513. </div>
  1514. </script>
  1515. <script type="text/html" id="snippet-execution-status${ suffix }">
  1516. <div class="snippet-execution-status" data-bind="clickForAceFocus: ace">
  1517. <a class="inactive-action pull-left snippet-logs-btn" href="javascript:void(0)" data-bind="visible: status() === 'running' && errors().length == 0, click: function() { hideFixedHeaders(); $data.showLogs(!$data.showLogs());}, css: {'blue': $data.showLogs}" title="${ _('Toggle Logs') }"><i class="fa fa-fw" data-bind="css: { 'fa-caret-right': !$data.showLogs(), 'fa-caret-down': $data.showLogs() }"></i></a>
  1518. <div class="snippet-progress-container" data-bind="visible: status() != 'canceled' && status() != 'with-sql-analyzer-report'">
  1519. <div class="progress-snippet progress" data-bind="css: {
  1520. 'progress-starting': progress() == 0 && (status() == 'running' || status() == 'starting'),
  1521. 'progress-warning': progress() > 0 && progress() < 100,
  1522. 'progress-success': progress() == 100,
  1523. 'progress-danger': progress() == 0 && errors().length > 0}" style="background-color: #FFF; width: 100%">
  1524. <div class="bar" data-bind="style: {'width': (errors().length > 0 ? 100 : Math.max(2, progress())) + '%'}"></div>
  1525. </div>
  1526. </div>
  1527. <div class="snippet-error-container alert alert-error" style="margin-bottom: 0" data-bind="visible: errors().length > 0">
  1528. <ul class="unstyled" data-bind="foreach: errors">
  1529. <li data-bind="text: message"></li>
  1530. <!-- ko if: help -->
  1531. <li><a href="javascript:void(0)" data-bind="click: function() {
  1532. huePubSub.publish('editor.settings.update', {
  1533. key: $data.help.setting.name,
  1534. value: $data.help.setting.value
  1535. });
  1536. $parent.settingsVisible(true);
  1537. }">${ _("Update max_row_size setting.") }</a></li>
  1538. <!-- /ko -->
  1539. </ul>
  1540. </div>
  1541. <div class="snippet-error-container alert alert-error" style="margin-bottom: 0" data-bind="visible: aceErrors().length > 0">
  1542. <ul class="unstyled" data-bind="foreach: aceErrors">
  1543. <li data-bind="text: message"></li>
  1544. </ul>
  1545. </div>
  1546. <div class="snippet-error-container alert" style="margin-bottom: 0" data-bind="visible: aceWarnings().length > 0">
  1547. <ul class="unstyled" data-bind="foreach: aceWarnings">
  1548. <li data-bind="text: message"></li>
  1549. </ul>
  1550. </div>
  1551. <div class="snippet-error-container alert alert-error" style="margin-bottom: 0" data-bind="visible: status() == 'canceled', click: function() { status('ready'); }" title="${ _('Click to hide') }">
  1552. <ul class="unstyled">
  1553. <li>${ _("The statement was canceled.") }</li>
  1554. </ul>
  1555. </div>
  1556. </div>
  1557. </script>
  1558. <script type="text/html" id="snippet-code-resizer${ suffix }">
  1559. <div class="snippet-code-resizer" data-bind="aceResizer : { snippet: $data, target: '.ace-container-resizable', onStart: hideFixedHeaders, onStop: redrawFixedHeaders }">
  1560. <i class="fa fa-ellipsis-h"></i>
  1561. </div>
  1562. </script>
  1563. <script type="text/html" id="notebook-snippet-type-controls${ suffix }">
  1564. <div class="inactive-action dropdown hover-actions">
  1565. <a class="snippet-side-btn" style="padding-right: 0; padding-left: 2px;" data-toggle="dropdown" href="javascript: void(0);">
  1566. <span data-bind="template: { name: 'snippetIcon${ suffix }', data: $data }"></span>
  1567. </a>
  1568. <a class="inactive-action dropdown-toggle snippet-side-btn" style="padding:0" data-toggle="dropdown" href="javascript: void(0);">
  1569. <i class="fa fa-caret-down"></i>
  1570. </a>
  1571. <ul class="dropdown-menu" data-bind="foreach: $root.availableSnippets">
  1572. <li><a class="pointer" data-bind="click: function(){ $parent.type($data.type()); }, text: name"></a></li>
  1573. </ul>
  1574. </div>
  1575. </script>
  1576. <script type ="text/html" id="snippet-execution-controls${ suffix }">
  1577. <div class="snippet-actions" style="position: absolute; bottom: 0">
  1578. <!-- ko if: status() == 'loading' -->
  1579. <a class="snippet-side-btn blue" data-testid="editor--execute--button" style="cursor: default;" title="${ _('Creating session') }">
  1580. <i class="fa fa-fw fa-spinner fa-spin"></i>
  1581. </a>
  1582. <!-- /ko -->
  1583. <a class="snippet-side-btn" data-bind="click: reexecute, visible: $root.editorMode() && result.statements_count() > 1, css: {'blue': $parent.history().length == 0 || $root.editorMode(), 'disabled': ! isReady() }" title="${ _('Restart from the first statement') }">
  1584. <i class="fa fa-fw fa-repeat snippet-side-single"></i>
  1585. </a>
  1586. <div class="label label-info" data-bind="attr: {'title':'${ _ko('Showing results of the statement #')}' + (result.statement_id() + 1)}, visible: $root.editorMode() && result.statements_count() > 1">
  1587. <div class="pull-left" data-bind="text: (result.statement_id() + 1)"></div><div class="pull-left">/</div><div class="pull-left" data-bind="text: result.statements_count()"></div>
  1588. </div>
  1589. <!-- ko if: !isCanceling() -->
  1590. <a class="snippet-side-btn red" data-bind="click: cancel, visible: status() == 'running' || status() == 'starting'" title="${ _('Cancel operation') }">
  1591. <i class="fa fa-fw fa-stop snippet-side-single"></i>
  1592. </a>
  1593. <!-- /ko -->
  1594. <!-- ko if: isCanceling() -->
  1595. <a class="snippet-side-btn" style="cursor: default;" title="${ _('Canceling operation...') }">
  1596. <i class="fa fa-fw fa-spinner snippet-side-single fa-spin"></i>
  1597. </a>
  1598. <!-- /ko -->
  1599. <div class="inactive-action dropdown hover-actions pointer" data-bind="css: {'disabled': ! isReady() || status() === 'running' || status() === 'loading' }">
  1600. <!-- ko if: isBatchable() && wasBatchExecuted() -->
  1601. <a class="snippet-side-btn" style="padding-right:0; padding-left: 2px" href="javascript: void(0)" title="${ _('Submit all the queries as a background batch job.') }" data-bind="click: function() { wasBatchExecuted(true); execute(); }, visible: status() != 'running' && status() != 'loading', css: {'blue': $parent.history().length == 0 || $root.editorMode(), 'disabled': ! isReady() }">
  1602. <i class="fa fa-fw fa-send"></i>
  1603. </a>
  1604. <!-- /ko -->
  1605. <!-- ko if: ! isBatchable() || ! wasBatchExecuted() -->
  1606. <a class="snippet-side-btn" style="padding-right:0" href="javascript: void(0)" data-bind="attr: {'title': $root.editorMode() && result.statements_count() > 1 ? '${ _ko('Execute next statement')}' : '${ _ko('Execute or CTRL + ENTER') }'}, click: function() { wasBatchExecuted(false); execute(); }, visible: status() != 'running' && status() != 'loading' && status() != 'starting', css: {'blue': $parent.history().length == 0 || $root.editorMode(), 'disabled': ! isReady() }, style: {'padding-left': $parent.isBatchable() ? '2px' : '0' }">
  1607. <i class="fa fa-fw fa-play" data-bind="css: { 'snippet-side-single' : ! $parent.isBatchable() }"></i>
  1608. </a>
  1609. <!-- /ko -->
  1610. % if ENABLE_BATCH_EXECUTE.get():
  1611. <!-- ko if: isBatchable() && status() != 'running' && status() != 'loading' && ! $root.isPresentationMode() -->
  1612. <a class="dropdown-toggle snippet-side-btn" style="padding:0" data-toggle="dropdown" href="javascript: void(0)" data-bind="css: {'disabled': ! isReady(), 'blue': currentQueryTab() == 'queryExplain' }">
  1613. <i class="fa fa-caret-down"></i>
  1614. </a>
  1615. <ul class="dropdown-menu less-padding">
  1616. <li>
  1617. <a href="javascript:void(0)" data-bind="click: function() { wasBatchExecuted(false); $('.dropdown-toggle').dropdown('toggle'); execute(); }, style: { color: ! isReady() || status() === 'running' || status() === 'loading' ? '#999' : ''}, css: {'disabled': ! isReady() || status() === 'running' || status() === 'loading' }" title="${ _('Execute interactively the current statement') }">
  1618. <i class="fa fa-fw fa-play"></i> ${_('Execute')}
  1619. </a>
  1620. </li>
  1621. <li>
  1622. <a href="javascript:void(0)" data-bind="click: function() { wasBatchExecuted(true); $('.dropdown-toggle').dropdown('toggle'); execute(); }, css: {'disabled': ! isReady() }" title="${ _('Submit all the queries as a background batch job.') }">
  1623. <i class="fa fa-fw fa-send"></i> ${_('Batch')}
  1624. </a>
  1625. </li>
  1626. </ul>
  1627. <!-- /ko -->
  1628. % endif
  1629. </div>
  1630. <!-- ko if: isSqlDialect && ! $root.isPresentationMode() -->
  1631. <div class="inactive-action dropdown hover-actions pointer" data-bind="css: {'disabled': ! isReady() || status() === 'running' || status() === 'loading' }">
  1632. <a class="snippet-side-btn" style="padding-right:0; padding-left: 2px;" href="javascript: void(0)" data-bind="click: explain, css: {'disabled': ! isReady() || status() === 'running' || status() === 'loading', 'blue': currentQueryTab() == 'queryExplain' }" title="${ _('Explain the current SQL query') }">
  1633. <i class="fa fa-fw fa-map-o"></i>
  1634. </a>
  1635. <a class="dropdown-toggle snippet-side-btn" style="padding:0" data-toggle="dropdown" href="javascript: void(0)" data-bind="css: {'disabled': ! isReady(), 'blue': currentQueryTab() == 'queryExplain' }">
  1636. <i class="fa fa-caret-down"></i>
  1637. </a>
  1638. <ul class="dropdown-menu less-padding">
  1639. <li>
  1640. <a href="javascript:void(0)" data-bind="click: explain, style: { color: ! isReady() || status() === 'running' || status() === 'loading' ? '#999' : ''}, css: {'disabled': ! isReady() || status() === 'running' || status() === 'loading' }" title="${ _('Explain the current SQL query') }">
  1641. <i class="fa fa-fw fa-map-o"></i> ${_('Explain')}
  1642. </a>
  1643. </li>
  1644. % if conf.ENABLE_GIST.get():
  1645. <li>
  1646. <a href="javascript:void(0)" data-bind="click: createGist, css: {'disabled': ! isReady() }" title="${ _('Share the query selection via a link') }">
  1647. <i class="fa fa-fw fa-link"></i> ${_('Get shareable link')}
  1648. </a>
  1649. </li>
  1650. % endif
  1651. <!-- ko if: formatEnabled -->
  1652. <li>
  1653. <a href="javascript:void(0)" data-bind="click: format, css: {'disabled': ! isReady() }" title="${ _('Format the current SQL query') }">
  1654. <i class="fa fa-fw fa-indent"></i> ${_('Format')}
  1655. </a>
  1656. </li>
  1657. <!-- /ko -->
  1658. <li>
  1659. <a href="javascript:void(0)" data-bind="click: clear, css: {'disabled': ! isReady() }" title="${ _('Clear the current editor') }">
  1660. <i class="fa fa-fw fa-eraser"></i> ${_('Clear')}
  1661. </a>
  1662. </li>
  1663. <!-- ko if: HAS_SQL_ANALYZER -->
  1664. <li class="divider"></li>
  1665. <li>
  1666. <a href="javascript:void(0)" data-bind="click: checkCompatibility, visible: type() == 'hive' || type() == 'impala'" title="${ _('Get hints on how to port SQL from other databases') }">
  1667. <i class="fa fa-fw fa-random"></i> ${_('Check compatibility')}
  1668. </a>
  1669. </li>
  1670. % if conf.DJANGO_DEBUG_MODE.get() and is_admin(user):
  1671. <li>
  1672. <a href="javascript:void(0)" data-bind="click: function() { huePubSub.publish('editor.upload.history'); }" title="${ _('Load recent queries in order to improve recommendations') }">
  1673. <i class="fa fa-fw fa-cloud-upload"></i> ${_('Upload history')}
  1674. </a>
  1675. </li>
  1676. % endif
  1677. <!-- /ko -->
  1678. </ul>
  1679. </div>
  1680. <!-- /ko -->
  1681. </div>
  1682. </script>
  1683. <script type="text/html" id="snippet-result-controls${ suffix }">
  1684. <div class="snippet-actions" style="opacity:1">
  1685. <div style="margin-top:25px;">
  1686. <a class="snippet-side-btn" href="javascript: void(0)" data-bind="click: function() { $data.showGrid(true); huePubSub.publish('redraw.fixed.headers'); huePubSub.publish('table.extender.redraw'); }, css: {'active': $data.showGrid}" title="${ _('Grid') }">
  1687. <i class="fa fa-fw fa-th"></i>
  1688. </a>
  1689. </div>
  1690. <!-- ko if: window.CUSTOM_DASHBOARD_URL -->
  1691. <a class="snippet-side-btn" href="javascript: void(0)" data-bind="click: dashboardRedirect.bind($data)" title="${ _('Dashboard') }">
  1692. <i class="hcha fa-fw hcha-bar-chart"></i>
  1693. </a>
  1694. <!-- /ko -->
  1695. <!-- ko ifnot: window.CUSTOM_DASHBOARD_URL -->
  1696. <div class="dropdown">
  1697. <a class="snippet-side-btn" style="padding-right:0" href="javascript: void(0)" data-bind="css: {'active': $data.showChart }, click: function() { $data.showChart(true); }" >
  1698. <i class="hcha fa-fw hcha-bar-chart" data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.BARCHART" title="${ _('Bars') }"></i>
  1699. <i class="hcha fa-fw hcha-timeline-chart" data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.TIMELINECHART" title="${ _('Time') }"></i>
  1700. <i class="hcha fa-fw hcha-pie-chart" data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.PIECHART" title="${ _('Pie') }"></i>
  1701. <i class="fa fa-fw fa-dot-circle-o" data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.SCATTERCHART" title="${ _('Scatter') }"></i>
  1702. <i class="fa fa-fw fa-map-marker" data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.MAP" title="${ _('Marker Map') }"></i>
  1703. <i class="hcha fa-fw hcha-map-chart" data-bind="visible: chartType() == window.HUE_CHARTS.TYPES.GRADIENTMAP" title="${ _('Gradient Map') }"></i>
  1704. </a>
  1705. <a class="dropdown-toggle snippet-side-btn" style="padding:0" data-toggle="dropdown" href="javascript: void(0)" data-bind="css: {'active': $data.showChart}">
  1706. <i class="fa fa-caret-down"></i>
  1707. </a>
  1708. <ul class="dropdown-menu less-padding">
  1709. <li>
  1710. <a href="javascript:void(0)" data-bind="css: {'active': chartType() == window.HUE_CHARTS.TYPES.BARCHART}, click: function(){ $data.showChart(true); chartType(window.HUE_CHARTS.TYPES.BARCHART); }">
  1711. <i class="hcha hcha-bar-chart"></i> ${_('Bars')}
  1712. </a>
  1713. </li>
  1714. <li data-bind="visible: result.cleanedDateTimeMeta().length > 0">
  1715. <a href="javascript:void(0)" data-bind="css: {'active': chartType() == window.HUE_CHARTS.TYPES.TIMELINECHART}, click: function(){ $data.showChart(true); chartType(window.HUE_CHARTS.TYPES.TIMELINECHART); }">
  1716. <i class="hcha hcha-timeline-chart"></i> ${_('Time')}
  1717. </a>
  1718. </li>
  1719. <li>
  1720. <a href="javascript:void(0)" data-bind="css: {'active': chartType() == window.HUE_CHARTS.TYPES.PIECHART}, click: function(){ $data.showChart(true); chartType(window.HUE_CHARTS.TYPES.PIECHART); }">
  1721. <i class="hcha hcha-pie-chart"></i> ${_('Pie')}
  1722. </a>
  1723. </li>
  1724. <li>
  1725. <a href="javascript:void(0)" data-bind="css: {'active': chartType() == window.HUE_CHARTS.TYPES.SCATTERCHART}, click: function(){ $data.showChart(true); chartType(window.HUE_CHARTS.TYPES.SCATTERCHART); }">
  1726. <i class="fa fa-fw fa-dot-circle-o chart-icon"></i> ${_('Scatter')}
  1727. </a>
  1728. </li>
  1729. <li>
  1730. <a href="javascript:void(0)" data-bind="css: {'active': chartType() == window.HUE_CHARTS.TYPES.MAP}, click: function(){ $data.showChart(true); chartType(window.HUE_CHARTS.TYPES.MAP); }">
  1731. <i class="fa fa-fw fa-map-marker chart-icon"></i> ${_('Marker Map')}
  1732. </a>
  1733. </li>
  1734. <li>
  1735. <a href="javascript:void(0)" data-bind="css: {'active': chartType() == window.HUE_CHARTS.TYPES.GRADIENTMAP}, click: function(){ $data.showChart(true); chartType(window.HUE_CHARTS.TYPES.GRADIENTMAP); }">
  1736. <i class="hcha hcha-map-chart"></i> ${_('Gradient Map')}
  1737. </a>
  1738. </li>
  1739. </ul>
  1740. </div>
  1741. <!-- /ko -->
  1742. <div>
  1743. <a class="snippet-side-btn" href="javascript:void(0)" data-bind="click: function(){ huePubSub.publish('chart.hard.reset'); isResultSettingsVisible(! isResultSettingsVisible()) }, css: { 'blue' : isResultSettingsVisible }" title="${ _('Columns') }">
  1744. <!-- ko if: isResultSettingsVisible() -->
  1745. <i class="fa fa-fw fa-chevron-left"></i>
  1746. <!-- /ko -->
  1747. <!-- ko ifnot: isResultSettingsVisible() -->
  1748. <i class="fa fa-fw fa-columns"></i>
  1749. <!-- /ko -->
  1750. </a>
  1751. </div>
  1752. % if conf.ENABLE_DOWNLOAD.get():
  1753. <div data-bind="component: { name: 'downloadSnippetResults', params: { gridSideBtn: false, snippet: $data, notebook: $parent } }" style="display:inline-block;"></div>
  1754. % endif
  1755. </div>
  1756. </script>
  1757. <div class="ace-filechooser" style="display:none;">
  1758. <div class="ace-filechooser-close">
  1759. <a class="pointer" data-bind="click: function(){ $('.ace-filechooser').hide(); }"><i class="fa fa-times"></i></a>
  1760. </div>
  1761. <div class="ace-filechooser-content">
  1762. </div>
  1763. </div>
  1764. <div id="removeSnippetModal${ suffix }" class="modal hide fade">
  1765. <div class="modal-header">
  1766. <button type="button" class="close" data-dismiss="modal" aria-label="${ _('Close') }"><span aria-hidden="true">&times;</span></button>
  1767. <h2 class="modal-title">${_('Confirm Remove')}</h2>
  1768. </div>
  1769. <div class="modal-body">
  1770. <p>${_('Are you sure you want to remove this snippet?')}</p>
  1771. </div>
  1772. <div class="modal-footer" data-bind="with: $root.removeSnippetConfirmation">
  1773. <a class="btn" data-bind="click: function() { $root.removeSnippetConfirmation(null); $('#removeSnippetModal${ suffix }').modal('hide'); }">${_('No')}</a>
  1774. <input type="submit" value="${_('Yes')}" class="btn btn-danger" data-bind="click: function() { notebook.snippets.remove(snippet); redrawFixedHeaders(100); $root.removeSnippetConfirmation(null); $('#removeSnippetModal${ suffix }').modal('hide'); }" />
  1775. </div>
  1776. </div>
  1777. <div class="hoverMsg hide">
  1778. <!-- ko if: $root.editorMode() -->
  1779. <p class="hoverText">${_('Drop a SQL file here')}</p>
  1780. <!-- /ko -->
  1781. <!-- ko ifnot: $root.editorMode() -->
  1782. <p class="hoverText">${_('Drop iPython/Zeppelin notebooks here')}</p>
  1783. <!-- /ko -->
  1784. </div>
  1785. <div id="saveAsModal${ suffix }" class="modal hide fade">
  1786. <div class="modal-header">
  1787. <button type="button" class="close" data-dismiss="modal" aria-label="${ _('Close') }"><span aria-hidden="true">&times;</span></button>
  1788. <!-- ko if: $root.editorMode() -->
  1789. <h2 class="modal-title">${_('Save query as...')}</h2>
  1790. <!-- /ko -->
  1791. <!-- ko ifnot: $root.editorMode() -->
  1792. <h2 class="modal-title">${_('Save notebook as...')}</h2>
  1793. <!-- /ko -->
  1794. </div>
  1795. <!-- ko if: $root.selectedNotebook() -->
  1796. <div class="modal-body">
  1797. <form class="form-horizontal">
  1798. <div class="control-group">
  1799. <label class="control-label">${_('Name')}</label>
  1800. <div class="controls">
  1801. <input type="text" class="input-xlarge" data-bind="value: $root.selectedNotebook().name, valueUpdate:'afterkeydown'"/>
  1802. </div>
  1803. </div>
  1804. <div class="control-group">
  1805. <label class="control-label">${_('Description')}</label>
  1806. <div class="controls">
  1807. <input type="text" class="input-xlarge" data-bind="value: $root.selectedNotebook().description, valueUpdate:'afterkeydown'" placeholder="${ _('(optional)') }"/>
  1808. </div>
  1809. </div>
  1810. </form>
  1811. </div>
  1812. <div class="modal-footer">
  1813. <a class="btn" data-dismiss="modal">${_('Cancel')}</a>
  1814. <input type="button" class="btn btn-primary disable-feedback" value="${_('Save')}" data-dismiss="modal" data-bind="click: saveAsNotebook, enable: $root.selectedNotebook().name().length > 0"/>
  1815. </div>
  1816. <!-- /ko -->
  1817. </div>
  1818. <div id="saveToFileModal${ suffix }" class="modal hide fade">
  1819. <div class="modal-header">
  1820. <button type="button" class="close" data-dismiss="modal" aria-label="${ _('Close') }"><span aria-hidden="true">&times;</span></button>
  1821. <h2 class="modal-title">${_('Are you sure you want to save back to File?')}</h2>
  1822. </div>
  1823. <div class="modal-footer">
  1824. <a class="btn" data-dismiss="modal">${_('Cancel')}</a>
  1825. <input type="button" class="btn btn-primary disable-feedback" value="${_('Save')}" data-dismiss="modal" data-bind="click: function() { huePubSub.publish('save.snippet.to.file'); }"/>
  1826. </div>
  1827. </div>
  1828. <div id="authModal${ suffix }" class="modal hide fade">
  1829. <div class="modal-header">
  1830. <button type="button" class="close" data-dismiss="modal" aria-label="${ _('Close') }"><span aria-hidden="true">&times;</span></button>
  1831. <h2 class="modal-title">${_('Connect to the data source')}</h2>
  1832. </div>
  1833. <div class="modal-body">
  1834. <!-- ko if: $root.authSessionMessage() -->
  1835. <div class="row-fluid">
  1836. <div class="alert-warning">
  1837. <span data-bind="text: authSessionMessage"></span>
  1838. </div>
  1839. </div>
  1840. <!-- /ko -->
  1841. <div class="row-fluid">
  1842. <div class="span6">
  1843. <div class="input-prepend">
  1844. <span class="add-on muted"><i class="fa fa-user"></i></span>
  1845. <input name="username" type="text" data-bind="value: $root.authSessionUsername" placeholder="${ _('Username') }"/>
  1846. </div>
  1847. </div>
  1848. <div class="span6">
  1849. <div class="input-prepend">
  1850. <span class="add-on muted"><i class="fa fa-lock"></i></span>
  1851. <input name="password" type="password" data-bind="value: $root.authSessionPassword" placeholder="${ _('Password') }"/>
  1852. </div>
  1853. </div>
  1854. </div>
  1855. </div>
  1856. <div class="modal-footer">
  1857. <a class="btn" data-dismiss="modal">${_('Cancel')}</a>
  1858. <a class="btn btn-primary disable-feedback" data-dismiss="modal" data-bind="click: function() { $root.selectedNotebook().authSession(); }">${_('Connect')}</a>
  1859. </div>
  1860. </div>
  1861. <div id="clearHistoryModal${ suffix }" class="modal hide fade">
  1862. <div class="modal-header">
  1863. <button type="button" class="close" data-dismiss="modal" aria-label="${ _('Close') }"><span aria-hidden="true">&times;</span></button>
  1864. <h2 class="modal-title">${_('Confirm History Clear')}</h2>
  1865. </div>
  1866. <div class="modal-body">
  1867. <p>${_('Are you sure you want to clear the query history?')}</p>
  1868. </div>
  1869. <div class="modal-footer">
  1870. <a class="btn" data-dismiss="modal">${_('No')}</a>
  1871. <a class="btn btn-danger disable-feedback" data-bind="click: function() { $root.selectedNotebook().clearHistory(); }">${_('Yes')}</a>
  1872. </div>
  1873. </div>
  1874. <!-- ko if: $root.selectedNotebook() -->
  1875. <!-- ko with: $root.selectedNotebook() -->
  1876. <div id="retryModal${ suffix }" class="modal hide fade" data-keyboard="false" data-backdrop="static">
  1877. <div class="modal-header">
  1878. <h2 class="modal-title">${_('Operation timed out')}</h2>
  1879. </div>
  1880. <div class="modal-body">
  1881. <p>${_('The operation timed out. Do you want to retry?')}</p>
  1882. </div>
  1883. <div class="modal-footer">
  1884. <a class="btn" data-bind="click: retryModalCancel">${_('No')}</a>
  1885. <a class="btn btn-primary disable-feedback" data-bind="click: retryModalConfirm">${_('Yes, retry')}</a>
  1886. </div>
  1887. </div>
  1888. <!-- /ko -->
  1889. <!-- /ko -->
  1890. <div class="submit-modal-editor modal hide"></div>
  1891. </%def>
  1892. <%def name="commonJS(is_embeddable=False, bindableElement='editorComponents', suffix='')">
  1893. <script type="application/json" id="editorOptionsJson">
  1894. ${ options_json | n,unicode,antixss }
  1895. </script>
  1896. <script ${nonce_attribute(request)} src="${ static('desktop/js/editor-component.js') }"></script>
  1897. </%def>