galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
January 2014
- 1 participants
- 280 discussions
commit/galaxy-central: carlfeberhard: Functional browser tests: update/fix upload tests
by commits-noreply@bitbucket.org 08 Jan '14
by commits-noreply@bitbucket.org 08 Jan '14
08 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/6c269fbd11a4/
Changeset: 6c269fbd11a4
User: carlfeberhard
Date: 2014-01-08 20:40:41
Summary: Functional browser tests: update/fix upload tests
Affected #: 4 files
diff -r 3240786183e464dd9233a7e64eebe06a0fed0172 -r 6c269fbd11a43236a0dd4c7df388125fdaf8962d test/casperjs/modules/historypanel.js
--- a/test/casperjs/modules/historypanel.js
+++ b/test/casperjs/modules/historypanel.js
@@ -33,13 +33,13 @@
// =================================================================== API (external)
// ------------------------------------------------------------------- frame control
-/** Is casper currently 'in' the history frame?
- * @returns {Boolean}
- */
-HistoryPanel.prototype.inFrame = function inFrame(){
- return ( ( this.spaceghost.page.frameName === this.spaceghost.data.selectors.frames.history )
- && ( this.spaceghost.page.frameTitle === this.data.text.frameTitle ) );
-};
+///** Is casper currently 'in' the history frame?
+// * @returns {Boolean}
+// */
+//HistoryPanel.prototype.inFrame = function inFrame(){
+// return ( ( this.spaceghost.page.frameName === this.spaceghost.data.selectors.frames.history )
+// && ( this.spaceghost.page.frameTitle === this.data.text.frameTitle ) );
+//};
/** Hover over an element in the history panel.
* @param {String} selector a css or xpath selector for an historyItemWrapper
@@ -61,36 +61,27 @@
};
// ------------------------------------------------------------------- hdas
-/** Parse the hid and name from an HDA title.
+///** Parse the hid and name from an HDA title.
+// * NOTE: if more than one is found, will return the first found.
+// * @param {String} title the title of the hda
+// * @returns {Object} of the form { hid: <hid>, name: <name> }
+// */
+//HistoryPanel.prototype.hdaHidAndNameFromTitle = function hdaHidAndNameFromTitle( title ){
+// var sep = ': ', split = title.split( sep, 1 );
+// return {
+// name : (( split.length >= 2 )?( split[1] ):( split[0] )),
+// hid : (( split.length >= 2 )?( parseInt( split[0], 10 ) ):( undefined ))
+// };
+//};
+
+/** Find the casper element info of the hda wrapper given the hda title.
* NOTE: if more than one is found, will return the first found.
* @param {String} title the title of the hda
- * @returns {Object} of the form { hid: <hid>, name: <name> }
- */
-HistoryPanel.prototype.hdaHidAndNameFromTitle = function hdaHidAndNameFromTitle( title ){
- var sep = ': ', split = title.split( sep, 1 );
- return {
- name : (( split.length >= 2 )?( split[1] ):( split[0] )),
- hid : (( split.length >= 2 )?( parseInt( split[0], 10 ) ):( undefined ))
- };
-};
-
-/** Find the casper element info of the hda wrapper given the hda title and hid.
- * NOTE: if more than one is found, will return the first found.
- * @param {String} title the title of the hda
- * @param {Int} hid (optional) the hid of the hda to look for
* @returns {Object|null} ElementInfo of the historyItemWrapper found, null if not found
*/
-HistoryPanel.prototype.hdaElementInfoByTitle = function hdaElementInfoByTitle( title, hid ){
- var spaceghost = this.spaceghost,
- titleContains = ( hid !== undefined )?( hid + ': ' + title ):( title );
- //TODO: this would fail if we named/uploaded a file that has quotations -
- // we can use underscore.un/escape to solve that
-
- return spaceghost.jumpToHistory( function getWrapperInfo(){
- var wrapperXpath = xpath( '//span[@class="historyItemTitle" ' +
- 'and contains(text(),"' + titleContains + '")]/../..' );
- return spaceghost.elementInfoOrNull( wrapperXpath );
- });
+HistoryPanel.prototype.hdaElementInfoByTitle = function hdaElementInfoByTitle( title ){
+ var wrapperXpath = xpath( '//span[@class="dataset-name" and contains(text(),"' + title + '")]/../../..' );
+ return this.spaceghost.elementInfoOrNull( wrapperXpath );
};
/** Get the state string of the given hda.
@@ -99,12 +90,10 @@
* @returns {String|undefined} class string of the historyItemWrapper found, undefined if not found or set
*/
HistoryPanel.prototype.getHdaState = function getHdaState( hdaSelector ){
- return this.spaceghost.jumpToHistory( function(){
- var found = null,
- hdaInfo = this.elementInfoOrNull( hdaSelector );
- if( !hdaInfo ){ return undefined; }
- return (( found = hdaInfo.attributes[ 'class' ].match( /historyItem\-(\w+)/ ) )?( found[1] ):( undefined ));
- });
+ var found = null,
+ hdaInfo = this.spaceghost.elementInfoOrNull( hdaSelector );
+ if( !hdaInfo ){ return undefined; }
+ return (( found = hdaInfo.attributes[ 'class' ].match( /state\-(\w+)/ ) )?( found[1] ):( undefined ));
};
/** Get the encoded database/API id of the given hda.
@@ -119,20 +108,20 @@
};
// ------------------------------------------------------------------- step functions
-/** Version of Casper#withFrame for the history iframe.
- * Hopefully will allow easier test transition if/when frames are removed
- * (i.e. -> just call the function).
- * NOTE: is more than one Casper step.
- * @param {Function} then function called when in the history frame
- */
-HistoryPanel.prototype.then = function then( thenFn ){
- if( this.inFrame() ){
- thenFn.call( this.spaceghost );
- } else {
- this.spaceghost.withHistoryPanel( thenFn );
- }
-};
-
+///** Version of Casper#withFrame for the history iframe.
+// * Hopefully will allow easier test transition if/when frames are removed
+// * (i.e. -> just call the function).
+// * NOTE: is more than one Casper step.
+// * @param {Function} then function called when in the history frame
+// */
+//HistoryPanel.prototype.then = function then( thenFn ){
+// if( this.inFrame() ){
+// thenFn.call( this.spaceghost );
+// } else {
+// this.spaceghost.withHistoryPanel( thenFn );
+// }
+//};
+//
/** Moves into history iframe and waits until hdas are visible or empty message is.
* NOTE: is more than one Casper step.
* @see Casper@waitFor
@@ -140,13 +129,13 @@
HistoryPanel.prototype.waitForHdas = function waitForHdas( then, timeout, maxWait ){
//TODO:?? should this wait until the seletors are in AND they are opaque?
var spaceghost = this.spaceghost;
- this.then( function waitingForHdas(){
+ spaceghost.then( function waitingForHdas(){
this.waitFor(
function checkHpanel(){
- // trying a subtitle opacity test for page.isloaded
var subtitleOpacity = this.evaluate( function( selector ){
return $( selector ).css( 'opacity' );
}, this.historypanel.data.selectors.history.subtitle );
+ // wait until the subtitle is faded in and either the hdas or the empty history msg is displayed
return ( subtitleOpacity !== 1
&& ( ( this.visible( this.historypanel.data.selectors.hda.wrapper.itemClass ) )
||( this.visible( this.historypanel.data.selectors.history.emptyMsg ) ) ) );
@@ -218,7 +207,7 @@
var hpanel = this,
spaceghost = this.spaceghost;
- this.then( function(){
+ this.spaceghost.then( function(){
// get initial state, cache old timeout, set new timeout
var prevState = hpanel.getHdaState( hdaSelector ),
oldWaitTimeout = spaceghost.options.waitTimeout;
@@ -356,39 +345,39 @@
},
selectors : {
history : {
- name : 'div#history-name',
- subtitle : 'div#history-subtitle-area',
- tagIcon : '#history-tag.icon-button',
- tagArea : '#history-tag-area',
- annoIcon : '#history-annotate.icon-button',
- annoArea : '#history-annotation-area',
- // weak
- emptyMsg : '.infomessagesmall',
- undeleteLink : '.historyItemUndelete',
- hdaContainer : '.history-datasets-list'
+ title : '.history-title',
+ name : '.history-title .history-name',
+ subtitle : '.history-subtitle',
+ tagIcon : '.history-secondary-actions .history-tag-btn',
+ tagArea : '.history-controls .tags-display',
+ annoIcon : '.history-secondary-actions .history-annotate-btn',
+ annoArea : '.history-controls .annotation-display',
+ emptyMsg : '.empty-history-message',
+ hdaContainer: '.datasets-list'
+ //undeleteLink : '.historyItemUndelete',
},
hda : {
wrapper : {
- itemClass : '.historyItem',
+ itemClass : '.hda',
stateClasses : {
- prefix : 'historyItem-',
- ok : 'historyItem-ok',
- 'new' : 'historyItem-new'
+ prefix : 'state-',
+ ok : 'state-ok',
+ 'new' : 'state-new'
}
},
errorMessage : '.errormessagesmall',
- title : '.historyItemTitle',
- titleButtonArea : '.historyItemButtons',
- body : '.historyItemBody',
- summary : '.hda-summary',
- dbkey : '.metadata-dbkey',
- info : '.hda-info',
+ title : '.dataset-title',
+ titleButtonArea : '.dataset-primary-actions',
+ summary : '.dataset-summary',
+ dbkey : '.dataset-dbkey',
+ info : '.dataset-info',
+ body : '.dataset-body',
primaryActionButtons : 'div[id^="primary-actions"]',
secondaryActionButtons : 'div[id^="secondary-actions"]',
- peek : 'pre.peek'
+ peek : '.dataset-peek'
}
},
labels : {
@@ -399,7 +388,7 @@
},
text : {
windowTitle : 'History',
- frameTitle : 'Galaxy History',
+ //frameTitle : 'Galaxy History',
anonymous : {
tooltips : {
name : 'You must be logged in to edit your history name'
diff -r 3240786183e464dd9233a7e64eebe06a0fed0172 -r 6c269fbd11a43236a0dd4c7df388125fdaf8962d test/casperjs/modules/tools.js
--- a/test/casperjs/modules/tools.js
+++ b/test/casperjs/modules/tools.js
@@ -89,7 +89,7 @@
// click the upload tool
spaceghost.thenOpen( spaceghost.baseUrl, function(){
// we can apprently click a tool label without expanding the tool container for it
- this.clickLabel( spaceghost.data.labels.tools.upload.panelLabel );
+ this.click( xpath( '//a[contains(text(),"Upload File")]' ) );
this.jumpToMain( function(){
this.waitForSelector( 'body' );
});
@@ -108,7 +108,7 @@
// wait for main panel, history reload
////NOTE!: assumes tool execution reloads the history panel
- this.waitForMultipleNavigation( [ 'tool_runner/upload_async_message', 'history' ],
+ this.waitForMultipleNavigation( [ 'tool_runner/upload_async_message' ],
function thenAfterUploadRefreshes(){
// debugging
this.jumpToMain( function(){
diff -r 3240786183e464dd9233a7e64eebe06a0fed0172 -r 6c269fbd11a43236a0dd4c7df388125fdaf8962d test/casperjs/spaceghost.js
--- a/test/casperjs/spaceghost.js
+++ b/test/casperjs/spaceghost.js
@@ -626,15 +626,6 @@
// ------------------------------------------------------------------- iframes, damnable iframes
-/** Version of Casper#withFrame for the history iframe.
- * Hopefully will allow easier test transition if/when frames are removed
- * (i.e. -> just call the function).
- * @param {Function} then function called when in the history frame
- */
-SpaceGhost.prototype.withHistoryPanel = function withHistoryPanel( then ){
- return this.withFrame( this.data.selectors.frames.history, then );
-};
-
/** Version of Casper#withFrame for the main iframe.
* @param {Function} then function called when in the frame
*/
@@ -671,14 +662,14 @@
return returned;
};
-/** Jumps into history frame, exectutes fn, and jumps back to original frame.
- * @param {Selector} frame the selector for the frame to jump to
- * @param {Function} fn function called when in the frame
- * @returns {Any} the return value of fn
- */
-SpaceGhost.prototype.jumpToHistory = function jumpToHistory( fn ){
- return this.jumpToFrame( this.data.selectors.frames.history, fn );
-};
+///** Jumps into history frame, exectutes fn, and jumps back to original frame.
+// * @param {Selector} frame the selector for the frame to jump to
+// * @param {Function} fn function called when in the frame
+// * @returns {Any} the return value of fn
+// */
+//SpaceGhost.prototype.jumpToHistory = function jumpToHistory( fn ){
+// return this.jumpToFrame( this.data.selectors.frames.history, fn );
+//};
/** Jumps into main frame, exectutes fn, and jumps back to original frame.
* @param {Selector} frame the selector for the frame to jump to
diff -r 3240786183e464dd9233a7e64eebe06a0fed0172 -r 6c269fbd11a43236a0dd4c7df388125fdaf8962d test/casperjs/upload-tests.js
--- a/test/casperjs/upload-tests.js
+++ b/test/casperjs/upload-tests.js
@@ -59,7 +59,6 @@
var filename = '1.txt',
filepath = this.options.scriptDir + '/../../test-data/' + filename;
-
this.tools._uploadFile( filepath );
// when an upload begins successfully main should reload with a infomessagelarge
@@ -83,6 +82,7 @@
this.test.fail( 'Could not locate new hda: ' + testUploadInfo.name );
} else {
+ spaceghost.debugElement( spaceghost.jsonStr( hdaInfo ) );
this.historypanel.waitForHdaState( '#' + hdaInfo.attributes.id, 'ok',
function whenInStateFn( newHdaInfo ){
//this.debug( 'newHdaInfo:\n' + this.jsonStr( newHdaInfo ) );
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: martenson: js data libraries refactor, tweaks, logging removal
by commits-noreply@bitbucket.org 08 Jan '14
by commits-noreply@bitbucket.org 08 Jan '14
08 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3240786183e4/
Changeset: 3240786183e4
User: martenson
Date: 2014-01-08 19:54:38
Summary: js data libraries refactor, tweaks, logging removal
Affected #: 4 files
diff -r 3cdd4aae8403e76df8e0ac1efa621ad9b8889039 -r 3240786183e464dd9233a7e64eebe06a0fed0172 lib/galaxy/webapps/galaxy/api/folder_contents.py
--- a/lib/galaxy/webapps/galaxy/api/folder_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/folder_contents.py
@@ -108,8 +108,6 @@
return_item.update ( dict ( item_count = content_item.item_count ) )
if content_item.api_type == 'file':
- log.debug( 'FolderContentsController, method index(), dataset name: ' + content_item.name )
- log.debug( 'vars: ' + str(vars( content_item )) )
library_dataset_dict = content_item.to_dict()
library_dataset_dict['data_type']
library_dataset_dict['file_size']
diff -r 3cdd4aae8403e76df8e0ac1efa621ad9b8889039 -r 3240786183e464dd9233a7e64eebe06a0fed0172 static/scripts/galaxy.library.js
--- a/static/scripts/galaxy.library.js
+++ b/static/scripts/galaxy.library.js
@@ -90,7 +90,7 @@
// === VIEWS ====
// MMMMMMMMMMMMMM
-// galaxy folder
+//main view for folder browsing
var FolderContentView = Backbone.View.extend({
// main element definition
el : '#center',
@@ -116,7 +116,7 @@
// === TEMPLATES ====
// MMMMMMMMMMMMMMMMMM
- // set up
+ // main template for folder browsing
templateFolder : function (){
var tmpl_array = [];
@@ -162,7 +162,7 @@
tmpl_array.push(' <th>name</th>');
tmpl_array.push(' <th>data type</th>');
tmpl_array.push(' <th>size</th>');
- tmpl_array.push(' <th>date</th>');
+ tmpl_array.push(' <th>date (UTC)</th>');
tmpl_array.push(' </thead>');
tmpl_array.push(' <tbody>');
tmpl_array.push(' <td></td>');
@@ -184,7 +184,7 @@
tmpl_array.push(' <span class="muted">(empty folder)</span>');
tmpl_array.push(' <% } %>');
tmpl_array.push(' </td>');
- tmpl_array.push(' <td>folder</td>'); // data type
+ tmpl_array.push(' <td>folder</td>');
tmpl_array.push(' <td><%= _.escape(content_item.get("item_count")) %> item(s)</td>'); // size
tmpl_array.push(' <% } else { %>');
tmpl_array.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');
@@ -228,7 +228,7 @@
tmpl_array.push(' <td><%= _.escape(size) %></td>');
tmpl_array.push(' </tr>');
tmpl_array.push(' <tr>');
- tmpl_array.push(' <th scope="row">Date uploaded</th>');
+ tmpl_array.push(' <th scope="row">Date uploaded (UTC)</th>');
tmpl_array.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');
tmpl_array.push(' </tr>');
tmpl_array.push(' <tr>');
@@ -240,7 +240,7 @@
tmpl_array.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');
tmpl_array.push(' </tr>');
tmpl_array.push(' <th scope="row">Comment Lines</th>');
- tmpl_array.push(' <% if (item.get("metadata_comment_lines") === "") { %>'); //folder
+ tmpl_array.push(' <% if (item.get("metadata_comment_lines") === "") { %>');
tmpl_array.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');
tmpl_array.push(' <% } else { %>');
tmpl_array.push(' <td scope="row">unknown</td>');
@@ -296,19 +296,34 @@
return tmpl_array.join('');
},
- // convert size to nice string
- size_to_string : function (size)
- {
- // identify unit
- var unit = "";
- if (size >= 100000000000) { size = size / 100000000000; unit = "TB"; } else
- if (size >= 100000000) { size = size / 100000000; unit = "GB"; } else
- if (size >= 100000) { size = size / 100000; unit = "MB"; } else
- if (size >= 100) { size = size / 100; unit = "KB"; } else
- { size = size * 10; unit = "b"; }
- // return formatted string
- return (Math.round(size) / 10) + unit;
- },
+ templateProgressBar : function (){
+ var tmpl_array = [];
+
+ tmpl_array.push('<div class="import_text">');
+ tmpl_array.push('Importing selected datasets to history <b><%= _.escape(history_name) %></b>');
+ tmpl_array.push('</div>');
+ tmpl_array.push('<div class="progress">');
+ tmpl_array.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');
+ tmpl_array.push(' <span class="completion_span">0% Complete</span>');
+ tmpl_array.push(' </div>');
+ tmpl_array.push('</div>');
+ tmpl_array.push('');
+
+ return tmpl_array.join('');
+ },
+
+ templateNewFolderInModal: function(){
+ tmpl_array = [];
+
+ tmpl_array.push('<div id="new_folder_modal">');
+ tmpl_array.push('<form>');
+ tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');
+ tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');
+ tmpl_array.push('</form>');
+ tmpl_array.push('</div>');
+
+ return tmpl_array.join('');
+ },
// MMMMMMMMMMMMMMM
// === EVENTS ====
@@ -325,6 +340,10 @@
'click .btn_open_folder' : 'navigateToFolder'
},
+// MMMMMMMMMMMMMMMMMM
+// === FUNCTIONS ====
+// MMMMMMMMMMMMMMMMMM
+
//render the folder view
render: function (options) {
//hack to show scrollbars
@@ -360,10 +379,27 @@
// var template = _.template(that.templateFolder(), { path: folderContainer.full_path, items: folderContainer.attributes.folder.models, id: options.id });
that.$el.html(template);
- }
+ },
+ error: function(){
+ mod_toastr.error('An error occured :(');
+ }
})
},
+ // convert size to nice string
+ size_to_string : function (size)
+ {
+ // identify unit
+ var unit = "";
+ if (size >= 100000000000) { size = size / 100000000000; unit = "TB"; } else
+ if (size >= 100000000) { size = size / 100000000; unit = "GB"; } else
+ if (size >= 100000) { size = size / 100000; unit = "MB"; } else
+ if (size >= 100) { size = size / 100; unit = "KB"; } else
+ { size = size * 10; unit = "b"; }
+ // return formatted string
+ return (Math.round(size) / 10) + unit;
+ },
+
// handles the click on 'open' and 'upper' folder icons
navigateToFolder : function(event){
var folder_id = $(event.target).attr('data-id');
@@ -398,9 +434,18 @@
// TODO can render here already
//fetch user histories for import purposes
histories.fetch({
- success: function (histories){self.renderModalAfterFetch(item, histories)}
+ success: function (histories){
+ self.renderModalAfterFetch(item, histories)
+ },
+ error: function(){
+ mod_toastr.error('An error occured during fetching histories:(');
+ self.renderModalAfterFetch(item)
+ }
});
- }
+ },
+ error: function(){
+ mod_toastr.error('An error occured during loading dataset details :(');
+ }
});
},
@@ -422,16 +467,17 @@
});
$(".peek").html(item.get("peek"));
- var history_footer_tmpl = _.template(this.templateHistorySelectInModal(), {histories : histories.models});
- $(this.modal.elMain).find('.buttons').prepend(history_footer_tmpl);
- // preset last selected history if we know it
- if (self.lastSelectedHistory.length > 0) {
- $(this.modal.elMain).find('#dataset_import_single').val(self.lastSelectedHistory);
- }
-
+ // show the import-into-history footer only if the request for histories succeeded
+ if (typeof history.models !== undefined){
+ var history_footer_tmpl = _.template(this.templateHistorySelectInModal(), {histories : histories.models});
+ $(this.modal.elMain).find('.buttons').prepend(history_footer_tmpl);
+ // preset last selected history if we know it
+ if (self.lastSelectedHistory.length > 0) {
+ $(this.modal.elMain).find('#dataset_import_single').val(self.lastSelectedHistory);
+ }
+ }
this.modal.bindEvents();
- // show the prepared modal
this.modal.show();
},
@@ -555,7 +601,6 @@
$('#toolbtn_bulk_import').hide();
$('#toolbtn_dl').hide();
}
-
},
// show bulk import modal
@@ -577,8 +622,10 @@
}
});
self.modal.bindEvents();
- // show the prepared modal
self.modal.show();
+ },
+ error: function(){
+ mod_toastr.error('An error occured :(');
}
});
},
@@ -616,7 +663,7 @@
datasets_to_import.push(historyItem);
};
- // call the recursive function to call ajax one after each other
+ // call the recursive function to call ajax one after each other (request FIFO queue)
this.chainCall(datasets_to_import);
},
@@ -646,22 +693,7 @@
$('.completion_span').text(txt_representation);
},
- // progress bar
- templateProgressBar : function (){
- var tmpl_array = [];
- tmpl_array.push('<div class="import_text">');
- tmpl_array.push('Importing selected datasets to history <b><%= _.escape(history_name) %></b>');
- tmpl_array.push('</div>');
- tmpl_array.push('<div class="progress">');
- tmpl_array.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');
- tmpl_array.push(' <span class="completion_span">0% Complete</span>');
- tmpl_array.push(' </div>');
- tmpl_array.push('</div>');
- tmpl_array.push('');
-
- return tmpl_array.join('');
- },
// download selected datasets
download : function(folder_id, format){
@@ -706,14 +738,13 @@
this.modal = new mod_modal.GalaxyModal({
destructible : true,
title : 'Create New Folder',
- body : this.template_new_folder(),
+ body : this.templateNewFolderInModal(),
buttons : {
'Create' : function() {self.create_new_folder_event()},
'Close' : function() {self.modal.hideOrDestroy(); self.modal = null;}
}
});
this.modal.bindEvents();
- // show prepared modal
this.modal.show();
},
@@ -726,7 +757,7 @@
url_items = Backbone.history.fragment.split('/');
current_folder_id = url_items[url_items.length-1];
folder.url = folder.urlRoot + '/' + current_folder_id ;
-
+
var self = this;
folder.save(folderDetails, {
success: function (folder) {
@@ -755,20 +786,6 @@
// validate new library info
validate_new_folder: function(folderDetails){
return folderDetails.name !== '';
- },
-
- // template for new library modal
- template_new_folder: function(){
- tmpl_array = [];
-
- tmpl_array.push('<div id="new_folder_modal">');
- tmpl_array.push('<form>');
- tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');
- tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');
- tmpl_array.push('</form>');
- tmpl_array.push('</div>');
-
- return tmpl_array.join('');
}
});
@@ -785,11 +802,13 @@
initialize : function(){
},
- // template
- template_library_list : function (){
+// MMMMMMMMMMMMMMMMMM
+// === TEMPLATES ====
+// MMMMMMMMMMMMMMMMMM
+
+ templateLibraryList: function(){
tmpl_array = [];
tmpl_array.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; overflow: auto !important; ">');
-
tmpl_array.push('');
tmpl_array.push('<h3>New Data Libraries. This is work in progress. Report problems & ideas to <a href="mailto:marten@bx.psu.edu?Subject=DataLibraries_Feedback" target="_blank">Marten</a>.</h3>');
tmpl_array.push('<a href="" id="create_new_library_btn" class="btn btn-primary file ">New Library</a>');
@@ -814,14 +833,27 @@
tmpl_array.push(' <% }); %>');
tmpl_array.push(' </tbody>');
tmpl_array.push('</table>');
+ tmpl_array.push('</div>');
- tmpl_array.push('</div>');
return tmpl_array.join('');
},
- // render
+ templateNewLibraryInModal: function(){
+ tmpl_array = [];
+
+ tmpl_array.push('<div id="new_library_modal">');
+ tmpl_array.push(' <form>');
+ tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');
+ tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');
+ tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');
+ tmpl_array.push(' </form>');
+ tmpl_array.push('</div>');
+
+ return tmpl_array.join('');
+ },
+
render: function () {
- //hack to show scrollbars due to #center element inheritance
+ // modification of upper DOM element to show scrollbars due to the #center element inheritance
$("#center").css('overflow','auto');
var that = this;
@@ -829,7 +861,7 @@
libraries.fetch({
success: function (libraries) {
- var template = _.template(that.template_library_list(), { libraries : libraries.models });
+ var template = _.template(that.templateLibraryList(), { libraries : libraries.models });
that.$el.html(template);
},
error: function(model, response){
@@ -863,14 +895,13 @@
this.modal = new mod_modal.GalaxyModal({
destructible : true,
title : 'Create New Library',
- body : this.template_new_library(),
+ body : this.templateNewLibraryInModal(),
buttons : {
'Create' : function() {self.create_new_library_event()},
'Close' : function() {self.modal.hideOrDestroy();}
}
});
this.modal.bindEvents();
- // show prepared modal
this.modal.show();
},
@@ -916,21 +947,6 @@
// validate new library info
validate_new_library: function(libraryDetails){
return libraryDetails.name !== '';
- },
-
- // template for new library modal
- template_new_library: function(){
- tmpl_array = [];
-
- tmpl_array.push('<div id="new_library_modal">');
- tmpl_array.push('<form>');
- tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');
- tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');
- tmpl_array.push('<input type="text" name="Synopsis" value="" placeholder="Synopsis">');
- tmpl_array.push('</form>');
- tmpl_array.push('</div>');
-
- return tmpl_array.join('');
}
});
@@ -938,6 +954,7 @@
var GalaxyLibrary = Backbone.View.extend({
folderContentView : null,
galaxyLibraryview : null,
+
initialize : function(){
folderContentView = new FolderContentView();
diff -r 3cdd4aae8403e76df8e0ac1efa621ad9b8889039 -r 3240786183e464dd9233a7e64eebe06a0fed0172 static/scripts/galaxy.modal.js
--- a/static/scripts/galaxy.modal.js
+++ b/static/scripts/galaxy.modal.js
@@ -19,7 +19,9 @@
// options
options : {
- destructible: false // by default the modal cannot be removed by theself.destroy() method
+ // by default the modal cannot be removed by the self.destroy() method
+ // but only hidden through self.hide()
+ destructible: false
},
// initialize
@@ -99,9 +101,9 @@
hide: function(){
// fade out
this.$el.fadeOut('fast');
-
// set flag
this.visible = false;
+ // unbind events
this.unbindEvents();
},
@@ -109,8 +111,8 @@
destroy: function(){
// set flag
this.visible = false;
+ // unbind events
this.unbindEvents();
-
// remove
this.$el.remove();
},
diff -r 3cdd4aae8403e76df8e0ac1efa621ad9b8889039 -r 3240786183e464dd9233a7e64eebe06a0fed0172 static/scripts/packed/galaxy.library.js
--- a/static/scripts/packed/galaxy.library.js
+++ b/static/scripts/packed/galaxy.library.js
@@ -1,1 +1,1 @@
-var view=null;var library_router=null;var responses=[];define(["galaxy.modal","galaxy.masthead","utils/galaxy.utils","libs/toastr"],function(k,l,h,n){var f=Backbone.Model.extend({urlRoot:"/api/libraries"});var c=Backbone.Model.extend({urlRoot:"/api/folders"});var o=Backbone.Collection.extend({url:"/api/libraries",model:f});var i=Backbone.Model.extend({urlRoot:"/api/libraries/datasets"});var d=Backbone.Collection.extend({model:i});var e=Backbone.Model.extend({defaults:{folder:new d(),full_path:"unknown",urlRoot:"/api/folders/",id:"unknown"},parse:function(r){this.full_path=r[0].full_path;this.get("folder").reset(r[1].folder_contents);return r}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Model.extend({url:"/api/histories/"});var p=Backbone.Collection.extend({url:"/api/histories",model:j});var q=Backbone.Router.extend({routes:{"":"libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var m=Backbone.View.extend({el:"#center",progress:0,progressStep:1,lastSelectedHistory:"",modal:null,folders:null,initialize:function(){this.folders=[];this.queue=jQuery.Deferred();this.queue.resolve()},templateFolder:function(){var r=[];r.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; ">');r.push('<h3>New Data Libraries. This is work in progress. Report problems & ideas to <a href="mailto:marten@bx.psu.edu?Subject=DataLibraries_Feedback" target="_blank">Marten</a>.</h3>');r.push('<div id="library_folder_toolbar" >');r.push(' <button title="Create New Folder" id="toolbtn_create_folder" class="btn btn-primary" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder-close"></span> folder</button>');r.push(' <button id="toolbtn_bulk_import" class="btn btn-primary" style="display: none; margin-left: 0.5em;" type="button"><span class="fa fa-external-link"></span> to history</button>');r.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; display: none; ">');r.push(' <button id="drop_toggle" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">');r.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');r.push(" </button>");r.push(' <ul class="dropdown-menu" role="menu">');r.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');r.push(" </ul>");r.push(" </div>");r.push("</div>");r.push('<div class="library_breadcrumb">');r.push('<a title="Return to the list of libraries" href="#">Libraries</a><b>|</b> ');r.push("<% _.each(path, function(path_item) { %>");r.push("<% if (path_item[0] != id) { %>");r.push('<a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a><b>|</b> ');r.push("<% } else { %>");r.push('<span title="You are in this folder"><%- path_item[1] %></span>');r.push("<% } %>");r.push("<% }); %>");r.push("</div>");r.push('<table id="folder_table" class="table table-condensed">');r.push(" <thead>");r.push(' <th style="text-align: center; width: 20px; "><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');r.push(' <th class="button_heading">view</th>');r.push(" <th>name</th>");r.push(" <th>data type</th>");r.push(" <th>size</th>");r.push(" <th>date</th>");r.push(" </thead>");r.push(" <tbody>");r.push(" <td></td>");r.push(' <td><button title="Go to parent folder" type="button" data-id="<%- upper_folder_id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-arrow-up"></span> .. go up</td>');r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" </tr>");r.push(" <% _.each(items, function(content_item) { %>");r.push(' <tr class="folder_row light" id="<%- content_item.id %>">');r.push(' <% if (content_item.get("type") === "folder") { %>');r.push(" <td></td>");r.push(' <td><button title="Open this folder" type="button" data-id="<%- content_item.id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-folder-open"></span> browse</td>');r.push(' <td><%- content_item.get("name") %>');r.push(' <% if (content_item.get("item_count") === 0) { %>');r.push(' <span class="muted">(empty folder)</span>');r.push(" <% } %>");r.push(" </td>");r.push(" <td>folder</td>");r.push(' <td><%= _.escape(content_item.get("item_count")) %> item(s)</td>');r.push(" <% } else { %>");r.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');r.push(" <td>");r.push(' <button title="See details of this dataset" type="button" class="library-dataset btn btn-default btn-xs">');r.push(' <span class="fa fa-eye"></span> details');r.push(" </button>");r.push(" </td>");r.push(' <td><%- content_item.get("name") %></td>');r.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');r.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');r.push(" <% } %> ");r.push(' <td><%= _.escape(content_item.get("time_updated")) %></td>');r.push(" </tr>");r.push(" <% }); %>");r.push(" ");r.push(" </tbody>");r.push("</table>");r.push("</div>");return r.join("")},templateDatasetModal:function(){var r=[];r.push('<div id="dataset_info_modal">');r.push(' <table class="table table-striped table-condensed">');r.push(" <tr>");r.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');r.push(' <td><%= _.escape(item.get("name")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Data type</th>');r.push(' <td><%= _.escape(item.get("data_type")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Genome build</th>');r.push(' <td><%= _.escape(item.get("genome_build")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Size</th>');r.push(" <td><%= _.escape(size) %></td>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Date uploaded</th>');r.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Uploaded by</th>');r.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');r.push(" </tr>");r.push(' <tr scope="row">');r.push(' <th scope="row">Data Lines</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Comment Lines</th>');r.push(' <% if (item.get("metadata_comment_lines") === "") { %>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');r.push(" <% } else { %>");r.push(' <td scope="row">unknown</td>');r.push(" <% } %>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Number of Columns</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Column Types</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Miscellaneous information</th>');r.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');r.push(" </tr>");r.push(" </table>");r.push(' <pre class="peek">');r.push(" </pre>");r.push("</div>");return r.join("")},templateHistorySelectInModal:function(){var r=[];r.push('<span id="history_modal_combo" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateBulkImportInModal:function(){var r=[];r.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},size_to_string:function(r){var s="";if(r>=100000000000){r=r/100000000000;s="TB"}else{if(r>=100000000){r=r/100000000;s="GB"}else{if(r>=100000){r=r/100000;s="MB"}else{if(r>=100){r=r/100;s="KB"}else{r=r*10;s="b"}}}}return(Math.round(r)/10)+s},events:{"click #select-all-checkboxes":"selectAll","click .folder_row":"selectClickedRow","click #toolbtn_bulk_import":"modalBulkImport","click #toolbtn_dl":"bulkDownload","click .library-dataset":"showDatasetDetails","click #toolbtn_create_folder":"createFolderFromModal","click .btn_open_folder":"navigateToFolder"},render:function(r){$("#center").css("overflow","auto");view=this;var t=this;var s=new e({id:r.id});s.url=s.attributes.urlRoot+r.id+"/contents";s.fetch({success:function(u){for(var w=0;w<s.attributes.folder.models.length;w++){var v=s.attributes.folder.models[w];if(v.get("type")==="file"){v.set("readable_size",t.size_to_string(v.get("file_size")))}}var y=s.full_path;var z;if(y.length===1){z=0}else{z=y[y.length-2][0]}var x=_.template(t.templateFolder(),{path:s.full_path,items:s.attributes.folder.models,id:r.id,upper_folder_id:z});t.$el.html(x)}})},navigateToFolder:function(s){var r=$(s.target).attr("data-id");if(typeof r==="undefined"){return false}else{if(r==="0"){library_router.navigate("#",{trigger:true,replace:true})}else{library_router.navigate("folders/"+r,{trigger:true,replace:true})}}},showDatasetDetails:function(u){u.preventDefault();var v=$(u.target).parent().parent().attr("id");var t=new i();var s=new p();t.id=v;var r=this;t.fetch({success:function(w){s.fetch({success:function(x){r.renderModalAfterFetch(w,x)}})}})},renderModalAfterFetch:function(w,t){var u=this.size_to_string(w.get("file_size"));var v=_.template(this.templateDatasetModal(),{item:w,size:u});var s=this;this.modal=new k.GalaxyModal({destructible:true,title:"Dataset Details",body:v,buttons:{Import:function(){s.importCurrentIntoHistory()},Download:function(){s.downloadCurrent()},Close:function(){s.modal.hideOrDestroy()}}});$(".peek").html(w.get("peek"));var r=_.template(this.templateHistorySelectInModal(),{histories:t.models});$(this.modal.elMain).find(".buttons").prepend(r);if(s.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(s.lastSelectedHistory)}this.modal.bindEvents();this.modal.show()},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var r=[];r.push($("#id_row").attr("data-id"));var s="/api/libraries/datasets/download/uncompressed";var t={ldda_ids:r};folderContentView.processDownload(s,t);this.modal.enableButton("Import");this.modal.enableButton("Download")},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var t=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=t;var r=$("#id_row").attr("data-id");var u=new b();var s=this;u.url=u.urlRoot+t+"/contents";u.save({content:r,source:"library"},{success:function(){n.success("Dataset imported");s.modal.enableButton("Import");s.modal.enableButton("Download")},error:function(){n.error("An error occured! Dataset not imported. Please try again.");s.modal.enableButton("Import");s.modal.enableButton("Download")}})},selectAll:function(s){var r=s.target.checked;that=this;$(":checkbox").each(function(){this.checked=r;$row=$(this.parentElement.parentElement);(r)?that.makeDarkRow($row):that.makeWhiteRow($row)});this.checkTools()},selectClickedRow:function(s){var u="";var r;var t;if(s.target.localName==="input"){u=s.target;r=$(s.target.parentElement.parentElement);t="input"}else{if(s.target.localName==="td"){u=$("#"+s.target.parentElement.id).find(":checkbox")[0];r=$(s.target.parentElement);t="td"}}if(u===""){s.stopPropagation();return}if(u===undefined){s.stopPropagation();return}if(u.checked){if(t==="td"){u.checked="";this.makeWhiteRow(r)}else{if(t==="input"){this.makeDarkRow(r)}}}else{if(t==="td"){u.checked="selected";this.makeDarkRow(r)}else{if(t==="input"){this.makeWhiteRow(r)}}}this.checkTools()},makeDarkRow:function(r){r.removeClass("light");r.find("a").removeClass("light");r.addClass("dark");r.find("a").addClass("dark")},makeWhiteRow:function(r){r.removeClass("dark");r.find("a").removeClass("dark");r.addClass("light");r.find("a").addClass("light")},checkTools:function(){var r=$("#folder_table").find(":checked");if(r.length>0){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}else{$("#toolbtn_bulk_import").hide();$("#toolbtn_dl").hide()}},modalBulkImport:function(){var s=this;var r=new p();r.fetch({success:function(t){var u=_.template(s.templateBulkImportInModal(),{histories:t.models});s.modal=new k.GalaxyModal({destructible:true,title:"Import into History",body:u,buttons:{Import:function(){s.importAllIntoHistory()},Close:function(){s.modal.hideOrDestroy()}}});s.modal.bindEvents();s.modal.show()}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var t=$("select[name=dataset_import_bulk] option:selected").val();var x=$("select[name=dataset_import_bulk] option:selected").text();var z=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){z.push(this.parentElement.parentElement.id)}});var y=_.template(this.templateProgressBar(),{history_name:x});$(this.modal.elMain).find(".modal-body").html(y);var u=100/z.length;this.initProgress(u);var r=[];for(var s=z.length-1;s>=0;s--){library_dataset_id=z[s];var v=new b();var w=this;v.url=v.urlRoot+t+"/contents";v.content=library_dataset_id;v.source="library";r.push(v)}this.chainCall(r)},chainCall:function(s){var r=this;var t=s.pop();if(typeof t==="undefined"){n.success("All datasets imported");this.modal.hideOrDestroy();return}var u=$.when(t.save({content:t.content,source:t.source})).done(function(v){r.updateProgress();responses.push(v);r.chainCall(s)})},initProgress:function(r){this.progress=0;this.progressStep=r},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},templateProgressBar:function(){var r=[];r.push('<div class="import_text">');r.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");r.push("</div>");r.push('<div class="progress">');r.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');r.push(' <span class="completion_span">0% Complete</span>');r.push(" </div>");r.push("</div>");r.push("");return r.join("")},download:function(r,v){var t=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){t.push(this.parentElement.parentElement.id)}});var s="/api/libraries/datasets/download/"+v;var u={ldda_ids:t};this.processDownload(s,u,"get")},processDownload:function(s,t,u){if(s&&t){t=typeof t=="string"?t:$.param(t);var r="";$.each(t.split("&"),function(){var v=this.split("=");r+='<input type="hidden" name="'+v[0]+'" value="'+v[1]+'" />'});$('<form action="'+s+'" method="'+(u||"post")+'">'+r+"</form>").appendTo("body").submit().remove();n.info("Your download will begin soon")}},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,title:"Create New Folder",body:this.template_new_folder(),buttons:{Create:function(){r.create_new_folder_event()},Close:function(){r.modal.hideOrDestroy();r.modal=null}}});this.modal.bindEvents();this.modal.show()},create_new_folder_event:function(){var r=this.serialize_new_folder();if(this.validate_new_folder(r)){var t=new c();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];t.url=t.urlRoot+"/"+current_folder_id;var s=this;t.save(r,{success:function(u){s.modal.hideOrDestroy();n.success("Folder created");s.render({id:current_folder_id})},error:function(){n.error("An error occured :(")}})}else{n.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(r){return r.name!==""},template_new_folder:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return tmpl_array.join("")}});var a=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal"},initialize:function(){},template_library_list:function(){tmpl_array=[];tmpl_array.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; overflow: auto !important; ">');tmpl_array.push("");tmpl_array.push('<h3>New Data Libraries. This is work in progress. Report problems & ideas to <a href="mailto:marten@bx.psu.edu?Subject=DataLibraries_Feedback" target="_blank">Marten</a>.</h3>');tmpl_array.push('<a href="" id="create_new_library_btn" class="btn btn-primary file ">New Library</a>');tmpl_array.push('<table class="table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th class="button_heading"></th>');tmpl_array.push(" <th>name</th>");tmpl_array.push(" <th>description</th>");tmpl_array.push(" <th>synopsis</th> ");tmpl_array.push(" <th>model type</th> ");tmpl_array.push(" </thead>");tmpl_array.push(" <tbody>");tmpl_array.push(" <% _.each(libraries, function(library) { %>");tmpl_array.push(" <tr>");tmpl_array.push(' <td><button title="Open this library" type="button" data-id="<%- library.get("root_folder_id") %>" class="btn_open_folder btn btn-default btn-xs">');tmpl_array.push(' <span class="fa fa-folder-open"></span> browse</td>');tmpl_array.push(' <td><%- library.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("model_class")) %></td>');tmpl_array.push(" </tr>");tmpl_array.push(" <% }); %>");tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("</div>");return tmpl_array.join("")},render:function(){$("#center").css("overflow","auto");var r=this;libraries=new o();libraries.fetch({success:function(s){var t=_.template(r.template_library_list(),{libraries:s.models});r.$el.html(t)},error:function(t,s){if(s.statusCode().status===403){n.error("Please log in first. Redirecting to login page in 3s.");setTimeout(r.redirectToLogin,3000)}else{n.error("An error occured. Please try again.")}}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},modal:null,show_library_modal:function(s){s.preventDefault();s.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,title:"Create New Library",body:this.template_new_library(),buttons:{Create:function(){r.create_new_library_event()},Close:function(){r.modal.hideOrDestroy()}}});this.modal.bindEvents();this.modal.show()},create_new_library_event:function(){var t=this.serialize_new_library();if(this.validate_new_library(t)){var s=new f();var r=this;s.save(t,{success:function(u){r.modal.hideOrDestroy();r.clear_library_modal();r.render();n.success("Library created")},error:function(){n.error("An error occured :(")}})}else{n.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(r){return r.name!==""},template_new_library:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push('<input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push("</form>");tmpl_array.push("</div>");return tmpl_array.join("")}});var g=Backbone.View.extend({folderContentView:null,galaxyLibraryview:null,initialize:function(){folderContentView=new m();galaxyLibraryview=new a();library_router=new q();library_router.on("route:libraries",function(){galaxyLibraryview.render()});library_router.on("route:folder_content",function(r){folderContentView.render({id:r})});library_router.on("route:download",function(r,s){if($("#center").find(":checked").length===0){library_router.navigate("folders/"+r,{trigger:true,replace:true})}else{folderContentView.download(r,s);library_router.navigate("folders/"+r,{trigger:false,replace:true})}});Backbone.history.start();return this}});return{GalaxyApp:g}});
\ No newline at end of file
+var view=null;var library_router=null;var responses=[];define(["galaxy.modal","galaxy.masthead","utils/galaxy.utils","libs/toastr"],function(k,l,h,n){var f=Backbone.Model.extend({urlRoot:"/api/libraries"});var c=Backbone.Model.extend({urlRoot:"/api/folders"});var o=Backbone.Collection.extend({url:"/api/libraries",model:f});var i=Backbone.Model.extend({urlRoot:"/api/libraries/datasets"});var d=Backbone.Collection.extend({model:i});var e=Backbone.Model.extend({defaults:{folder:new d(),full_path:"unknown",urlRoot:"/api/folders/",id:"unknown"},parse:function(r){this.full_path=r[0].full_path;this.get("folder").reset(r[1].folder_contents);return r}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Model.extend({url:"/api/histories/"});var p=Backbone.Collection.extend({url:"/api/histories",model:j});var q=Backbone.Router.extend({routes:{"":"libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var m=Backbone.View.extend({el:"#center",progress:0,progressStep:1,lastSelectedHistory:"",modal:null,folders:null,initialize:function(){this.folders=[];this.queue=jQuery.Deferred();this.queue.resolve()},templateFolder:function(){var r=[];r.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; ">');r.push('<h3>New Data Libraries. This is work in progress. Report problems & ideas to <a href="mailto:marten@bx.psu.edu?Subject=DataLibraries_Feedback" target="_blank">Marten</a>.</h3>');r.push('<div id="library_folder_toolbar" >');r.push(' <button title="Create New Folder" id="toolbtn_create_folder" class="btn btn-primary" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder-close"></span> folder</button>');r.push(' <button id="toolbtn_bulk_import" class="btn btn-primary" style="display: none; margin-left: 0.5em;" type="button"><span class="fa fa-external-link"></span> to history</button>');r.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; display: none; ">');r.push(' <button id="drop_toggle" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">');r.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');r.push(" </button>");r.push(' <ul class="dropdown-menu" role="menu">');r.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');r.push(" </ul>");r.push(" </div>");r.push("</div>");r.push('<div class="library_breadcrumb">');r.push('<a title="Return to the list of libraries" href="#">Libraries</a><b>|</b> ');r.push("<% _.each(path, function(path_item) { %>");r.push("<% if (path_item[0] != id) { %>");r.push('<a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a><b>|</b> ');r.push("<% } else { %>");r.push('<span title="You are in this folder"><%- path_item[1] %></span>');r.push("<% } %>");r.push("<% }); %>");r.push("</div>");r.push('<table id="folder_table" class="table table-condensed">');r.push(" <thead>");r.push(' <th style="text-align: center; width: 20px; "><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');r.push(' <th class="button_heading">view</th>');r.push(" <th>name</th>");r.push(" <th>data type</th>");r.push(" <th>size</th>");r.push(" <th>date (UTC)</th>");r.push(" </thead>");r.push(" <tbody>");r.push(" <td></td>");r.push(' <td><button title="Go to parent folder" type="button" data-id="<%- upper_folder_id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-arrow-up"></span> .. go up</td>');r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" </tr>");r.push(" <% _.each(items, function(content_item) { %>");r.push(' <tr class="folder_row light" id="<%- content_item.id %>">');r.push(' <% if (content_item.get("type") === "folder") { %>');r.push(" <td></td>");r.push(' <td><button title="Open this folder" type="button" data-id="<%- content_item.id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-folder-open"></span> browse</td>');r.push(' <td><%- content_item.get("name") %>');r.push(' <% if (content_item.get("item_count") === 0) { %>');r.push(' <span class="muted">(empty folder)</span>');r.push(" <% } %>");r.push(" </td>");r.push(" <td>folder</td>");r.push(' <td><%= _.escape(content_item.get("item_count")) %> item(s)</td>');r.push(" <% } else { %>");r.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');r.push(" <td>");r.push(' <button title="See details of this dataset" type="button" class="library-dataset btn btn-default btn-xs">');r.push(' <span class="fa fa-eye"></span> details');r.push(" </button>");r.push(" </td>");r.push(' <td><%- content_item.get("name") %></td>');r.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');r.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');r.push(" <% } %> ");r.push(' <td><%= _.escape(content_item.get("time_updated")) %></td>');r.push(" </tr>");r.push(" <% }); %>");r.push(" ");r.push(" </tbody>");r.push("</table>");r.push("</div>");return r.join("")},templateDatasetModal:function(){var r=[];r.push('<div id="dataset_info_modal">');r.push(' <table class="table table-striped table-condensed">');r.push(" <tr>");r.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');r.push(' <td><%= _.escape(item.get("name")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Data type</th>');r.push(' <td><%= _.escape(item.get("data_type")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Genome build</th>');r.push(' <td><%= _.escape(item.get("genome_build")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Size</th>');r.push(" <td><%= _.escape(size) %></td>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Date uploaded (UTC)</th>');r.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Uploaded by</th>');r.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');r.push(" </tr>");r.push(' <tr scope="row">');r.push(' <th scope="row">Data Lines</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Comment Lines</th>');r.push(' <% if (item.get("metadata_comment_lines") === "") { %>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');r.push(" <% } else { %>");r.push(' <td scope="row">unknown</td>');r.push(" <% } %>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Number of Columns</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Column Types</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Miscellaneous information</th>');r.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');r.push(" </tr>");r.push(" </table>");r.push(' <pre class="peek">');r.push(" </pre>");r.push("</div>");return r.join("")},templateHistorySelectInModal:function(){var r=[];r.push('<span id="history_modal_combo" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateBulkImportInModal:function(){var r=[];r.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateProgressBar:function(){var r=[];r.push('<div class="import_text">');r.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");r.push("</div>");r.push('<div class="progress">');r.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');r.push(' <span class="completion_span">0% Complete</span>');r.push(" </div>");r.push("</div>");r.push("");return r.join("")},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return tmpl_array.join("")},events:{"click #select-all-checkboxes":"selectAll","click .folder_row":"selectClickedRow","click #toolbtn_bulk_import":"modalBulkImport","click #toolbtn_dl":"bulkDownload","click .library-dataset":"showDatasetDetails","click #toolbtn_create_folder":"createFolderFromModal","click .btn_open_folder":"navigateToFolder"},render:function(r){$("#center").css("overflow","auto");view=this;var t=this;var s=new e({id:r.id});s.url=s.attributes.urlRoot+r.id+"/contents";s.fetch({success:function(u){for(var w=0;w<s.attributes.folder.models.length;w++){var v=s.attributes.folder.models[w];if(v.get("type")==="file"){v.set("readable_size",t.size_to_string(v.get("file_size")))}}var y=s.full_path;var z;if(y.length===1){z=0}else{z=y[y.length-2][0]}var x=_.template(t.templateFolder(),{path:s.full_path,items:s.attributes.folder.models,id:r.id,upper_folder_id:z});t.$el.html(x)},error:function(){n.error("An error occured :(")}})},size_to_string:function(r){var s="";if(r>=100000000000){r=r/100000000000;s="TB"}else{if(r>=100000000){r=r/100000000;s="GB"}else{if(r>=100000){r=r/100000;s="MB"}else{if(r>=100){r=r/100;s="KB"}else{r=r*10;s="b"}}}}return(Math.round(r)/10)+s},navigateToFolder:function(s){var r=$(s.target).attr("data-id");if(typeof r==="undefined"){return false}else{if(r==="0"){library_router.navigate("#",{trigger:true,replace:true})}else{library_router.navigate("folders/"+r,{trigger:true,replace:true})}}},showDatasetDetails:function(u){u.preventDefault();var v=$(u.target).parent().parent().attr("id");var t=new i();var s=new p();t.id=v;var r=this;t.fetch({success:function(w){s.fetch({success:function(x){r.renderModalAfterFetch(w,x)},error:function(){n.error("An error occured during fetching histories:(");r.renderModalAfterFetch(w)}})},error:function(){n.error("An error occured during loading dataset details :(")}})},renderModalAfterFetch:function(w,t){var u=this.size_to_string(w.get("file_size"));var v=_.template(this.templateDatasetModal(),{item:w,size:u});var s=this;this.modal=new k.GalaxyModal({destructible:true,title:"Dataset Details",body:v,buttons:{Import:function(){s.importCurrentIntoHistory()},Download:function(){s.downloadCurrent()},Close:function(){s.modal.hideOrDestroy()}}});$(".peek").html(w.get("peek"));if(typeof history.models!==undefined){var r=_.template(this.templateHistorySelectInModal(),{histories:t.models});$(this.modal.elMain).find(".buttons").prepend(r);if(s.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(s.lastSelectedHistory)}}this.modal.bindEvents();this.modal.show()},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var r=[];r.push($("#id_row").attr("data-id"));var s="/api/libraries/datasets/download/uncompressed";var t={ldda_ids:r};folderContentView.processDownload(s,t);this.modal.enableButton("Import");this.modal.enableButton("Download")},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var t=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=t;var r=$("#id_row").attr("data-id");var u=new b();var s=this;u.url=u.urlRoot+t+"/contents";u.save({content:r,source:"library"},{success:function(){n.success("Dataset imported");s.modal.enableButton("Import");s.modal.enableButton("Download")},error:function(){n.error("An error occured! Dataset not imported. Please try again.");s.modal.enableButton("Import");s.modal.enableButton("Download")}})},selectAll:function(s){var r=s.target.checked;that=this;$(":checkbox").each(function(){this.checked=r;$row=$(this.parentElement.parentElement);(r)?that.makeDarkRow($row):that.makeWhiteRow($row)});this.checkTools()},selectClickedRow:function(s){var u="";var r;var t;if(s.target.localName==="input"){u=s.target;r=$(s.target.parentElement.parentElement);t="input"}else{if(s.target.localName==="td"){u=$("#"+s.target.parentElement.id).find(":checkbox")[0];r=$(s.target.parentElement);t="td"}}if(u===""){s.stopPropagation();return}if(u===undefined){s.stopPropagation();return}if(u.checked){if(t==="td"){u.checked="";this.makeWhiteRow(r)}else{if(t==="input"){this.makeDarkRow(r)}}}else{if(t==="td"){u.checked="selected";this.makeDarkRow(r)}else{if(t==="input"){this.makeWhiteRow(r)}}}this.checkTools()},makeDarkRow:function(r){r.removeClass("light");r.find("a").removeClass("light");r.addClass("dark");r.find("a").addClass("dark")},makeWhiteRow:function(r){r.removeClass("dark");r.find("a").removeClass("dark");r.addClass("light");r.find("a").addClass("light")},checkTools:function(){var r=$("#folder_table").find(":checked");if(r.length>0){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}else{$("#toolbtn_bulk_import").hide();$("#toolbtn_dl").hide()}},modalBulkImport:function(){var s=this;var r=new p();r.fetch({success:function(t){var u=_.template(s.templateBulkImportInModal(),{histories:t.models});s.modal=new k.GalaxyModal({destructible:true,title:"Import into History",body:u,buttons:{Import:function(){s.importAllIntoHistory()},Close:function(){s.modal.hideOrDestroy()}}});s.modal.bindEvents();s.modal.show()},error:function(){n.error("An error occured :(")}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var t=$("select[name=dataset_import_bulk] option:selected").val();var x=$("select[name=dataset_import_bulk] option:selected").text();var z=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){z.push(this.parentElement.parentElement.id)}});var y=_.template(this.templateProgressBar(),{history_name:x});$(this.modal.elMain).find(".modal-body").html(y);var u=100/z.length;this.initProgress(u);var r=[];for(var s=z.length-1;s>=0;s--){library_dataset_id=z[s];var v=new b();var w=this;v.url=v.urlRoot+t+"/contents";v.content=library_dataset_id;v.source="library";r.push(v)}this.chainCall(r)},chainCall:function(s){var r=this;var t=s.pop();if(typeof t==="undefined"){n.success("All datasets imported");this.modal.hideOrDestroy();return}var u=$.when(t.save({content:t.content,source:t.source})).done(function(v){r.updateProgress();responses.push(v);r.chainCall(s)})},initProgress:function(r){this.progress=0;this.progressStep=r},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(r,v){var t=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){t.push(this.parentElement.parentElement.id)}});var s="/api/libraries/datasets/download/"+v;var u={ldda_ids:t};this.processDownload(s,u,"get")},processDownload:function(s,t,u){if(s&&t){t=typeof t=="string"?t:$.param(t);var r="";$.each(t.split("&"),function(){var v=this.split("=");r+='<input type="hidden" name="'+v[0]+'" value="'+v[1]+'" />'});$('<form action="'+s+'" method="'+(u||"post")+'">'+r+"</form>").appendTo("body").submit().remove();n.info("Your download will begin soon")}},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,title:"Create New Folder",body:this.templateNewFolderInModal(),buttons:{Create:function(){r.create_new_folder_event()},Close:function(){r.modal.hideOrDestroy();r.modal=null}}});this.modal.bindEvents();this.modal.show()},create_new_folder_event:function(){var r=this.serialize_new_folder();if(this.validate_new_folder(r)){var t=new c();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];t.url=t.urlRoot+"/"+current_folder_id;var s=this;t.save(r,{success:function(u){s.modal.hideOrDestroy();n.success("Folder created");s.render({id:current_folder_id})},error:function(){n.error("An error occured :(")}})}else{n.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(r){return r.name!==""}});var a=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal"},initialize:function(){},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; overflow: auto !important; ">');tmpl_array.push("");tmpl_array.push('<h3>New Data Libraries. This is work in progress. Report problems & ideas to <a href="mailto:marten@bx.psu.edu?Subject=DataLibraries_Feedback" target="_blank">Marten</a>.</h3>');tmpl_array.push('<a href="" id="create_new_library_btn" class="btn btn-primary file ">New Library</a>');tmpl_array.push('<table class="table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th class="button_heading"></th>');tmpl_array.push(" <th>name</th>");tmpl_array.push(" <th>description</th>");tmpl_array.push(" <th>synopsis</th> ");tmpl_array.push(" <th>model type</th> ");tmpl_array.push(" </thead>");tmpl_array.push(" <tbody>");tmpl_array.push(" <% _.each(libraries, function(library) { %>");tmpl_array.push(" <tr>");tmpl_array.push(' <td><button title="Open this library" type="button" data-id="<%- library.get("root_folder_id") %>" class="btn_open_folder btn btn-default btn-xs">');tmpl_array.push(' <span class="fa fa-folder-open"></span> browse</td>');tmpl_array.push(' <td><%- library.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("model_class")) %></td>');tmpl_array.push(" </tr>");tmpl_array.push(" <% }); %>");tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("</div>");return tmpl_array.join("")},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")},render:function(){$("#center").css("overflow","auto");var r=this;libraries=new o();libraries.fetch({success:function(s){var t=_.template(r.templateLibraryList(),{libraries:s.models});r.$el.html(t)},error:function(t,s){if(s.statusCode().status===403){n.error("Please log in first. Redirecting to login page in 3s.");setTimeout(r.redirectToLogin,3000)}else{n.error("An error occured. Please try again.")}}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},modal:null,show_library_modal:function(s){s.preventDefault();s.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){r.create_new_library_event()},Close:function(){r.modal.hideOrDestroy()}}});this.modal.bindEvents();this.modal.show()},create_new_library_event:function(){var t=this.serialize_new_library();if(this.validate_new_library(t)){var s=new f();var r=this;s.save(t,{success:function(u){r.modal.hideOrDestroy();r.clear_library_modal();r.render();n.success("Library created")},error:function(){n.error("An error occured :(")}})}else{n.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(r){return r.name!==""}});var g=Backbone.View.extend({folderContentView:null,galaxyLibraryview:null,initialize:function(){folderContentView=new m();galaxyLibraryview=new a();library_router=new q();library_router.on("route:libraries",function(){galaxyLibraryview.render()});library_router.on("route:folder_content",function(r){folderContentView.render({id:r})});library_router.on("route:download",function(r,s){if($("#center").find(":checked").length===0){library_router.navigate("folders/"+r,{trigger:true,replace:true})}else{folderContentView.download(r,s);library_router.navigate("folders/"+r,{trigger:false,replace:true})}});Backbone.history.start();return this}});return{GalaxyApp:g}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Functional browser tests: update/fix login tests
by commits-noreply@bitbucket.org 08 Jan '14
by commits-noreply@bitbucket.org 08 Jan '14
08 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3cdd4aae8403/
Changeset: 3cdd4aae8403
User: carlfeberhard
Date: 2014-01-08 19:34:43
Summary: Functional browser tests: update/fix login tests
Affected #: 2 files
diff -r 725010d022f3dae2400fab9d009b3d65af70f440 -r 3cdd4aae8403e76df8e0ac1efa621ad9b8889039 test/casperjs/login-tests.js
--- a/test/casperjs/login-tests.js
+++ b/test/casperjs/login-tests.js
@@ -39,7 +39,7 @@
password = spaceghost.fixtureData.testUser.password;
}
-var userEmailSelector = '//a[contains(text(),"Logged in as")]/span["id=#user-email"]';
+var userEmailSelector = '//a[contains(text(),"Logged in as")]';
// =================================================================== TESTS
// register a user (again...)
@@ -53,9 +53,11 @@
this.test.comment( 'logging out: ' + email );
spaceghost.user.logout();
});
-spaceghost.then( function(){
- this.test.assertSelectorDoesntHaveText( xpath( userEmailSelector ), /\w/ );
- this.test.assert( spaceghost.user.loggedInAs() === '', 'loggedInAs() is empty string' );
+spaceghost.thenOpen( spaceghost.baseUrl, function(){
+ spaceghost.waitForMasthead( function() {
+ this.test.assertDoesntExist( xpath( userEmailSelector ) );
+ this.test.assert( spaceghost.user.loggedInAs() === '', 'loggedInAs() is empty string' );
+ });
});
// log them back in - check for email in logged in text
diff -r 725010d022f3dae2400fab9d009b3d65af70f440 -r 3cdd4aae8403e76df8e0ac1efa621ad9b8889039 test/casperjs/modules/user.js
--- a/test/casperjs/modules/user.js
+++ b/test/casperjs/modules/user.js
@@ -81,7 +81,6 @@
spaceghost.thenOpen( spaceghost.baseUrl, function(){
spaceghost.waitForMasthead( function() {
- spaceghost.clickLabel( spaceghost.data.labels.masthead.menus.user );
spaceghost.clickLabel( spaceghost.data.labels.masthead.userMenu.login );
spaceghost.withMainPanel( function mainBeforeLogin(){
@@ -162,7 +161,7 @@
try {
var emailSelector = xpath( spaceghost.data.selectors.masthead.userMenu.userEmail_xpath ),
loggedInInfo = spaceghost.elementInfoOrNull( emailSelector );
- if( loggedInInfo ){
+ if( loggedInInfo !== null ){
userEmail = loggedInInfo.text.replace( 'Logged in as ', '' );
}
} catch( err ){
@@ -177,13 +176,13 @@
*/
User.prototype.logout = function logout(){
var spaceghost = this.spaceghost;
- if( !this.loggedInAs() ){ return spaceghost; }
spaceghost.thenOpen( spaceghost.baseUrl, function(){
this.info( 'user logging out' );
- //TODO: handle already logged out
spaceghost.waitForMasthead( function _logout() {
- spaceghost.clickLabel( spaceghost.data.labels.masthead.menus.user );
- spaceghost.clickLabel( spaceghost.data.labels.masthead.userMenu.logout );
+ if( spaceghost.user.loggedInAs() ){
+ spaceghost.clickLabel( spaceghost.data.labels.masthead.menus.user );
+ spaceghost.clickLabel( spaceghost.data.labels.masthead.userMenu.logout );
+ }
});
});
return spaceghost;
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/613f3d93261b/
Changeset: 613f3d93261b
User: inithello
Date: 2014-01-08 18:20:41
Summary: Fix error when time_last_tested has a None value.
Affected #: 1 file
diff -r 709c4b85bc411e5424c9536435d76fa4ee62781e -r 613f3d93261b282d6260b09100ffd5d3be3ff7dc lib/galaxy/webapps/tool_shed/model/__init__.py
--- a/lib/galaxy/webapps/tool_shed/model/__init__.py
+++ b/lib/galaxy/webapps/tool_shed/model/__init__.py
@@ -275,7 +275,8 @@
rval = super( RepositoryMetadata, self ).to_dict( view=view, value_mapper=value_mapper )
if 'time_last_tested' in rval:
time_last_tested = rval[ 'time_last_tested' ]
- rval[ 'time_last_tested' ] = time_last_tested.isoformat()
+ if time_last_tested is not None:
+ rval[ 'time_last_tested' ] = time_last_tested.isoformat()
return rval
https://bitbucket.org/galaxy/galaxy-central/commits/725010d022f3/
Changeset: 725010d022f3
User: inithello
Date: 2014-01-08 18:27:14
Summary: When a push is received in the hg controller, update the repository on disk after the push is complete.
Affected #: 1 file
diff -r 613f3d93261b282d6260b09100ffd5d3be3ff7dc -r 725010d022f3dae2400fab9d009b3d65af70f440 lib/galaxy/webapps/tool_shed/controllers/hg.py
--- a/lib/galaxy/webapps/tool_shed/controllers/hg.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/hg.py
@@ -2,6 +2,7 @@
from galaxy import web
from galaxy.web.base.controller import BaseUIController
from tool_shed.util.shed_util_common import get_repository_by_name_and_owner
+from tool_shed.util.shed_util_common import update_repository
from tool_shed.util.metadata_util import set_repository_metadata
from galaxy import eggs
@@ -9,6 +10,8 @@
import mercurial.__version__
from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import wsgiapplication
+from mercurial import hg
+from mercurial import ui
log = logging.getLogger(__name__)
@@ -36,6 +39,11 @@
repository = get_repository_by_name_and_owner( trans.app, name, owner )
if repository:
if hg_version >= '2.2.3':
+ # Update the repository on disk to the tip revision, because the web upload form uses the on-disk working
+ # directory. If the repository is not updated on disk, pushing from the command line and then uploading
+ # via the web interface will result in a new head being created.
+ repo = hg.repository( ui.ui(), repository.repo_path( trans.app ) )
+ update_repository( repo, ctx_rev=None )
# Set metadata using the repository files on disk.
error_message, status = set_repository_metadata( trans, repository )
if status == 'ok' and error_message:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Retain and display more errors if they occurred during repository creation and population when importing a repository capsule into a tool shed.
by commits-noreply@bitbucket.org 08 Jan '14
by commits-noreply@bitbucket.org 08 Jan '14
08 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/709c4b85bc41/
Changeset: 709c4b85bc41
User: greg
Date: 2014-01-08 16:10:05
Summary: Retain and display more errors if they occurred during repository creation and population when importing a repository capsule into a tool shed.
Affected #: 1 file
diff -r 796cf860956c4f61b873335e502a8db4a0d7e951 -r 709c4b85bc411e5424c9536435d76fa4ee62781e lib/tool_shed/util/repository_maintenance_util.py
--- a/lib/tool_shed/util/repository_maintenance_util.py
+++ b/lib/tool_shed/util/repository_maintenance_util.py
@@ -154,6 +154,9 @@
# Populate the new repository with the contents of exported repository archive.
results_dict = import_util.import_repository_archive( trans, repository, repository_archive_dict )
ok = results_dict.get( 'ok', False )
+ error_message = results_dict.get( 'error_message', '' )
+ if error_message:
+ results_message += error_message
import_results_tups.append( ( ok, ( str( name ), str( username ) ), results_message ) )
else:
# The repository either already exists in this Tool Shed or the current user is not authorized to create it.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Fix for retrieving repository dependency information for a repository changeset revision via the Tool Shed's API.
by commits-noreply@bitbucket.org 08 Jan '14
by commits-noreply@bitbucket.org 08 Jan '14
08 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/796cf860956c/
Changeset: 796cf860956c
User: greg
Date: 2014-01-08 15:46:33
Summary: Fix for retrieving repository dependency information for a repository changeset revision via the Tool Shed's API.
Affected #: 1 file
diff -r af196ff2cc63fcc59b07c1579891ffe7bed2013a -r 796cf860956c4f61b873335e502a8db4a0d7e951 lib/galaxy/webapps/tool_shed/api/repository_revisions.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
@@ -89,12 +89,16 @@
for rd_tup in rd_tups:
tool_shed, name, owner, changeset_revision = rd_tup[ 0:4 ]
repository_dependency = suc.get_repository_by_name_and_owner( trans.app, name, owner )
+ repository_dependency_id = trans.security.encode_id( repository_dependency.id )
+ repository_dependency_repository_metadata = \
+ suc.get_repository_metadata_by_changeset_revision( trans, repository_dependency_id, changeset_revision )
+ repository_dependency_repository_metadata_id = trans.security.encode_id( repository_dependency_repository_metadata.id )
repository_dependency_dict = repository_dependency.to_dict( view='element', value_mapper=value_mapper )
# We have to add the changeset_revision of of the repository dependency.
repository_dependency_dict[ 'changeset_revision' ] = changeset_revision
repository_dependency_dict[ 'url' ] = web.url_for( controller='repositories',
action='show',
- id=trans.security.encode_id( repository_dependency.id ) )
+ id=repository_dependency_repository_metadata_id )
repository_dependencies_dicts.append( repository_dependency_dict )
return repository_dependencies_dicts
except Exception, e:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Fixes for comparing datetime values in the tool shed's install and test framework.
by commits-noreply@bitbucket.org 08 Jan '14
by commits-noreply@bitbucket.org 08 Jan '14
08 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/af196ff2cc63/
Changeset: af196ff2cc63
User: greg
Date: 2014-01-08 15:25:17
Summary: Fixes for comparing datetime values in the tool shed's install and test framework.
Affected #: 2 files
diff -r 6aeb657bc40ee0884f538308e1bfbec0b197c44b -r af196ff2cc63fcc59b07c1579891ffe7bed2013a lib/galaxy/webapps/tool_shed/model/__init__.py
--- a/lib/galaxy/webapps/tool_shed/model/__init__.py
+++ b/lib/galaxy/webapps/tool_shed/model/__init__.py
@@ -271,6 +271,13 @@
return True
return False
+ def to_dict( self, view='collection', value_mapper=None ):
+ rval = super( RepositoryMetadata, self ).to_dict( view=view, value_mapper=value_mapper )
+ if 'time_last_tested' in rval:
+ time_last_tested = rval[ 'time_last_tested' ]
+ rval[ 'time_last_tested' ] = time_last_tested.isoformat()
+ return rval
+
class SkipToolTest( object, Dictifiable ):
dict_collection_visible_keys = ( 'id', 'repository_metadata_id', 'initial_changeset_revision' )
diff -r 6aeb657bc40ee0884f538308e1bfbec0b197c44b -r af196ff2cc63fcc59b07c1579891ffe7bed2013a test/install_and_test_tool_shed_repositories/base/util.py
--- a/test/install_and_test_tool_shed_repositories/base/util.py
+++ b/test/install_and_test_tool_shed_repositories/base/util.py
@@ -898,16 +898,16 @@
log.debug( 'due to the following error getting tool_test_results:\n%s' % str( error_message ) )
else:
# Check the required repository's time_last_tested value to see if its tool_test_results column
- # has been updated within the past 12 hours.
- """
- twelve_hours_ago = datetime.utcnow() - timedelta( hours=12 )
+ # has been updated within the past 12 hours. The RepositoryMetadata class's to_dict() method
+ # returns the value of time_last_tested in datetime.isoformat().
+ twelve_hours_ago = ( datetime.utcnow() - timedelta( hours=12 ) ).isoformat()
time_last_tested, error_message = get_time_last_tested( galaxy_tool_shed_url, repository_metadata_id )
if time_last_tested is not None and time_last_tested < twelve_hours_ago:
log.debug( 'The install containers for version %s of repository dependency %s owned by %s have been ' % \
( changeset_revision, name, owner ) )
log.debug( 'populated within the past 12 hours (likely in this test run), so skipping this check.' )
continue
- if time_last_tested is None:
+ elif time_last_tested is None:
log.debug( 'The time_last_tested column value is None for version %s of repository dependency %s owned by %s.' % \
( changeset_revision, name, owner ) )
elif time_last_tested < twelve_hours_ago:
@@ -916,7 +916,6 @@
else:
log.debug( 'Version %s of repository dependency %s owned by %s was last tested more than 12 hours ago.' % \
( changeset_revision, name, owner ) )
- """
# Inspect the tool_test_results_dict for the last test run to see if it has not yet been populated.
if len( tool_test_results_dicts ) == 0:
tool_test_results_dict = {}
@@ -977,8 +976,8 @@
else:
log.debug( 'Cannot retrieve revision %s of required repository %s owned by %s from the database ' % \
( changeset_revision, name, owner ) )
- log.debug( 'so tool_test_results cannot be saved.' )
- log.debug( 'The attributes used to retrieve the record are:\n' )
+ log.debug( 'so tool_test_results cannot be saved at this time.' )
+ log.debug( 'The attributes used to retrieve the record are:' )
log.debug( 'tool_shed: %s name: %s owner: %s changeset_revision: %s' % \
( cleaned_tool_shed_url, name, owner, changeset_revision ) )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Eliminate comparison of times tested in the tool shed's install and test framework.
by commits-noreply@bitbucket.org 07 Jan '14
by commits-noreply@bitbucket.org 07 Jan '14
07 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/6aeb657bc40e/
Changeset: 6aeb657bc40e
User: greg
Date: 2014-01-08 03:50:02
Summary: Eliminate comparison of times tested in the tool shed's install and test framework.
Affected #: 1 file
diff -r 478c60421dd9a71422d98ee2ada8043bf53ffeef -r 6aeb657bc40ee0884f538308e1bfbec0b197c44b test/install_and_test_tool_shed_repositories/base/util.py
--- a/test/install_and_test_tool_shed_repositories/base/util.py
+++ b/test/install_and_test_tool_shed_repositories/base/util.py
@@ -899,6 +899,7 @@
else:
# Check the required repository's time_last_tested value to see if its tool_test_results column
# has been updated within the past 12 hours.
+ """
twelve_hours_ago = datetime.utcnow() - timedelta( hours=12 )
time_last_tested, error_message = get_time_last_tested( galaxy_tool_shed_url, repository_metadata_id )
if time_last_tested is not None and time_last_tested < twelve_hours_ago:
@@ -915,6 +916,7 @@
else:
log.debug( 'Version %s of repository dependency %s owned by %s was last tested more than 12 hours ago.' % \
( changeset_revision, name, owner ) )
+ """
# Inspect the tool_test_results_dict for the last test run to see if it has not yet been populated.
if len( tool_test_results_dicts ) == 0:
tool_test_results_dict = {}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Don't map the time_last_tested column in the tool shed API.
by commits-noreply@bitbucket.org 07 Jan '14
by commits-noreply@bitbucket.org 07 Jan '14
07 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/478c60421dd9/
Changeset: 478c60421dd9
User: greg
Date: 2014-01-08 03:37:17
Summary: Don't map the time_last_tested column in the tool shed API.
Affected #: 1 file
diff -r 2a23dec18caabf3e326447db7eabd0b2d963fef4 -r 478c60421dd9a71422d98ee2ada8043bf53ffeef lib/galaxy/webapps/tool_shed/api/repository_revisions.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
@@ -1,6 +1,5 @@
import datetime
import logging
-from galaxy.web.framework.helpers import time_ago
from tool_shed.util import metadata_util
from galaxy import web
from galaxy import util
@@ -234,8 +233,4 @@
def __get_value_mapper( self, trans, repository_metadata ):
value_mapper = { 'id' : trans.security.encode_id,
'repository_id' : trans.security.encode_id }
- if repository_metadata.time_last_tested is not None:
- # For some reason the Dictifiable.to_dict() method in ~/galaxy/model/item_attrs.py requires
- # a function rather than a mapped value, so just pass the time_ago function here.
- value_mapper[ 'time_last_tested' ] = time_ago
return value_mapper
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Functional browser tests: fix registration tests
by commits-noreply@bitbucket.org 07 Jan '14
by commits-noreply@bitbucket.org 07 Jan '14
07 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/2a23dec18caa/
Changeset: 2a23dec18caa
User: carlfeberhard
Date: 2014-01-07 23:09:21
Summary: Functional browser tests: fix registration tests
Affected #: 3 files
diff -r 64c6c98b9976c3dadb77426b6a6805922aa7810c -r 2a23dec18caabf3e326447db7eabd0b2d963fef4 test/casperjs/modules/user.js
--- a/test/casperjs/modules/user.js
+++ b/test/casperjs/modules/user.js
@@ -160,11 +160,13 @@
var spaceghost = this.spaceghost,
userEmail = '';
try {
- var loggedInInfo = spaceghost.getElementInfo(
- xpath( spaceghost.data.selectors.masthead.userMenu.userEmail_xpath ) );
- userEmail = loggedInInfo.text;
+ var emailSelector = xpath( spaceghost.data.selectors.masthead.userMenu.userEmail_xpath ),
+ loggedInInfo = spaceghost.elementInfoOrNull( emailSelector );
+ if( loggedInInfo ){
+ userEmail = loggedInInfo.text.replace( 'Logged in as ', '' );
+ }
} catch( err ){
- spaceghost.error( err );
+ spaceghost.warn( err );
}
//console.debug( 'loggedInInfo:', spaceghost.jsonStr( loggedInInfo ) );
return userEmail;
@@ -175,6 +177,7 @@
*/
User.prototype.logout = function logout(){
var spaceghost = this.spaceghost;
+ if( !this.loggedInAs() ){ return spaceghost; }
spaceghost.thenOpen( spaceghost.baseUrl, function(){
this.info( 'user logging out' );
//TODO: handle already logged out
diff -r 64c6c98b9976c3dadb77426b6a6805922aa7810c -r 2a23dec18caabf3e326447db7eabd0b2d963fef4 test/casperjs/registration-tests.js
--- a/test/casperjs/registration-tests.js
+++ b/test/casperjs/registration-tests.js
@@ -64,7 +64,8 @@
spaceghost.thenOpen( spaceghost.baseUrl, function(){
this.waitForMasthead( function() {
this.clickLabel( 'User' );
- this.test.assertSelectorHasText( 'a #user-email', email, '#user-email === ' + email );
+ this.test.assertSelectorHasText( xpath( spaceghost.data.selectors.masthead.userMenu.userEmail_xpath ),
+ email, '#user-email === ' + email );
});
});
@@ -77,8 +78,9 @@
});
spaceghost.then( function(){
this.waitForMasthead( function() {
- this.debug( 'email:' + this.getElementInfo( 'a #user-email' ).html );
- this.test.assert( !this.getElementInfo( 'a #user-email' ).html, '#user-email is empty' );
+ var emailSelector = xpath( this.data.selectors.masthead.userMenu.userEmail_xpath );
+ this.debug( 'email:' + this.elementInfoOrNull( emailSelector ) );
+ this.test.assert( !this.elementInfoOrNull( emailSelector ), 'user email not found' );
});
});
@@ -99,7 +101,7 @@
this.user._submitRegistration( badEmail, password, username, confirm );
});
self.then(function(){
- this.assertErrorMessage( 'Enter a real email address' );
+ this.assertErrorMessage( 'Please enter your valid email address' );
});
});
@@ -108,10 +110,10 @@
spaceghost.each( badPasswords, function( self, badPassword ){
self.then( function(){
this.test.comment( 'attempting bad password: ' + badPassword );
- this.user._submitRegistration( spaceghost.user.getRandomEmail(), badPassword, username, confirm );
+ this.user._submitRegistration( spaceghost.user.getRandomEmail(), badPassword, username, badPassword );
});
self.then(function(){
- this.assertErrorMessage( 'Use a password of at least 6 characters' );
+ this.assertErrorMessage( 'Please use a password of at least 6 characters' );
});
});
@@ -123,7 +125,7 @@
this.user._submitRegistration( spaceghost.user.getRandomEmail(), password, username, badConfirm );
});
self.then(function(){
- this.assertErrorMessage( 'Passwords do not match' );
+ this.assertErrorMessage( 'Passwords don\'t match' );
});
});
@@ -149,7 +151,7 @@
this.user._submitRegistration( newEmail, password, badUsername, confirm );
});
self.then(function(){
- this.assertErrorMessage( "Public name must contain only lower-case letters, numbers and '-'" );
+ this.assertErrorMessage( 'Public name must contain only lowercase letters, numbers and "-"' );
});
});
diff -r 64c6c98b9976c3dadb77426b6a6805922aa7810c -r 2a23dec18caabf3e326447db7eabd0b2d963fef4 test/casperjs/spaceghost.js
--- a/test/casperjs/spaceghost.js
+++ b/test/casperjs/spaceghost.js
@@ -793,7 +793,7 @@
* @param {CasperJS selector} messageSelector what element in which to search for the text
* (defaults to '.errormessage')
*/
-SpaceGhost.prototype.assertErrorMessage = function assertSelectorAndTextInFrame( message, frame, messageSelector ){
+SpaceGhost.prototype.assertErrorMessage = function assertErrorMessage( message, frame, messageSelector ){
messageSelector = messageSelector || this.data.selectors.messages.error;
frame = frame || this.data.selectors.frames.main;
this.assertSelectorAndTextInFrame( messageSelector, message, frame );
@@ -1135,8 +1135,7 @@
masthead : {
adminLink : '#masthead a[href="/admin/index"]',
userMenu : {
- userEmail : 'a #user-email',
- userEmail_xpath : '//a[contains(text(),"Logged in as")]/span["id=#user-email"]'
+ userEmail_xpath : '//a[contains(text(),"Logged in as")]'
}
},
loginPage : {
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0