navigation-bar.mako 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. ## Licensed to Cloudera, Inc. under one
  2. ## or more contributor license agreements. See the NOTICE file
  3. ## distributed with this work for additional information
  4. ## regarding copyright ownership. Cloudera, Inc. licenses this file
  5. ## to you under the Apache License, Version 2.0 (the
  6. ## "License"); you may not use this file except in compliance
  7. ## with the License. You may obtain a copy of the License at
  8. ##
  9. ## http://www.apache.org/licenses/LICENSE-2.0
  10. ##
  11. ## Unless required by applicable law or agreed to in writing, software
  12. ## distributed under the License is distributed on an "AS IS" BASIS,
  13. ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ## See the License for the specific language governing permissions and
  15. ## limitations under the License.
  16. <%!
  17. from django.utils.translation import ugettext as _
  18. from oozie.conf import ENABLE_V2
  19. %>
  20. <%namespace name="utils" file="utils.inc.mako" />
  21. <%def name="menubar(section='', dashboard=False, is_editor=False, pullright=None, is_embeddable=False)">
  22. <div class="navbar hue-title-bar">
  23. <div class="navbar-inner">
  24. <div class="container-fluid">
  25. %if pullright:
  26. ${pullright()}
  27. %endif
  28. <div class="nav-collapse">
  29. <ul class="nav">
  30. <li class="app-header">
  31. <%def name="getURL(section, dashboard, is_v2)">
  32. <%
  33. if dashboard:
  34. if is_v2:
  35. if section == 'coordinators':
  36. return url('oozie:list_editor_coordinators')
  37. elif section == 'bundles':
  38. return url('oozie:list_editor_bundles')
  39. else:
  40. return url('oozie:list_editor_workflows')
  41. else:
  42. if section == 'coordinators':
  43. return url('oozie:list_coordinators')
  44. elif section == 'bundles':
  45. return url('oozie:list_bundles')
  46. else:
  47. return url('oozie:list_workflows')
  48. else:
  49. if section == 'coordinators':
  50. return url('oozie:list_oozie_coordinators')
  51. elif section == 'bundles':
  52. return url('oozie:list_oozie_bundles')
  53. else:
  54. return url('oozie:list_oozie_workflows')
  55. %>
  56. </%def>
  57. % if dashboard:
  58. <a title="${ _('Switch to the editor') }" href="${getURL(section, dashboard, ENABLE_V2.get())}">
  59. <img src="${ static('oozie/art/icon_oozie_dashboard_48.png') }" class="app-icon" alt="${ _('Oozie dashboard icon') }" /> ${ _('Oozie Dashboard') }
  60. </a>
  61. % else:
  62. <a title="${ _('Switch to the dashboard') }" href="${getURL(section, dashboard, ENABLE_V2.get())}">
  63. <svg class="svg-app-icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#hi-oozie"></use></svg> ${ _('Oozie Editor') }
  64. </a>
  65. % endif
  66. </li>
  67. % if dashboard:
  68. <li class="${utils.is_selected(section, 'workflows')}"><a href="${url('oozie:list_oozie_workflows')}">${ _('Workflows') }</a></li>
  69. <li class="${utils.is_selected(section, 'coordinators')}"><a href="${url('oozie:list_oozie_coordinators')}">${ _('Coordinators') }</a></li>
  70. <li class="${utils.is_selected(section, 'bundles')}"><a href="${url('oozie:list_oozie_bundles')}">${ _('Bundles') }</a></li>
  71. <li class="${utils.is_selected(section, 'sla')}"><a href="${url('oozie:list_oozie_sla')}">${ _('SLA') }</a></li>
  72. <li class="${utils.is_selected(section, 'oozie')}"><a href="${url('oozie:list_oozie_info')}">${ _('Oozie') }</a></li>
  73. % else:
  74. % if is_editor:
  75. <li class="${utils.is_selected(section, 'workflows')}">
  76. <a href="${url('oozie:list_editor_workflows')}">${ _('Workflows') }</a>
  77. </li>
  78. <li class="${utils.is_selected(section, 'coordinators')}">
  79. <a href="${url('oozie:list_editor_coordinators')}">${ _('Coordinators') }</a>
  80. </li>
  81. <li class="${utils.is_selected(section, 'bundles')}">
  82. <a href="${url('oozie:list_editor_bundles')}">${ _('Bundles') }</a>
  83. </li>
  84. % else:
  85. <li class="${utils.is_selected(section, 'workflows')}"><a href="${url('oozie:list_workflows')}">${ _('Workflows') }</a></li>
  86. <li class="${utils.is_selected(section, 'coordinators')}"><a href="${url('oozie:list_coordinators')}">${ _('Coordinators') }</a></li>
  87. <li class="${utils.is_selected(section, 'bundles')}"><a href="${url('oozie:list_bundles')}">${ _('Bundles') }</a></li>
  88. % endif
  89. % endif
  90. </ul>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. % if not dashboard and not is_editor and ENABLE_V2.get():
  96. <div class="alert alert-warn" style="position: fixed; top: 28px; z-index: 1031; right: 0; height: 28px; line-height: 28px; border: none">
  97. ${ _('This is the old editor, please migrate your jobs to the ') }
  98. <a style="display:inline" href="${url('oozie:new_workflow') if utils.is_selected(section, 'workflows') else url('oozie:new_coordinator') if utils.is_selected(section, 'coordinators') else url('oozie:new_bundle')}">${ _('new editor.') }</a>
  99. </div>
  100. % endif
  101. </%def>