| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876 |
- ## or more contributor license agreements. See the NOTICE file
- ## distributed with this work for additional information
- ## regarding copyright ownership. Cloudera, Inc. licenses this file
- ## to you under the Apache License, Version 2.0 (the
- ## "License"); you may not use this file except in compliance
- ## with the License. You may obtain a copy of the License at
- ##
- ## http://www.apache.org/licenses/LICENSE-2.0
- ##
- ## Unless required by applicable law or agreed to in writing, software
- ## distributed under the License is distributed on an "AS IS" BASIS,
- ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ## See the License for the specific language governing permissions and
- ## limitations under the License.
- <%!
- import cgi
- import urllib
- import time
- from desktop.views import commonheader, commonfooter
- from django.utils.translation import ugettext as _
- %>
- <%namespace name="actionbar" file="actionbar.mako" />
- ${ commonheader(None, "jobsub", user, "60px") | n,unicode }
- <link rel="stylesheet" href="/jobsub/static/css/jobsub.css">
- <script src="/static/ext/js/mustache.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/ext/js/routie-0.3.0.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/ext/js/datatables-paging-0.1.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/ext/js/knockout-2.1.0.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/ext/js/knockout.mapping-2.3.2.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/ext/js/moment.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="/oozie/static/js/workflow.models.js" type="text/javascript" charset="utf-8"></script>
- <script src="/oozie/static/js/workflow.node-fields.js" type="text/javascript" charset="utf-8"></script>
- <script src="/jobsub/static/js/jobsub.templates.js" type="text/javascript" charset="utf-8"></script>
- <script src="/jobsub/static/js/jobsub.ko.js" type="text/javascript" charset="utf-8"></script>
- <script src="/jobsub/static/js/jobsub.js" type="text/javascript" charset="utf-8"></script>
- <div class="container-fluid">
- <h1>${_('Job Designs')}</h1>
- <%actionbar:render>
- <%def name="actions()">
- <div class="btn-toolbar" style="display: inline; vertical-align: middle">
- <button id="home" class="btn" title="${_('Home')}"><i class="icon-share"></i> ${_('Home')}</button>
-
- <!-- ko ifnot: inTrash -->
- <button id="submit-design" class="btn" title="${_('Submit')}" data-bind="enable: selectedDesignObjects().length == 1"><i class="icon-play"></i> ${_('Submit')}</button>
- <button id="edit-design" class="btn" title="${_('Edit')}" data-bind="enable: selectedDesignObjects().length == 1"><i class="icon-pencil"></i> ${_('Edit')}</button>
- <button id="copy-designs" class="btn" title="${_('Copy')}" data-bind="enable: selectedDesignObjects().length > 0"><i class="icon-retweet"></i> ${_('Copy')}</button>
- <div id="delete-dropdown" class="btn-group" style="vertical-align: middle">
- <button id="delete-btn" class="btn toolbarBtn dropdown-toggle" title="${_('Delete')}" data-toggle="dropdown" data-bind="enable: selectedDesignObjects().length > 0">
- <i class="icon-remove"></i> ${_('Delete')}
- <span class="caret"></span>
- </button>
- <ul class="dropdown-menu" style="top: auto">
- <li><a href="javascript:void(0);" id="trash-designs" title="${_('Move to trash')}"><i class="icon-trash"></i> ${_('Move to trash')}</a></li>
- <li><a href="javascript:void(0);" id="destroy-designs" title="${_('Delete forever')}"><i class="icon-bolt"></i> ${_('Delete forever')}</a></li>
- </ul>
- </div>
- <!-- /ko -->
- <!-- ko if: inTrash -->
- <button id="restore-designs" class="btn" title="${_('Restore')}" data-bind="enable: selectedDesignObjects().length > 0"><i class="icon-cloud-upload"></i> ${_('Restore')}</button>
- <button id="destroy-designs" class="btn" title="${_('Delete forever')}" data-bind="enable: selectedDesignObjects().length > 0"><i class="icon-bolt"></i> ${_('Delete forever')}</button>
- <!-- /ko -->
- </div>
- </%def>
- <%def name="creation()">
- <div class="btn-toolbar" style="display: inline; vertical-align: middle">
- <!-- ko ifnot: inTrash -->
- <div id="new-action-dropdown" class="btn-group" style="vertical-align: middle">
- <a href="#" class="btn new-action-link dropdown-toggle" title="${_('New action')}" data-toggle="dropdown">
- <i class="icon-plus-sign"></i> ${_('New action')}
- <span class="caret"></span>
- </a>
- <ul class="dropdown-menu" style="top: auto">
- <li>
- <a href="#new-design/mapreduce" class="new-node-link" title="${_('Create MapReduce design')}" rel="tooltip"><i class="icon-plus-sign"></i> MapReduce</a>
- </li>
- <li>
- <a href="#new-design/java" class="new-node-link" title="${_('Create Java design')}" rel="tooltip"><i class="icon-plus-sign"></i> Java</a>
- </li>
- <li>
- <a href="#new-design/streaming" class="new-node-link" title="${_('Create Streaming design')}" rel="tooltip"><i class="icon-plus-sign"></i> Streaming</a>
- </li>
- <li>
- <a href="#new-design/hive" class="new-node-link" title="${_('Create Hive design')}" rel="tooltip"><i class="icon-plus-sign"></i> Hive</a>
- </li>
- <li>
- <a href="#new-design/pig" class="new-node-link" title="${_('Create Pig design')}" rel="tooltip"><i class="icon-plus-sign"></i> Pig</a>
- </li>
- <li>
- <a href="#new-design/sqoop" class="new-node-link" title="${_('Create Sqoop design')}" rel="tooltip"><i class="icon-plus-sign"></i> Sqoop</a>
- </li>
- <li>
- <a href="#new-design/fs" class="new-node-link" title="${_('Create Fs design')}" rel="tooltip"><i class="icon-plus-sign"></i> Fs</a>
- </li>
- <li>
- <a href="#new-design/ssh" class="new-node-link" title="${_('Create Ssh design')}" rel="tooltip"><i class="icon-plus-sign"></i> Ssh</a>
- </li>
- <li>
- <a href="#new-design/shell" class="new-node-link" title="${_('Create Shell design')}" rel="tooltip"><i class="icon-plus-sign"></i> Shell</a>
- </li>
- <li>
- <a href="#new-design/email" class="new-node-link" title="${_('Create Email design')}" rel="tooltip"><i class="icon-plus-sign"></i> Email</a>
- </li>
- <li>
- <a href="#new-design/distcp" class="new-node-link" title="${_('Create DistCp design')}" rel="tooltip"><i class="icon-plus-sign"></i> DistCp</a>
- </li>
- </ul>
- </div>
-
- <a href="#trashed-designs" class="btn"><i class="icon-trash"></i> ${ _('Trash') }</a>
- <!-- /ko -->
- <!-- ko if: inTrash -->
- <button type="button" id="purge-trashed-designs" class="btn" title="${ _('Delete all the designs') }"><i class="icon-fire"></i> ${ _('Empty') }</button>
- <!-- /ko -->
- </div>
- </%def>
- </%actionbar:render>
- <div id="design" class="section" data-bind="template: {'name': temporary().template(), 'data': temporary().design(), 'if': temporary().design()}"></div>
- <div id="list-designs" class="section">
- <table id="designTable" class="table table-condensed datatables">
- <thead>
- <tr>
- <th width="1%">
- <div id="selectAll" data-bind="click: toggleSelectAll, css: {'hueCheckbox': true, 'icon-ok': allSelected}"></div>
- </th>
- <th>${_('Name')}</th>
- <th>${_('Description')}</th>
- <th>${_('Owner')}</th>
- <th>${_('Type')}</th>
- <th>${_('Status')}</th>
- <th>${_('Last modified')}</th>
- <th>${_('Trashed')}</th>
- </tr>
- </thead>
- <tbody id="designs" data-bind="template: {'name': 'designTemplate', 'foreach': designs}">
- </tbody>
- </table>
- </div>
- </div>
- <script id="designTemplate" type="text/html">
- <tr style="cursor: pointer" data-bind="with: design">
- <td data-row-selector-exclude="true" data-bind="click: function(data, event) {$root.toggleSelect.call($root, $index());}" class="center" style="cursor: default">
- <div class="hueCheckbox savedCheck" data-row-selector-exclude="true" data-bind="css: {'hueCheckbox': name != '..', 'icon-ok': $parent.selected()}"></div>
- </td>
- <td data-bind="click: function(data, event) { window.location = '#edit-design/' + $index() }, text: name"></td>
- <td data-bind="click: function(data, event) { window.location = '#edit-design/' + $index() }, text: description"></td>
- <td data-bind="click: function(data, event) { window.location = '#edit-design/' + $index() }, text: owner"></td>
- <td data-bind="click: function(data, event) { window.location = '#edit-design/' + $index() }, text: node_type"></td>
- <td data-bind="click: function(data, event) { window.location = '#edit-design/' + $index() }">
- <!-- ko if: is_shared -->
- <span class="label label-info">shared</span>
- <!-- /ko -->
- <!-- ko ifnot: is_shared -->
- <span class="label label-info">personal</span>
- <!-- /ko -->
- </td>
- <td data-bind="click: function(data, event) { window.location = '#edit-design/' + $index() }, text: new Date(last_modified() * 1000).format('%B %d, %Y %I:%M %p'), attr: { 'data-sort-value': last_modified() }"></td>
- <td data-bind="text: is_trashed"></td>
- </tr>
- </script>
- <div id="submitWf" class="modal hide fade"></div>
- <div id="trashWf" class="modal hide fade">
- <form id="trashWfForm" action="#" method="POST" style="margin:0">
- <div class="modal-header">
- <a href="#" class="close" data-dismiss="modal">×</a>
- <h3 id="trashWfMessage">${_('Move the selected designs to trash?')}</h3>
- </div>
- <div class="modal-footer">
- <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
- <input type="submit" class="btn btn-danger" value="${_('Yes')}" data-dismiss="modal" data-bind="click: trashDesigns" />
- </div>
- </form>
- </div>
- <div id="destroyWf" class="modal hide fade">
- <form id="destroyWfForm" action="#" method="POST" style="margin:0">
- <div class="modal-header">
- <a href="#" class="close" data-dismiss="modal">×</a>
- <h3 id="destroyWfMessage">${_('Delete the selected designs?')}</h3>
- </div>
- <div class="modal-footer">
- <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
- <input type="submit" class="btn btn-danger" value="${_('Yes')}" data-dismiss="modal" data-bind="click: destroyDesigns" />
- </div>
- </form>
- </div>
- <div id="purgeWf" class="modal hide fade">
- <form id="purgeWfForm" action="#" method="POST" style="margin:0">
- <div class="modal-header">
- <a href="#" class="close" data-dismiss="modal">×</a>
- <h3 id="purgeWfMessage">${_('Delete all trashed designs?')}</h3>
- </div>
- <div class="modal-footer">
- <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
- <input type="submit" class="btn btn-danger" value="${_('Yes')}" data-dismiss="modal" data-bind="click: destroyAllTrashedDesigns" />
- </div>
- </form>
- </div>
- <div id="restoreWf" class="modal hide fade">
- <form id="restoreWfForm" action="#" method="POST" style="margin:0">
- <div class="modal-header">
- <a href="#" class="close" data-dismiss="modal">×</a>
- <h3 id="restoreWfMessage">${_('Restore the selected designs?')}</h3>
- </div>
- <div class="modal-footer">
- <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
- <input type="submit" class="btn btn-danger" value="${_('Yes')}" data-dismiss="modal" data-bind="click: restoreDesigns" />
- </div>
- </form>
- </div>
- <div id="chooseFile" class="modal hide fade">
- <div class="modal-header">
- <a href="#" class="close" data-dismiss="modal">×</a>
- <h3>${_('Choose a file')}</h3>
- </div>
- <div class="modal-body">
- <div id="fileChooserModal">
- </div>
- </div>
- <div class="modal-footer">
- </div>
- </div>
- <script type="text/javascript" charset="utf-8">
- //// Contexts
- // Context matches up with jobsub.templates.js and various templates defined there.
- // If there is an update to any of the templates,
- // This global context may need to be updated.
- // Global context is extended to provide any uniqueness.
- var global_action_context = {
- 'alert': "${_('You can parameterize the values, using')} <code>$myVar</code> ${_('or')} <code>${"${"}myVar}</code>. ${_('When the design is submitted, you will be prompted for the actual value of ')}<code>myVar</code>.",
- 'paths_alert': "${_('All the paths are relative to the deployment directory. They can be absolute but this is not recommended.')}",
- 'smtp_alert': "${_('Requires some SMTP server configuration to be present (in oozie-site.xml).')}",
- 'ssh_alert': "${_('The ssh server requires passwordless login.')}",
- 'save': {
- 'name': "${_('Save')}",
- 'func': "function(data, event) {$root.saveDesign.call($root, data, event);}"
- },
- 'cancel': {
- 'name': "${_('Cancel')}",
- 'func': "function(data, event) {$root.closeDesign.call($parent, {}); reload();}"
- },
- 'name': {
- 'name': "${ _('Name') }",
- 'popover': "${ _('Name of the design.') }",
- 'js': {
- 'name': 'name'
- }
- },
- 'description': {
- 'name': "${ _('Description') }",
- 'popover': "${ _('Description of the design.') }",
- 'js': {
- 'name': 'description'
- }
- },
- 'is_shared': {
- 'name': "${ _('Is shared') }",
- 'popover': "${ _('Enable other users to have access to this job.') }",
- 'js': {
- 'name': 'is_shared'
- }
- },
- 'capture_output': {
- 'name': "${ _('Capture output') }",
- 'popover': "${ _('Capture the output of this job.') }",
- 'js': {
- 'name': 'capture_output'
- }
- },
- 'parameters': {
- 'title': "${ _('Oozie parameters') }",
- 'name': "${ _('Name') }",
- 'value': "${ _('Value') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeParameter.call($parent, data, event) }'
- },
- 'add': {
- 'name': "${ _('Add') }",
- 'func': 'addParameter'
- },
- 'ko': {
- 'items': "parameters",
- 'error_class': "parameters_error_class",
- 'condition': "parameters_condition"
- }
- },
- 'user': {
- 'name': "${ _('User') }",
- 'popover': "${ _('User to authenticate with.') }"
- },
- 'host': {
- 'name': "${ _('Host') }",
- 'popover': "${ _('Host to execute command on.') }"
- },
- 'command': {
- 'name': "${ _('Command') }",
- 'popover': "${ _('Command to execute.') }"
- },
- 'script_path': {
- 'name': "${ _('Script name') }",
- 'popover': "${ _('Path to the script to execute.') }"
- },
- 'jar_path': {
- 'name': "${ _('Jar path') }",
- 'popover': "${ _('Path to jar files on HDFS.') }"
- },
- 'main_class': {
- 'name': "${ _('Main class') }",
- 'popover': "${ _('Main class') }"
- },
- 'args': {
- 'name': "${ _('Args') }",
- 'popover': "${ _('Args') }"
- },
- 'java_opts': {
- 'name': "${ _('Java opts') }",
- 'popover': "${ _('Java opts') }"
- },
- 'mapper': {
- 'name': "${ _('Mapper') }",
- 'popover': "${ _('Mapper') }"
- },
- 'reducer': {
- 'name': "${ _('Reducer') }",
- 'popover': "${ _('Reducer') }"
- },
- 'to': {
- 'name': "${ _('TO addresses') }",
- 'popover': "${ _('TO addresses') }"
- },
- 'cc': {
- 'name': "${ _('CC addresses (optional)') }",
- 'popover': "${ _('CC addresses (optional)') }"
- },
- 'subject': {
- 'name': "${ _('Subject') }",
- 'popover': "${ _('Subject') }"
- },
- 'body': {
- 'name': "${ _('Body') }",
- 'popover': "${ _('Body') }"
- },
- 'job_properties': {
- 'title': "${ _('Job properties') }",
- 'name': "${ _('Property name') }",
- 'value': "${ _('Value') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeProperty.call($parent, data, event) }'
- },
- 'add': {
- 'name': "${ _('Add property') }",
- 'func': 'addProperty'
- },
- 'ko': {
- 'items': "job_properties",
- 'error_class': "job_properties_error_class",
- 'condition': "job_properties_condition"
- }
- },
- 'prepares': {
- 'title': "${ _('Prepare') }",
- 'name': "${ _('Type') }",
- 'value': "${ _('Value') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removePrepare.call($parent, data, event) }'
- },
- 'add': {
- 'delete': {
- 'name': "${ _('Add delete') }",
- 'func': 'addPrepareDelete'
- },
- 'mkdir': {
- 'name': "${ _('Add mkdir') }",
- 'func': 'addPrepareMkdir'
- }
- },
- 'ko': {
- 'items': "prepares",
- 'error_class': "prepares_error_class",
- 'condition': "prepares_condition"
- }
- },
- 'params': {
- 'title': "${ _('Params') }",
- 'name': "${ _('Type') }",
- 'value': "${ _('Value') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeParam.call($parent, data, event) }'
- },
- 'add': [{
- 'name': "${ _('Add param') }",
- 'func': 'addParam'
- }],
- 'ko': {
- 'items': "params",
- 'error_class': "params_error_class",
- 'condition': "params_condition"
- }
- },
- 'files': {
- 'title': "${ _('Files') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeFile.call($parent, data, event) }'
- },
- 'add': {
- 'name': "${ _('Add file') }",
- 'func': 'addFile'
- },
- 'ko': {
- 'items': "files",
- 'error_class': "files_error_class",
- 'condition': "files_condition"
- }
- },
- 'archives': {
- 'title': "${ _('Archives') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeArchive.call($parent, data, event) }'
- },
- 'add': {
- 'name': "${ _('Add archive') }",
- 'func': 'addArchive'
- },
- 'ko': {
- 'items': "archives",
- 'error_class': "archives_error_class",
- 'condition': "archives_condition"
- }
- }
- };
- var contexts = {
- 'mapreduce': {
- 'title': "${ _('Job Design (mapreduce type)') }"
- },
- 'java': {
- 'title': "${ _('Job Design (java type)') }"
- },
- 'streaming': {
- 'title': "${ _('Job Design (streaming type)') }"
- },
- 'hive': {
- 'title': "${ _('Job Design (hive type)') }"
- },
- 'pig': {
- 'title': "${ _('Job Design (pig type)') }",
- 'params': {
- 'title': "${ _('Params') }",
- 'name': "${ _('Type') }",
- 'value': "${ _('Value') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeParam.call($parent, data, event) }'
- },
- 'add': [{
- 'name': "${ _('Add param') }",
- 'func': 'addParam'
- },{
- 'name': "${ _('Add argument') }",
- 'func': 'addArgument'
- }],
- 'ko': {
- 'items': "params",
- 'error_class': "params_error_class",
- 'condition': "params_condition"
- }
- },
- },
- 'sqoop': {
- 'title': "${ _('Job Design (sqoop type)') }",
- 'script_path': {
- 'name': "${ _('Command') }",
- 'popover': "${ _('Command to execute.') }"
- },
- 'params': {
- 'title': "${ _('Params') }",
- 'name': "${ _('Type') }",
- 'value': "${ _('Value') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeParam.call($parent, data, event) }'
- },
- 'add': [{
- 'name': "${ _('Add arg') }",
- 'func': 'addArg'
- }],
- 'ko': {
- 'items': "params",
- 'error_class': "params_error_class",
- 'condition': "params_condition"
- }
- }
- },
- 'fs': {
- 'title': "${ _('Job Design (fs type)') }",
- 'deletes': {
- 'title': "${ _('Delete path') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeDelete.call($parent, data, event) }'
- },
- 'add': {
- 'name': "${ _('Add path') }",
- 'func': 'addDelete'
- },
- 'ko': {
- 'items': "deletes",
- 'error_class': "deletes_error_class",
- 'condition': "deletes_condition"
- }
- },
- 'mkdirs': {
- 'title': "${ _('Create directory') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeMkdir.call($parent, data, event) }'
- },
- 'add': {
- 'name': "${ _('Add path') }",
- 'func': 'addMkdir'
- },
- 'ko': {
- 'items': "mkdirs",
- 'error_class': "mkdirs_error_class",
- 'condition': "mkdirs_condition"
- }
- },
- 'touchzs': {
- 'title': "${ _('Create or touch file') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeTouchz.call($parent, data, event) }'
- },
- 'add': {
- 'name': "${ _('Add path') }",
- 'func': 'addTouchz'
- },
- 'ko': {
- 'items': "touchzs",
- 'error_class': "touchzs_error_class",
- 'condition': "touchzs_condition"
- }
- },
- 'chmods': {
- 'title': "${ _('Change permissions') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeChmod.call($parent, data, event) }'
- },
- 'add': {
- 'name': "${ _('Add chmod') }",
- 'func': 'addChmod'
- },
- 'ko': {
- 'items': "chmods",
- 'error_class': "chmods_error_class",
- 'condition': "chmods_condition"
- }
- },
- 'moves': {
- 'title': "${ _('Move file') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeMove.call($parent, data, event) }'
- },
- 'add': {
- 'name': "${ _('Add move') }",
- 'func': 'addMove'
- },
- 'ko': {
- 'items': "moves",
- 'error_class': "moves_error_class",
- 'condition': "moves_condition"
- }
- }
- },
- 'ssh': {
- 'title': "${ _('Job Design (ssh type)') }",
- 'params': {
- 'title': "${ _('Params') }",
- 'name': "${ _('Type') }",
- 'value': "${ _('Value') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeParam.call($parent, data, event) }'
- },
- 'add': [{
- 'name': "${ _('Add arg') }",
- 'func': 'addArg'
- }],
- 'ko': {
- 'items': "params",
- 'error_class': "params_error_class",
- 'condition': "params_condition"
- }
- },
- },
- 'shell': {
- 'title': "${ _('Job Design (shell type)') }",
- 'params': {
- 'title': "${ _('Params') }",
- 'name': "${ _('Type') }",
- 'value': "${ _('Value') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeParam.call($parent, data, event) }'
- },
- 'add': [{
- 'name': "${ _('Add argument') }",
- 'func': 'addArgument'
- },{
- 'name': "${ _('Add env-var') }",
- 'func': 'addEnvVar'
- }],
- 'ko': {
- 'items': "params",
- 'error_class': "params_error_class",
- 'condition': "params_condition"
- }
- },
- },
- 'email': {
- 'title': "${ _('Job Design (email type)') }"
- },
- 'distcp': {
- 'title': "${ _('Job Design (distcp type)') }",
- 'params': {
- 'title': "${ _('Params') }",
- 'name': "${ _('Type') }",
- 'value': "${ _('Value') }",
- 'delete': {
- 'name': "${ _('Delete') }",
- 'func': 'function(data, event) { $parent.removeParam.call($parent, data, event) }'
- },
- 'add': [{
- 'name': "${ _('Add argument') }",
- 'func': 'addArgument'
- }],
- 'ko': {
- 'items': "params",
- 'error_class': "params_error_class",
- 'condition': "params_condition"
- }
- },
- }
- }
- //// Binding
- var designs = new Designs();
- ko.applyBindings(designs);
- // Design table and other variables.
- var designTableOptions = {
- "sPaginationType": "bootstrap",
- "bLengthChange": false,
- "sDom": "<'row'r>t<'row'<'span8'i><''p>>",
- "bDestroy": true,
- "aoColumnDefs": [
- { "bSortable": false, "aTargets": [ 0 ] },
- { "sSortDataType": "dom-sort-value", "sType": "numeric", "aTargets": [6] },
- { "bVisible": false, "aTargets": [7] }
- ],
- "aaSorting": [[ 6, "desc" ]],
- "fnPreDrawCallback": function( oSettings ) {
- if (designs.allSelected()) {
- designs.selectAll();
- }
- },
- "oLanguage": {
- "sEmptyTable": "${_('No data available')}",
- "sInfo": "${_('Showing _START_ to _END_ of _TOTAL_ entries')}",
- "sInfoEmpty": "${_('Showing 0 to 0 of 0 entries')}",
- "sInfoFiltered": "${_('(filtered from _MAX_ total entries)')}",
- "sZeroRecords": "${_('No matching records')}",
- "oPaginate": {
- "sFirst": "${_('First')}",
- "sLast": "${_('Last')}",
- "sNext": "${_('Next')}",
- "sPrevious": "${_('Previous')}"
- }
- }
- };
- var designTable = $('#designTable').dataTable( designTableOptions );
- /**
- * Redraw a table after the table has been dynamically updated.
- * This is necessary because KO and datatables don't play well together.
- */
- function redraw() {
- designTable.fnDestroy();
- designTable = $('#designTable').dataTable( designTableOptions );
- designTable.fnFilter(designs.inTrash().toString(), 7);
- }
- /**
- * Reload with datatables.
- * Remove datatables, reload, then reinitialize datatables.
- * Knockout doesn't work without this.
- */
- function reload() {
- $(document).one('load.designs', function() {
- designTable.fnDestroy();
- });
- designs.load();
- $(document).one('initialized.designs', function() {
- designTable = $('#designTable').dataTable( designTableOptions );
- designTable.fnFilter(designs.inTrash().toString(), 7);
- });
- }
- $(document).bind('loaded.designs', function() {
- // Filter should be added again after datatable has been recreated.
- $("#filterInput").keyup(function() {
- if (designTable != null){
- designTable.fnFilter($(this).val());
- }
- });
- });
- $(document).bind('saved.design', reload);
- $(document).bind('deleted.design', reload);
- $(document).bind('cloned.design', reload);
- $(document).bind('restored.design', reload);
- reload();
- /**
- * Using Mustache templating system: http://mustache.github.com/
- * Templates and partials are loaded in jobsub.templates.js
- * Context is matched up with templates and partials.
- * Routie is used to provide hash routing: http://projects.jga.me/routie/.
- */
- var setupRoutes = (function() {
- var eventCount = 0;
- return function(e) {
- if (++eventCount > 1) {
- //// Routes
- routie({
- 'new-design/:node_type': function(node_type) {
- /**
- * Update context with correct title.
- * Create empty design to fill.
- * Create template by calling `getActionTemplate`.
- */
- // Show section only after we've finished the new design process.
- $(document).one('created.design', function() {
- showSection('design');
- });
- designs.closeDesign();
- var context = $.extend(true, {}, global_action_context, contexts[node_type]);
- templates.getActionTemplate(node_type, context);
- designs.newDesign(node_type);
- },
- 'edit-design/:index': function(index) {
- /**
- * Update context with correct title.
- * Design is selected through 'list-designs'.
- */
- designs.closeDesign();
- var designObject = designs.designs()[index];
- if (!designObject) {
- routie('list-designs');
- return;
- }
- // Show section only after we've finished the edit design process.
- $(document).one('edited.design', function() {
- if (designObject.design().editable()) {
- $('#design input').removeAttr('disabled');
- $('#design textarea').removeAttr('disabled');
- $('#design button').removeAttr('disabled');
- } else {
- $('#design input').attr('disabled', 'disabled');
- $('#design textarea').attr('disabled', 'disabled');
- $('#design button').attr('disabled', 'disabled');
- }
- showSection('design');
- });
- var node_type = designObject.design().node_type();
- var context = $.extend(true, {}, global_action_context, contexts[node_type]);
- templates.getActionTemplate(node_type, context);
- designs.deselectAll();
- designs.select(index);
- designs.editDesign();
- },
- 'trashed-designs': function() {
- $('#home').removeAttr('disabled');
- designs.inTrash(true);
- showSection('list-designs');
- redraw();
- },
- 'list-designs': function() {
- $('#home').removeAttr('disabled');
- designs.inTrash(false);
- showSection('list-designs');
- redraw();
- }
- });
- }
- routie('list-designs');
- }
- })();
- $(document).ready(setupRoutes);
- $(document).one('loaded.designs', setupRoutes);
- $(document).ready(function(e) {
- //// Row selector, buttons, and various features.
- $(".btn[rel='tooltip']").tooltip({'placement':'bottom'});
- $("a[data-row-selector='true']").jHueRowSelector();
- $('#submit-design').click(function() {
- var url = '/oozie/submit_workflow/' + designs.selectedDesign().id();
- $.get(url, function (response) {
- $('#submitWf').html(response);
- $('#submitWf').modal('show');
- }
- );
- });
- $('body').on('click', '#edit-design', function() {
- routie('edit-design/' + designs.selectedIndex());
- });
- $('body').on('click', '#trash-designs', function() {
- $('#trashWf').modal('show');
- });
- $('body').on('click', '#destroy-designs', function() {
- $('#destroyWf').modal('show');
- });
- $('body').on('click', '#purge-trashed-designs', function() {
- $('#purgeWf').modal('show');
- });
- $('body').on('click', '#restore-designs', function() {
- $('#restoreWf').modal('show');
- });
- $('body').on('click', '#copy-designs', function() {
- designs.cloneDesigns();
- });
- $('#home').click(function() {
- routie('list-designs');
- });
- // load the autocomplete properties
- var AUTOCOMPLETE_PROPERTIES;
- $.getJSON("${ url('oozie:autocomplete_properties') }", function (properties) {
- AUTOCOMPLETE_PROPERTIES = properties;
- });
- });
- </script>
- ${ commonfooter(messages) | n,unicode }
|