mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Merge pull request #7172 from Carreau/sort-dashboard
Sort dashbord list in frontend
This commit is contained in:
commit
4f4e14342b
@ -162,7 +162,26 @@ define([
|
||||
* directories.
|
||||
* @param {String} error_msg An error message
|
||||
*/
|
||||
|
||||
|
||||
var type_order = {'directory':0,'notebook':1,'file':2};
|
||||
|
||||
NotebookList.prototype.draw_notebook_list = function (list, error_msg) {
|
||||
list.content.sort(function(a, b) {
|
||||
if (type_order[a['type']] < type_order[b['type']]) {
|
||||
return -1;
|
||||
}
|
||||
if (type_order[a['type']] > type_order[b['type']]) {
|
||||
return 1;
|
||||
}
|
||||
if (a['name'] < b['name']) {
|
||||
return -1;
|
||||
}
|
||||
if (a['name'] > b['name']) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
var message = error_msg || 'Notebook list empty.';
|
||||
var item = null;
|
||||
var model = null;
|
||||
|
Loading…
Reference in New Issue
Block a user