Skip to content

Commit

Permalink
Remove custom file filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio committed Jul 12, 2024
1 parent 16f1767 commit 4d9974d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
1 change: 0 additions & 1 deletion packages/tree-extension/schema/widget.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"jupyter.lab.toolbars": {
"FileBrowser": [
{ "name": "spacer", "type": "spacer", "rank": 900 },
{ "name": "fileNameSearcher", "rank": 950, "disabled": true },
{ "name": "new-dropdown", "rank": 1000 },
{ "name": "uploader", "rank": 1010 },
{ "name": "refresh", "command": "filebrowser:refresh", "rank": 1020 }
Expand Down
31 changes: 2 additions & 29 deletions packages/tree-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ import { ITranslator } from '@jupyterlab/translation';

import {
caretDownIcon,
FilenameSearcher,
folderIcon,
IScore,
runningIcon,
} from '@jupyterlab/ui-components';

Expand All @@ -58,17 +56,14 @@ const FILE_BROWSER_FACTORY = 'FileBrowser';
*/
const FILE_BROWSER_PLUGIN_ID = '@jupyterlab/filebrowser-extension:browser';

/**
* The class name added to the filebrowser filterbox node.
*/
const FILTERBOX_CLASS = 'jp-FileBrowser-filterBox';

/**
* The namespace for command IDs.
*/
namespace CommandIDs {
// The command to activate the filebrowser widget in tree view.
export const activate = 'filebrowser:activate';

export const toggleFileFilter = 'filebrowser:toggle-file-filter';
}

/**
Expand Down Expand Up @@ -325,28 +320,6 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
})
);

toolbarRegistry.addFactory(
FILE_BROWSER_FACTORY,
'fileNameSearcher',
(browser: FileBrowser) => {
const searcher = FilenameSearcher({
updateFilter: (
filterFn: (item: string) => Partial<IScore> | null,
query?: string
) => {
browser.model.setFilter((value) => {
return filterFn(value.name.toLowerCase());
});
},
useFuzzyFilter: true,
placeholder: trans.__('Filter files by name'),
forceRefresh: true,
});
searcher.addClass(FILTERBOX_CLASS);
return searcher;
}
);

setToolbar(
browser,
createToolbarFactory(
Expand Down

0 comments on commit 4d9974d

Please sign in to comment.