diff --git a/static/scripts/galaxy-app-base.js b/static/scripts/galaxy-app-base.js index 369ed146970..427ada90ead 100644 --- a/static/scripts/galaxy-app-base.js +++ b/static/scripts/galaxy-app-base.js @@ -1,33 +1,44 @@ define([ 'mvc/user/user-model', 'utils/metrics-logger', - 'utils/add-logging' -], function( userModel, metricsLogger, addLogging ){ + 'utils/add-logging', + 'utils/localization' +], function( userModel, metricsLogger, addLogging, localize ){ // ============================================================================ -/** - * +/** Base galaxy client-side application. + * Iniitializes: + * logger : the logger/metrics-logger + * localize : the string localizer + * config : the current configuration (any k/v in + * universe_wsgi.ini available from the configuration API) + * user : the current user (as a mvc/user/user-model) */ function GalaxyApp( options ){ var self = this; return self._init( options || {} ); } +// add logging shortcuts for this object addLogging( GalaxyApp, 'GalaxyApp' ); -/** */ +/** default options */ GalaxyApp.defaultOptions = { + /** root url of this app */ // move to self.root? root : '/' }; -/** */ +/** initalize options and sub-components */ GalaxyApp.prototype._init = function init( options ){ var self = this; + self._processOptions( options ); + self.debug( 'GalaxyApp.options: ', self.options ); + self._initLogger( options.loggerOptions || {} ); self.debug( 'GalaxyApp.logger: ', self.logger ); - self._processOptions( options ); - self.debug( 'GalaxyApp.options: ', self.options ); + self._initLocale(); + self.debug( 'GalaxyApp.localize: ', self.localize ); self.config = options.config || {}; self.debug( 'GalaxyApp.config: ', self.config ); @@ -38,7 +49,7 @@ GalaxyApp.prototype._init = function init( options ){ return self; }; -/** */ +/** add an option from options if the key matches an option in defaultOptions */ GalaxyApp.prototype._processOptions = function _processOptions( options ){ var self = this, defaults = GalaxyApp.defaultOptions; @@ -53,7 +64,7 @@ GalaxyApp.prototype._processOptions = function _processOptions( options ){ return self; }; -/** */ +/** set up the current user as a Backbone model (mvc/user/user-model) */ GalaxyApp.prototype._initUser = function _initUser( userJSON ){ var self = this; self.debug( '_initUser:', userJSON ); @@ -61,7 +72,7 @@ GalaxyApp.prototype._initUser = function _initUser( userJSON ){ return self; }; -/** */ +/** set up the metrics logger (utils/metrics-logger) and pass loggerOptions */ GalaxyApp.prototype._initLogger = function _initLogger( loggerOptions ){ var self = this; self.debug( '_initLogger:', loggerOptions ); @@ -69,7 +80,17 @@ GalaxyApp.prototype._initLogger = function _initLogger( loggerOptions ){ return self; }; -/** */ +/** add the localize fn to this object and the window namespace (as '_l') */ +GalaxyApp.prototype._initLocale = function _initLocale( options ){ + var self = this; + self.debug( '_initLocale:', options ); + self.localize = localize; + // add to window as global shortened alias + window._l = self.localize; + return self; +}; + +/** string rep */ GalaxyApp.prototype.toString = function toString(){ var userEmail = this.user.get( 'email' ) || '(anonymous)'; return 'GalaxyApp(' + userEmail + ')'; diff --git a/static/scripts/i18n.js b/static/scripts/i18n.js new file mode 100644 index 00000000000..9fa0c2646a7 --- /dev/null +++ b/static/scripts/i18n.js @@ -0,0 +1,183 @@ +/** + * @license RequireJS i18n 2.0.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/requirejs/i18n for details + */ +/*jslint regexp: true */ +/*global require: false, navigator: false, define: false */ + +/** + * This plugin handles i18n! prefixed modules. It does the following: + * + * 1) A regular module can have a dependency on an i18n bundle, but the regular + * module does not want to specify what locale to load. So it just specifies + * the top-level bundle, like "i18n!nls/colors". + * + * This plugin will load the i18n bundle at nls/colors, see that it is a root/master + * bundle since it does not have a locale in its name. It will then try to find + * the best match locale available in that master bundle, then request all the + * locale pieces for that best match locale. For instance, if the locale is "en-us", + * then the plugin will ask for the "en-us", "en" and "root" bundles to be loaded + * (but only if they are specified on the master bundle). + * + * Once all the bundles for the locale pieces load, then it mixes in all those + * locale pieces into each other, then finally sets the context.defined value + * for the nls/colors bundle to be that mixed in locale. + * + * 2) A regular module specifies a specific locale to load. For instance, + * i18n!nls/fr-fr/colors. In this case, the plugin needs to load the master bundle + * first, at nls/colors, then figure out what the best match locale is for fr-fr, + * since maybe only fr or just root is defined for that locale. Once that best + * fit is found, all of its locale pieces need to have their bundles loaded. + * + * Once all the bundles for the locale pieces load, then it mixes in all those + * locale pieces into each other, then finally sets the context.defined value + * for the nls/fr-fr/colors bundle to be that mixed in locale. + */ +(function () { + 'use strict'; + + //regexp for reconstructing the master bundle name from parts of the regexp match + //nlsRegExp.exec("foo/bar/baz/nls/en-ca/foo") gives: + //["foo/bar/baz/nls/en-ca/foo", "foo/bar/baz/nls/", "/", "/", "en-ca", "foo"] + //nlsRegExp.exec("foo/bar/baz/nls/foo") gives: + //["foo/bar/baz/nls/foo", "foo/bar/baz/nls/", "/", "/", "foo", ""] + //so, if match[5] is blank, it means this is the top bundle definition. + var nlsRegExp = /(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/; + + //Helper function to avoid repeating code. Lots of arguments in the + //desire to stay functional and support RequireJS contexts without having + //to know about the RequireJS contexts. + function addPart(locale, master, needed, toLoad, prefix, suffix) { + if (master[locale]) { + needed.push(locale); + if (master[locale] === true || master[locale] === 1) { + toLoad.push(prefix + locale + '/' + suffix); + } + } + } + + function addIfExists(req, locale, toLoad, prefix, suffix) { + var fullName = prefix + locale + '/' + suffix; + if (require._fileExists(req.toUrl(fullName + '.js'))) { + toLoad.push(fullName); + } + } + + /** + * Simple function to mix in properties from source into target, + * but only if target does not already have a property of the same name. + * This is not robust in IE for transferring methods that match + * Object.prototype names, but the uses of mixin here seem unlikely to + * trigger a problem related to that. + */ + function mixin(target, source, force) { + var prop; + for (prop in source) { + if (source.hasOwnProperty(prop) && (!target.hasOwnProperty(prop) || force)) { + target[prop] = source[prop]; + } else if (typeof source[prop] === 'object') { + if (!target[prop] && source[prop]) { + target[prop] = {}; + } + mixin(target[prop], source[prop], force); + } + } + } + + define(['module'], function (module) { + var masterConfig = module.config ? module.config() : {}; + + return { + version: '2.0.4', + /** + * Called when a dependency needs to be loaded. + */ + load: function (name, req, onLoad, config) { + config = config || {}; + + if (config.locale) { + masterConfig.locale = config.locale; + } + + var masterName, + match = nlsRegExp.exec(name), + prefix = match[1], + locale = match[4], + suffix = match[5], + parts = locale.split("-"), + toLoad = [], + value = {}, + i, part, current = ""; + + //If match[5] is blank, it means this is the top bundle definition, + //so it does not have to be handled. Locale-specific requests + //will have a match[4] value but no match[5] + if (match[5]) { + //locale-specific bundle + prefix = match[1]; + masterName = prefix + suffix; + } else { + //Top-level bundle. + masterName = name; + suffix = match[4]; + locale = masterConfig.locale; + if (!locale) { + locale = masterConfig.locale = + typeof navigator === "undefined" ? "root" : + (navigator.language || + navigator.userLanguage || "root").toLowerCase(); + } + parts = locale.split("-"); + } + + if (config.isBuild) { + //Check for existence of all locale possible files and + //require them if exist. + toLoad.push(masterName); + addIfExists(req, "root", toLoad, prefix, suffix); + for (i = 0; i < parts.length; i++) { + part = parts[i]; + current += (current ? "-" : "") + part; + addIfExists(req, current, toLoad, prefix, suffix); + } + + req(toLoad, function () { + onLoad(); + }); + } else { + //First, fetch the master bundle, it knows what locales are available. + req([masterName], function (master) { + //Figure out the best fit + var needed = [], + part; + + //Always allow for root, then do the rest of the locale parts. + addPart("root", master, needed, toLoad, prefix, suffix); + for (i = 0; i < parts.length; i++) { + part = parts[i]; + current += (current ? "-" : "") + part; + addPart(current, master, needed, toLoad, prefix, suffix); + } + + //Load all the parts missing. + req(toLoad, function () { + var i, partBundle, part; + for (i = needed.length - 1; i > -1 && needed[i]; i--) { + part = needed[i]; + partBundle = master[part]; + if (partBundle === true || partBundle === 1) { + partBundle = req(prefix + part + '/' + suffix); + } + mixin(value, partBundle); + } + + //All done, notify the loader. + onLoad(value); + }); + }); + } + } + }; + }); +}()); diff --git a/static/scripts/mvc/dataset/hda-base.js b/static/scripts/mvc/dataset/hda-base.js index 63a4d6033a8..2f6d4170223 100644 --- a/static/scripts/mvc/dataset/hda-base.js +++ b/static/scripts/mvc/dataset/hda-base.js @@ -1,7 +1,8 @@ define([ "mvc/dataset/hda-model", - "mvc/base-mvc" -], function( hdaModel, baseMVC ){ + "mvc/base-mvc", + "utils/localization" +], function( hdaModel, baseMVC, _l ){ /* global Backbone */ //============================================================================== /** @class Read only view for HistoryDatasetAssociation. diff --git a/static/scripts/mvc/dataset/hda-edit.js b/static/scripts/mvc/dataset/hda-edit.js index 241d014ce0d..acb781b9f7d 100644 --- a/static/scripts/mvc/dataset/hda-edit.js +++ b/static/scripts/mvc/dataset/hda-edit.js @@ -2,8 +2,9 @@ define([ "mvc/dataset/hda-model", "mvc/dataset/hda-base", "mvc/tags", - "mvc/annotations" -], function( hdaModel, hdaBase, tagsMod, annotationsMod ){ + "mvc/annotations", + "utils/localization" +], function( hdaModel, hdaBase, tagsMod, annotationsMod, _l ){ //============================================================================== /** @class Editing view for HistoryDatasetAssociation. * @name HDAEditView diff --git a/static/scripts/mvc/dataset/hda-model.js b/static/scripts/mvc/dataset/hda-model.js index 76cc523a651..b5e0a496fb0 100644 --- a/static/scripts/mvc/dataset/hda-model.js +++ b/static/scripts/mvc/dataset/hda-model.js @@ -1,6 +1,7 @@ define([ - "mvc/base-mvc" -], function( baseMVC ){ + "mvc/base-mvc", + "utils/localization" +], function( baseMVC, _l ){ //============================================================================== /** @class (HDA) model for a Galaxy dataset * related to a history. diff --git a/static/scripts/mvc/history/annotated-history-panel.js b/static/scripts/mvc/history/annotated-history-panel.js index 56dbecfa8af..4b45ef89b75 100644 --- a/static/scripts/mvc/history/annotated-history-panel.js +++ b/static/scripts/mvc/history/annotated-history-panel.js @@ -1,8 +1,9 @@ define([ "mvc/dataset/hda-model", "mvc/dataset/hda-base", - "mvc/history/readonly-history-panel" -], function( hdaModel, hdaBase, readonlyPanel ){ + "mvc/history/readonly-history-panel", + "utils/localization" +], function( hdaModel, hdaBase, readonlyPanel, _l ){ /* ============================================================================= TODO: diff --git a/static/scripts/mvc/history/current-history-panel.js b/static/scripts/mvc/history/current-history-panel.js index 490a20a1fbf..b20a7084114 100644 --- a/static/scripts/mvc/history/current-history-panel.js +++ b/static/scripts/mvc/history/current-history-panel.js @@ -1,8 +1,9 @@ define([ "mvc/dataset/hda-edit", "mvc/history/history-panel", - "mvc/base-mvc" -], function( hdaEdit, hpanel, baseMVC ){ + "mvc/base-mvc", + "utils/localization" +], function( hdaEdit, hpanel, baseMVC, _l ){ // ============================================================================ /** session storage for history panel preferences (and to maintain state) */ diff --git a/static/scripts/mvc/history/history-model.js b/static/scripts/mvc/history/history-model.js index 0b09f02f9fe..0921d17db59 100644 --- a/static/scripts/mvc/history/history-model.js +++ b/static/scripts/mvc/history/history-model.js @@ -1,7 +1,8 @@ define([ "mvc/dataset/hda-model", - "mvc/base-mvc" -], function( hdaModel, baseMVC ){ + "mvc/base-mvc", + "utils/localization" +], function( hdaModel, baseMVC, _l ){ //============================================================================== /** @class Model for a Galaxy history resource - both a record of user * tool use and a collection of the datasets those tools produced. diff --git a/static/scripts/mvc/history/history-panel.js b/static/scripts/mvc/history/history-panel.js index 77cc702a4a3..c858f969823 100644 --- a/static/scripts/mvc/history/history-panel.js +++ b/static/scripts/mvc/history/history-panel.js @@ -3,8 +3,9 @@ define([ "mvc/dataset/hda-edit", "mvc/history/readonly-history-panel", "mvc/tags", - "mvc/annotations" -], function( hdaModel, hdaEdit, readonlyPanel, tagsMod, annotationsMod ){ + "mvc/annotations", + "utils/localization" +], function( hdaModel, hdaEdit, readonlyPanel, tagsMod, annotationsMod, _l ){ /* ============================================================================= TODO: diff --git a/static/scripts/mvc/history/readonly-history-panel.js b/static/scripts/mvc/history/readonly-history-panel.js index 11d8249fe0b..e598c8c0a47 100644 --- a/static/scripts/mvc/history/readonly-history-panel.js +++ b/static/scripts/mvc/history/readonly-history-panel.js @@ -2,8 +2,9 @@ define([ "mvc/history/history-model", "mvc/dataset/hda-base", "mvc/user/user-model", - "mvc/base-mvc" -], function( historyModel, hdaBase, userModel, baseMVC ){ + "mvc/base-mvc", + "utils/localization" +], function( historyModel, hdaBase, userModel, baseMVC, _l ){ // ============================================================================ /** session storage for individual history preferences */ var HistoryPrefs = baseMVC.SessionStorageModel.extend({ diff --git a/static/scripts/mvc/user/user-model.js b/static/scripts/mvc/user/user-model.js index ebeb1479b0f..9ea75a1bb93 100644 --- a/static/scripts/mvc/user/user-model.js +++ b/static/scripts/mvc/user/user-model.js @@ -1,6 +1,7 @@ define([ - "mvc/base-mvc" -], function( baseMVC ){ + "mvc/base-mvc", + "utils/localization" +], function( baseMVC, _l ){ //============================================================================== /** @class Model for a Galaxy user (including anonymous users). * @name User diff --git a/static/scripts/mvc/user/user-quotameter.js b/static/scripts/mvc/user/user-quotameter.js index c2095cc8873..c5a6e7e43a8 100644 --- a/static/scripts/mvc/user/user-quotameter.js +++ b/static/scripts/mvc/user/user-quotameter.js @@ -1,6 +1,7 @@ define([ - "mvc/base-mvc" -], function( baseMVC ){ + "mvc/base-mvc", + "utils/localization" +], function( baseMVC, _l ){ //============================================================================== /** @class View to display a user's disk/storage usage * either as a progress bar representing the percentage of a quota used diff --git a/static/scripts/nls/ja/locale.js b/static/scripts/nls/ja/locale.js new file mode 100644 index 00000000000..9ea9f75015a --- /dev/null +++ b/static/scripts/nls/ja/locale.js @@ -0,0 +1,389 @@ +/** ja localization */ +define({ + +// templates/history/options.mako:24 +"Are you sure you want to delete the current history?" : +"現在のヒストリーを消すことに同意しますか?", + +// templates/root/history.mako:38 +"collapse all" : +"すべてをおりたたむ", + +// templates/dataset/edit_attributes.mako:2 +"History Item Attributes" : +"ヒストリーアイテム変数", + +// templates/dataset/edit_attributes.mako:19 +"Edit Attributes" : +"変数を編集する", + +// templates/dataset/edit_attributes.mako:64 +"This will inspect the dataset and attempt to correct the above column values if they are not accurate." : +"これはデータセットを調査して上記のカラムの値を修正することを試みます。", + +// templates/dataset/edit_attributes.mako:68 +"Required metadata values are missing. Some of these values may not be editable by the user. Selecting \"Auto-detect\" will attempt to fix these values." : +"必要なメタデータの値が不明です。それらのいくつかの値はユーザによって編集可能にはなっていません。「自動判定」を選択するとそれらの値をただしくできるかもしれません。", + +// templates/dataset/edit_attributes.mako:78 +"Convert to new format" : +"新しいフォーマットに変換する", + +// templates/dataset/edit_attributes.mako:84 +"Convert to" : +"変換する", + +// templates/dataset/edit_attributes.mako:95 +"This will create a new dataset with the contents of this dataset converted to a new format." : +"新しいフォーマットに変換したデータセットを新規作成します。", + +// templates/dataset/edit_attributes.mako:111 +"Change data type" : +"データタイプを変更する", + +// templates/dataset/edit_attributes.mako:117 +"New Type" : +"新しいタイプ", + +// templates/dataset/edit_attributes.mako:124 +"This will change the datatype of the existing dataset but not modify its contents. Use this if Galaxy has incorrectly guessed the type of your dataset." : +"これは既存のデータセットのデータタイプを変更します。しかしデータセットの中身は変更しません。データセットのタイプの誤判定があったときに使用します。", + +// templates/dataset/edit_attributes.mako:137 +"Copy History Item" : +"ヒストリーアイテムをコピーする", + +// templates/history/list.mako:3 +"Your saved histories" : +"保存したヒストリー", + +// templates/history/list.mako:19 +"Stored Histories" : +"格納してあるヒストリー", + +// templates/history/list.mako:21 templates/root/history.mako:239 +"hide deleted" : +"削除したヒストリーを隠す", + +// templates/history/list.mako:23 +"show deleted" : +"削除したヒストリーを表示する", + +// templates/history/list.mako:27 +"Name" : +"名前", + +// templates/history/list.mako:27 +"Size" : +"サイズ", + +// templates/history/list.mako:27 +"Last modified" : +"最終更新日", + +// templates/history/list.mako:27 +"Actions" : +"操作", + +// templates/history/list.mako:45 +"rename" : +"名称変更する", + +// templates/history/list.mako:46 +"switch to" : +"変更する", + +// templates/history/list.mako:47 +"delete" : +"削除する", + +// templates/history/list.mako:49 +"undelete" : +"削除から戻す", + +// templates/history/list.mako:55 +"Action" : +"操作", + +// templates/history/list.mako:56 templates/history/options.mako:21 +"Share" : +"共有", + +// templates/history/list.mako:56 templates/history/options.mako:15 +"Rename" : +"名称変更する", + +// templates/history/list.mako:56 templates/history/options.mako:24 +"Delete" : +"削除する", + +// templates/history/list.mako:58 +"Undelete" : +"削除から戻す", + +// templates/history/list.mako:65 +"You have no stored histories" : +"保管してあるヒストリーはありません", + +// templates/history/options.mako:5 +"History Options" : +"ヒストリーオプション", + +// templates/history/options.mako:9 +"You must be " : +"あなたは", + +// templates/history/options.mako:9 +"logged in" : +"ログイン", + +// templates/history/options.mako:9 +" to store or switch histories." : +"しないとヒストリーの保管や変更ができません。", + +// templates/history/options.mako:15 +// python-format +" current history (stored as \"%s\")" : +" 現在のヒストリー(\"%s\" として保管されています)", + +// templates/history/options.mako:16 +"List" : +"リストする", + +// templates/history/options.mako:16 +" previously stored histories" : +" 以前に保管したヒストリー", + +// templates/history/options.mako:18 +"Create" : +"作成する", + +// templates/history/options.mako:18 +" a new empty history" : +" 新規ヒストリー", + +// templates/history/options.mako:20 +"Construct workflow" : +"ワークフローを構築する", + +// templates/history/options.mako:20 +" from the current history" : +" 現在のヒストリーから", + +// templates/history/options.mako:21 templates/history/options.mako:24 +" current history" : +" 現在のヒストリー", + +// templates/history/options.mako:23 +"Show deleted" : +"削除したヒストリーを表示する", + +// templates/history/options.mako:23 +" datasets in history" : +" ヒストリーのデータセット", + +// templates/history/rename.mako:3 templates/history/rename.mako:6 +"Rename History" : +"ヒストリーの名称変更をする", + + +"Rename Histories" : +"名称変更する", + +"Perform Action" : +"操作を実行する", + +"Submit" : +"登録する", + + + +// templates/history/rename.mako:10 +"Current Name" : +"現在の名称", + +// templates/history/rename.mako:10 +"New Name" : +"新しい名称", + +// templates/history/share.mako:3 +"Share histories" : +"ヒストリーを共有する", + +// templates/history/share.mako:6 +"Share Histories" : +"ヒストリーを共有する", + +// templates/history/share.mako:9 +"History Name:" : +"ヒストリー名", + +// templates/history/share.mako:9 +"Number of Datasets:" : +"データセット数", + +// templates/history/share.mako:9 +"Share Link" : +"共有リンク", + +// templates/history/share.mako:15 +"This history contains no data." : +"このヒストリーにはデータがありません。", + +// templates/history/share.mako:21 +"copy link to share" : +"共有リンクをコピーする", + +// templates/history/share.mako:24 +"Email of User to share with:" : +"共有したいユーザのEメール:", +//"つぎのヒストリーを共有するユーザのEメールアドレス:" + +// templates/root/history.mako:7 +"Galaxy History" : +"Galaxy ヒストリー", + +// templates/root/history.mako:237 +"refresh" : +"リフレッシュ", + +// templates/root/history.mako:245 +"You are currently viewing a deleted history!" : +"消去したヒストリーをみています。", + +// templates/root/history.mako:289 +"Your history is empty. Click 'Get Data' on the left pane to start" : +"ヒストリーは空です。解析をはじめるには、左パネルの 'データ取得' をクリック", + +// templates/root/history_common.mako:41 +"Job is waiting to run" : +"ジョブは実行待ちです", + +// templates/root/history_common.mako:43 +"Job is currently running" : +"ジョブは実行中です", + +// templates/root/history_common.mako:46 +"An error occurred running this job: " : +"このジョブの実行中に発生したエラー: ", + +// templates/root/history_common.mako:47 +"report this error" : +"このエラーを報告する", + +// templates/root/history_common.mako:54 +"No data: " : +"データ無し: ", + +// templates/root/history_common.mako:58 +"format: " : +"フォーマット: ", + +// templates/root/history_common.mako:59 +"database: " : +"データベース: ", + +// templates/root/history_common.mako:66 templates/root/masthead.mako:20 +"Info: " : +"情報: ", + +// templates/root/history_common.mako:85 +// python-format +"Error: unknown dataset state \"%s\"." : +"エラー: 不明なデータ状態 \"%s\"。", + +// templates/root/index.mako:32 +"Options" : +"オプション", + +// templates/root/index.mako:34 +"History" : +"ヒストリー", + +// templates/root/masthead.mako:20 +"report bugs" : +"バグを報告する", + +// templates/root/masthead.mako:21 +"wiki" : +"wiki", + +// templates/root/masthead.mako:22 +"screencasts" : +"スクリーンキャスト", + +// templates/root/masthead.mako:23 +"blog" : +"ブログ", + +// templates/root/masthead.mako:31 +// python-format +"Logged in as %s: " : +"%s としてログイン中: ", + +// templates/root/masthead.mako:31 +"manage" : +"管理", + +// templates/root/masthead.mako:32 +"logout" : +"ログアウト", + +// templates/root/masthead.mako:34 +"Account: " : +"アカウント: ", + +// templates/root/masthead.mako:34 +"create" : +"作成", + +// templates/root/masthead.mako:35 +"login" : +"ログイン", + +// templates/root/tool_menu.mako:52 +"Galaxy Tools" : +"Galaxy ツール群", + +// templates/root/tool_menu.mako:129 +"Workflow" : +"ワークフロー", + +// templates/root/tool_menu.mako:134 +"Manage" : +"管理", + +// templates/root/tool_menu.mako:134 +"workflows" : +"ワークフロー", + +// templates/user/index.mako:2 templates/user/index.mako:4 +"Account settings" : +"アカウント設定", + +// templates/user/index.mako:7 +// python-format +"You are currently logged in as %s." : +"%s としてログイン中。", + +// templates/user/index.mako:9 +"Change your password" : +"パスワード変更", + +// templates/user/index.mako:10 +"Update your email address" : +"メールアドレス変更", + +// templates/user/index.mako:11 +"Logout" : +"ログアウト", + +// templates/user/index.mako:16 +"Login" : +"ログイン", + +// templates/user/index.mako:17 +"Create new account" : +"新規アカウントを作成する" + +}) diff --git a/static/scripts/nls/locale.js b/static/scripts/nls/locale.js new file mode 100644 index 00000000000..985689e026c --- /dev/null +++ b/static/scripts/nls/locale.js @@ -0,0 +1,517 @@ +/** en/main localization hash - for use with requirejs' i18n plugin */ +define({ + root : { +// ---------------------------------------------------------------------------- localized +"history" : +false, + +// templates/history/options.mako:24 +"Are you sure you want to delete the current history?" : +false, + +// templates/root/history.mako:38 +"collapse all" : +false, + +// templates/dataset/edit_attributes.mako:2 +"History Item Attributes" : +false, + +// templates/dataset/edit_attributes.mako:19 +"Edit Attributes" : +false, + +// templates/dataset/edit_attributes.mako:64 +"This will inspect the dataset and attempt to correct the above column values if they are not accurate." : +false, + +// templates/dataset/edit_attributes.mako:68 +"Required metadata values are missing. Some of these values may not be editable by the user. Selecting \"Auto-detect\" will attempt to fix these values." : +false, + +// templates/dataset/edit_attributes.mako:78 +"Convert to new format" : +false, + +// templates/dataset/edit_attributes.mako:84 +"Convert to" : +false, + +// templates/dataset/edit_attributes.mako:95 +"This will create a new dataset with the contents of this dataset converted to a new format." : +false, + +// templates/dataset/edit_attributes.mako:111 +"Change data type" : +false, + +// templates/dataset/edit_attributes.mako:117 +"New Type" : +false, + +// templates/dataset/edit_attributes.mako:124 +"This will change the datatype of the existing dataset but not modify its contents. Use this if Galaxy has incorrectly guessed the type of your dataset." : +false, + +// templates/dataset/edit_attributes.mako:137 +"Copy History Item" : +false, + +// templates/history/list.mako:3 +"Your saved histories" : +false, + +// templates/history/list.mako:19 +"Stored Histories" : +false, + +// templates/history/list.mako:21 templates/root/history.mako:239 +"hide deleted" : +false, + +// templates/history/list.mako:23 +"show deleted" : +false, + +// templates/history/list.mako:27 +"Name" : +false, + +// templates/history/list.mako:27 +"Size" : +false, + +// templates/history/list.mako:27 +"Last modified" : +false, + +// templates/history/list.mako:27 +"Actions" : +false, + +// templates/history/list.mako:45 +"rename" : +false, + +// templates/history/list.mako:46 +"switch to" : +false, + +// templates/history/list.mako:47 +"delete" : +false, + +// templates/history/list.mako:49 +"undelete" : +false, + +// templates/history/list.mako:55 +"Action" : +false, + +// templates/history/list.mako:56 templates/history/options.mako:21 +"Share" : +false, + +// templates/history/list.mako:56 templates/history/options.mako:15 +"Rename" : +false, + +// templates/history/list.mako:56 templates/history/options.mako:24 +"Delete" : +false, + +// templates/history/list.mako:58 +"Undelete" : +false, + +// templates/history/list.mako:65 +"You have no stored histories" : +false, + +// templates/history/options.mako:5 +"History Options" : +false, + +// templates/history/options.mako:9 +"You must be " : +false, + +// templates/history/options.mako:9 +"logged in" : +false, + +// templates/history/options.mako:9 +" to store or switch histories." : +false, + +// templates/history/options.mako:15 +// python-format +" current history (stored as \"%s\")" : +false, + +// templates/history/options.mako:16 +"List" : +false, + +// templates/history/options.mako:16 +" previously stored histories" : +false, + +// templates/history/options.mako:18 +"Create" : +false, + +// templates/history/options.mako:18 +" a new empty history" : +false, + +// templates/history/options.mako:20 +"Construct workflow" : +false, + +// templates/history/options.mako:20 +" from the current history" : +false, + +// templates/history/options.mako:21 templates/history/options.mako:24 +" current history" : +false, + +// templates/history/options.mako:23 +"Show deleted" : +false, + +// templates/history/options.mako:23 +" datasets in history" : +false, + +// templates/history/rename.mako:3 templates/history/rename.mako:6 +"Rename History" : +false, + + +"Rename Histories" : +false, + +"Perform Action" : +false, + +"Submit" : +false, + +// templates/history/rename.mako:10 +"Current Name" : +false, + +// templates/history/rename.mako:10 +"New Name" : +false, + +// templates/history/share.mako:3 +"Share histories" : +false, + +// templates/history/share.mako:6 +"Share Histories" : +false, + +// templates/history/share.mako:9 +"History Name:" : +false, + +// templates/history/share.mako:9 +"Number of Datasets:" : +false, + +// templates/history/share.mako:9 +"Share Link" : +false, + +// templates/history/share.mako:15 +"This history contains no data." : +false, + +// templates/history/share.mako:21 +"copy link to share" : +false, + +// templates/history/share.mako:24 +"Email of User to share with:" : +false, + +// templates/root/history.mako:7 +"Galaxy History" : +false, + +// templates/root/history.mako:237 +"refresh" : +false, + +// templates/root/history.mako:245 +"You are currently viewing a deleted history!" : +false, + +// templates/root/history.mako:289 +"Your history is empty. Click 'Get Data' on the left pane to start" : +false, + +// templates/root/history_common.mako:41 +"Job is waiting to run" : +false, + +// templates/root/history_common.mako:43 +"Job is currently running" : +false, + +// templates/root/history_common.mako:46 +"An error occurred running this job: " : +false, + +// templates/root/history_common.mako:47 +"report this error" : +false, + +// templates/root/history_common.mako:54 +"No data: " : +false, + +// templates/root/history_common.mako:58 +"format: " : +false, + +// templates/root/history_common.mako:59 +"database: " : +false, + +// templates/root/history_common.mako:66 templates/root/masthead.mako:20 +"Info: " : +false, + +// templates/root/history_common.mako:85 +// python-format +"Error: unknown dataset state \"%s\"." : +false, + +// templates/root/index.mako:32 +"Options" : +false, + +// templates/root/index.mako:34 +"History" : +false, + +// templates/root/masthead.mako:20 +"report bugs" : +false, + +// templates/root/masthead.mako:21 +"wiki" : +false, + +// templates/root/masthead.mako:22 +"screencasts" : +false, + +// templates/root/masthead.mako:23 +"blog" : +false, + +// templates/root/masthead.mako:31 +// python-format +"Logged in as %s: " : +false, + +// templates/root/masthead.mako:31 +"manage" : +false, + +// templates/root/masthead.mako:32 +"logout" : +false, + +// templates/root/masthead.mako:34 +"Account: " : +false, + +// templates/root/masthead.mako:34 +"create" : +false, + +// templates/root/masthead.mako:35 +"login" : +false, + +// templates/root/tool_menu.mako:52 +"Galaxy Tools" : +false, + +// templates/root/tool_menu.mako:129 +"Workflow" : +false, + +// templates/root/tool_menu.mako:134 +"Manage" : +false, + +// templates/root/tool_menu.mako:134 +"workflows" : +false, + +// templates/user/index.mako:2 templates/user/index.mako:4 +"Account settings" : +false, + +// templates/user/index.mako:7 +// python-format +"You are currently logged in as %s." : +false, + +// templates/user/index.mako:9 +"Change your password" : +false, + +// templates/user/index.mako:10 +"Update your email address" : +false, + +// templates/user/index.mako:11 +"Logout" : +false, + +// templates/user/index.mako:16 +"Login" : +false, + +// templates/user/index.mako:17 +"Create new account" : +false, + + +// ---------------------------------------------------------------------------- need to be localized +"anonymous user" : +false, + +"Using " : +false, + +"There was an error getting the data for this dataset" : +false, + +"This dataset has been deleted and removed from disk." : +false, + +"This dataset has been deleted." : +false, + +"This dataset has been hidden." : +false, + +"format" : +false, + +"database" : +false, + +"This history is empty" : +false, + +"No matching datasets found" : +false, + +"You are over your disk quota." : +false, + +"Tool execution is on hold until your disk usage drops below your allocated quota." : +false, + +"All" : +false, + +"None" : +false, + +"For all selected" : +false, + +"This history is empty. Click 'Get Data' on the left tool menu to start" : +false, + +"Include Deleted Datasets" : +false, + +"Include Hidden Datasets" : +false, + +"Edit history tags" : +false, + +"Edit history Annotation" : +false, + +"Operations on multiple datasets" : +false, + +"Search datasets" : +false, + +"clear search (esc)" : +false, + +"loading..." : +false, + +"Hide datasets" : +false, + +"Unhide datasets" : +false, + +"Delete datasets" : +false, + +"Undelete datasets" : +false, + +"Permanently delete datasets" : +false, + +"Click to rename history" : +false, + +"View data" : +false, + +"Edit attributes" : +false, + +"View details" : +false, + +"Run this job again" : +false, + +"Edit dataset tags" : +false, + +"Edit dataset annotation" : +false, + +" Click here to undelete it or here to immediately remove it from disk" : +false, + +" Click here to unhide it" : +false, + +"Download" : +false, + +"Visualize" : +false + + +// ---------------------------------------------------------------------------- +}, + 'ja' : true, + 'zh' : true +}); diff --git a/static/scripts/nls/zh/locale.js b/static/scripts/nls/zh/locale.js new file mode 100644 index 00000000000..6858f039c64 --- /dev/null +++ b/static/scripts/nls/zh/locale.js @@ -0,0 +1,570 @@ +/** zh localization */ +define({ + +// templates/base_panels.mako:5 +"Galaxy" : +"Galaxy", + +// templates/history/options.mako:24 +"Are you sure you want to delete the current history?" : +"确认要删除当前的历史记录吗?", + +// templates/root/history.mako:38 +"collapse all" : +"全部收缩", + +// templates/root/index.mako:5 +"Tools" : +"工具", + + +// tools/**.xml +"Get Data" : +"获取数据", + +"Get ENCODE Data" : +"获取ENCODE数据", + +"ENCODE Tools" : +"ENCODE工具", + +"Lift-Over" : +"版本转换", + +"Text Manipulation" : +"文本操作", + +"Filter and Sort" : +"过滤和排序", + +"Join, Subtract and Group" : +"结合,差集与分组", + +"Convert Formats" : +"格式转换", + +"Extract Features" : +"特征提取", + +"Fetch Sequences" : +"获取序列", + +"Fetch Alignments" : +"获取比对上的序列", + +"Get Genomic Scores" : +"获得基因组分数", + +"Operate on Genomic Intervals" : +"基因组区间操作", + +"Statistics" : +"统计量", + +"Graph/Display Data" : +"图形/数据", + +"Regional Variation" : +"区域多态性", + +"Evolution: HyPhy" : +"进化: HyPhy", + +"Taxonomy manipulation" : +"分类处理", + +"Solexa tools" : +"Solexa工具", + +"FASTA manipulation" : +"FASTA处理", + +"Short Read QC and Manipulation" : +"短片段数据质量控制及处理", + +"Short Read Mapping" : +"短片段回贴", + + +// templates/admin_main.mako:3 templates/admin_main.mako:8 +"Galaxy Administration" : +"Galaxy 管理", + +// templates/admin_main.mako:17 +"Admin password: " : +"管理员密码: ", + +// templates/admin_main.mako:19 +"Reload tool: " : +"重新载入工具", + +// templates/admin_main.mako:35 +"Reload" : +"重新载入", + +// templates/dataset/edit_attributes.mako:2 +"History Item Attributes" : +"历史项目属性", + +// templates/dataset/edit_attributes.mako:19 +"Edit attributes" : +"编辑属性", + +// templates/dataset/edit_attributes.mako:64 +"This will inspect the dataset and attempt to correct the above column values if they are not accurate." : +"数据集检查,若有错误,更正上述栏中的值。", + +// templates/dataset/edit_attributes.mako:68 +"Required metadata values are missing. Some of these values may not be editable by the user. Selecting \"Auto-detect\" will attempt to fix these values." : +"缺少所需的metadata的值。用户可能无法对这些值进行编辑。选择“自动检测”来尝试修正这些值。", + +// templates/dataset/edit_attributes.mako:78 +"Convert to new format" : +"转换为新格式", + +// templates/dataset/edit_attributes.mako:84 +"Convert to" : +"转换为", + +// templates/dataset/edit_attributes.mako:95 +"This will create a new dataset with the contents of this dataset converted to a new format." : +"这将产生一个转换格式后的新数据集,", + +// templates/dataset/edit_attributes.mako:111 +"Change data type" : +"改变数据类型", + +// templates/dataset/edit_attributes.mako:117 +"New Type" : +"新类型", + +// templates/dataset/edit_attributes.mako:124 +"This will change the datatype of the existing dataset but not modify its contents. Use this if Galaxy has incorrectly guessed the type of your dataset." : +"这将改变已有数据集的数据类型,但不改变其内容。当Galaxy不能正确判断你的数据类型时,设置该参数。", + +// templates/dataset/edit_attributes.mako:137 +"Copy History Item" : +"复制历史记录项", + +// templates/history/list.mako:3 +"Saved Histories" : +"已保存的历史", + + +// templates/history/list.mako:21 templates/root/history.mako:239 +"hide deleted" : +"隐藏已删除的数据", + +// templates/history/list.mako:23 +"show deleted" : +"显示已删除的数据", + +// templates/history/list.mako:27 +"Name" : +"名称", + +// templates/history/list.mako:27 +"Size" : +"大小", + +// templates/history/list.mako:27 +"Last modified" : +"最后修改时间", + +// templates/history/list.mako:27 +"Actions" : +"操作", + +// templates/history/list.mako:45 +"rename" : +"重命名", + +// templates/history/list.mako:46 +"switch to" : +"切换到", + +// templates/history/list.mako:47 +"delete" : +"删除", + +// templates/history/list.mako:49 +"undelete" : +"还原", + +// templates/history/list.mako:55 +"Action" : +"操作", + +// templates/history/list.mako:56 templates/history/options.mako:21 +"Share" : +"共享", + +// templates/history/list.mako:56 templates/history/options.mako:15 +"Rename" : +"重命名", + +// templates/history/list.mako:56 templates/history/options.mako:24 +"Delete" : +"删除", + +// templates/history/list.mako:58 +"Undelete" : +"还原", + +// templates/history/list.mako:65 +"You have no stored histories" : +"没有存储的历史记录", + +// templates/history/options.mako:5 +"History Options" : +"历史记录选项", + +// templates/history/options.mako:9 +"You must be " : +"你必须成为", + +// templates/history/options.mako:9 +"logged in" : +"登录", + +// templates/history/options.mako:9 +" to store or switch histories." : +"以存储或切换历史记录", + +// templates/history/options.mako:15 +// python-format +" current history (stored as \"%s\")" : +" 当前历史(以\"%s\"形式存储)", + +// templates/history/options.mako:16 +"List" : +"列表", + +// templates/history/options.mako:16 +" previously stored histories" : +" 以前存储的历史记录", + +// templates/history/options.mako:18 +"Create" : +"创建", + +// templates/history/options.mako:18 +" a new empty history" : +" 一个新的空白历史记录", + +// templates/history/options.mako:20 +"Construct workflow" : +"构建工作流程", + +// templates/history/options.mako:20 +" from the current history" : +" 来源于当前历史", + +// templates/history/options.mako:21 templates/history/options.mako:24 +" current history" : +" 当前历史", + +// templates/history/options.mako:23 +"Show deleted" : +"显示已删除", + +// templates/history/options.mako:23 +" datasets in history" : +" 历史中的数据集", + +// templates/history/rename.mako:3 templates/history/rename.mako:6 +"Rename History" : +"重命名历史", + + +"Rename Histories" : +"重命名历史记录", + +"Perform Action" : +"运行操作", + +"Submit" : +"提交", + + + +// templates/history/rename.mako:10 +"Current Name" : +"当前名称", + +// templates/history/rename.mako:10 +"New Name" : +"新名称", + +// templates/history/share.mako:3 +"Share histories" : +"共享历史记录", + +// templates/history/share.mako:6 +"Share Histories" : +"共享历史记录", + +// templates/history/share.mako:9 +"History Name:" : +"历史名称", + +// templates/history/share.mako:9 +"Number of Datasets:" : +"数据集数量", + +// templates/history/share.mako:9 +"Share Link" : +"共享链接", + +// templates/history/share.mako:15 +"This history contains no data." : +"这项历史中没有数据", + +// templates/history/share.mako:21 +"copy link to share" : +"复制链接以共享", + +// templates/history/share.mako:24 +"Email of User to share with:" : +"发送到这些Email地址进行分享", + +// templates/root/history.mako:7 +"Galaxy History" : +"Galaxy 历史", + +// templates/root/history.mako:237 +"refresh" : +"刷新", + +// templates/root/history.mako:245 +"You are currently viewing a deleted history!" : +"正在查看已删除的历史", + +// templates/root/history.mako:289 +"Your history is empty. Click 'Get Data' on the left pane to start" : +"历史已空,请单击左边窗格中‘获取数据’", + +// templates/root/history_common.mako:41 +"Job is waiting to run" : +"等待运行的进程", + +// templates/root/history_common.mako:43 +"Job is currently running" : +"正在运行的进程", + +// templates/root/history_common.mako:46 +"An error occurred running this job: " : +"进程运行时出错 ", + +// templates/root/history_common.mako:47 +"report this error" : +"报告错误", + +// templates/root/history_common.mako:54 +"No data: " : +"没有数据: ", + +// templates/root/history_common.mako:58 +"format: " : +"格式: ", + +// templates/root/history_common.mako:59 +"database: " : +"数据库: ", + +// templates/root/history_common.mako:66 templates/root/masthead.mako:20 +"Info: " : +"信息: ", + +// templates/root/history_common.mako:85 +// python-format +"Error: unknown dataset state \"%s\"." : +"错误:未知的数据集状态 \"%s\"。", + + +"Options" : +"选项", + +"History" : +"历史", + +// templates/root/masthead.mako:20 +"report bugs" : +"错误报告", + +// templates/root/masthead.mako:21 +"wiki" : +"wiki", + +// templates/root/masthead.mako:22 +"screencasts" : +"演示视频", + + +// templates/root/masthead.mako:23 +"blog" : +"博客", + +// templates/root/masthead.mako:31 +// python-format +"Logged in as %s: " : +"以%s的身份登录: ", + +// templates/root/masthead.mako:31 +"manage" : +"管理", + +// templates/root/masthead.mako:32 +"logout" : +"注销", + +// templates/root/masthead.mako:34 +"Account: " : +"帐户: ", + +// templates/root/masthead.mako:34 +"create" : +"创建", + +// templates/root/masthead.mako:35 +"login" : +"登录", + +// templates/root/tool_menu.mako:52 +"Galaxy Tools" : +"Galaxy 工具", + +// templates/root/tool_menu.mako:129 +"Workflow" : +"工作流程", + +// templates/root/tool_menu.mako:134 +"Manage" : +"管理", + +// templates/root/tool_menu.mako:134 +"workflows" : +"工作流程", + +// templates/user/index.mako:2 templates/user/index.mako:4 +"Account settings" : +"帐户设置", + +// templates/user/index.mako:7 +// python-format +"You are currently logged in as %s." : +"当前以%s的身份登录", + +// templates/user/index.mako:9 +"Change your password" : +"修改密码", + +// templates/user/index.mako:10 +"Update your email address" : +"更新电子邮件地址", + +// templates/user/index.mako:11 +"Logout" : +"注销", + +// templates/user/index.mako:16 +"Login" : +"登录", + +// templates/user/index.mako:17 +"Create new account" : +"创建新帐户", + +"Show Tool Search" : +"显示工具搜索", + +"Analyze Data" : +"分析数据", + +"analysis" : +"分析", + +"History Lists" : +"历史记录清单", + +"Histories Shared with Me" : +"共享的数据", + +"Current History" : +"当前历史记录", + +"Create New" : +"创建", + +"Clone" : +"复制", + +"Share or Publish" : +"共享或发布", + +"Extract Workflow" : +"提取工作流程", + +"Dataset Security" : +"数据安全性", + + +"Show Deleted Datasets" : +"显示已删除的数据", + +"Show Hidden Datasets" : +"显示隐藏的数据", + +"Show Structure" : +"显示结构", + +"Export to File" : +"导出为文件", + +"Other Actions" : +"其他", + +"Import from File" : +"导入文件", + +"Shared Data" : +"数据共享", + +"Data Libraries" : +"数据仓库", + +"Published Histories" : +"已发布的历史记录", + +"Published Workflows" : +"已发布的工作流程", + +"Published Pages" : +"已发布的页面", + +"Help" : +"帮助", + +"Email comments, bug reports, or suggestions" : +"发邮件进行意见反馈或错误报告", + + +"User" : +"用户", + + +"Register" : +"注册", + +"Support" : +"技术支持", + +"Galaxy Wiki" : +"Galaxy百科", + +"Video tutorials (screencasts)" : +"视频教程(动画演示)", + +"How to Cite Galaxy" : +"如何引用Galaxy", +}) diff --git a/static/scripts/packed/galaxy-app-base.js b/static/scripts/packed/galaxy-app-base.js index d537c8f2fae..fc97f9f2b1d 100644 --- a/static/scripts/packed/galaxy-app-base.js +++ b/static/scripts/packed/galaxy-app-base.js @@ -1 +1 @@ -define(["mvc/user/user-model","utils/metrics-logger","utils/add-logging"],function(a,c,e){function f(k){var j=this;return j._init(k||{})}e(f,"GalaxyApp");f.defaultOptions={root:"/"};f.prototype._init=function h(k){var j=this;j._initLogger(k.loggerOptions||{});j.debug("GalaxyApp.logger: ",j.logger);j._processOptions(k);j.debug("GalaxyApp.options: ",j.options);j.config=k.config||{};j.debug("GalaxyApp.config: ",j.config);j._initUser(k.userJSON||{});j.debug("GalaxyApp.user: ",j.user);return j};f.prototype._processOptions=function d(m){var l=this,n=f.defaultOptions;l.debug("_processOptions: ",m);l.options={};for(var j in n){if(n.hasOwnProperty(j)){l.options[j]=(m.hasOwnProperty(j))?(m[j]):(n[j])}}return l};f.prototype._initUser=function g(k){var j=this;j.debug("_initUser:",k);j.user=new a.User(k);return j};f.prototype._initLogger=function i(k){var j=this;j.debug("_initLogger:",k);j.logger=new c.MetricsLogger(k);return j};f.prototype.toString=function b(){var j=this.user.get("email")||"(anonymous)";return"GalaxyApp("+j+")"};return{GalaxyApp:f}}); \ No newline at end of file +define(["mvc/user/user-model","utils/metrics-logger","utils/add-logging","utils/localization"],function(a,c,f,d){function g(m){var l=this;return l._init(m||{})}f(g,"GalaxyApp");g.defaultOptions={root:"/"};g.prototype._init=function j(m){var l=this;l._processOptions(m);l.debug("GalaxyApp.options: ",l.options);l._initLogger(m.loggerOptions||{});l.debug("GalaxyApp.logger: ",l.logger);l._initLocale();l.debug("GalaxyApp.localize: ",l.localize);l.config=m.config||{};l.debug("GalaxyApp.config: ",l.config);l._initUser(m.userJSON||{});l.debug("GalaxyApp.user: ",l.user);return l};g.prototype._processOptions=function e(n){var m=this,o=g.defaultOptions;m.debug("_processOptions: ",n);m.options={};for(var l in o){if(o.hasOwnProperty(l)){m.options[l]=(n.hasOwnProperty(l))?(n[l]):(o[l])}}return m};g.prototype._initUser=function i(m){var l=this;l.debug("_initUser:",m);l.user=new a.User(m);return l};g.prototype._initLogger=function k(m){var l=this;l.debug("_initLogger:",m);l.logger=new c.MetricsLogger(m);return l};g.prototype._initLocale=function h(m){var l=this;l.debug("_initLocale:",m);l.localize=d;window._l=l.localize;return l};g.prototype.toString=function b(){var l=this.user.get("email")||"(anonymous)";return"GalaxyApp("+l+")"};return{GalaxyApp:g}}); \ No newline at end of file diff --git a/static/scripts/packed/i18n.js b/static/scripts/packed/i18n.js new file mode 100644 index 00000000000..f79844120c2 --- /dev/null +++ b/static/scripts/packed/i18n.js @@ -0,0 +1 @@ +(function(){var a=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;function d(e,h,g,f,i,j){if(h[e]){g.push(e);if(h[e]===true||h[e]===1){f.push(i+e+"/"+j)}}}function c(g,e,f,h,i){var j=h+e+"/"+i;if(require._fileExists(g.toUrl(j+".js"))){f.push(j)}}function b(g,f,e){var h;for(h in f){if(f.hasOwnProperty(h)&&(!g.hasOwnProperty(h)||e)){g[h]=f[h]}else{if(typeof f[h]==="object"){if(!g[h]&&f[h]){g[h]={}}b(g[h],f[h],e)}}}}define(["module"],function(e){var f=e.config?e.config():{};return{version:"2.0.4",load:function(g,s,r,k){k=k||{};if(k.locale){f.locale=k.locale}var q,n=a.exec(g),o=n[1],t=n[4],v=n[5],l=t.split("-"),h=[],u={},m,j,p="";if(n[5]){o=n[1];q=o+v}else{q=g;v=n[4];t=f.locale;if(!t){t=f.locale=typeof navigator==="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()}l=t.split("-")}if(k.isBuild){h.push(q);c(s,"root",h,o,v);for(m=0;m-1&&w[A];A--){z=w[A];y=x[z];if(y===true||y===1){y=s(o+z+"/"+v)}b(u,y)}r(u)})})}}}})}()); \ No newline at end of file diff --git a/static/scripts/packed/mvc/dataset/hda-base.js b/static/scripts/packed/mvc/dataset/hda-base.js index 41b9e62aae5..0b2a97b039d 100644 --- a/static/scripts/packed/mvc/dataset/hda-base.js +++ b/static/scripts/packed/mvc/dataset/hda-base.js @@ -1 +1 @@ -define(["mvc/dataset/hda-model","mvc/base-mvc"],function(d,b){var c=Backbone.View.extend(b.LoggableMixin).extend({tagName:"div",className:"dataset hda history-panel-hda",id:function(){return"hda-"+this.model.get("id")},fxSpeed:"fast",initialize:function(f){if(f.logger){this.logger=this.model.logger=f.logger}this.log(this+".initialize:",f);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];this.linkTarget=f.linkTarget||"_blank";this.selectable=f.selectable||false;this.selected=f.selected||false;this.expanded=f.expanded||false;this.draggable=f.draggable||false;this._setUpListeners()},_setUpListeners:function(){this.model.on("change",function(g,f){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this)},render:function(h){h=(h===undefined)?(true):(h);var f=this;this.$el.find("[title]").tooltip("destroy");this.urls=this.model.urls();var g=this._buildNewRender();if(h){$(f).queue(function(i){this.$el.fadeOut(f.fxSpeed,i)})}$(f).queue(function(i){this.$el.empty().attr("class",f.className).addClass("state-"+f.model.get("state")).append(g.children());if(this.selectable){this.showSelector(0)}i()});if(h){$(f).queue(function(i){this.$el.fadeIn(f.fxSpeed,i)})}$(f).queue(function(i){this.trigger("rendered",f);if(this.model.inReadyState()){this.trigger("rendered:ready",f)}if(this.draggable){this.draggableOn()}i()});return this},_buildNewRender:function(){var f=$(c.templates.skeleton(this.model.toJSON()));f.find(".dataset-primary-actions").append(this._render_titleButtons());f.children(".dataset-body").replaceWith(this._render_body());this._setUpBehaviors(f);return f},_setUpBehaviors:function(f){f=f||this.$el;make_popup_menus(f);f.find("[title]").tooltip({placement:"bottom"})},_render_titleButtons:function(){return[this._render_displayButton()]},_render_displayButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.DISCARDED)||(!this.model.get("accessible"))){return null}var g={target:this.linkTarget,classes:"dataset-display"};if(this.model.get("purged")){g.disabled=true;g.title=_l("Cannot display datasets removed from disk")}else{if(this.model.get("state")===d.HistoryDatasetAssociation.STATES.UPLOAD){g.disabled=true;g.title=_l("This dataset must finish uploading before it can be viewed")}else{if(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW){g.disabled=true;g.title=_l("This dataset is not yet viewable")}else{g.title=_l("View data");g.href=this.urls.display;var f=this;g.onclick=function(h){if(Galaxy.frame&&Galaxy.frame.active){Galaxy.frame.add({title:"Data Viewer: "+f.model.get("name"),type:"url",content:f.urls.display});h.preventDefault()}}}}}g.faIcon="fa-eye";return faIconButton(g)},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var g=this.urls,h=this.model.get("meta_files");if(_.isEmpty(h)){return $(['','',""].join(""))}var i="dataset-"+this.model.get("id")+"-popup",f=['
','',_l("Download Dataset"),"",""+_l("Additional Files")+"",_.map(h,function(j){return['',_l("Download")," ",j.file_type,""].join("")}).join("\n"),"
",'
','','','','',"","
"].join("\n");return $(f)},_render_showParamsButton:function(){return faIconButton({title:_l("View details"),classes:"dataset-params-btn",href:this.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle"})},_render_body:function(){var g=$('
Error: unknown dataset state "'+this.model.get("state")+'".
'),f=this["_render_body_"+this.model.get("state")];if(_.isFunction(f)){g=f.call(this)}this._setUpBehaviors(g);if(this.expanded){g.show()}return g},_render_stateBodyHelper:function(f,i){i=i||[];var g=this,h=$(c.templates.body(_.extend(this.model.toJSON(),{body:f})));h.find(".dataset-actions .left").append(_.map(i,function(j){return j.call(g)}));return h},_render_body_new:function(){return this._render_stateBodyHelper("
"+_l("This is a new dataset and not all of its data are available yet")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_noPermission:function(){return this._render_stateBodyHelper("
"+_l("You do not have permission to view this dataset")+"
")},_render_body_discarded:function(){return this._render_stateBodyHelper("
"+_l("The job creating this dataset was cancelled before completion")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_queued:function(){return this._render_stateBodyHelper("
"+_l("This job is waiting to run")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_upload:function(){return this._render_stateBodyHelper("
"+_l("This dataset is currently uploading")+"
")},_render_body_setting_metadata:function(){return this._render_stateBodyHelper("
"+_l("Metadata is being auto-detected")+"
")},_render_body_running:function(){return this._render_stateBodyHelper("
"+_l("This job is currently running")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_paused:function(){return this._render_stateBodyHelper("
"+_l('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume')+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_error:function(){var f=['',_l("An error occurred with this dataset"),":",'
',$.trim(this.model.get("misc_info")),"
"].join("");if(!this.model.get("purged")){f="
"+this.model.get("misc_blurb")+"
"+f}return this._render_stateBodyHelper(f,[this._render_downloadButton].concat(this.defaultPrimaryActionButtonRenderers))},_render_body_empty:function(){return this._render_stateBodyHelper("
"+_l("No data")+": "+this.model.get("misc_blurb")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_failed_metadata:function(){var f=$('
').append($("").text(_l("An error occurred setting the metadata for this dataset"))),g=this._render_body_ok();g.prepend(f);return g},_render_body_ok:function(){var f=this,h=$(c.templates.body(this.model.toJSON())),g=[this._render_downloadButton].concat(this.defaultPrimaryActionButtonRenderers);h.find(".dataset-actions .left").append(_.map(g,function(i){return i.call(f)}));if(this.model.isDeletedOrPurged()){return h}return h},events:{"click .dataset-title-bar":"toggleBodyVisibility","keydown .dataset-title-bar":"toggleBodyVisibility","click .dataset-selector":"toggleSelect"},toggleBodyVisibility:function(i,g){var f=32,h=13;if(i&&(i.type==="keydown")&&!(i.keyCode===f||i.keyCode===h)){return true}var j=this.$el.find(".dataset-body");g=(g===undefined)?(!j.is(":visible")):(g);if(g){this.expandBody()}else{this.collapseBody()}return false},expandBody:function(){var f=this;function g(){f.$el.children(".dataset-body").replaceWith(f._render_body());f.$el.children(".dataset-body").slideDown(f.fxSpeed,function(){f.expanded=true;f.trigger("body-expanded",f.model.get("id"))})}if(this.model.inReadyState()&&!this.model.hasDetails()){this.model.fetch({silent:true}).always(function(h){f.urls=f.model.urls();g()})}else{g()}},collapseBody:function(){var f=this;this.$el.children(".dataset-body").slideUp(f.fxSpeed,function(){f.expanded=false;f.trigger("body-collapsed",f.model.get("id"))})},showSelector:function(){if(this.selected){this.select(null,true)}this.selectable=true;this.trigger("selectable",true,this);this.$(".dataset-primary-actions").hide();this.$(".dataset-selector").show()},hideSelector:function(){this.selectable=false;this.trigger("selectable",false,this);this.$(".dataset-selector").hide();this.$(".dataset-primary-actions").show()},toggleSelector:function(){if(!this.$el.find(".dataset-selector").is(":visible")){this.showSelector()}else{this.hideSelector()}},select:function(f){this.$el.find(".dataset-selector span").removeClass("fa-square-o").addClass("fa-check-square-o");if(!this.selected){this.trigger("selected",this);this.selected=true}return false},deselect:function(f){this.$el.find(".dataset-selector span").removeClass("fa-check-square-o").addClass("fa-square-o");if(this.selected){this.trigger("de-selected",this);this.selected=false}return false},toggleSelect:function(f){if(this.selected){this.deselect(f)}else{this.select(f)}},draggableOn:function(){this.draggable=true;this.dragStartHandler=_.bind(this._dragStartHandler,this);this.dragEndHandler=_.bind(this._dragEndHandler,this);var f=this.$el.find(".dataset-title-bar").attr("draggable",true).get(0);f.addEventListener("dragstart",this.dragStartHandler,false);f.addEventListener("dragend",this.dragEndHandler,false)},draggableOff:function(){this.draggable=false;var f=this.$el.find(".dataset-title-bar").attr("draggable",false).get(0);f.removeEventListener("dragstart",this.dragStartHandler,false);f.removeEventListener("dragend",this.dragEndHandler,false)},toggleDraggable:function(){if(this.draggable){this.draggableOff()}else{this.draggableOn()}},_dragStartHandler:function(f){this.trigger("dragstart",this);f.dataTransfer.effectAllowed="move";f.dataTransfer.setData("text",JSON.stringify(this.model.toJSON()));return false},_dragEndHandler:function(f){this.trigger("dragend",this);return false},remove:function(g){var f=this;this.$el.fadeOut(f.fxSpeed,function(){f.$el.remove();f.off();if(g){g()}})},toString:function(){var f=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+f+")"}});var a=['
','
',"<% if( hda.error ){ %>",'
',_l("There was an error getting the data for this dataset"),":<%- hda.error %>","
","<% } %>","<% if( hda.deleted ){ %>","<% if( hda.purged ){ %>",'
',_l("This dataset has been deleted and removed from disk."),"
","<% } else { %>",'
',_l("This dataset has been deleted."),"
","<% } %>","<% } %>","<% if( !hda.visible ){ %>",'
',_l("This dataset has been hidden."),"
","<% } %>","
",'
','',"
",'
','
','','
','<%- hda.hid %> ','<%- hda.name %>',"
","
",'
',"
"].join("");var e=['
',"<% if( hda.body ){ %>",'
',"<%= hda.body %>","
",'
','
','
',"
","<% } else { %>",'
',"<% if( hda.misc_blurb ){ %>",'
','<%- hda.misc_blurb %>',"
","<% } %>","<% if( hda.data_type ){ %>",'
','",'<%- hda.data_type %>',"
","<% } %>","<% if( hda.metadata_dbkey ){ %>",'
','",'',"<%- hda.metadata_dbkey %>","","
","<% } %>","<% if( hda.misc_info ){ %>",'
','<%- hda.misc_info %>',"
","<% } %>","
",'
','
','
',"
","<% if( !hda.deleted ){ %>",'
','
','
',"<% _.each( hda.display_apps, function( app ){ %>",'
','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
","<% }); %>","<% _.each( hda.display_types, function( app ){ %>",'
','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
","<% }); %>","
",'
',"<% if( hda.peek ){ %>",'
<%= hda.peek %>
',"<% } %>","
","<% } %>","<% } %>","
"].join("");c.templates={skeleton:function(f){return _.template(a,f,{variable:"hda"})},body:function(f){return _.template(e,f,{variable:"hda"})}};return{HDABaseView:c}}); \ No newline at end of file +define(["mvc/dataset/hda-model","mvc/base-mvc","utils/localization"],function(e,b,d){var c=Backbone.View.extend(b.LoggableMixin).extend({tagName:"div",className:"dataset hda history-panel-hda",id:function(){return"hda-"+this.model.get("id")},fxSpeed:"fast",initialize:function(g){if(g.logger){this.logger=this.model.logger=g.logger}this.log(this+".initialize:",g);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];this.linkTarget=g.linkTarget||"_blank";this.selectable=g.selectable||false;this.selected=g.selected||false;this.expanded=g.expanded||false;this.draggable=g.draggable||false;this._setUpListeners()},_setUpListeners:function(){this.model.on("change",function(h,g){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this)},render:function(i){i=(i===undefined)?(true):(i);var g=this;this.$el.find("[title]").tooltip("destroy");this.urls=this.model.urls();var h=this._buildNewRender();if(i){$(g).queue(function(j){this.$el.fadeOut(g.fxSpeed,j)})}$(g).queue(function(j){this.$el.empty().attr("class",g.className).addClass("state-"+g.model.get("state")).append(h.children());if(this.selectable){this.showSelector(0)}j()});if(i){$(g).queue(function(j){this.$el.fadeIn(g.fxSpeed,j)})}$(g).queue(function(j){this.trigger("rendered",g);if(this.model.inReadyState()){this.trigger("rendered:ready",g)}if(this.draggable){this.draggableOn()}j()});return this},_buildNewRender:function(){var g=$(c.templates.skeleton(this.model.toJSON()));g.find(".dataset-primary-actions").append(this._render_titleButtons());g.children(".dataset-body").replaceWith(this._render_body());this._setUpBehaviors(g);return g},_setUpBehaviors:function(g){g=g||this.$el;make_popup_menus(g);g.find("[title]").tooltip({placement:"bottom"})},_render_titleButtons:function(){return[this._render_displayButton()]},_render_displayButton:function(){if((this.model.get("state")===e.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===e.HistoryDatasetAssociation.STATES.DISCARDED)||(!this.model.get("accessible"))){return null}var h={target:this.linkTarget,classes:"dataset-display"};if(this.model.get("purged")){h.disabled=true;h.title=d("Cannot display datasets removed from disk")}else{if(this.model.get("state")===e.HistoryDatasetAssociation.STATES.UPLOAD){h.disabled=true;h.title=d("This dataset must finish uploading before it can be viewed")}else{if(this.model.get("state")===e.HistoryDatasetAssociation.STATES.NEW){h.disabled=true;h.title=d("This dataset is not yet viewable")}else{h.title=d("View data");h.href=this.urls.display;var g=this;h.onclick=function(i){if(Galaxy.frame&&Galaxy.frame.active){Galaxy.frame.add({title:"Data Viewer: "+g.model.get("name"),type:"url",content:g.urls.display});i.preventDefault()}}}}}h.faIcon="fa-eye";return faIconButton(h)},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var h=this.urls,i=this.model.get("meta_files");if(_.isEmpty(i)){return $(['','',""].join(""))}var j="dataset-"+this.model.get("id")+"-popup",g=['
','',d("Download Dataset"),"",""+d("Additional Files")+"",_.map(i,function(k){return['',d("Download")," ",k.file_type,""].join("")}).join("\n"),"
",'"].join("\n");return $(g)},_render_showParamsButton:function(){return faIconButton({title:d("View details"),classes:"dataset-params-btn",href:this.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle"})},_render_body:function(){var h=$('
Error: unknown dataset state "'+this.model.get("state")+'".
'),g=this["_render_body_"+this.model.get("state")];if(_.isFunction(g)){h=g.call(this)}this._setUpBehaviors(h);if(this.expanded){h.show()}return h},_render_stateBodyHelper:function(g,j){j=j||[];var h=this,i=$(c.templates.body(_.extend(this.model.toJSON(),{body:g})));i.find(".dataset-actions .left").append(_.map(j,function(k){return k.call(h)}));return i},_render_body_new:function(){return this._render_stateBodyHelper("
"+d("This is a new dataset and not all of its data are available yet")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_noPermission:function(){return this._render_stateBodyHelper("
"+d("You do not have permission to view this dataset")+"
")},_render_body_discarded:function(){return this._render_stateBodyHelper("
"+d("The job creating this dataset was cancelled before completion")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_queued:function(){return this._render_stateBodyHelper("
"+d("This job is waiting to run")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_upload:function(){return this._render_stateBodyHelper("
"+d("This dataset is currently uploading")+"
")},_render_body_setting_metadata:function(){return this._render_stateBodyHelper("
"+d("Metadata is being auto-detected")+"
")},_render_body_running:function(){return this._render_stateBodyHelper("
"+d("This job is currently running")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_paused:function(){return this._render_stateBodyHelper("
"+d('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume')+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_error:function(){var g=['',d("An error occurred with this dataset"),":",'
',$.trim(this.model.get("misc_info")),"
"].join("");if(!this.model.get("purged")){g="
"+this.model.get("misc_blurb")+"
"+g}return this._render_stateBodyHelper(g,[this._render_downloadButton].concat(this.defaultPrimaryActionButtonRenderers))},_render_body_empty:function(){return this._render_stateBodyHelper("
"+d("No data")+": "+this.model.get("misc_blurb")+"
",this.defaultPrimaryActionButtonRenderers)},_render_body_failed_metadata:function(){var g=$('
').append($("").text(d("An error occurred setting the metadata for this dataset"))),h=this._render_body_ok();h.prepend(g);return h},_render_body_ok:function(){var g=this,i=$(c.templates.body(this.model.toJSON())),h=[this._render_downloadButton].concat(this.defaultPrimaryActionButtonRenderers);i.find(".dataset-actions .left").append(_.map(h,function(j){return j.call(g)}));if(this.model.isDeletedOrPurged()){return i}return i},events:{"click .dataset-title-bar":"toggleBodyVisibility","keydown .dataset-title-bar":"toggleBodyVisibility","click .dataset-selector":"toggleSelect"},toggleBodyVisibility:function(j,h){var g=32,i=13;if(j&&(j.type==="keydown")&&!(j.keyCode===g||j.keyCode===i)){return true}var k=this.$el.find(".dataset-body");h=(h===undefined)?(!k.is(":visible")):(h);if(h){this.expandBody()}else{this.collapseBody()}return false},expandBody:function(){var g=this;function h(){g.$el.children(".dataset-body").replaceWith(g._render_body());g.$el.children(".dataset-body").slideDown(g.fxSpeed,function(){g.expanded=true;g.trigger("body-expanded",g.model.get("id"))})}if(this.model.inReadyState()&&!this.model.hasDetails()){this.model.fetch({silent:true}).always(function(i){g.urls=g.model.urls();h()})}else{h()}},collapseBody:function(){var g=this;this.$el.children(".dataset-body").slideUp(g.fxSpeed,function(){g.expanded=false;g.trigger("body-collapsed",g.model.get("id"))})},showSelector:function(){if(this.selected){this.select(null,true)}this.selectable=true;this.trigger("selectable",true,this);this.$(".dataset-primary-actions").hide();this.$(".dataset-selector").show()},hideSelector:function(){this.selectable=false;this.trigger("selectable",false,this);this.$(".dataset-selector").hide();this.$(".dataset-primary-actions").show()},toggleSelector:function(){if(!this.$el.find(".dataset-selector").is(":visible")){this.showSelector()}else{this.hideSelector()}},select:function(g){this.$el.find(".dataset-selector span").removeClass("fa-square-o").addClass("fa-check-square-o");if(!this.selected){this.trigger("selected",this);this.selected=true}return false},deselect:function(g){this.$el.find(".dataset-selector span").removeClass("fa-check-square-o").addClass("fa-square-o");if(this.selected){this.trigger("de-selected",this);this.selected=false}return false},toggleSelect:function(g){if(this.selected){this.deselect(g)}else{this.select(g)}},draggableOn:function(){this.draggable=true;this.dragStartHandler=_.bind(this._dragStartHandler,this);this.dragEndHandler=_.bind(this._dragEndHandler,this);var g=this.$el.find(".dataset-title-bar").attr("draggable",true).get(0);g.addEventListener("dragstart",this.dragStartHandler,false);g.addEventListener("dragend",this.dragEndHandler,false)},draggableOff:function(){this.draggable=false;var g=this.$el.find(".dataset-title-bar").attr("draggable",false).get(0);g.removeEventListener("dragstart",this.dragStartHandler,false);g.removeEventListener("dragend",this.dragEndHandler,false)},toggleDraggable:function(){if(this.draggable){this.draggableOff()}else{this.draggableOn()}},_dragStartHandler:function(g){this.trigger("dragstart",this);g.dataTransfer.effectAllowed="move";g.dataTransfer.setData("text",JSON.stringify(this.model.toJSON()));return false},_dragEndHandler:function(g){this.trigger("dragend",this);return false},remove:function(h){var g=this;this.$el.fadeOut(g.fxSpeed,function(){g.$el.remove();g.off();if(h){h()}})},toString:function(){var g=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+g+")"}});var a=['
','
',"<% if( hda.error ){ %>",'
',d("There was an error getting the data for this dataset"),":<%- hda.error %>","
","<% } %>","<% if( hda.deleted ){ %>","<% if( hda.purged ){ %>",'
',d("This dataset has been deleted and removed from disk."),"
","<% } else { %>",'
',d("This dataset has been deleted."),"
","<% } %>","<% } %>","<% if( !hda.visible ){ %>",'
',d("This dataset has been hidden."),"
","<% } %>","
",'
','',"
",'
','
','','
','<%- hda.hid %> ','<%- hda.name %>',"
","
",'
',"
"].join("");var f=['
',"<% if( hda.body ){ %>",'
',"<%= hda.body %>","
",'
','
','
',"
","<% } else { %>",'
',"<% if( hda.misc_blurb ){ %>",'
','<%- hda.misc_blurb %>',"
","<% } %>","<% if( hda.data_type ){ %>",'
','",'<%- hda.data_type %>',"
","<% } %>","<% if( hda.metadata_dbkey ){ %>",'
','",'',"<%- hda.metadata_dbkey %>","","
","<% } %>","<% if( hda.misc_info ){ %>",'
','<%- hda.misc_info %>',"
","<% } %>","
",'
','
','
',"
","<% if( !hda.deleted ){ %>",'
','
','
',"<% _.each( hda.display_apps, function( app ){ %>",'
','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
","<% }); %>","<% _.each( hda.display_types, function( app ){ %>",'
','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
","<% }); %>","
",'
',"<% if( hda.peek ){ %>",'
<%= hda.peek %>
',"<% } %>","
","<% } %>","<% } %>","
"].join("");c.templates={skeleton:function(g){return _.template(a,g,{variable:"hda"})},body:function(g){return _.template(f,g,{variable:"hda"})}};return{HDABaseView:c}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/dataset/hda-edit.js b/static/scripts/packed/mvc/dataset/hda-edit.js index 4ba9e970e27..b79c29bcfd7 100644 --- a/static/scripts/packed/mvc/dataset/hda-edit.js +++ b/static/scripts/packed/mvc/dataset/hda-edit.js @@ -1 +1 @@ -define(["mvc/dataset/hda-model","mvc/dataset/hda-base","mvc/tags","mvc/annotations"],function(f,b,a,e){var g=b.HDABaseView.extend({initialize:function(h){b.HDABaseView.prototype.initialize.call(this,h);this.hasUser=h.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton];this.tagsEditorShown=h.tagsEditorShown||false;this.annotationEditorShown=h.annotationEditorShown||false},_render_titleButtons:function(){return b.HDABaseView.prototype._render_titleButtons.call(this).concat([this._render_editButton(),this._render_deleteButton()])},_render_editButton:function(){if((this.model.get("state")===f.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===f.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var j=this.model.get("purged"),h=this.model.get("deleted"),i={title:_l("Edit attributes"),href:this.urls.edit,target:this.linkTarget,classes:"dataset-edit"};if(h||j){i.disabled=true;if(j){i.title=_l("Cannot edit attributes of datasets removed from disk")}else{if(h){i.title=_l("Undelete dataset to edit attributes")}}}else{if(this.model.get("state")===f.HistoryDatasetAssociation.STATES.UPLOAD){i.disabled=true;i.title=_l("This dataset must finish uploading before it can be edited")}else{if(this.model.get("state")===f.HistoryDatasetAssociation.STATES.NEW){i.disabled=true;i.title=_l("This dataset is not yet editable")}}}i.faIcon="fa-pencil";return faIconButton(i)},_render_deleteButton:function(){if((this.model.get("state")===f.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var h=this,i={title:_l("Delete"),classes:"dataset-delete",onclick:function(){h.$el.find(".icon-btn.dataset-delete").trigger("mouseout");h.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){i={title:_l("Dataset is already deleted"),disabled:true}}i.faIcon="fa-times";return faIconButton(i)},_render_errButton:function(){if(this.model.get("state")!==f.HistoryDatasetAssociation.STATES.ERROR){return null}return faIconButton({title:_l("View or report this error"),href:this.urls.report_error,classes:"dataset-report-error-btn",target:this.linkTarget,faIcon:"fa-bug"})},_render_rerunButton:function(){return faIconButton({title:_l("Run this job again"),href:this.urls.rerun,classes:"dataset-rerun-btn",target:this.linkTarget,faIcon:"fa-refresh"})},_render_visualizationsButton:function(){var h=this.model.get("visualizations");if((!this.hasUser)||(!this.model.hasData())||(_.isEmpty(h))){return null}if(_.isObject(h[0])){return this._render_visualizationsFrameworkButton(h)}if(!this.urls.visualization){return null}var j=this.model.get("dbkey"),n=this.urls.visualization,k={},o={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(j){o.dbkey=j}var i=faIconButton({title:_l("Visualize"),classes:"dataset-visualize-btn",faIcon:"fa-bar-chart-o"});function l(p){if(p==="trackster"){return c(n,o,j)}return function(){Galaxy.frame.add({title:"Visualization",type:"url",content:n+"/"+p+"?"+$.param(o)})}}function m(p){return p.charAt(0).toUpperCase()+p.slice(1)}if(h.length===1){i.attr("data-original-title",_l("Visualize in ")+_l(m(h[0])));i.click(l(h[0]))}else{_.each(h,function(p){k[_l(m(p))]=l(p)});make_popupmenu(i,k)}return i},_render_visualizationsFrameworkButton:function(h){if(!(this.model.hasData())||!(h&&!_.isEmpty(h))){return null}var j=faIconButton({title:_l("Visualize"),classes:"dataset-visualize-btn",faIcon:"fa-bar-chart-o"});if(h.length===1){var i=h[0];j.attr("data-original-title",_l("Visualize in ")+i.html);j.attr("href",i.href)}else{var k=[];_.each(h,function(l){l.func=function(m){if(Galaxy.frame&&Galaxy.frame.active){Galaxy.frame.add({title:"Visualization",type:"url",content:l.href});m.preventDefault();return false}return true};k.push(l);return false});PopupMenu.create(j,k)}return j},_buildNewRender:function(){var h=b.HDABaseView.prototype._buildNewRender.call(this);h.find(".dataset-deleted-msg").append(_l(' Click here to undelete it or here to immediately remove it from disk'));h.find(".dataset-hidden-msg").append(_l(' Click here to unhide it'));return h},_render_body_failed_metadata:function(){var i=$("").attr({href:this.urls.edit,target:this.linkTarget}).text(_l("set it manually or retry auto-detection")),h=$("").text(". "+_l("You may be able to")+" ").append(i),j=b.HDABaseView.prototype._render_body_failed_metadata.call(this);j.find(".warningmessagesmall strong").append(h);return j},_render_body_error:function(){var h=b.HDABaseView.prototype._render_body_error.call(this);h.find(".dataset-actions .left").prepend(this._render_errButton());return h},_render_body_ok:function(){var h=b.HDABaseView.prototype._render_body_ok.call(this);if(this.model.isDeletedOrPurged()){return h}this.makeDbkeyEditLink(h);if(this.hasUser){h.find(".dataset-actions .left").append(this._render_visualizationsButton());this._renderTags(h);this._renderAnnotation(h)}return h},_renderTags:function(h){var i=this;this.tagsEditor=new a.TagsEditor({model:this.model,el:h.find(".tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){i.tagsEditorShown=true},onhide:function(){i.tagsEditorShown=false},$activator:faIconButton({title:_l("Edit dataset tags"),classes:"dataset-tag-btn",faIcon:"fa-tags"}).appendTo(h.find(".dataset-actions .right"))});if(this.tagsEditorShown){this.tagsEditor.toggle(true)}},_renderAnnotation:function(h){var i=this;this.annotationEditor=new e.AnnotationEditor({model:this.model,el:h.find(".annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){i.annotationEditorShown=true},onhide:function(){i.annotationEditorShown=false},$activator:faIconButton({title:_l("Edit dataset annotation"),classes:"dataset-annotate-btn",faIcon:"fa-comment"}).appendTo(h.find(".dataset-actions .right"))});if(this.annotationEditorShown){this.annotationEditor.toggle(true)}},makeDbkeyEditLink:function(i){if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){var h=$('?').attr("href",this.urls.edit).attr("target",this.linkTarget);i.find(".dataset-dbkey .value").replaceWith(h)}},events:_.extend(_.clone(b.HDABaseView.prototype.events),{"click .dataset-undelete":function(h){this.model.undelete();return false},"click .dataset-unhide":function(h){this.model.unhide();return false},"click .dataset-purge":"confirmPurge"}),confirmPurge:function d(h){this.model.purge();return false},toString:function(){var h=(this.model)?(this.model+""):("(no model)");return"HDAView("+h+")"}});function c(h,j,i){return function(){var k={};if(i){k["f-dbkey"]=i}$.ajax({url:h+"/list_tracks?"+$.param(k),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(l){var m=window.parent;m.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){m.Galaxy.modal.hide()},"View in saved visualization":function(){m.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:l,buttons:{Cancel:function(){m.Galaxy.modal.hide()},"Add to visualization":function(){$(m.document).find("input[name=id]:checked").each(function(){m.Galaxy.modal.hide();var n=$(this).val();j.id=n;m.Galaxy.frame.add({title:"Trackster",type:"url",content:h+"/trackster?"+$.param(j)})})}}})},"View in new visualization":function(){m.Galaxy.modal.hide();var n=h+"/trackster?"+$.param(j);m.Galaxy.frame.add({title:"Trackster",type:"url",content:n})}}})}});return false}}return{HDAEditView:g}}); \ No newline at end of file +define(["mvc/dataset/hda-model","mvc/dataset/hda-base","mvc/tags","mvc/annotations","utils/localization"],function(g,b,a,e,f){var h=b.HDABaseView.extend({initialize:function(i){b.HDABaseView.prototype.initialize.call(this,i);this.hasUser=i.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton];this.tagsEditorShown=i.tagsEditorShown||false;this.annotationEditorShown=i.annotationEditorShown||false},_render_titleButtons:function(){return b.HDABaseView.prototype._render_titleButtons.call(this).concat([this._render_editButton(),this._render_deleteButton()])},_render_editButton:function(){if((this.model.get("state")===g.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===g.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var k=this.model.get("purged"),i=this.model.get("deleted"),j={title:f("Edit attributes"),href:this.urls.edit,target:this.linkTarget,classes:"dataset-edit"};if(i||k){j.disabled=true;if(k){j.title=f("Cannot edit attributes of datasets removed from disk")}else{if(i){j.title=f("Undelete dataset to edit attributes")}}}else{if(this.model.get("state")===g.HistoryDatasetAssociation.STATES.UPLOAD){j.disabled=true;j.title=f("This dataset must finish uploading before it can be edited")}else{if(this.model.get("state")===g.HistoryDatasetAssociation.STATES.NEW){j.disabled=true;j.title=f("This dataset is not yet editable")}}}j.faIcon="fa-pencil";return faIconButton(j)},_render_deleteButton:function(){if((this.model.get("state")===g.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var i=this,j={title:f("Delete"),classes:"dataset-delete",onclick:function(){i.$el.find(".icon-btn.dataset-delete").trigger("mouseout");i.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){j={title:f("Dataset is already deleted"),disabled:true}}j.faIcon="fa-times";return faIconButton(j)},_render_errButton:function(){if(this.model.get("state")!==g.HistoryDatasetAssociation.STATES.ERROR){return null}return faIconButton({title:f("View or report this error"),href:this.urls.report_error,classes:"dataset-report-error-btn",target:this.linkTarget,faIcon:"fa-bug"})},_render_rerunButton:function(){return faIconButton({title:f("Run this job again"),href:this.urls.rerun,classes:"dataset-rerun-btn",target:this.linkTarget,faIcon:"fa-refresh"})},_render_visualizationsButton:function(){var i=this.model.get("visualizations");if((!this.hasUser)||(!this.model.hasData())||(_.isEmpty(i))){return null}if(_.isObject(i[0])){return this._render_visualizationsFrameworkButton(i)}if(!this.urls.visualization){return null}var k=this.model.get("dbkey"),o=this.urls.visualization,l={},p={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(k){p.dbkey=k}var j=faIconButton({title:f("Visualize"),classes:"dataset-visualize-btn",faIcon:"fa-bar-chart-o"});function m(q){if(q==="trackster"){return c(o,p,k)}return function(){Galaxy.frame.add({title:"Visualization",type:"url",content:o+"/"+q+"?"+$.param(p)})}}function n(q){return q.charAt(0).toUpperCase()+q.slice(1)}if(i.length===1){j.attr("data-original-title",f("Visualize in ")+f(n(i[0])));j.click(m(i[0]))}else{_.each(i,function(q){l[f(n(q))]=m(q)});make_popupmenu(j,l)}return j},_render_visualizationsFrameworkButton:function(i){if(!(this.model.hasData())||!(i&&!_.isEmpty(i))){return null}var k=faIconButton({title:f("Visualize"),classes:"dataset-visualize-btn",faIcon:"fa-bar-chart-o"});if(i.length===1){var j=i[0];k.attr("data-original-title",f("Visualize in ")+j.html);k.attr("href",j.href)}else{var l=[];_.each(i,function(m){m.func=function(n){if(Galaxy.frame&&Galaxy.frame.active){Galaxy.frame.add({title:"Visualization",type:"url",content:m.href});n.preventDefault();return false}return true};l.push(m);return false});PopupMenu.create(k,l)}return k},_buildNewRender:function(){var i=b.HDABaseView.prototype._buildNewRender.call(this);i.find(".dataset-deleted-msg").append(f(' Click here to undelete it or here to immediately remove it from disk'));i.find(".dataset-hidden-msg").append(f(' Click here to unhide it'));return i},_render_body_failed_metadata:function(){var j=$("").attr({href:this.urls.edit,target:this.linkTarget}).text(f("set it manually or retry auto-detection")),i=$("").text(". "+f("You may be able to")+" ").append(j),k=b.HDABaseView.prototype._render_body_failed_metadata.call(this);k.find(".warningmessagesmall strong").append(i);return k},_render_body_error:function(){var i=b.HDABaseView.prototype._render_body_error.call(this);i.find(".dataset-actions .left").prepend(this._render_errButton());return i},_render_body_ok:function(){var i=b.HDABaseView.prototype._render_body_ok.call(this);if(this.model.isDeletedOrPurged()){return i}this.makeDbkeyEditLink(i);if(this.hasUser){i.find(".dataset-actions .left").append(this._render_visualizationsButton());this._renderTags(i);this._renderAnnotation(i)}return i},_renderTags:function(i){var j=this;this.tagsEditor=new a.TagsEditor({model:this.model,el:i.find(".tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){j.tagsEditorShown=true},onhide:function(){j.tagsEditorShown=false},$activator:faIconButton({title:f("Edit dataset tags"),classes:"dataset-tag-btn",faIcon:"fa-tags"}).appendTo(i.find(".dataset-actions .right"))});if(this.tagsEditorShown){this.tagsEditor.toggle(true)}},_renderAnnotation:function(i){var j=this;this.annotationEditor=new e.AnnotationEditor({model:this.model,el:i.find(".annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){j.annotationEditorShown=true},onhide:function(){j.annotationEditorShown=false},$activator:faIconButton({title:f("Edit dataset annotation"),classes:"dataset-annotate-btn",faIcon:"fa-comment"}).appendTo(i.find(".dataset-actions .right"))});if(this.annotationEditorShown){this.annotationEditor.toggle(true)}},makeDbkeyEditLink:function(j){if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){var i=$('?').attr("href",this.urls.edit).attr("target",this.linkTarget);j.find(".dataset-dbkey .value").replaceWith(i)}},events:_.extend(_.clone(b.HDABaseView.prototype.events),{"click .dataset-undelete":function(i){this.model.undelete();return false},"click .dataset-unhide":function(i){this.model.unhide();return false},"click .dataset-purge":"confirmPurge"}),confirmPurge:function d(i){this.model.purge();return false},toString:function(){var i=(this.model)?(this.model+""):("(no model)");return"HDAView("+i+")"}});function c(i,k,j){return function(){var l={};if(j){l["f-dbkey"]=j}$.ajax({url:i+"/list_tracks?"+$.param(l),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(m){var n=window.parent;n.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){n.Galaxy.modal.hide()},"View in saved visualization":function(){n.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:m,buttons:{Cancel:function(){n.Galaxy.modal.hide()},"Add to visualization":function(){$(n.document).find("input[name=id]:checked").each(function(){n.Galaxy.modal.hide();var o=$(this).val();k.id=o;n.Galaxy.frame.add({title:"Trackster",type:"url",content:i+"/trackster?"+$.param(k)})})}}})},"View in new visualization":function(){n.Galaxy.modal.hide();var o=i+"/trackster?"+$.param(k);n.Galaxy.frame.add({title:"Trackster",type:"url",content:o})}}})}});return false}}return{HDAEditView:h}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/dataset/hda-model.js b/static/scripts/packed/mvc/dataset/hda-model.js index b18acfe35a1..9ccec412b2e 100644 --- a/static/scripts/packed/mvc/dataset/hda-model.js +++ b/static/scripts/packed/mvc/dataset/hda-model.js @@ -1 +1 @@ -define(["mvc/base-mvc"],function(b){var e=Backbone.Model.extend(b.LoggableMixin).extend({defaults:{history_id:null,model_class:"HistoryDatasetAssociation",hid:0,id:null,name:"(unnamed dataset)",state:"new",deleted:false,visible:true,accessible:true,purged:false,data_type:"",file_size:0,file_ext:"",meta_files:[],misc_blurb:"",misc_info:"",tags:[],annotation:""},urlRoot:galaxy_config.root+"api/histories/",url:function(){return this.urlRoot+this.get("history_id")+"/contents/"+this.get("id")},urls:function(){var j=this.get("id");if(!j){return{}}var i={purge:galaxy_config.root+"datasets/"+j+"/purge_async",display:galaxy_config.root+"datasets/"+j+"/display/?preview=True",edit:galaxy_config.root+"datasets/"+j+"/edit",download:galaxy_config.root+"datasets/"+j+"/display?to_ext="+this.get("file_ext"),report_error:galaxy_config.root+"dataset/errors?id="+j,rerun:galaxy_config.root+"tool_runner/rerun?id="+j,show_params:galaxy_config.root+"datasets/"+j+"/show_params",visualization:galaxy_config.root+"visualization",annotation:{get:galaxy_config.root+"dataset/get_annotation_async?id="+j,set:galaxy_config.root+"dataset/annotate_async?id="+j},meta_download:galaxy_config.root+"dataset/get_metadata_file?hda_id="+j+"&metadata_name="};return i},initialize:function(i){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"));if(!this.get("accessible")){this.set("state",e.STATES.NOT_VIEWABLE)}this._setUpListeners()},_setUpListeners:function(){this.on("change:state",function(j,i){this.log(this+" has changed state:",j,i);if(this.inReadyState()){this.trigger("state:ready",j,i,this.previous("state"))}})},isDeletedOrPurged:function(){return(this.get("deleted")||this.get("purged"))},isVisible:function(j,k){var i=true;if((!j)&&(this.get("deleted")||this.get("purged"))){i=false}if((!k)&&(!this.get("visible"))){i=false}return i},hidden:function(){return !this.get("visible")},inReadyState:function(){var i=_.contains(e.READY_STATES,this.get("state"));return(this.isDeletedOrPurged()||i)},hasDetails:function(){return _.has(this.attributes,"genome_build")},hasData:function(){return(this.get("file_size")>0)},"delete":function d(i){if(this.get("deleted")){return jQuery.when()}return this.save({deleted:true},i)},undelete:function a(i){if(!this.get("deleted")||this.get("purged")){return jQuery.when()}return this.save({deleted:false},i)},hide:function c(i){if(!this.get("visible")){return jQuery.when()}return this.save({visible:false},i)},unhide:function h(i){if(this.get("visible")){return jQuery.when()}return this.save({visible:true},i)},purge:function g(i){if(this.get("purged")){return jQuery.when()}i=i||{};i.url=galaxy_config.root+"datasets/"+this.get("id")+"/purge_async";var j=this,k=jQuery.ajax(i);k.done(function(n,l,m){j.set({deleted:true,purged:true})});k.fail(function(p,l,o){var m=_l("Unable to purge dataset");var n=("Removal of datasets by users is not allowed in this Galaxy instance");if(p.responseJSON&&p.responseJSON.error){m=p.responseJSON.error}else{if(p.responseText.indexOf(n)!==-1){m=n}}p.responseText=m;j.trigger("error",j,p,i,_l(m),{error:m})});return k},searchAttributes:["name","file_ext","genome_build","misc_blurb","misc_info","annotation","tags"],searchAliases:{title:"name",format:"file_ext",database:"genome_build",blurb:"misc_blurb",description:"misc_blurb",info:"misc_info",tag:"tags"},searchAttribute:function(k,i){var j=this.get(k);if(!i||(j===undefined||j===null)){return false}if(_.isArray(j)){return this._searchArrayAttribute(j,i)}return(j.toString().toLowerCase().indexOf(i.toLowerCase())!==-1)},_searchArrayAttribute:function(j,i){i=i.toLowerCase();return _.any(j,function(k){return(k.toString().toLowerCase().indexOf(i.toLowerCase())!==-1)})},search:function(i){var j=this;return _.filter(this.searchAttributes,function(k){return j.searchAttribute(k,i)})},matches:function(j){var l="=",i=j.split(l);if(i.length>=2){var k=i[0];k=this.searchAliases[k]||k;return this.searchAttribute(k,i[1])}return !!this.search(j).length},matchesAll:function(j){var i=this;j=j.match(/(".*"|\w*=".*"|\S*)/g).filter(function(k){return !!k});return _.all(j,function(k){k=k.replace(/"/g,"");return i.matches(k)})},toString:function(){var i=this.get("id")||"";if(this.get("name")){i=this.get("hid")+' :"'+this.get("name")+'",'+i}return"HDA("+i+")"}});e.STATES={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};e.READY_STATES=[e.STATES.OK,e.STATES.EMPTY,e.STATES.PAUSED,e.STATES.FAILED_METADATA,e.STATES.NOT_VIEWABLE,e.STATES.DISCARDED,e.STATES.ERROR];e.NOT_READY_STATES=[e.STATES.UPLOAD,e.STATES.QUEUED,e.STATES.RUNNING,e.STATES.SETTING_METADATA,e.STATES.NEW];var f=Backbone.Collection.extend(b.LoggableMixin).extend({model:e,urlRoot:galaxy_config.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(j,i){i=i||{};this.historyId=i.historyId},ids:function(){return this.map(function(i){return i.id})},notReady:function(){return this.filter(function(i){return !i.inReadyState()})},running:function(){var i=[];this.each(function(j){if(!j.inReadyState()){i.push(j.get("id"))}});return i},getByHid:function(i){return _.first(this.filter(function(j){return j.get("hid")===i}))},getVisible:function(i,l,k){k=k||[];var j=new f(this.filter(function(m){return m.isVisible(i,l)}));_.each(k,function(m){if(!_.isFunction(m)){return}j=new f(j.filter(m))});return j},haveDetails:function(){return this.all(function(i){return i.hasDetails()})},fetchAllDetails:function(j){j=j||{};var i={details:"all"};j.data=(j.data)?(_.extend(j.data,i)):(i);return this.fetch(j)},ajaxQueue:function(l,k){var j=jQuery.Deferred(),i=this.length,n=[];if(!i){j.resolve([]);return j}var m=this.chain().reverse().map(function(p,o){return function(){var q=l.call(p,k);q.done(function(r){j.notify({curr:o,total:i,response:r,model:p})});q.always(function(r){n.push(r);if(m.length){m.shift()()}else{j.resolve(n)}})}}).value();m.shift()();return j},matches:function(i){return this.filter(function(j){return j.matches(i)})},set:function(k,i){var j=this;k=_.map(k,function(m){var n=j.get(m.id);if(!n){return m}var l=n.toJSON();_.extend(l,m);return l});Backbone.Collection.prototype.set.call(this,k,i)},toString:function(){return(["HDACollection(",[this.historyId,this.length].join(),")"].join(""))}});return{HistoryDatasetAssociation:e,HDACollection:f}}); \ No newline at end of file +define(["mvc/base-mvc","utils/localization"],function(d,b){var i=Backbone.Model.extend(d.LoggableMixin).extend({defaults:{history_id:null,model_class:"HistoryDatasetAssociation",hid:0,id:null,name:"(unnamed dataset)",state:"new",deleted:false,visible:true,accessible:true,purged:false,data_type:"",file_size:0,file_ext:"",meta_files:[],misc_blurb:"",misc_info:"",tags:[],annotation:""},urlRoot:galaxy_config.root+"api/histories/",url:function(){return this.urlRoot+this.get("history_id")+"/contents/"+this.get("id")},urls:function(){var k=this.get("id");if(!k){return{}}var j={purge:galaxy_config.root+"datasets/"+k+"/purge_async",display:galaxy_config.root+"datasets/"+k+"/display/?preview=True",edit:galaxy_config.root+"datasets/"+k+"/edit",download:galaxy_config.root+"datasets/"+k+"/display?to_ext="+this.get("file_ext"),report_error:galaxy_config.root+"dataset/errors?id="+k,rerun:galaxy_config.root+"tool_runner/rerun?id="+k,show_params:galaxy_config.root+"datasets/"+k+"/show_params",visualization:galaxy_config.root+"visualization",annotation:{get:galaxy_config.root+"dataset/get_annotation_async?id="+k,set:galaxy_config.root+"dataset/annotate_async?id="+k},meta_download:galaxy_config.root+"dataset/get_metadata_file?hda_id="+k+"&metadata_name="};return j},initialize:function(j){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"));if(!this.get("accessible")){this.set("state",i.STATES.NOT_VIEWABLE)}this._setUpListeners()},_setUpListeners:function(){this.on("change:state",function(k,j){this.log(this+" has changed state:",k,j);if(this.inReadyState()){this.trigger("state:ready",k,j,this.previous("state"))}})},isDeletedOrPurged:function(){return(this.get("deleted")||this.get("purged"))},isVisible:function(k,l){var j=true;if((!k)&&(this.get("deleted")||this.get("purged"))){j=false}if((!l)&&(!this.get("visible"))){j=false}return j},hidden:function(){return !this.get("visible")},inReadyState:function(){var j=_.contains(i.READY_STATES,this.get("state"));return(this.isDeletedOrPurged()||j)},hasDetails:function(){return _.has(this.attributes,"genome_build")},hasData:function(){return(this.get("file_size")>0)},"delete":function e(j){if(this.get("deleted")){return jQuery.when()}return this.save({deleted:true},j)},undelete:function h(j){if(!this.get("deleted")||this.get("purged")){return jQuery.when()}return this.save({deleted:false},j)},hide:function c(j){if(!this.get("visible")){return jQuery.when()}return this.save({visible:false},j)},unhide:function g(j){if(this.get("visible")){return jQuery.when()}return this.save({visible:true},j)},purge:function f(j){if(this.get("purged")){return jQuery.when()}j=j||{};j.url=galaxy_config.root+"datasets/"+this.get("id")+"/purge_async";var k=this,l=jQuery.ajax(j);l.done(function(o,m,n){k.set({deleted:true,purged:true})});l.fail(function(q,m,p){var n=b("Unable to purge dataset");var o=("Removal of datasets by users is not allowed in this Galaxy instance");if(q.responseJSON&&q.responseJSON.error){n=q.responseJSON.error}else{if(q.responseText.indexOf(o)!==-1){n=o}}q.responseText=n;k.trigger("error",k,q,j,b(n),{error:n})});return l},searchAttributes:["name","file_ext","genome_build","misc_blurb","misc_info","annotation","tags"],searchAliases:{title:"name",format:"file_ext",database:"genome_build",blurb:"misc_blurb",description:"misc_blurb",info:"misc_info",tag:"tags"},searchAttribute:function(l,j){var k=this.get(l);if(!j||(k===undefined||k===null)){return false}if(_.isArray(k)){return this._searchArrayAttribute(k,j)}return(k.toString().toLowerCase().indexOf(j.toLowerCase())!==-1)},_searchArrayAttribute:function(k,j){j=j.toLowerCase();return _.any(k,function(l){return(l.toString().toLowerCase().indexOf(j.toLowerCase())!==-1)})},search:function(j){var k=this;return _.filter(this.searchAttributes,function(l){return k.searchAttribute(l,j)})},matches:function(k){var m="=",j=k.split(m);if(j.length>=2){var l=j[0];l=this.searchAliases[l]||l;return this.searchAttribute(l,j[1])}return !!this.search(k).length},matchesAll:function(k){var j=this;k=k.match(/(".*"|\w*=".*"|\S*)/g).filter(function(l){return !!l});return _.all(k,function(l){l=l.replace(/"/g,"");return j.matches(l)})},toString:function(){var j=this.get("id")||"";if(this.get("name")){j=this.get("hid")+' :"'+this.get("name")+'",'+j}return"HDA("+j+")"}});i.STATES={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};i.READY_STATES=[i.STATES.OK,i.STATES.EMPTY,i.STATES.PAUSED,i.STATES.FAILED_METADATA,i.STATES.NOT_VIEWABLE,i.STATES.DISCARDED,i.STATES.ERROR];i.NOT_READY_STATES=[i.STATES.UPLOAD,i.STATES.QUEUED,i.STATES.RUNNING,i.STATES.SETTING_METADATA,i.STATES.NEW];var a=Backbone.Collection.extend(d.LoggableMixin).extend({model:i,urlRoot:galaxy_config.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(k,j){j=j||{};this.historyId=j.historyId},ids:function(){return this.map(function(j){return j.id})},notReady:function(){return this.filter(function(j){return !j.inReadyState()})},running:function(){var j=[];this.each(function(k){if(!k.inReadyState()){j.push(k.get("id"))}});return j},getByHid:function(j){return _.first(this.filter(function(k){return k.get("hid")===j}))},getVisible:function(j,m,l){l=l||[];var k=new a(this.filter(function(n){return n.isVisible(j,m)}));_.each(l,function(n){if(!_.isFunction(n)){return}k=new a(k.filter(n))});return k},haveDetails:function(){return this.all(function(j){return j.hasDetails()})},fetchAllDetails:function(k){k=k||{};var j={details:"all"};k.data=(k.data)?(_.extend(k.data,j)):(j);return this.fetch(k)},ajaxQueue:function(m,l){var k=jQuery.Deferred(),j=this.length,o=[];if(!j){k.resolve([]);return k}var n=this.chain().reverse().map(function(q,p){return function(){var r=m.call(q,l);r.done(function(s){k.notify({curr:p,total:j,response:s,model:q})});r.always(function(s){o.push(s);if(n.length){n.shift()()}else{k.resolve(o)}})}}).value();n.shift()();return k},matches:function(j){return this.filter(function(k){return k.matches(j)})},set:function(l,j){var k=this;l=_.map(l,function(n){var o=k.get(n.id);if(!o){return n}var m=o.toJSON();_.extend(m,n);return m});Backbone.Collection.prototype.set.call(this,l,j)},toString:function(){return(["HDACollection(",[this.historyId,this.length].join(),")"].join(""))}});return{HistoryDatasetAssociation:i,HDACollection:a}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/history/annotated-history-panel.js b/static/scripts/packed/mvc/history/annotated-history-panel.js index 4c08408a2c8..467032b7269 100644 --- a/static/scripts/packed/mvc/history/annotated-history-panel.js +++ b/static/scripts/packed/mvc/history/annotated-history-panel.js @@ -1 +1 @@ -define(["mvc/dataset/hda-model","mvc/dataset/hda-base","mvc/history/readonly-history-panel"],function(c,a,b){var d=b.ReadOnlyHistoryPanel.extend({className:"annotated-history-panel",HDAViewClass:a.HDABaseView,renderModel:function(){this.$el.addClass(this.className);var g=b.ReadOnlyHistoryPanel.prototype.renderModel.call(this),e=this.$datasetsList(g),f=$("").addClass("datasets-list datasets-table");f.append(e.children());e.replaceWith(f);g.find(".history-subtitle").after(this.renderHistoryAnnotation());g.find(".history-search-btn").hide();g.find(".history-controls").after(g.find(".history-search-controls").show());return g},renderHistoryAnnotation:function(){var e=this.model.get("annotation");if(!e){return null}return $(['
',e,"
"].join(""))},renderHdas:function(f){f=f||this.$el;var e=b.ReadOnlyHistoryPanel.prototype.renderHdas.call(this,f);this.$datasetsList(f).prepend($("").addClass("headers").append([$("").addClass("dataset-row").append([$("
").text(_l("Dataset")),$("").text(_l("Annotation"))]));return e},attachHdaView:function(h,f){f=f||this.$el;var i=_.find(h.el.classList,function(j){return(/^state\-/).test(j)}),e=h.model.get("annotation")||"",g=$("
").addClass("dataset-container").append(h.$el).addClass(i?i.replace("-","-color-"):""),$("").addClass("additional-info").text(e)]);this.$datasetsList(f).append(g)},events:_.extend(_.clone(b.ReadOnlyHistoryPanel.prototype.events),{"click tr":function(e){$(e.currentTarget).find(".dataset-title-bar").click()},"click .icon-btn":function(e){e.stopPropagation()}}),toString:function(){return"AnnotatedHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{AnnotatedHistoryPanel:d}}); \ No newline at end of file +define(["mvc/dataset/hda-model","mvc/dataset/hda-base","mvc/history/readonly-history-panel","utils/localization"],function(d,a,b,c){var e=b.ReadOnlyHistoryPanel.extend({className:"annotated-history-panel",HDAViewClass:a.HDABaseView,renderModel:function(){this.$el.addClass(this.className);var h=b.ReadOnlyHistoryPanel.prototype.renderModel.call(this),f=this.$datasetsList(h),g=$("").addClass("datasets-list datasets-table");g.append(f.children());f.replaceWith(g);h.find(".history-subtitle").after(this.renderHistoryAnnotation());h.find(".history-search-btn").hide();h.find(".history-controls").after(h.find(".history-search-controls").show());return h},renderHistoryAnnotation:function(){var f=this.model.get("annotation");if(!f){return null}return $(['
',f,"
"].join(""))},renderHdas:function(g){g=g||this.$el;var f=b.ReadOnlyHistoryPanel.prototype.renderHdas.call(this,g);this.$datasetsList(g).prepend($("").addClass("headers").append([$("").addClass("dataset-row").append([$("
").text(c("Dataset")),$("").text(c("Annotation"))]));return f},attachHdaView:function(i,g){g=g||this.$el;var j=_.find(i.el.classList,function(k){return(/^state\-/).test(k)}),f=i.model.get("annotation")||"",h=$("
").addClass("dataset-container").append(i.$el).addClass(j?j.replace("-","-color-"):""),$("").addClass("additional-info").text(f)]);this.$datasetsList(g).append(h)},events:_.extend(_.clone(b.ReadOnlyHistoryPanel.prototype.events),{"click tr":function(f){$(f.currentTarget).find(".dataset-title-bar").click()},"click .icon-btn":function(f){f.stopPropagation()}}),toString:function(){return"AnnotatedHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{AnnotatedHistoryPanel:e}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/history/current-history-panel.js b/static/scripts/packed/mvc/history/current-history-panel.js index dc63cc72e14..5a333036267 100644 --- a/static/scripts/packed/mvc/history/current-history-panel.js +++ b/static/scripts/packed/mvc/history/current-history-panel.js @@ -1 +1 @@ -define(["mvc/dataset/hda-edit","mvc/history/history-panel","mvc/base-mvc"],function(b,f,c){var d=c.SessionStorageModel.extend({defaults:{searching:false,tagsEditorShown:false,annotationEditorShown:false},toString:function(){return"HistoryPanelPrefs("+JSON.stringify(this.toJSON())+")"}});d.storageKey=function e(){return("history-panel")};var a=f.HistoryPanel.extend({HDAViewClass:b.HDAEditView,emptyMsg:_l("This history is empty. Click 'Get Data' on the left tool menu to start"),noneFoundMsg:_l("No matching datasets found"),initialize:function(g){g=g||{};this.preferences=new d(_.extend({id:d.storageKey()},_.pick(g,_.keys(d.prototype.defaults))));f.HistoryPanel.prototype.initialize.call(this,g)},loadCurrentHistory:function(h){var g=this;return this.loadHistoryWithHDADetails("current",h).then(function(j,i){g.trigger("current-history",g)})},switchToHistory:function(j,i){var g=this,h=function(){return jQuery.ajax({url:galaxy_config.root+"api/histories/"+j+"/set_as_current",method:"PUT"})};return this.loadHistoryWithHDADetails(j,i,h).then(function(l,k){g.trigger("switched-history",g)})},createNewHistory:function(i){if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){this.displayMessage("error",_l("You must be logged in to create histories"));return $.when()}var g=this,h=function(){return jQuery.post(galaxy_config.root+"api/histories",{current:true})};return this.loadHistory(undefined,i,h).then(function(k,j){g.trigger("new-history",g)})},setModel:function(h,g,i){f.HistoryPanel.prototype.setModel.call(this,h,g,i);if(this.model){this.log("checking for updates");this.model.checkForUpdates()}return this},_setUpModelEventHandlers:function(){f.HistoryPanel.prototype._setUpModelEventHandlers.call(this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}this.model.hdas.on("state:ready",function(h,i,g){if((!h.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(this.hdaViews[h.id])}},this)},render:function(i,j){this.log("render:",i,j);i=(i===undefined)?(this.fxSpeed):(i);var g=this,h;if(this.model){h=this.renderModel()}else{h=this.renderWithoutModel()}$(g).queue("fx",[function(k){if(i&&g.$el.is(":visible")){g.$el.fadeOut(i,k)}else{k()}},function(k){g.$el.empty();if(h){g.$el.append(h.children());g.renderBasedOnPrefs()}k()},function(k){if(i&&!g.$el.is(":visible")){g.$el.fadeIn(i,k)}else{k()}},function(k){if(j){j.call(this)}g.trigger("rendered",this);k()}]);return this},renderBasedOnPrefs:function(){if(this.preferences.get("searching")){this.toggleSearchControls(0,true)}},_renderEmptyMsg:function(i){var h=this,g=h.$emptyMessage(i),j=$(".toolMenuContainer");if((_.isEmpty(h.hdaViews)&&!h.searchFor)&&(Galaxy&&Galaxy.upload&&j.size())){g.empty();g.html([_l("This history is empty. "),_l("You can "),'',_l("load your own data"),"",_l(" or "),'',_l("get data from an external source"),""].join(""));g.find(".uploader-link").click(function(k){Galaxy.upload._eventShow(k)});g.find(".get-data-link").click(function(k){j.parent().scrollTop(0);j.find('span:contains("Get Data")').click()});g.show()}else{f.HistoryPanel.prototype._renderEmptyMsg.call(this,i)}return this},toggleSearchControls:function(h,g){var i=f.HistoryPanel.prototype.toggleSearchControls.call(this,h,g);this.preferences.set("searching",i)},_renderTags:function(g){var h=this;f.HistoryPanel.prototype._renderTags.call(this,g);if(this.preferences.get("tagsEditorShown")){this.tagsEditor.toggle(true)}this.tagsEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(i){h.preferences.set("tagsEditorShown",i.hidden)})},_renderAnnotation:function(g){var h=this;f.HistoryPanel.prototype._renderAnnotation.call(this,g);if(this.preferences.get("annotationEditorShown")){this.annotationEditor.toggle(true)}this.annotationEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(i){h.preferences.set("annotationEditorShown",i.hidden)})},connectToQuotaMeter:function(g){if(!g){return this}this.listenTo(g,"quota:over",this.showQuotaMessage);this.listenTo(g,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(g&&g.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var g=this.$el.find(".quota-message");if(g.is(":hidden")){g.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var g=this.$el.find(".quota-message");if(!g.is(":hidden")){g.slideUp(this.fxSpeed)}},connectToOptionsMenu:function(g){if(!g){return this}this.on("new-storage",function(i,h){if(g&&i){g.findItemByHtml(_l("Include Deleted Datasets")).checked=i.get("show_deleted");g.findItemByHtml(_l("Include Hidden Datasets")).checked=i.get("show_hidden")}});return this},toString:function(){return"CurrentHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{CurrentHistoryPanel:a}}); \ No newline at end of file +define(["mvc/dataset/hda-edit","mvc/history/history-panel","mvc/base-mvc","utils/localization"],function(b,g,c,e){var d=c.SessionStorageModel.extend({defaults:{searching:false,tagsEditorShown:false,annotationEditorShown:false},toString:function(){return"HistoryPanelPrefs("+JSON.stringify(this.toJSON())+")"}});d.storageKey=function f(){return("history-panel")};var a=g.HistoryPanel.extend({HDAViewClass:b.HDAEditView,emptyMsg:e("This history is empty. Click 'Get Data' on the left tool menu to start"),noneFoundMsg:e("No matching datasets found"),initialize:function(h){h=h||{};this.preferences=new d(_.extend({id:d.storageKey()},_.pick(h,_.keys(d.prototype.defaults))));g.HistoryPanel.prototype.initialize.call(this,h)},loadCurrentHistory:function(i){var h=this;return this.loadHistoryWithHDADetails("current",i).then(function(k,j){h.trigger("current-history",h)})},switchToHistory:function(k,j){var h=this,i=function(){return jQuery.ajax({url:galaxy_config.root+"api/histories/"+k+"/set_as_current",method:"PUT"})};return this.loadHistoryWithHDADetails(k,j,i).then(function(m,l){h.trigger("switched-history",h)})},createNewHistory:function(j){if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){this.displayMessage("error",e("You must be logged in to create histories"));return $.when()}var h=this,i=function(){return jQuery.post(galaxy_config.root+"api/histories",{current:true})};return this.loadHistory(undefined,j,i).then(function(l,k){h.trigger("new-history",h)})},setModel:function(i,h,j){g.HistoryPanel.prototype.setModel.call(this,i,h,j);if(this.model){this.log("checking for updates");this.model.checkForUpdates()}return this},_setUpModelEventHandlers:function(){g.HistoryPanel.prototype._setUpModelEventHandlers.call(this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}this.model.hdas.on("state:ready",function(i,j,h){if((!i.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(this.hdaViews[i.id])}},this)},render:function(j,k){this.log("render:",j,k);j=(j===undefined)?(this.fxSpeed):(j);var h=this,i;if(this.model){i=this.renderModel()}else{i=this.renderWithoutModel()}$(h).queue("fx",[function(l){if(j&&h.$el.is(":visible")){h.$el.fadeOut(j,l)}else{l()}},function(l){h.$el.empty();if(i){h.$el.append(i.children());h.renderBasedOnPrefs()}l()},function(l){if(j&&!h.$el.is(":visible")){h.$el.fadeIn(j,l)}else{l()}},function(l){if(k){k.call(this)}h.trigger("rendered",this);l()}]);return this},renderBasedOnPrefs:function(){if(this.preferences.get("searching")){this.toggleSearchControls(0,true)}},_renderEmptyMsg:function(j){var i=this,h=i.$emptyMessage(j),k=$(".toolMenuContainer");if((_.isEmpty(i.hdaViews)&&!i.searchFor)&&(Galaxy&&Galaxy.upload&&k.size())){h.empty();h.html([e("This history is empty. "),e("You can "),'',e("load your own data"),"",e(" or "),'',e("get data from an external source"),""].join(""));h.find(".uploader-link").click(function(l){Galaxy.upload._eventShow(l)});h.find(".get-data-link").click(function(l){k.parent().scrollTop(0);k.find('span:contains("Get Data")').click()});h.show()}else{g.HistoryPanel.prototype._renderEmptyMsg.call(this,j)}return this},toggleSearchControls:function(i,h){var j=g.HistoryPanel.prototype.toggleSearchControls.call(this,i,h);this.preferences.set("searching",j)},_renderTags:function(h){var i=this;g.HistoryPanel.prototype._renderTags.call(this,h);if(this.preferences.get("tagsEditorShown")){this.tagsEditor.toggle(true)}this.tagsEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(j){i.preferences.set("tagsEditorShown",j.hidden)})},_renderAnnotation:function(h){var i=this;g.HistoryPanel.prototype._renderAnnotation.call(this,h);if(this.preferences.get("annotationEditorShown")){this.annotationEditor.toggle(true)}this.annotationEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(j){i.preferences.set("annotationEditorShown",j.hidden)})},connectToQuotaMeter:function(h){if(!h){return this}this.listenTo(h,"quota:over",this.showQuotaMessage);this.listenTo(h,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(h&&h.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var h=this.$el.find(".quota-message");if(h.is(":hidden")){h.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var h=this.$el.find(".quota-message");if(!h.is(":hidden")){h.slideUp(this.fxSpeed)}},connectToOptionsMenu:function(h){if(!h){return this}this.on("new-storage",function(j,i){if(h&&j){h.findItemByHtml(e("Include Deleted Datasets")).checked=j.get("show_deleted");h.findItemByHtml(e("Include Hidden Datasets")).checked=j.get("show_hidden")}});return this},toString:function(){return"CurrentHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{CurrentHistoryPanel:a}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/history/history-model.js b/static/scripts/packed/mvc/history/history-model.js index 4a9c0ab5ac4..e29e6cf500d 100644 --- a/static/scripts/packed/mvc/history/history-model.js +++ b/static/scripts/packed/mvc/history/history-model.js @@ -1 +1 @@ -define(["mvc/dataset/hda-model","mvc/base-mvc"],function(b,a){var d=Backbone.Model.extend(a.LoggableMixin).extend({defaults:{model_class:"History",id:null,name:"Unnamed History",state:"new",diskSize:0,deleted:false},urlRoot:galaxy_config.root+"api/histories",renameUrl:function(){var f=this.get("id");if(!f){return undefined}return galaxy_config.root+"history/rename_async?id="+this.get("id")},annotateUrl:function(){var f=this.get("id");if(!f){return undefined}return galaxy_config.root+"history/annotate_async?id="+this.get("id")},tagUrl:function(){var f=this.get("id");if(!f){return undefined}return galaxy_config.root+"tag/get_tagging_elt_async?item_id="+this.get("id")+"&item_class=History"},initialize:function(g,h,f){f=f||{};this.logger=f.logger||null;this.log(this+".initialize:",g,h,f);this.hdas=new b.HDACollection(h||[],{historyId:this.get("id")});if(h&&_.isArray(h)){this.hdas.reset(h)}this._setUpListeners();this.updateTimeoutId=null},_setUpListeners:function(){this.on("error",function(g,j,f,i,h){this.errorHandler(g,j,f,i,h)});if(this.hdas){this.listenTo(this.hdas,"error",function(){this.trigger.apply(this,["error:hdas"].concat(jQuery.makeArray(arguments)))})}this.on("change:id",function(g,f){if(this.hdas){this.hdas.historyId=f}},this)},errorHandler:function(g,j,f,i,h){this.clearUpdateTimeout()},ownedByCurrUser:function(){if(!Galaxy||!Galaxy.currUser){return false}if(Galaxy.currUser.isAnonymous()||Galaxy.currUser.id!==this.get("user_id")){return false}return true},hdaCount:function(){return _.reduce(_.values(this.get("state_details")),function(f,g){return f+g},0)},checkForUpdates:function(f){if(this.hdas.running().length){this.setUpdateTimeout()}else{this.trigger("ready");if(_.isFunction(f)){f.call(this)}}return this},setUpdateTimeout:function(f){f=f||d.UPDATE_DELAY;var g=this;this.clearUpdateTimeout();this.updateTimeoutId=setTimeout(function(){g.refresh()},f);return this.updateTimeoutId},clearUpdateTimeout:function(){if(this.updateTimeoutId){clearTimeout(this.updateTimeoutId);this.updateTimeoutId=null}},refresh:function(g,f){g=g||[];f=f||{};var h=this;f.data=f.data||{};if(g.length){f.data.details=g.join(",")}var i=this.hdas.fetch(f);i.done(function(j){h.checkForUpdates(function(){this.fetch()})});return i},toString:function(){return"History("+this.get("id")+","+this.get("name")+")"}});d.UPDATE_DELAY=4000;d.getHistoryData=function e(g,q){q=q||{};var k=q.hdaDetailIds||[];var m=jQuery.Deferred(),l=null;function h(r){return jQuery.ajax(galaxy_config.root+"api/histories/"+g)}function f(r){if(!r||!r.state_ids){return 0}return _.reduce(r.state_ids,function(s,u,t){return s+u.length},0)}function p(s){if(!f(s)){return[]}if(_.isFunction(k)){k=k(s)}var r=(k.length)?({details:k.join(",")}):({});return jQuery.ajax(galaxy_config.root+"api/histories/"+s.id+"/contents",{data:r})}var o=q.historyFn||h,n=q.hdaFn||p;var j=o(g);j.done(function(r){l=r;m.notify({status:"history data retrieved",historyJSON:l})});j.fail(function(t,r,s){m.reject(t,"loading the history")});var i=j.then(n);i.then(function(r){m.notify({status:"dataset data retrieved",historyJSON:l,hdaJSON:r});m.resolve(l,r)});i.fail(function(t,r,s){m.reject(t,"loading the datasets",{history:l})});return m};var c=Backbone.Collection.extend(a.LoggableMixin).extend({model:d,urlRoot:galaxy_config.root+"api/histories"});return{History:d,HistoryCollection:c}}); \ No newline at end of file +define(["mvc/dataset/hda-model","mvc/base-mvc","utils/localization"],function(c,a,b){var e=Backbone.Model.extend(a.LoggableMixin).extend({defaults:{model_class:"History",id:null,name:"Unnamed History",state:"new",diskSize:0,deleted:false},urlRoot:galaxy_config.root+"api/histories",renameUrl:function(){var g=this.get("id");if(!g){return undefined}return galaxy_config.root+"history/rename_async?id="+this.get("id")},annotateUrl:function(){var g=this.get("id");if(!g){return undefined}return galaxy_config.root+"history/annotate_async?id="+this.get("id")},tagUrl:function(){var g=this.get("id");if(!g){return undefined}return galaxy_config.root+"tag/get_tagging_elt_async?item_id="+this.get("id")+"&item_class=History"},initialize:function(h,i,g){g=g||{};this.logger=g.logger||null;this.log(this+".initialize:",h,i,g);this.hdas=new c.HDACollection(i||[],{historyId:this.get("id")});if(i&&_.isArray(i)){this.hdas.reset(i)}this._setUpListeners();this.updateTimeoutId=null},_setUpListeners:function(){this.on("error",function(h,k,g,j,i){this.errorHandler(h,k,g,j,i)});if(this.hdas){this.listenTo(this.hdas,"error",function(){this.trigger.apply(this,["error:hdas"].concat(jQuery.makeArray(arguments)))})}this.on("change:id",function(h,g){if(this.hdas){this.hdas.historyId=g}},this)},errorHandler:function(h,k,g,j,i){this.clearUpdateTimeout()},ownedByCurrUser:function(){if(!Galaxy||!Galaxy.currUser){return false}if(Galaxy.currUser.isAnonymous()||Galaxy.currUser.id!==this.get("user_id")){return false}return true},hdaCount:function(){return _.reduce(_.values(this.get("state_details")),function(g,h){return g+h},0)},checkForUpdates:function(g){if(this.hdas.running().length){this.setUpdateTimeout()}else{this.trigger("ready");if(_.isFunction(g)){g.call(this)}}return this},setUpdateTimeout:function(g){g=g||e.UPDATE_DELAY;var h=this;this.clearUpdateTimeout();this.updateTimeoutId=setTimeout(function(){h.refresh()},g);return this.updateTimeoutId},clearUpdateTimeout:function(){if(this.updateTimeoutId){clearTimeout(this.updateTimeoutId);this.updateTimeoutId=null}},refresh:function(h,g){h=h||[];g=g||{};var i=this;g.data=g.data||{};if(h.length){g.data.details=h.join(",")}var j=this.hdas.fetch(g);j.done(function(k){i.checkForUpdates(function(){this.fetch()})});return j},toString:function(){return"History("+this.get("id")+","+this.get("name")+")"}});e.UPDATE_DELAY=4000;e.getHistoryData=function f(h,r){r=r||{};var l=r.hdaDetailIds||[];var n=jQuery.Deferred(),m=null;function i(s){return jQuery.ajax(galaxy_config.root+"api/histories/"+h)}function g(s){if(!s||!s.state_ids){return 0}return _.reduce(s.state_ids,function(t,v,u){return t+v.length},0)}function q(t){if(!g(t)){return[]}if(_.isFunction(l)){l=l(t)}var s=(l.length)?({details:l.join(",")}):({});return jQuery.ajax(galaxy_config.root+"api/histories/"+t.id+"/contents",{data:s})}var p=r.historyFn||i,o=r.hdaFn||q;var k=p(h);k.done(function(s){m=s;n.notify({status:"history data retrieved",historyJSON:m})});k.fail(function(u,s,t){n.reject(u,"loading the history")});var j=k.then(o);j.then(function(s){n.notify({status:"dataset data retrieved",historyJSON:m,hdaJSON:s});n.resolve(m,s)});j.fail(function(u,s,t){n.reject(u,"loading the datasets",{history:m})});return n};var d=Backbone.Collection.extend(a.LoggableMixin).extend({model:e,urlRoot:galaxy_config.root+"api/histories"});return{History:e,HistoryCollection:d}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/history/history-panel.js b/static/scripts/packed/mvc/history/history-panel.js index d7d247035e8..9922ae4c9f6 100644 --- a/static/scripts/packed/mvc/history/history-panel.js +++ b/static/scripts/packed/mvc/history/history-panel.js @@ -1 +1 @@ -define(["mvc/dataset/hda-model","mvc/dataset/hda-edit","mvc/history/readonly-history-panel","mvc/tags","mvc/annotations"],function(e,b,d,a,c){var f=d.ReadOnlyHistoryPanel.extend({HDAViewClass:b.HDAEditView,initialize:function(g){g=g||{};this.selectedHdaIds=[];this.tagsEditor=null;this.annotationEditor=null;this.selecting=g.selecting||false;this.annotationEditorShown=g.annotationEditorShown||false;this.tagsEditorShown=g.tagsEditorShown||false;d.ReadOnlyHistoryPanel.prototype.initialize.call(this,g)},_setUpModelEventHandlers:function(){d.ReadOnlyHistoryPanel.prototype._setUpModelEventHandlers.call(this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);this.model.hdas.on("change:deleted",this._handleHdaDeletionChange,this);this.model.hdas.on("change:visible",this._handleHdaVisibleChange,this);this.model.hdas.on("change:purged",function(g){this.model.fetch()},this)},renderModel:function(){var g=$("
");g.append(f.templates.historyPanel(this.model.toJSON()));this.$emptyMessage(g).text(this.emptyMsg);if(Galaxy&&Galaxy.currUser&&Galaxy.currUser.id&&Galaxy.currUser.id===this.model.get("user_id")){this._renderTags(g);this._renderAnnotation(g)}g.find(".history-secondary-actions").prepend(this._renderSelectButton());g.find(".history-dataset-actions").toggle(this.selecting);g.find(".history-secondary-actions").prepend(this._renderSearchButton());this._setUpBehaviours(g);this.renderHdas(g);return g},_renderTags:function(g){var h=this;this.tagsEditor=new a.TagsEditor({model:this.model,el:g.find(".history-controls .tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){h.toggleHDATagEditors(true,h.fxSpeed)},onhide:function(){h.toggleHDATagEditors(false,h.fxSpeed)},$activator:faIconButton({title:_l("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(g.find(".history-secondary-actions"))})},_renderAnnotation:function(g){var h=this;this.annotationEditor=new c.AnnotationEditor({model:this.model,el:g.find(".history-controls .annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){h.toggleHDAAnnotationEditors(true,h.fxSpeed)},onhide:function(){h.toggleHDAAnnotationEditors(false,h.fxSpeed)},$activator:faIconButton({title:_l("Edit history Annotation"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(g.find(".history-secondary-actions"))})},_renderSelectButton:function(g){return faIconButton({title:_l("Operations on multiple datasets"),classes:"history-select-btn",faIcon:"fa-check-square-o"})},_setUpBehaviours:function(g){g=g||this.$el;d.ReadOnlyHistoryPanel.prototype._setUpBehaviours.call(this,g);if(!this.model){return}this._setUpDatasetActionsPopup(g);if((!Galaxy.currUser||Galaxy.currUser.isAnonymous())||(Galaxy.currUser.id!==this.model.get("user_id"))){return}var h=this;g.find(".history-name").attr("title",_l("Click to rename history")).tooltip({placement:"bottom"}).make_text_editable({on_finish:function(i){var j=h.model.get("name");if(i&&i!==j){h.$el.find(".history-name").text(i);h.model.save({name:i}).fail(function(){h.$el.find(".history-name").text(h.model.previous("name"))})}else{h.$el.find(".history-name").text(j)}}})},_setUpDatasetActionsPopup:function(g){var h=this;(new PopupMenu(g.find(".history-dataset-action-popup-btn"),[{html:_l("Hide datasets"),func:function(){var i=e.HistoryDatasetAssociation.prototype.hide;h.getSelectedHdaCollection().ajaxQueue(i)}},{html:_l("Unhide datasets"),func:function(){var i=e.HistoryDatasetAssociation.prototype.unhide;h.getSelectedHdaCollection().ajaxQueue(i)}},{html:_l("Delete datasets"),func:function(){var i=e.HistoryDatasetAssociation.prototype["delete"];h.getSelectedHdaCollection().ajaxQueue(i)}},{html:_l("Undelete datasets"),func:function(){var i=e.HistoryDatasetAssociation.prototype.undelete;h.getSelectedHdaCollection().ajaxQueue(i)}},{html:_l("Permanently delete datasets"),func:function(){if(confirm(_l("This will permanently remove the data in your datasets. Are you sure?"))){var i=e.HistoryDatasetAssociation.prototype.purge;h.getSelectedHdaCollection().ajaxQueue(i)}}}]))},_handleHdaDeletionChange:function(g){if(g.get("deleted")&&!this.storage.get("show_deleted")){this.removeHdaView(this.hdaViews[g.id])}},_handleHdaVisibleChange:function(g){if(g.hidden()&&!this.storage.get("show_hidden")){this.removeHdaView(this.hdaViews[g.id])}},_createHdaView:function(h){var g=h.get("id"),i=new this.HDAViewClass({model:h,linkTarget:this.linkTarget,expanded:this.storage.get("expandedHdas")[g],selectable:this.selecting,hasUser:this.model.ownedByCurrUser(),logger:this.logger,tagsEditorShown:(this.tagsEditor&&!this.tagsEditor.hidden),annotationEditorShown:(this.annotationEditor&&!this.annotationEditor.hidden)});this._setUpHdaListeners(i);return i},_setUpHdaListeners:function(h){var g=this;d.ReadOnlyHistoryPanel.prototype._setUpHdaListeners.call(this,h);h.on("selected",function(i){var j=i.model.get("id");g.selectedHdaIds=_.union(g.selectedHdaIds,[j])});h.on("de-selected",function(i){var j=i.model.get("id");g.selectedHdaIds=_.without(g.selectedHdaIds,j)})},toggleHDATagEditors:function(g){var h=arguments;_.each(this.hdaViews,function(i){if(i.tagsEditor){i.tagsEditor.toggle.apply(i.tagsEditor,h)}})},toggleHDAAnnotationEditors:function(g){var h=arguments;_.each(this.hdaViews,function(i){if(i.annotationEditor){i.annotationEditor.toggle.apply(i.annotationEditor,h)}})},removeHdaView:function(h){if(!h){return}var g=this;h.$el.fadeOut(g.fxSpeed,function(){h.off();h.remove();delete g.hdaViews[h.model.id];if(_.isEmpty(g.hdaViews)){g.$emptyMessage().fadeIn(g.fxSpeed,function(){g.trigger("empty-history",g)})}})},events:_.extend(_.clone(d.ReadOnlyHistoryPanel.prototype.events),{"click .history-select-btn":"toggleSelectors","click .history-select-all-datasets-btn":"selectAllDatasets","click .history-deselect-all-datasets-btn":"deselectAllDatasets"}),updateHistoryDiskSize:function(){this.$el.find(".history-size").text(this.model.get("nice_size"))},showSelectors:function(g){g=(g!==undefined)?(g):(this.fxSpeed);this.selecting=true;this.$(".history-dataset-actions").slideDown(g);_.each(this.hdaViews,function(h){h.showSelector()});this.selectedHdaIds=[]},hideSelectors:function(g){g=(g!==undefined)?(g):(this.fxSpeed);this.selecting=false;this.$(".history-dataset-actions").slideUp(g);_.each(this.hdaViews,function(h){h.hideSelector()});this.selectedHdaIds=[]},toggleSelectors:function(){if(!this.selecting){this.showSelectors()}else{this.hideSelectors()}},selectAllDatasets:function(g){_.each(this.hdaViews,function(h){h.select(g)})},deselectAllDatasets:function(g){_.each(this.hdaViews,function(h){h.deselect(g)})},getSelectedHdaViews:function(){return _.filter(this.hdaViews,function(g){return g.selected})},getSelectedHdaCollection:function(){return new e.HDACollection(_.map(this.getSelectedHdaViews(),function(g){return g.model}),{historyId:this.model.id})},toString:function(){return"HistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{HistoryPanel:f}}); \ No newline at end of file +define(["mvc/dataset/hda-model","mvc/dataset/hda-edit","mvc/history/readonly-history-panel","mvc/tags","mvc/annotations","utils/localization"],function(f,b,d,a,c,e){var g=d.ReadOnlyHistoryPanel.extend({HDAViewClass:b.HDAEditView,initialize:function(h){h=h||{};this.selectedHdaIds=[];this.tagsEditor=null;this.annotationEditor=null;this.selecting=h.selecting||false;this.annotationEditorShown=h.annotationEditorShown||false;this.tagsEditorShown=h.tagsEditorShown||false;d.ReadOnlyHistoryPanel.prototype.initialize.call(this,h)},_setUpModelEventHandlers:function(){d.ReadOnlyHistoryPanel.prototype._setUpModelEventHandlers.call(this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);this.model.hdas.on("change:deleted",this._handleHdaDeletionChange,this);this.model.hdas.on("change:visible",this._handleHdaVisibleChange,this);this.model.hdas.on("change:purged",function(h){this.model.fetch()},this)},renderModel:function(){var h=$("
");h.append(g.templates.historyPanel(this.model.toJSON()));this.$emptyMessage(h).text(this.emptyMsg);if(Galaxy&&Galaxy.currUser&&Galaxy.currUser.id&&Galaxy.currUser.id===this.model.get("user_id")){this._renderTags(h);this._renderAnnotation(h)}h.find(".history-secondary-actions").prepend(this._renderSelectButton());h.find(".history-dataset-actions").toggle(this.selecting);h.find(".history-secondary-actions").prepend(this._renderSearchButton());this._setUpBehaviours(h);this.renderHdas(h);return h},_renderTags:function(h){var i=this;this.tagsEditor=new a.TagsEditor({model:this.model,el:h.find(".history-controls .tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){i.toggleHDATagEditors(true,i.fxSpeed)},onhide:function(){i.toggleHDATagEditors(false,i.fxSpeed)},$activator:faIconButton({title:e("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(h.find(".history-secondary-actions"))})},_renderAnnotation:function(h){var i=this;this.annotationEditor=new c.AnnotationEditor({model:this.model,el:h.find(".history-controls .annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){i.toggleHDAAnnotationEditors(true,i.fxSpeed)},onhide:function(){i.toggleHDAAnnotationEditors(false,i.fxSpeed)},$activator:faIconButton({title:e("Edit history Annotation"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(h.find(".history-secondary-actions"))})},_renderSelectButton:function(h){return faIconButton({title:e("Operations on multiple datasets"),classes:"history-select-btn",faIcon:"fa-check-square-o"})},_setUpBehaviours:function(h){h=h||this.$el;d.ReadOnlyHistoryPanel.prototype._setUpBehaviours.call(this,h);if(!this.model){return}this._setUpDatasetActionsPopup(h);if((!Galaxy.currUser||Galaxy.currUser.isAnonymous())||(Galaxy.currUser.id!==this.model.get("user_id"))){return}var i=this;h.find(".history-name").attr("title",e("Click to rename history")).tooltip({placement:"bottom"}).make_text_editable({on_finish:function(j){var k=i.model.get("name");if(j&&j!==k){i.$el.find(".history-name").text(j);i.model.save({name:j}).fail(function(){i.$el.find(".history-name").text(i.model.previous("name"))})}else{i.$el.find(".history-name").text(k)}}})},_setUpDatasetActionsPopup:function(h){var i=this;(new PopupMenu(h.find(".history-dataset-action-popup-btn"),[{html:e("Hide datasets"),func:function(){var j=f.HistoryDatasetAssociation.prototype.hide;i.getSelectedHdaCollection().ajaxQueue(j)}},{html:e("Unhide datasets"),func:function(){var j=f.HistoryDatasetAssociation.prototype.unhide;i.getSelectedHdaCollection().ajaxQueue(j)}},{html:e("Delete datasets"),func:function(){var j=f.HistoryDatasetAssociation.prototype["delete"];i.getSelectedHdaCollection().ajaxQueue(j)}},{html:e("Undelete datasets"),func:function(){var j=f.HistoryDatasetAssociation.prototype.undelete;i.getSelectedHdaCollection().ajaxQueue(j)}},{html:e("Permanently delete datasets"),func:function(){if(confirm(e("This will permanently remove the data in your datasets. Are you sure?"))){var j=f.HistoryDatasetAssociation.prototype.purge;i.getSelectedHdaCollection().ajaxQueue(j)}}}]))},_handleHdaDeletionChange:function(h){if(h.get("deleted")&&!this.storage.get("show_deleted")){this.removeHdaView(this.hdaViews[h.id])}},_handleHdaVisibleChange:function(h){if(h.hidden()&&!this.storage.get("show_hidden")){this.removeHdaView(this.hdaViews[h.id])}},_createHdaView:function(i){var h=i.get("id"),j=new this.HDAViewClass({model:i,linkTarget:this.linkTarget,expanded:this.storage.get("expandedHdas")[h],selectable:this.selecting,hasUser:this.model.ownedByCurrUser(),logger:this.logger,tagsEditorShown:(this.tagsEditor&&!this.tagsEditor.hidden),annotationEditorShown:(this.annotationEditor&&!this.annotationEditor.hidden)});this._setUpHdaListeners(j);return j},_setUpHdaListeners:function(i){var h=this;d.ReadOnlyHistoryPanel.prototype._setUpHdaListeners.call(this,i);i.on("selected",function(j){var k=j.model.get("id");h.selectedHdaIds=_.union(h.selectedHdaIds,[k])});i.on("de-selected",function(j){var k=j.model.get("id");h.selectedHdaIds=_.without(h.selectedHdaIds,k)})},toggleHDATagEditors:function(h){var i=arguments;_.each(this.hdaViews,function(j){if(j.tagsEditor){j.tagsEditor.toggle.apply(j.tagsEditor,i)}})},toggleHDAAnnotationEditors:function(h){var i=arguments;_.each(this.hdaViews,function(j){if(j.annotationEditor){j.annotationEditor.toggle.apply(j.annotationEditor,i)}})},removeHdaView:function(i){if(!i){return}var h=this;i.$el.fadeOut(h.fxSpeed,function(){i.off();i.remove();delete h.hdaViews[i.model.id];if(_.isEmpty(h.hdaViews)){h.$emptyMessage().fadeIn(h.fxSpeed,function(){h.trigger("empty-history",h)})}})},events:_.extend(_.clone(d.ReadOnlyHistoryPanel.prototype.events),{"click .history-select-btn":"toggleSelectors","click .history-select-all-datasets-btn":"selectAllDatasets","click .history-deselect-all-datasets-btn":"deselectAllDatasets"}),updateHistoryDiskSize:function(){this.$el.find(".history-size").text(this.model.get("nice_size"))},showSelectors:function(h){h=(h!==undefined)?(h):(this.fxSpeed);this.selecting=true;this.$(".history-dataset-actions").slideDown(h);_.each(this.hdaViews,function(i){i.showSelector()});this.selectedHdaIds=[]},hideSelectors:function(h){h=(h!==undefined)?(h):(this.fxSpeed);this.selecting=false;this.$(".history-dataset-actions").slideUp(h);_.each(this.hdaViews,function(i){i.hideSelector()});this.selectedHdaIds=[]},toggleSelectors:function(){if(!this.selecting){this.showSelectors()}else{this.hideSelectors()}},selectAllDatasets:function(h){_.each(this.hdaViews,function(i){i.select(h)})},deselectAllDatasets:function(h){_.each(this.hdaViews,function(i){i.deselect(h)})},getSelectedHdaViews:function(){return _.filter(this.hdaViews,function(h){return h.selected})},getSelectedHdaCollection:function(){return new f.HDACollection(_.map(this.getSelectedHdaViews(),function(h){return h.model}),{historyId:this.model.id})},toString:function(){return"HistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{HistoryPanel:g}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/history/readonly-history-panel.js b/static/scripts/packed/mvc/history/readonly-history-panel.js index 5c81dfd9ef1..a1c71313701 100644 --- a/static/scripts/packed/mvc/history/readonly-history-panel.js +++ b/static/scripts/packed/mvc/history/readonly-history-panel.js @@ -1 +1 @@ -define(["mvc/history/history-model","mvc/dataset/hda-base","mvc/user/user-model","mvc/base-mvc"],function(f,b,a,e){var h=e.SessionStorageModel.extend({defaults:{expandedHdas:{},show_deleted:false,show_hidden:false},addExpandedHda:function(l){var k="expandedHdas";this.save(k,_.extend(this.get(k),_.object([l],[true])))},removeExpandedHda:function(l){var k="expandedHdas";this.save(k,_.omit(this.get(k),l))},toString:function(){return"HistoryPrefs("+this.id+")"}});h.storageKeyPrefix="history:";h.historyStorageKey=function d(k){if(!k){throw new Error("HistoryPrefs.historyStorageKey needs valid id: "+k)}return(h.storageKeyPrefix+k)};h.get=function c(k){return new h({id:h.historyStorageKey(k)})};h.clearAll=function g(l){for(var k in sessionStorage){if(k.indexOf(h.storageKeyPrefix)===0){sessionStorage.removeItem(k)}}};var i=Backbone.View.extend(e.LoggableMixin).extend({HDAViewClass:b.HDABaseView,tagName:"div",className:"history-panel",fxSpeed:"fast",emptyMsg:_l("This history is empty"),noneFoundMsg:_l("No matching datasets found"),initialize:function(k){k=k||{};if(k.logger){this.logger=k.logger}this.log(this+".initialize:",k);this.linkTarget=k.linkTarget||"_blank";this.fxSpeed=_.has(k,"fxSpeed")?(k.fxSpeed):(this.fxSpeed);this.filters=[];this.searchFor="";this.findContainerFn=k.findContainerFn;this.hdaViews={};this.indicator=new LoadingIndicator(this.$el);this._setUpListeners();var l=_.pick(k,"initiallyExpanded","show_deleted","show_hidden");this.setModel(this.model,l,false);if(k.onready){k.onready.call(this)}},_setUpListeners:function(){this.on("error",function(l,o,k,n,m){this.errorHandler(l,o,k,n,m)});this.on("loading-history",function(){this._showLoadingIndicator("loading history...",40)});this.on("loading-done",function(){this._hideLoadingIndicator(40);if(_.isEmpty(this.hdaViews)){this.trigger("empty-history",this)}});this.once("rendered",function(){this.trigger("rendered:initial",this);return false});if(this.logger){this.on("all",function(k){this.log(this+"",arguments)},this)}return this},errorHandler:function(m,p,l,o,n){console.error(m,p,l,o,n);if(p&&p.status===0&&p.readyState===0){}else{if(p&&p.status===502){}else{var k=this._parseErrorMessage(m,p,l,o,n);if(!this.$messages().is(":visible")){this.once("rendered",function(){this.displayMessage("error",k.message,k.details)})}else{this.displayMessage("error",k.message,k.details)}}}},_parseErrorMessage:function(n,r,m,q,p){var l=Galaxy.currUser,k={message:this._bePolite(q),details:{user:(l instanceof a.User)?(l.toJSON()):(l+""),source:(n instanceof Backbone.Model)?(n.toJSON()):(n+""),xhr:r,options:(r)?(_.omit(m,"xhr")):(m)}};_.extend(k.details,p||{});if(r&&_.isFunction(r.getAllResponseHeaders)){var o=r.getAllResponseHeaders();o=_.compact(o.split("\n"));o=_.map(o,function(s){return s.split(": ")});k.details.xhr.responseHeaders=_.object(o)}return k},_bePolite:function(k){k=k||_l("An error occurred while getting updates from the server");return k+". "+_l("Please contact a Galaxy administrator if the problem persists.")},loadHistoryWithHDADetails:function(m,l,k,o){var n=function(p){return _.keys(h.get(p.id).get("expandedHdas"))};return this.loadHistory(m,l,k,o,n)},loadHistory:function(n,m,l,q,o){var k=this;m=m||{};k.trigger("loading-history",k);var p=f.History.getHistoryData(n,{historyFn:l,hdaFn:q,hdaDetailIds:m.initiallyExpanded||o});return k._loadHistoryFromXHR(p,m).fail(function(t,r,s){k.trigger("error",k,t,m,_l("An error was encountered while "+r),{historyId:n,history:s||{}})}).always(function(){k.trigger("loading-done",k)})},_loadHistoryFromXHR:function(m,l){var k=this;m.then(function(n,o){k.JSONToModel(n,o,l)});m.fail(function(o,n){k.render()});return m},JSONToModel:function(n,k,l){this.log("JSONToModel:",n,k,l);l=l||{};var m=new f.History(n,k,l);this.setModel(m);return this},setModel:function(l,k,m){k=k||{};m=(m!==undefined)?(m):(true);this.log("setModel:",l,k,m);this.freeModel();this.selectedHdaIds=[];if(l){this.model=l;if(this.logger){this.model.logger=this.logger}this._setUpWebStorage(k.initiallyExpanded,k.show_deleted,k.show_hidden);this._setUpModelEventHandlers();this.trigger("new-model",this)}if(m){this.render()}return this},freeModel:function(){if(this.model){this.model.clearUpdateTimeout();this.stopListening(this.model);this.stopListening(this.model.hdas)}this.freeHdaViews();return this},freeHdaViews:function(){this.hdaViews={};return this},_setUpWebStorage:function(l,k,m){this.storage=new h({id:h.historyStorageKey(this.model.get("id"))});if(_.isObject(l)){this.storage.set("exandedHdas",l)}if(_.isBoolean(k)){this.storage.set("show_deleted",k)}if(_.isBoolean(m)){this.storage.set("show_hidden",m)}this.trigger("new-storage",this.storage,this);this.log(this+" (init'd) storage:",this.storage.get());return this},_setUpModelEventHandlers:function(){this.model.hdas.on("add",this.addHdaView,this);this.model.on("error error:hdas",function(l,n,k,m){this.errorHandler(l,n,k,m)},this);return this},render:function(m,n){this.log("render:",m,n);m=(m===undefined)?(this.fxSpeed):(m);var k=this,l;if(this.model){l=this.renderModel()}else{l=this.renderWithoutModel()}$(k).queue("fx",[function(o){if(m&&k.$el.is(":visible")){k.$el.fadeOut(m,o)}else{o()}},function(o){k.$el.empty();if(l){k.$el.append(l.children())}o()},function(o){if(m&&!k.$el.is(":visible")){k.$el.fadeIn(m,o)}else{o()}},function(o){if(n){n.call(this)}k.trigger("rendered",this);o()}]);return this},renderWithoutModel:function(){var k=$("
"),l=$("
").addClass("message-container").css({margin:"4px"});return k.append(l)},renderModel:function(){var k=$("
");k.append(i.templates.historyPanel(this.model.toJSON()));this.$emptyMessage(k).text(this.emptyMsg);k.find(".history-secondary-actions").prepend(this._renderSearchButton());this._setUpBehaviours(k);this.renderHdas(k);return k},_renderEmptyMsg:function(m){var l=this,k=l.$emptyMessage(m);if(!_.isEmpty(l.hdaViews)){k.hide()}else{if(l.searchFor){k.text(l.noneFoundMsg).show()}else{k.text(l.emptyMsg).show()}}return this},_renderSearchButton:function(k){return faIconButton({title:_l("Search datasets"),classes:"history-search-btn",faIcon:"fa-search"})},_setUpBehaviours:function(k){k=k||this.$el;k.find("[title]").tooltip({placement:"bottom"});this._setUpSearchInput(k.find(".history-search-controls .history-search-input"));return this},$container:function(){return(this.findContainerFn)?(this.findContainerFn.call(this)):(this.$el.parent())},$datasetsList:function(k){return(k||this.$el).find(".datasets-list")},$messages:function(k){return(k||this.$el).find(".message-container")},$emptyMessage:function(k){return(k||this.$el).find(".empty-history-message")},renderHdas:function(l){l=l||this.$el;var k=this,n={},m=this.model.hdas.getVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"),this.filters);this.$datasetsList(l).empty();if(m.length){m.each(function(p){var o=p.get("id"),q=k._createHdaView(p);n[o]=q;if(_.contains(k.selectedHdaIds,o)){q.selected=true}k.attachHdaView(q.render(),l)})}this.hdaViews=n;this._renderEmptyMsg(l);return this.hdaViews},_createHdaView:function(l){var k=l.get("id"),m=new this.HDAViewClass({model:l,linkTarget:this.linkTarget,expanded:this.storage.get("expandedHdas")[k],hasUser:this.model.ownedByCurrUser(),logger:this.logger});this._setUpHdaListeners(m);return m},_setUpHdaListeners:function(l){var k=this;l.on("error",function(n,p,m,o){k.errorHandler(n,p,m,o)});l.on("body-expanded",function(m){k.storage.addExpandedHda(m)});l.on("body-collapsed",function(m){k.storage.removeExpandedHda(m)});return this},attachHdaView:function(m,l){l=l||this.$el;var k=this.$datasetsList(l);k.prepend(m.$el);return this},addHdaView:function(n){this.log("add."+this,n);var l=this;if(!n.isVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"))){return l}$({}).queue([function m(p){var o=l.$emptyMessage();if(o.is(":visible")){o.fadeOut(l.fxSpeed,p)}else{p()}},function k(o){var p=l._createHdaView(n);l.hdaViews[n.id]=p;p.render().$el.hide();l.scrollToTop();l.attachHdaView(p);p.$el.slideDown(l.fxSpeed)}]);return l},refreshHdas:function(l,k){if(this.model){return this.model.refresh(l,k)}return $.when()},events:{"click .message-container":"clearMessages","click .history-search-btn":"toggleSearchControls"},collapseAllHdaBodies:function(){_.each(this.hdaViews,function(k){k.toggleBodyVisibility(null,false)});this.storage.set("expandedHdas",{});return this},toggleShowDeleted:function(k){k=(k!==undefined)?(k):(!this.storage.get("show_deleted"));this.storage.set("show_deleted",k);this.renderHdas();return this.storage.get("show_deleted")},toggleShowHidden:function(k){k=(k!==undefined)?(k):(!this.storage.get("show_hidden"));this.storage.set("show_hidden",k);this.renderHdas();return this.storage.get("show_hidden")},_setUpSearchInput:function(l){var m=this,n=".history-search-input";function k(o){if(m.model.hdas.haveDetails()){m.searchHdas(o);return}m.$el.find(n).searchInput("toggle-loading");m.model.hdas.fetchAllDetails({silent:true}).always(function(){m.$el.find(n).searchInput("toggle-loading")}).done(function(){m.searchHdas(o)})}l.searchInput({initialVal:m.searchFor,name:"history-search",placeholder:"search datasets",classes:"history-search",onfirstsearch:k,onsearch:_.bind(this.searchHdas,this),onclear:_.bind(this.clearHdaSearch,this)});return l},toggleSearchControls:function(m,k){var l=this.$el.find(".history-search-controls"),n=(jQuery.type(m)==="number")?(m):(this.fxSpeed);k=(k!==undefined)?(k):(!l.is(":visible"));if(k){l.slideDown(n,function(){$(this).find("input").focus()})}else{l.slideUp(n)}return k},searchHdas:function(k){var l=this;this.searchFor=k;this.filters=[function(m){return m.matchesAll(l.searchFor)}];this.trigger("search:searching",k,this);this.renderHdas();return this},clearHdaSearch:function(k){this.searchFor="";this.filters=[];this.trigger("search:clear",this);this.renderHdas();return this},_showLoadingIndicator:function(l,k,m){k=(k!==undefined)?(k):(this.fxSpeed);if(!this.indicator){this.indicator=new LoadingIndicator(this.$el,this.$el.parent())}if(!this.$el.is(":visible")){this.indicator.show(0,m)}else{this.$el.fadeOut(k);this.indicator.show(l,k,m)}},_hideLoadingIndicator:function(k,l){k=(k!==undefined)?(k):(this.fxSpeed);if(this.indicator){this.indicator.hide(k,l)}},displayMessage:function(p,q,o){var m=this;this.scrollToTop();var n=this.$messages(),k=$("
").addClass(p+"message").html(q);if(!_.isEmpty(o)){var l=$('Details').click(function(){Galaxy.modal.show(m._messageToModalOptions(p,q,o));return false});k.append(" ",l)}return n.html(k)},_messageToModalOptions:function(o,q,n){var k=this,p=$("
"),m={title:"Details"};function l(r){r=_.omit(r,_.functions(r));return["",_.map(r,function(t,s){t=(_.isObject(t))?(l(t)):(t);return'"}).join(""),"
'+s+''+t+"
"].join("")}if(_.isObject(n)){m.body=p.append(l(n))}else{m.body=p.html(n)}m.buttons={Ok:function(){Galaxy.modal.hide();k.clearMessages()}};return m},clearMessages:function(){this.$messages().empty();return this},scrollPosition:function(){return this.$container().scrollTop()},scrollTo:function(k){this.$container().scrollTop(k);return this},scrollToTop:function(){this.$container().scrollTop(0);return this},scrollToId:function(l){if((!l)||(!this.hdaViews[l])){return this}var k=this.hdaViews[l];this.scrollTo(k.el.offsetTop);return this},scrollToHid:function(k){var l=this.model.hdas.getByHid(k);if(!l){return this}return this.scrollToId(l.id)},toString:function(){return"ReadOnlyHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});var j=['
','
','
',"
",'
',"<% if( history.name ){ %>",'
<%= history.name %>
',"<% } %>","
",'
',"<% if( history.nice_size ){ %>",'
<%= history.nice_size %>
',"<% } %>",'
',"
","<% if( history.deleted ){ %>",'
',_l("You are currently viewing a deleted history!"),"
","<% } %>",'
',"<% if( history.message ){ %>",'
<%= history.message %>
',"<% } %>","
",'
',_l("You are over your disk quota."),_l("Tool execution is on hold until your disk usage drops below your allocated quota."),"
",'
','
','
','
','",'","
",'","
","
",'
','
',_l("Your history is empty. Click 'Get Data' on the left pane to start"),"
"].join("");i.templates={historyPanel:function(k){return _.template(j,k,{variable:"history"})}};return{ReadOnlyHistoryPanel:i}}); \ No newline at end of file +define(["mvc/history/history-model","mvc/dataset/hda-base","mvc/user/user-model","mvc/base-mvc","utils/localization"],function(g,b,a,f,d){var i=f.SessionStorageModel.extend({defaults:{expandedHdas:{},show_deleted:false,show_hidden:false},addExpandedHda:function(m){var l="expandedHdas";this.save(l,_.extend(this.get(l),_.object([m],[true])))},removeExpandedHda:function(m){var l="expandedHdas";this.save(l,_.omit(this.get(l),m))},toString:function(){return"HistoryPrefs("+this.id+")"}});i.storageKeyPrefix="history:";i.historyStorageKey=function e(l){if(!l){throw new Error("HistoryPrefs.historyStorageKey needs valid id: "+l)}return(i.storageKeyPrefix+l)};i.get=function c(l){return new i({id:i.historyStorageKey(l)})};i.clearAll=function h(m){for(var l in sessionStorage){if(l.indexOf(i.storageKeyPrefix)===0){sessionStorage.removeItem(l)}}};var j=Backbone.View.extend(f.LoggableMixin).extend({HDAViewClass:b.HDABaseView,tagName:"div",className:"history-panel",fxSpeed:"fast",emptyMsg:d("This history is empty"),noneFoundMsg:d("No matching datasets found"),initialize:function(l){l=l||{};if(l.logger){this.logger=l.logger}this.log(this+".initialize:",l);this.linkTarget=l.linkTarget||"_blank";this.fxSpeed=_.has(l,"fxSpeed")?(l.fxSpeed):(this.fxSpeed);this.filters=[];this.searchFor="";this.findContainerFn=l.findContainerFn;this.hdaViews={};this.indicator=new LoadingIndicator(this.$el);this._setUpListeners();var m=_.pick(l,"initiallyExpanded","show_deleted","show_hidden");this.setModel(this.model,m,false);if(l.onready){l.onready.call(this)}},_setUpListeners:function(){this.on("error",function(m,p,l,o,n){this.errorHandler(m,p,l,o,n)});this.on("loading-history",function(){this._showLoadingIndicator("loading history...",40)});this.on("loading-done",function(){this._hideLoadingIndicator(40);if(_.isEmpty(this.hdaViews)){this.trigger("empty-history",this)}});this.once("rendered",function(){this.trigger("rendered:initial",this);return false});if(this.logger){this.on("all",function(l){this.log(this+"",arguments)},this)}return this},errorHandler:function(n,q,m,p,o){console.error(n,q,m,p,o);if(q&&q.status===0&&q.readyState===0){}else{if(q&&q.status===502){}else{var l=this._parseErrorMessage(n,q,m,p,o);if(!this.$messages().is(":visible")){this.once("rendered",function(){this.displayMessage("error",l.message,l.details)})}else{this.displayMessage("error",l.message,l.details)}}}},_parseErrorMessage:function(o,s,n,r,q){var m=Galaxy.currUser,l={message:this._bePolite(r),details:{user:(m instanceof a.User)?(m.toJSON()):(m+""),source:(o instanceof Backbone.Model)?(o.toJSON()):(o+""),xhr:s,options:(s)?(_.omit(n,"xhr")):(n)}};_.extend(l.details,q||{});if(s&&_.isFunction(s.getAllResponseHeaders)){var p=s.getAllResponseHeaders();p=_.compact(p.split("\n"));p=_.map(p,function(t){return t.split(": ")});l.details.xhr.responseHeaders=_.object(p)}return l},_bePolite:function(l){l=l||d("An error occurred while getting updates from the server");return l+". "+d("Please contact a Galaxy administrator if the problem persists.")},loadHistoryWithHDADetails:function(n,m,l,p){var o=function(q){return _.keys(i.get(q.id).get("expandedHdas"))};return this.loadHistory(n,m,l,p,o)},loadHistory:function(o,n,m,r,p){var l=this;n=n||{};l.trigger("loading-history",l);var q=g.History.getHistoryData(o,{historyFn:m,hdaFn:r,hdaDetailIds:n.initiallyExpanded||p});return l._loadHistoryFromXHR(q,n).fail(function(u,s,t){l.trigger("error",l,u,n,d("An error was encountered while "+s),{historyId:o,history:t||{}})}).always(function(){l.trigger("loading-done",l)})},_loadHistoryFromXHR:function(n,m){var l=this;n.then(function(o,p){l.JSONToModel(o,p,m)});n.fail(function(p,o){l.render()});return n},JSONToModel:function(o,l,m){this.log("JSONToModel:",o,l,m);m=m||{};var n=new g.History(o,l,m);this.setModel(n);return this},setModel:function(m,l,n){l=l||{};n=(n!==undefined)?(n):(true);this.log("setModel:",m,l,n);this.freeModel();this.selectedHdaIds=[];if(m){this.model=m;if(this.logger){this.model.logger=this.logger}this._setUpWebStorage(l.initiallyExpanded,l.show_deleted,l.show_hidden);this._setUpModelEventHandlers();this.trigger("new-model",this)}if(n){this.render()}return this},freeModel:function(){if(this.model){this.model.clearUpdateTimeout();this.stopListening(this.model);this.stopListening(this.model.hdas)}this.freeHdaViews();return this},freeHdaViews:function(){this.hdaViews={};return this},_setUpWebStorage:function(m,l,n){this.storage=new i({id:i.historyStorageKey(this.model.get("id"))});if(_.isObject(m)){this.storage.set("exandedHdas",m)}if(_.isBoolean(l)){this.storage.set("show_deleted",l)}if(_.isBoolean(n)){this.storage.set("show_hidden",n)}this.trigger("new-storage",this.storage,this);this.log(this+" (init'd) storage:",this.storage.get());return this},_setUpModelEventHandlers:function(){this.model.hdas.on("add",this.addHdaView,this);this.model.on("error error:hdas",function(m,o,l,n){this.errorHandler(m,o,l,n)},this);return this},render:function(n,o){this.log("render:",n,o);n=(n===undefined)?(this.fxSpeed):(n);var l=this,m;if(this.model){m=this.renderModel()}else{m=this.renderWithoutModel()}$(l).queue("fx",[function(p){if(n&&l.$el.is(":visible")){l.$el.fadeOut(n,p)}else{p()}},function(p){l.$el.empty();if(m){l.$el.append(m.children())}p()},function(p){if(n&&!l.$el.is(":visible")){l.$el.fadeIn(n,p)}else{p()}},function(p){if(o){o.call(this)}l.trigger("rendered",this);p()}]);return this},renderWithoutModel:function(){var l=$("
"),m=$("
").addClass("message-container").css({margin:"4px"});return l.append(m)},renderModel:function(){var l=$("
");l.append(j.templates.historyPanel(this.model.toJSON()));this.$emptyMessage(l).text(this.emptyMsg);l.find(".history-secondary-actions").prepend(this._renderSearchButton());this._setUpBehaviours(l);this.renderHdas(l);return l},_renderEmptyMsg:function(n){var m=this,l=m.$emptyMessage(n);if(!_.isEmpty(m.hdaViews)){l.hide()}else{if(m.searchFor){l.text(m.noneFoundMsg).show()}else{l.text(m.emptyMsg).show()}}return this},_renderSearchButton:function(l){return faIconButton({title:d("Search datasets"),classes:"history-search-btn",faIcon:"fa-search"})},_setUpBehaviours:function(l){l=l||this.$el;l.find("[title]").tooltip({placement:"bottom"});this._setUpSearchInput(l.find(".history-search-controls .history-search-input"));return this},$container:function(){return(this.findContainerFn)?(this.findContainerFn.call(this)):(this.$el.parent())},$datasetsList:function(l){return(l||this.$el).find(".datasets-list")},$messages:function(l){return(l||this.$el).find(".message-container")},$emptyMessage:function(l){return(l||this.$el).find(".empty-history-message")},renderHdas:function(m){m=m||this.$el;var l=this,o={},n=this.model.hdas.getVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"),this.filters);this.$datasetsList(m).empty();if(n.length){n.each(function(q){var p=q.get("id"),r=l._createHdaView(q);o[p]=r;if(_.contains(l.selectedHdaIds,p)){r.selected=true}l.attachHdaView(r.render(),m)})}this.hdaViews=o;this._renderEmptyMsg(m);return this.hdaViews},_createHdaView:function(m){var l=m.get("id"),n=new this.HDAViewClass({model:m,linkTarget:this.linkTarget,expanded:this.storage.get("expandedHdas")[l],hasUser:this.model.ownedByCurrUser(),logger:this.logger});this._setUpHdaListeners(n);return n},_setUpHdaListeners:function(m){var l=this;m.on("error",function(o,q,n,p){l.errorHandler(o,q,n,p)});m.on("body-expanded",function(n){l.storage.addExpandedHda(n)});m.on("body-collapsed",function(n){l.storage.removeExpandedHda(n)});return this},attachHdaView:function(n,m){m=m||this.$el;var l=this.$datasetsList(m);l.prepend(n.$el);return this},addHdaView:function(o){this.log("add."+this,o);var m=this;if(!o.isVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"))){return m}$({}).queue([function n(q){var p=m.$emptyMessage();if(p.is(":visible")){p.fadeOut(m.fxSpeed,q)}else{q()}},function l(p){var q=m._createHdaView(o);m.hdaViews[o.id]=q;q.render().$el.hide();m.scrollToTop();m.attachHdaView(q);q.$el.slideDown(m.fxSpeed)}]);return m},refreshHdas:function(m,l){if(this.model){return this.model.refresh(m,l)}return $.when()},events:{"click .message-container":"clearMessages","click .history-search-btn":"toggleSearchControls"},collapseAllHdaBodies:function(){_.each(this.hdaViews,function(l){l.toggleBodyVisibility(null,false)});this.storage.set("expandedHdas",{});return this},toggleShowDeleted:function(l){l=(l!==undefined)?(l):(!this.storage.get("show_deleted"));this.storage.set("show_deleted",l);this.renderHdas();return this.storage.get("show_deleted")},toggleShowHidden:function(l){l=(l!==undefined)?(l):(!this.storage.get("show_hidden"));this.storage.set("show_hidden",l);this.renderHdas();return this.storage.get("show_hidden")},_setUpSearchInput:function(m){var n=this,o=".history-search-input";function l(p){if(n.model.hdas.haveDetails()){n.searchHdas(p);return}n.$el.find(o).searchInput("toggle-loading");n.model.hdas.fetchAllDetails({silent:true}).always(function(){n.$el.find(o).searchInput("toggle-loading")}).done(function(){n.searchHdas(p)})}m.searchInput({initialVal:n.searchFor,name:"history-search",placeholder:"search datasets",classes:"history-search",onfirstsearch:l,onsearch:_.bind(this.searchHdas,this),onclear:_.bind(this.clearHdaSearch,this)});return m},toggleSearchControls:function(n,l){var m=this.$el.find(".history-search-controls"),o=(jQuery.type(n)==="number")?(n):(this.fxSpeed);l=(l!==undefined)?(l):(!m.is(":visible"));if(l){m.slideDown(o,function(){$(this).find("input").focus()})}else{m.slideUp(o)}return l},searchHdas:function(l){var m=this;this.searchFor=l;this.filters=[function(n){return n.matchesAll(m.searchFor)}];this.trigger("search:searching",l,this);this.renderHdas();return this},clearHdaSearch:function(l){this.searchFor="";this.filters=[];this.trigger("search:clear",this);this.renderHdas();return this},_showLoadingIndicator:function(m,l,n){l=(l!==undefined)?(l):(this.fxSpeed);if(!this.indicator){this.indicator=new LoadingIndicator(this.$el,this.$el.parent())}if(!this.$el.is(":visible")){this.indicator.show(0,n)}else{this.$el.fadeOut(l);this.indicator.show(m,l,n)}},_hideLoadingIndicator:function(l,m){l=(l!==undefined)?(l):(this.fxSpeed);if(this.indicator){this.indicator.hide(l,m)}},displayMessage:function(q,r,p){var n=this;this.scrollToTop();var o=this.$messages(),l=$("
").addClass(q+"message").html(r);if(!_.isEmpty(p)){var m=$('Details').click(function(){Galaxy.modal.show(n._messageToModalOptions(q,r,p));return false});l.append(" ",m)}return o.html(l)},_messageToModalOptions:function(p,r,o){var l=this,q=$("
"),n={title:"Details"};function m(s){s=_.omit(s,_.functions(s));return["",_.map(s,function(u,t){u=(_.isObject(u))?(m(u)):(u);return'"}).join(""),"
'+t+''+u+"
"].join("")}if(_.isObject(o)){n.body=q.append(m(o))}else{n.body=q.html(o)}n.buttons={Ok:function(){Galaxy.modal.hide();l.clearMessages()}};return n},clearMessages:function(){this.$messages().empty();return this},scrollPosition:function(){return this.$container().scrollTop()},scrollTo:function(l){this.$container().scrollTop(l);return this},scrollToTop:function(){this.$container().scrollTop(0);return this},scrollToId:function(m){if((!m)||(!this.hdaViews[m])){return this}var l=this.hdaViews[m];this.scrollTo(l.el.offsetTop);return this},scrollToHid:function(l){var m=this.model.hdas.getByHid(l);if(!m){return this}return this.scrollToId(m.id)},toString:function(){return"ReadOnlyHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});var k=['
','
','
',"
",'
',"<% if( history.name ){ %>",'
<%= history.name %>
',"<% } %>","
",'
',"<% if( history.nice_size ){ %>",'
<%= history.nice_size %>
',"<% } %>",'
',"
","<% if( history.deleted ){ %>",'
',d("You are currently viewing a deleted history!"),"
","<% } %>",'
',"<% if( history.message ){ %>",'
<%= history.message %>
',"<% } %>","
",'
',d("You are over your disk quota."),d("Tool execution is on hold until your disk usage drops below your allocated quota."),"
",'
','
','
','
','",'","
",'","
","
",'
','
',d("Your history is empty. Click 'Get Data' on the left pane to start"),"
"].join("");j.templates={historyPanel:function(l){return _.template(k,l,{variable:"history"})}};return{ReadOnlyHistoryPanel:j}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/user/user-model.js b/static/scripts/packed/mvc/user/user-model.js index 4fff71defae..47e6d361c29 100644 --- a/static/scripts/packed/mvc/user/user-model.js +++ b/static/scripts/packed/mvc/user/user-model.js @@ -1 +1 @@ -define(["mvc/base-mvc"],function(a){var c=Backbone.Model.extend(a.LoggableMixin).extend({urlRoot:galaxy_config.root+"api/users",defaults:{id:null,username:"("+_l("anonymous user")+")",email:"",total_disk_usage:0,nice_total_disk_usage:"",quota_percent:null,is_admin:false},initialize:function(d){this.log("User.initialize:",d);this.on("loaded",function(e,f){this.log(this+" has loaded:",e,f)});this.on("change",function(e,f){this.log(this+" has changed:",e,f.changes)})},isAnonymous:function(){return(!this.get("email"))},isAdmin:function(){return(this.get("is_admin"))},loadFromApi:function(g,e){g=g||c.CURRENT_ID_STR;e=e||{};var d=this,f=e.success;e.success=function(i,h){d.trigger("loaded",i,h);if(f){f(i,h)}};if(g===c.CURRENT_ID_STR){e.url=this.urlRoot+"/"+c.CURRENT_ID_STR}return Backbone.Model.prototype.fetch.call(this,e)},clearSessionStorage:function(){for(var d in sessionStorage){if(d.indexOf("history:")===0){sessionStorage.removeItem(d)}else{if(d==="history-panel"){sessionStorage.removeItem(d)}}}},toString:function(){var d=[this.get("username")];if(this.get("id")){d.unshift(this.get("id"));d.push(this.get("email"))}return"User("+d.join(":")+")"}});c.CURRENT_ID_STR="current";c.getCurrentUserFromApi=function(e){var d=new c();d.loadFromApi(c.CURRENT_ID_STR,e);return d};var b=Backbone.Collection.extend(a.LoggableMixin).extend({model:c,urlRoot:galaxy_config.root+"api/users"});return{User:c}}); \ No newline at end of file +define(["mvc/base-mvc","utils/localization"],function(a,b){var d=Backbone.Model.extend(a.LoggableMixin).extend({urlRoot:galaxy_config.root+"api/users",defaults:{id:null,username:"("+b("anonymous user")+")",email:"",total_disk_usage:0,nice_total_disk_usage:"",quota_percent:null,is_admin:false},initialize:function(e){this.log("User.initialize:",e);this.on("loaded",function(f,g){this.log(this+" has loaded:",f,g)});this.on("change",function(f,g){this.log(this+" has changed:",f,g.changes)})},isAnonymous:function(){return(!this.get("email"))},isAdmin:function(){return(this.get("is_admin"))},loadFromApi:function(h,f){h=h||d.CURRENT_ID_STR;f=f||{};var e=this,g=f.success;f.success=function(j,i){e.trigger("loaded",j,i);if(g){g(j,i)}};if(h===d.CURRENT_ID_STR){f.url=this.urlRoot+"/"+d.CURRENT_ID_STR}return Backbone.Model.prototype.fetch.call(this,f)},clearSessionStorage:function(){for(var e in sessionStorage){if(e.indexOf("history:")===0){sessionStorage.removeItem(e)}else{if(e==="history-panel"){sessionStorage.removeItem(e)}}}},toString:function(){var e=[this.get("username")];if(this.get("id")){e.unshift(this.get("id"));e.push(this.get("email"))}return"User("+e.join(":")+")"}});d.CURRENT_ID_STR="current";d.getCurrentUserFromApi=function(f){var e=new d();e.loadFromApi(d.CURRENT_ID_STR,f);return e};var c=Backbone.Collection.extend(a.LoggableMixin).extend({model:d,urlRoot:galaxy_config.root+"api/users"});return{User:d}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/user/user-quotameter.js b/static/scripts/packed/mvc/user/user-quotameter.js index c26f3ca19bf..96ac00b2d16 100644 --- a/static/scripts/packed/mvc/user/user-quotameter.js +++ b/static/scripts/packed/mvc/user/user-quotameter.js @@ -1 +1 @@ -define(["mvc/base-mvc"],function(a){var b=Backbone.View.extend(a.LoggableMixin).extend({options:{warnAtPercent:85,errorAtPercent:100},initialize:function(c){this.log(this+".initialize:",c);_.extend(this.options,c);this.model.bind("change:quota_percent change:total_disk_usage",this.render,this)},update:function(c){this.log(this+" updating user data...",c);this.model.loadFromApi(this.model.get("id"),c);return this},isOverQuota:function(){return(this.model.get("quota_percent")!==null&&this.model.get("quota_percent")>=this.options.errorAtPercent)},_render_quota:function(){var c=this.model.toJSON(),e=c.quota_percent,d=$(this._templateQuotaMeter(c)),f=d.find(".progress-bar");if(this.isOverQuota()){f.attr("class","progress-bar progress-bar-danger");d.find(".quota-meter-text").css("color","white");this.trigger("quota:over",c)}else{if(e>=this.options.warnAtPercent){f.attr("class","progress-bar progress-bar-warning");this.trigger("quota:under quota:under:approaching",c)}else{f.attr("class","progress-bar progress-bar-success");this.trigger("quota:under quota:under:ok",c)}}return d},_render_usage:function(){var c=$(this._templateUsage(this.model.toJSON()));this.log(this+".rendering usage:",c);return c},render:function(){var c=null;this.log(this+".model.quota_percent:",this.model.get("quota_percent"));if((this.model.get("quota_percent")===null)||(this.model.get("quota_percent")===undefined)){c=this._render_usage()}else{c=this._render_quota()}this.$el.html(c);this.$el.find(".quota-meter-text").tooltip();return this},_templateQuotaMeter:function(c){return['
','
','
'):(">")),_l("Using")," ",c.quota_percent,"%","
","
"].join("")},_templateUsage:function(c){return['
','
',((c.nice_total_disk_usage)?(_l("Using ")+c.nice_total_disk_usage):("")),"
","
"].join("")},toString:function(){return"UserQuotaMeter("+this.model+")"}});return{UserQuotaMeter:b}}); \ No newline at end of file +define(["mvc/base-mvc","utils/localization"],function(a,c){var b=Backbone.View.extend(a.LoggableMixin).extend({options:{warnAtPercent:85,errorAtPercent:100},initialize:function(d){this.log(this+".initialize:",d);_.extend(this.options,d);this.model.bind("change:quota_percent change:total_disk_usage",this.render,this)},update:function(d){this.log(this+" updating user data...",d);this.model.loadFromApi(this.model.get("id"),d);return this},isOverQuota:function(){return(this.model.get("quota_percent")!==null&&this.model.get("quota_percent")>=this.options.errorAtPercent)},_render_quota:function(){var d=this.model.toJSON(),f=d.quota_percent,e=$(this._templateQuotaMeter(d)),g=e.find(".progress-bar");if(this.isOverQuota()){g.attr("class","progress-bar progress-bar-danger");e.find(".quota-meter-text").css("color","white");this.trigger("quota:over",d)}else{if(f>=this.options.warnAtPercent){g.attr("class","progress-bar progress-bar-warning");this.trigger("quota:under quota:under:approaching",d)}else{g.attr("class","progress-bar progress-bar-success");this.trigger("quota:under quota:under:ok",d)}}return e},_render_usage:function(){var d=$(this._templateUsage(this.model.toJSON()));this.log(this+".rendering usage:",d);return d},render:function(){var d=null;this.log(this+".model.quota_percent:",this.model.get("quota_percent"));if((this.model.get("quota_percent")===null)||(this.model.get("quota_percent")===undefined)){d=this._render_usage()}else{d=this._render_quota()}this.$el.html(d);this.$el.find(".quota-meter-text").tooltip();return this},_templateQuotaMeter:function(d){return['
','
','
'):(">")),c("Using")," ",d.quota_percent,"%","
","
"].join("")},_templateUsage:function(d){return['
','
',((d.nice_total_disk_usage)?(c("Using ")+d.nice_total_disk_usage):("")),"
","
"].join("")},toString:function(){return"UserQuotaMeter("+this.model+")"}});return{UserQuotaMeter:b}}); \ No newline at end of file diff --git a/static/scripts/packed/nls/ja/locale.js b/static/scripts/packed/nls/ja/locale.js new file mode 100644 index 00000000000..b3c40b483e5 --- /dev/null +++ b/static/scripts/packed/nls/ja/locale.js @@ -0,0 +1 @@ +define({"Are you sure you want to delete the current history?":"現在のヒストリーを消すことに同意しますか?","collapse all":"すべてをおりたたむ","History Item Attributes":"ヒストリーアイテム変数","Edit Attributes":"変数を編集する","This will inspect the dataset and attempt to correct the above column values if they are not accurate.":"これはデータセットを調査して上記のカラムの値を修正することを試みます。",'Required metadata values are missing. Some of these values may not be editable by the user. Selecting "Auto-detect" will attempt to fix these values.':"必要なメタデータの値が不明です。それらのいくつかの値はユーザによって編集可能にはなっていません。「自動判定」を選択するとそれらの値をただしくできるかもしれません。","Convert to new format":"新しいフォーマットに変換する","Convert to":"変換する","This will create a new dataset with the contents of this dataset converted to a new format.":"新しいフォーマットに変換したデータセットを新規作成します。","Change data type":"データタイプを変更する","New Type":"新しいタイプ","This will change the datatype of the existing dataset but not modify its contents. Use this if Galaxy has incorrectly guessed the type of your dataset.":"これは既存のデータセットのデータタイプを変更します。しかしデータセットの中身は変更しません。データセットのタイプの誤判定があったときに使用します。","Copy History Item":"ヒストリーアイテムをコピーする","Your saved histories":"保存したヒストリー","Stored Histories":"格納してあるヒストリー","hide deleted":"削除したヒストリーを隠す","show deleted":"削除したヒストリーを表示する",Name:"名前",Size:"サイズ","Last modified":"最終更新日",Actions:"操作",rename:"名称変更する","switch to":"変更する","delete":"削除する",undelete:"削除から戻す",Action:"操作",Share:"共有",Rename:"名称変更する",Delete:"削除する",Undelete:"削除から戻す","You have no stored histories":"保管してあるヒストリーはありません","History Options":"ヒストリーオプション","You must be ":"あなたは","logged in":"ログイン"," to store or switch histories.":"しないとヒストリーの保管や変更ができません。",' current history (stored as "%s")':' 現在のヒストリー("%s" として保管されています)',List:"リストする"," previously stored histories":" 以前に保管したヒストリー",Create:"作成する"," a new empty history":" 新規ヒストリー","Construct workflow":"ワークフローを構築する"," from the current history":" 現在のヒストリーから"," current history":" 現在のヒストリー","Show deleted":"削除したヒストリーを表示する"," datasets in history":" ヒストリーのデータセット","Rename History":"ヒストリーの名称変更をする","Rename Histories":"名称変更する","Perform Action":"操作を実行する",Submit:"登録する","Current Name":"現在の名称","New Name":"新しい名称","Share histories":"ヒストリーを共有する","Share Histories":"ヒストリーを共有する","History Name:":"ヒストリー名","Number of Datasets:":"データセット数","Share Link":"共有リンク","This history contains no data.":"このヒストリーにはデータがありません。","copy link to share":"共有リンクをコピーする","Email of User to share with:":"共有したいユーザのEメール:","Galaxy History":"Galaxy ヒストリー",refresh:"リフレッシュ","You are currently viewing a deleted history!":"消去したヒストリーをみています。","Your history is empty. Click 'Get Data' on the left pane to start":"ヒストリーは空です。解析をはじめるには、左パネルの 'データ取得' をクリック","Job is waiting to run":"ジョブは実行待ちです","Job is currently running":"ジョブは実行中です","An error occurred running this job: ":"このジョブの実行中に発生したエラー: ","report this error":"このエラーを報告する","No data: ":"データ無し: ","format: ":"フォーマット: ","database: ":"データベース: ","Info: ":"情報: ",'Error: unknown dataset state "%s".':'エラー: 不明なデータ状態 "%s"。',Options:"オプション",History:"ヒストリー","report bugs":"バグを報告する",wiki:"wiki",screencasts:"スクリーンキャスト",blog:"ブログ","Logged in as %s: ":"%s としてログイン中: ",manage:"管理",logout:"ログアウト","Account: ":"アカウント: ",create:"作成",login:"ログイン","Galaxy Tools":"Galaxy ツール群",Workflow:"ワークフロー",Manage:"管理",workflows:"ワークフロー","Account settings":"アカウント設定","You are currently logged in as %s.":"%s としてログイン中。","Change your password":"パスワード変更","Update your email address":"メールアドレス変更",Logout:"ログアウト",Login:"ログイン","Create new account":"新規アカウントを作成する"}); \ No newline at end of file diff --git a/static/scripts/packed/nls/locale.js b/static/scripts/packed/nls/locale.js new file mode 100644 index 00000000000..4b6b6bfe7ca --- /dev/null +++ b/static/scripts/packed/nls/locale.js @@ -0,0 +1 @@ +define({root:{history:false,"Are you sure you want to delete the current history?":false,"collapse all":false,"History Item Attributes":false,"Edit Attributes":false,"This will inspect the dataset and attempt to correct the above column values if they are not accurate.":false,'Required metadata values are missing. Some of these values may not be editable by the user. Selecting "Auto-detect" will attempt to fix these values.':false,"Convert to new format":false,"Convert to":false,"This will create a new dataset with the contents of this dataset converted to a new format.":false,"Change data type":false,"New Type":false,"This will change the datatype of the existing dataset but not modify its contents. Use this if Galaxy has incorrectly guessed the type of your dataset.":false,"Copy History Item":false,"Your saved histories":false,"Stored Histories":false,"hide deleted":false,"show deleted":false,Name:false,Size:false,"Last modified":false,Actions:false,rename:false,"switch to":false,"delete":false,undelete:false,Action:false,Share:false,Rename:false,Delete:false,Undelete:false,"You have no stored histories":false,"History Options":false,"You must be ":false,"logged in":false," to store or switch histories.":false,' current history (stored as "%s")':false,List:false," previously stored histories":false,Create:false," a new empty history":false,"Construct workflow":false," from the current history":false," current history":false,"Show deleted":false," datasets in history":false,"Rename History":false,"Rename Histories":false,"Perform Action":false,Submit:false,"Current Name":false,"New Name":false,"Share histories":false,"Share Histories":false,"History Name:":false,"Number of Datasets:":false,"Share Link":false,"This history contains no data.":false,"copy link to share":false,"Email of User to share with:":false,"Galaxy History":false,refresh:false,"You are currently viewing a deleted history!":false,"Your history is empty. Click 'Get Data' on the left pane to start":false,"Job is waiting to run":false,"Job is currently running":false,"An error occurred running this job: ":false,"report this error":false,"No data: ":false,"format: ":false,"database: ":false,"Info: ":false,'Error: unknown dataset state "%s".':false,Options:false,History:false,"report bugs":false,wiki:false,screencasts:false,blog:false,"Logged in as %s: ":false,manage:false,logout:false,"Account: ":false,create:false,login:false,"Galaxy Tools":false,Workflow:false,Manage:false,workflows:false,"Account settings":false,"You are currently logged in as %s.":false,"Change your password":false,"Update your email address":false,Logout:false,Login:false,"Create new account":false,"anonymous user":false,"Using ":false,"There was an error getting the data for this dataset":false,"This dataset has been deleted and removed from disk.":false,"This dataset has been deleted.":false,"This dataset has been hidden.":false,format:false,database:false,"This history is empty":false,"No matching datasets found":false,"You are over your disk quota.":false,"Tool execution is on hold until your disk usage drops below your allocated quota.":false,All:false,None:false,"For all selected":false,"This history is empty. Click 'Get Data' on the left tool menu to start":false,"Include Deleted Datasets":false,"Include Hidden Datasets":false,"Edit history tags":false,"Edit history Annotation":false,"Operations on multiple datasets":false,"Search datasets":false,"clear search (esc)":false,"loading...":false,"Hide datasets":false,"Unhide datasets":false,"Delete datasets":false,"Undelete datasets":false,"Permanently delete datasets":false,"Click to rename history":false,"View data":false,"Edit attributes":false,"View details":false,"Run this job again":false,"Edit dataset tags":false,"Edit dataset annotation":false,' Click here to undelete it or here to immediately remove it from disk':false,' Click here to unhide it':false,Download:false,Visualize:false},ja:true,zh:true}); \ No newline at end of file diff --git a/static/scripts/packed/nls/zh/locale.js b/static/scripts/packed/nls/zh/locale.js new file mode 100644 index 00000000000..9e8a8038061 --- /dev/null +++ b/static/scripts/packed/nls/zh/locale.js @@ -0,0 +1 @@ +define({Galaxy:"Galaxy","Are you sure you want to delete the current history?":"确认要删除当前的历史记录吗?","collapse all":"全部收缩",Tools:"工具","Get Data":"获取数据","Get ENCODE Data":"获取ENCODE数据","ENCODE Tools":"ENCODE工具","Lift-Over":"版本转换","Text Manipulation":"文本操作","Filter and Sort":"过滤和排序","Join, Subtract and Group":"结合,差集与分组","Convert Formats":"格式转换","Extract Features":"特征提取","Fetch Sequences":"获取序列","Fetch Alignments":"获取比对上的序列","Get Genomic Scores":"获得基因组分数","Operate on Genomic Intervals":"基因组区间操作",Statistics:"统计量","Graph/Display Data":"图形/数据","Regional Variation":"区域多态性","Evolution: HyPhy":"进化: HyPhy","Taxonomy manipulation":"分类处理","Solexa tools":"Solexa工具","FASTA manipulation":"FASTA处理","Short Read QC and Manipulation":"短片段数据质量控制及处理","Short Read Mapping":"短片段回贴","Galaxy Administration":"Galaxy 管理","Admin password: ":"管理员密码: ","Reload tool: ":"重新载入工具",Reload:"重新载入","History Item Attributes":"历史项目属性","Edit attributes":"编辑属性","This will inspect the dataset and attempt to correct the above column values if they are not accurate.":"数据集检查,若有错误,更正上述栏中的值。",'Required metadata values are missing. Some of these values may not be editable by the user. Selecting "Auto-detect" will attempt to fix these values.':"缺少所需的metadata的值。用户可能无法对这些值进行编辑。选择“自动检测”来尝试修正这些值。","Convert to new format":"转换为新格式","Convert to":"转换为","This will create a new dataset with the contents of this dataset converted to a new format.":"这将产生一个转换格式后的新数据集,","Change data type":"改变数据类型","New Type":"新类型","This will change the datatype of the existing dataset but not modify its contents. Use this if Galaxy has incorrectly guessed the type of your dataset.":"这将改变已有数据集的数据类型,但不改变其内容。当Galaxy不能正确判断你的数据类型时,设置该参数。","Copy History Item":"复制历史记录项","Saved Histories":"已保存的历史","hide deleted":"隐藏已删除的数据","show deleted":"显示已删除的数据",Name:"名称",Size:"大小","Last modified":"最后修改时间",Actions:"操作",rename:"重命名","switch to":"切换到","delete":"删除",undelete:"还原",Action:"操作",Share:"共享",Rename:"重命名",Delete:"删除",Undelete:"还原","You have no stored histories":"没有存储的历史记录","History Options":"历史记录选项","You must be ":"你必须成为","logged in":"登录"," to store or switch histories.":"以存储或切换历史记录",' current history (stored as "%s")':' 当前历史(以"%s"形式存储)',List:"列表"," previously stored histories":" 以前存储的历史记录",Create:"创建"," a new empty history":" 一个新的空白历史记录","Construct workflow":"构建工作流程"," from the current history":" 来源于当前历史"," current history":" 当前历史","Show deleted":"显示已删除"," datasets in history":" 历史中的数据集","Rename History":"重命名历史","Rename Histories":"重命名历史记录","Perform Action":"运行操作",Submit:"提交","Current Name":"当前名称","New Name":"新名称","Share histories":"共享历史记录","Share Histories":"共享历史记录","History Name:":"历史名称","Number of Datasets:":"数据集数量","Share Link":"共享链接","This history contains no data.":"这项历史中没有数据","copy link to share":"复制链接以共享","Email of User to share with:":"发送到这些Email地址进行分享","Galaxy History":"Galaxy 历史",refresh:"刷新","You are currently viewing a deleted history!":"正在查看已删除的历史","Your history is empty. Click 'Get Data' on the left pane to start":"历史已空,请单击左边窗格中‘获取数据’","Job is waiting to run":"等待运行的进程","Job is currently running":"正在运行的进程","An error occurred running this job: ":"进程运行时出错 ","report this error":"报告错误","No data: ":"没有数据: ","format: ":"格式: ","database: ":"数据库: ","Info: ":"信息: ",'Error: unknown dataset state "%s".':'错误:未知的数据集状态 "%s"。',Options:"选项",History:"历史","report bugs":"错误报告",wiki:"wiki",screencasts:"演示视频",blog:"博客","Logged in as %s: ":"以%s的身份登录: ",manage:"管理",logout:"注销","Account: ":"帐户: ",create:"创建",login:"登录","Galaxy Tools":"Galaxy 工具",Workflow:"工作流程",Manage:"管理",workflows:"工作流程","Account settings":"帐户设置","You are currently logged in as %s.":"当前以%s的身份登录","Change your password":"修改密码","Update your email address":"更新电子邮件地址",Logout:"注销",Login:"登录","Create new account":"创建新帐户","Show Tool Search":"显示工具搜索","Analyze Data":"分析数据",analysis:"分析","History Lists":"历史记录清单","Histories Shared with Me":"共享的数据","Current History":"当前历史记录","Create New":"创建",Clone:"复制","Share or Publish":"共享或发布","Extract Workflow":"提取工作流程","Dataset Security":"数据安全性","Show Deleted Datasets":"显示已删除的数据","Show Hidden Datasets":"显示隐藏的数据","Show Structure":"显示结构","Export to File":"导出为文件","Other Actions":"其他","Import from File":"导入文件","Shared Data":"数据共享","Data Libraries":"数据仓库","Published Histories":"已发布的历史记录","Published Workflows":"已发布的工作流程","Published Pages":"已发布的页面",Help:"帮助","Email comments, bug reports, or suggestions":"发邮件进行意见反馈或错误报告",User:"用户",Register:"注册",Support:"技术支持","Galaxy Wiki":"Galaxy百科","Video tutorials (screencasts)":"视频教程(动画演示)","How to Cite Galaxy":"如何引用Galaxy",}); \ No newline at end of file diff --git a/static/scripts/packed/utils/localization.js b/static/scripts/packed/utils/localization.js index 525a2771016..c893777f451 100644 --- a/static/scripts/packed/utils/localization.js +++ b/static/scripts/packed/utils/localization.js @@ -1 +1 @@ -var GalaxyLocalization=jQuery.extend({},{ALIAS_NAME:"_l",localizedStrings:{},setLocalizedString:function(b,a){var c=this;var d=function(f,e){if(f!==e){c.localizedStrings[f]=e}};if(jQuery.type(b)==="string"){d(b,a)}else{if(jQuery.type(b)==="object"){jQuery.each(b,function(e,f){d(e,f)})}else{throw ("Localization.setLocalizedString needs either a string or object as the first argument, given: "+b)}}},localize:function(a){return this.localizedStrings[a]||a},addAliasToNamespace:function(a){a[GalaxyLocalization.ALIAS_NAME]=function(b){return GalaxyLocalization.localize(b)}},toString:function(){return"GalaxyLocalization"}});GalaxyLocalization.addAliasToNamespace(window); \ No newline at end of file +define(["i18n!nls/locale"],function(b){var a=function(c){if(a.cacheNonLocalized&&!b.hasOwnProperty(c)){if(!a.nonLocalized){a.nonLocalized={}}a.nonLocalized[c]=navigator.language}return b[c]||c};a.cacheNonLocalized=false;return a}); \ No newline at end of file diff --git a/static/scripts/utils/localization.js b/static/scripts/utils/localization.js index 6a7f9fc314b..445148a7eb9 100644 --- a/static/scripts/utils/localization.js +++ b/static/scripts/utils/localization.js @@ -1,82 +1,28 @@ +define([ + 'i18n!nls/locale' +], function( localeStrings ){ // ============================================================================= -/** @class string localizer (and global short form alias) - * - * @example - * // set with either: - * GalaxyLocalization.setLocalizedString( original, localized ) - * GalaxyLocalization.setLocalizedString({ original1 : localized1, original2 : localized2 }) - * // get with either: - * GalaxyLocalization.localize( string ) - * _l( string ) - * - * @constructs +/** Attempt to get a localized string for strToLocalize. If not found, return + * the original strToLocalize. + * @param {String} strToLocalize the string to localize + * @returns either the localized string if found or strToLocalize if not found */ -//TODO: move to Galaxy.Localization (maybe galaxy.base.js) -var GalaxyLocalization = jQuery.extend( {}, { - /** shortened, alias reference to GalaxyLocalization.localize */ - ALIAS_NAME : '_l', - /** map of available localized strings (english -> localized) */ - localizedStrings : {}, +var localize = function( strToLocalize ){ + //console.debug( this + '.localize:', strToLocalize ); - /** Set a single English string -> localized string association, or set an entire map of those associations - * @param {String or Object} str_or_obj english (key) string or a map of english -> localized strings - * @param {String} localized string if str_or_obj was a string - */ - setLocalizedString : function( str_or_obj, localizedString ){ - //console.debug( this + '.setLocalizedString:', str_or_obj, localizedString ); - var self = this; + // cache strings that need to be localized but haven't been? + if( localize.cacheNonLocalized && !localeStrings.hasOwnProperty( strToLocalize ) ){ + //console.debug( 'localization NOT found:', strToLocalize ); + // add nonCached as hash directly to this function + if( !localize.nonLocalized ){ localize.nonLocalized = {}; } + localize.nonLocalized[ strToLocalize ] = navigator.language; + } + // return the localized version from the closure if it's there, the strToLocalize if not + return localeStrings[ strToLocalize ] || strToLocalize; +}; +localize.cacheNonLocalized = false; - // DRY non-duplicate assignment function - var setStringIfNotDuplicate = function( original, localized ){ - // do not set if identical - strcmp expensive but should only happen once per page per word - if( original !== localized ){ - self.localizedStrings[ original ] = localized; - } - }; - if( jQuery.type( str_or_obj ) === "string" ){ - setStringIfNotDuplicate( str_or_obj, localizedString ); - - } else if( jQuery.type( str_or_obj ) === "object" ){ - jQuery.each( str_or_obj, function( key, val ){ - //console.debug( 'key=>val', key, '=>', val ); - // could recurse here but no reason - setStringIfNotDuplicate( key, val ); - }); - - } else { - throw( 'Localization.setLocalizedString needs either a string or object as the first argument,' + - ' given: ' + str_or_obj ); - } - }, - - /** Attempt to get a localized string for strToLocalize. If not found, return the original strToLocalize. - * @param {String} strToLocalize the string to localize - * @returns either the localized string if found or strToLocalize if not found - */ - localize : function( strToLocalize ){ - //console.debug( this + '.localize:', strToLocalize ); - - //// uncomment this section to cache strings that need to be localized but haven't been - //if( !_.has( this.localizedStrings, strToLocalize ) ){ - // //console.debug( 'localization NOT found:', strToLocalize ); - // if( !this.nonLocalized ){ this.nonLocalized = {}; } - // this.nonLocalized[ strToLocalize ] = false; - //} - - // return the localized version if it's there, the strToLocalize if not - return this.localizedStrings[ strToLocalize ] || strToLocalize; - }, - - /** Add the localization function alias (GalaxyLocalization.ALIAS_NAME) to the given namespace. - * @param {Object} namespace the object/namespace to add the alias to - */ - addAliasToNamespace : function( namespace ){ - namespace[ GalaxyLocalization.ALIAS_NAME ] = function( str ){ return GalaxyLocalization.localize( str ); }; - }, - - /** String representation. */ - toString : function(){ return 'GalaxyLocalization'; } +// ============================================================================= + return localize; }); - -GalaxyLocalization.addAliasToNamespace( window ); diff --git a/templates/base/base_panels.mako b/templates/base/base_panels.mako index 0c7aa8cf7e4..1b33ed2b217 100644 --- a/templates/base/base_panels.mako +++ b/templates/base/base_panels.mako @@ -1,5 +1,6 @@ +<%namespace name="galaxy_client" file="../galaxy_client_app.mako" /> <% self.has_left_panel = hasattr( self, 'left_panel' ) self.has_right_panel = hasattr( self, 'right_panel' ) @@ -58,6 +59,7 @@ 'libs/require', "mvc/ui" )} + ${ galaxy_client.bootstrap() } +<%def name="current_history_panel( selector_to_attach_to=None, options )"> ## ---------------------------------------------------------------------------- -<%def name="history_panel( history_id, selector_to_attach_to=None, \ - show_deleted=None, show_hidden=None, hda_id=None )"> - -${history_panel_javascripts()} - - +<%def name="history_panel( history_id, selector_to_attach_to=None, options )"> ## ---------------------------------------------------------------------------- -<%def name="bootstrapped_history_panel( history, hdas, selector_to_attach_to=None, \ - show_deleted=None, show_hidden=None, hda_id=None )"> - -${history_panel_javascripts()} - - - - - -## ----------------------------------------------------------------------------- generic 'base' function -<%def name="history_panel_javascripts()"> -${h.js( - "utils/localization", -)} - -${localize_js_strings([ - # not needed?: "Galaxy History", - 'refresh', - 'collapse all', - 'hide deleted', - 'hide hidden', - 'You are currently viewing a deleted history!', - "Your history is empty. Click 'Get Data' on the left pane to start", - - # from history_common.mako - 'Download', - 'Display Data', - 'View data', - 'Edit attributes', - 'Delete', - 'Job is waiting to run', - 'View Details', - 'Job is currently running', - #'Run this job again', - 'Metadata is being Auto-Detected.', - 'No data: ', - 'format: ', - 'database: ', - #TODO localized data.dbkey?? - 'Info: ', - #TODO localized display_app.display_name?? - # _( link_app.name ) - # localized peek...ugh - 'Error: unknown dataset state' -])} - - +<%def name="bootstrapped_history_panel( history, hdas, selector_to_attach_to=None, options )"> diff --git a/templates/webapps/galaxy/history/view.mako b/templates/webapps/galaxy/history/view.mako index 980aebb24a4..18802cc80f3 100644 --- a/templates/webapps/galaxy/history/view.mako +++ b/templates/webapps/galaxy/history/view.mako @@ -1,4 +1,3 @@ -<%namespace file="/history/history_panel.mako" import="history_panel_javascripts" /> <%namespace file="/galaxy.masthead.mako" import="get_user_json" /> ## ---------------------------------------------------------------------------- @@ -70,7 +69,6 @@ a.btn { ## ---------------------------------------------------------------------------- <%def name="javascripts()"> ${parent.javascripts()} -${history_panel_javascripts()} %if not use_panels: -